1 #ifndef ABLATELIBRARY_STIFFENEDGAS_HPP
2 #define ABLATELIBRARY_STIFFENEDGAS_HPP
6 #include "parameters/parameters.hpp"
7 #include "utilities/vectorUtilities.hpp"
9 namespace ablate::eos {
14 constexpr
static inline int SPECIES_SIZE = -1;
17 const std::vector<std::string> species;
22 PetscInt numberSpecies;
24 Parameters parameters;
26 struct FunctionContext {
29 Parameters parameters;
40 static PetscErrorCode DensityFunction(
const PetscReal conserved[], PetscReal* property,
void* ctx);
41 static PetscErrorCode PressureFunction(
const PetscReal conserved[], PetscReal* property,
void* ctx);
42 static PetscErrorCode TemperatureFunction(
const PetscReal conserved[], PetscReal* property,
void* ctx);
43 static PetscErrorCode InternalSensibleEnergyFunction(
const PetscReal conserved[], PetscReal* property,
void* ctx);
44 static PetscErrorCode SensibleEnthalpyFunction(
const PetscReal conserved[], PetscReal* property,
void* ctx);
45 static PetscErrorCode SpecificHeatConstantVolumeFunction(
const PetscReal conserved[], PetscReal* property,
void* ctx);
46 static PetscErrorCode SpecificHeatConstantPressureFunction(
const PetscReal conserved[], PetscReal* property,
void* ctx);
47 static PetscErrorCode SpeedOfSoundFunction(
const PetscReal conserved[], PetscReal* property,
void* ctx);
48 static PetscErrorCode SpeciesSensibleEnthalpyFunction(
const PetscReal conserved[], PetscReal* property,
void* ctx);
60 static PetscErrorCode DensityTemperatureFunction(
const PetscReal conserved[], PetscReal T, PetscReal* property,
void* ctx);
61 static PetscErrorCode PressureTemperatureFunction(
const PetscReal conserved[], PetscReal T, PetscReal* property,
void* ctx);
62 static PetscErrorCode TemperatureTemperatureFunction(
const PetscReal conserved[], PetscReal T, PetscReal* property,
void* ctx);
63 static PetscErrorCode InternalSensibleEnergyTemperatureFunction(
const PetscReal conserved[], PetscReal T, PetscReal* property,
void* ctx);
64 static PetscErrorCode SensibleEnthalpyTemperatureFunction(
const PetscReal conserved[], PetscReal T, PetscReal* property,
void* ctx);
65 static PetscErrorCode SpecificHeatConstantVolumeTemperatureFunction(
const PetscReal conserved[], PetscReal T, PetscReal* property,
void* ctx);
66 static PetscErrorCode SpecificHeatConstantPressureTemperatureFunction(
const PetscReal conserved[], PetscReal T, PetscReal* property,
void* ctx);
67 static PetscErrorCode SpeedOfSoundTemperatureFunction(
const PetscReal conserved[], PetscReal T, PetscReal* property,
void* ctx);
68 static PetscErrorCode SpeciesSensibleEnthalpyTemperatureFunction(
const PetscReal conserved[], PetscReal T, PetscReal* property,
void* ctx);
74 using ThermodynamicStaticFunction = PetscErrorCode (*)(
const PetscReal conserved[], PetscReal* property,
void* ctx);
75 using ThermodynamicTemperatureStaticFunction = PetscErrorCode (*)(
const PetscReal conserved[], PetscReal temperature, PetscReal* property,
void* ctx);
76 std::map<ThermodynamicProperty, std::tuple<ThermodynamicStaticFunction, ThermodynamicTemperatureStaticFunction, int>> thermodynamicFunctions = {
77 {ThermodynamicProperty::Density, {DensityFunction, DensityTemperatureFunction, 1}},
78 {ThermodynamicProperty::Pressure, {PressureFunction, PressureTemperatureFunction, 1}},
79 {ThermodynamicProperty::Temperature, {TemperatureFunction, TemperatureTemperatureFunction, 1}},
80 {ThermodynamicProperty::InternalSensibleEnergy, {InternalSensibleEnergyFunction, InternalSensibleEnergyTemperatureFunction, 1}},
81 {ThermodynamicProperty::SensibleEnthalpy, {SensibleEnthalpyFunction, SensibleEnthalpyTemperatureFunction, 1}},
82 {ThermodynamicProperty::SpecificHeatConstantVolume, {SpecificHeatConstantVolumeFunction, SpecificHeatConstantVolumeTemperatureFunction, 1}},
83 {ThermodynamicProperty::SpecificHeatConstantPressure, {SpecificHeatConstantPressureFunction, SpecificHeatConstantPressureTemperatureFunction, 1}},
84 {ThermodynamicProperty::SpeedOfSound, {SpeedOfSoundFunction, SpeedOfSoundTemperatureFunction, 1}},
85 {ThermodynamicProperty::SpeciesSensibleEnthalpy, {SpeciesSensibleEnthalpyFunction, SpeciesSensibleEnthalpyTemperatureFunction, SPECIES_SIZE}}};
88 explicit StiffenedGas(std::shared_ptr<ablate::parameters::Parameters>, std::vector<std::string> species = {});
89 void View(std::ostream& stream)
const override;
131 EOSFunction
GetFieldFunctionFunction(
const std::string& field, ThermodynamicProperty property1, ThermodynamicProperty property2, std::vector<std::string> otherProperties)
const override;
143 [[nodiscard]]
virtual const std::vector<std::string>&
GetProgressVariables()
const override {
return ablate::utilities::VectorUtilities::Empty<std::string>; }
Definition: stiffenedGas.hpp:11
PetscReal GetSpecificHeatRatio() const
Definition: stiffenedGas.hpp:95
EOSFunction GetFieldFunctionFunction(const std::string &field, ThermodynamicProperty property1, ThermodynamicProperty property2, std::vector< std::string > otherProperties) const override
Definition: stiffenedGas.cpp:51
const std::vector< std::string > & GetSpeciesVariables() const override
Definition: stiffenedGas.hpp:137
ThermodynamicTemperatureFunction GetThermodynamicTemperatureFunction(ThermodynamicProperty property, const std::vector< domain::Field > &fields) const override
Definition: stiffenedGas.cpp:37
PetscReal GetSpecificHeatCp() const
Definition: stiffenedGas.hpp:101
PetscReal GetReferencePressure() const
Definition: stiffenedGas.hpp:107
ThermodynamicFunction GetThermodynamicFunction(ThermodynamicProperty property, const std::vector< domain::Field > &fields) const override
Definition: stiffenedGas.cpp:25
void View(std::ostream &stream) const override
Definition: stiffenedGas.cpp:12
virtual const std::vector< std::string > & GetProgressVariables() const override
Definition: stiffenedGas.hpp:143