OGS
IdealGasLaw.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <cassert>
18#include <string>
19
22
23namespace MaterialLib
24{
25namespace Fluid
26{
28class IdealGasLaw final : public FluidProperty
29{
30public:
32 explicit IdealGasLaw(const double molar_mass) : _molar_mass(molar_mass) {}
33
35 std::string getName() const override { return "Ideal gas law"; }
39 double getValue(const ArrayType& var_vals) const override
40 {
41 return _molar_mass *
42 var_vals[static_cast<int>(PropertyVariableType::p)] /
44 var_vals[static_cast<int>(PropertyVariableType::T)]);
45 }
46
52 double getdValue(const ArrayType& var_vals,
53 const PropertyVariableType var) const override
54 {
55 const double T = var_vals[static_cast<int>(PropertyVariableType::T)];
56 const double p = var_vals[static_cast<int>(PropertyVariableType::p)];
57 switch (var)
58 {
60 return dIdealGasLaw_dT(T, p);
62 return dIdealGasLaw_dp(T, p);
63 default:
64 return 0.;
65 }
66 }
67
68private:
70 const double _molar_mass;
71
75 double dIdealGasLaw_dT(const double T, const double pg) const
76 {
78 }
79
82 double dIdealGasLaw_dp(const double T, const double /* pg */) const
83 {
85 }
86};
87} // namespace Fluid
88} // namespace MaterialLib
Base class of fluid properties.
std::array< double, PropertyVariableNumber > ArrayType
Fluid density by ideal gas law.
Definition IdealGasLaw.h:29
double dIdealGasLaw_dp(const double T, const double) const
Definition IdealGasLaw.h:82
IdealGasLaw(const double molar_mass)
Definition IdealGasLaw.h:32
double getdValue(const ArrayType &var_vals, const PropertyVariableType var) const override
Definition IdealGasLaw.h:52
std::string getName() const override
Get density model name.
Definition IdealGasLaw.h:35
double getValue(const ArrayType &var_vals) const override
Definition IdealGasLaw.h:39
double dIdealGasLaw_dT(const double T, const double pg) const
Definition IdealGasLaw.h:75
const double _molar_mass
Molar mass of gas phase.
Definition IdealGasLaw.h:70
PropertyVariableType
Variable that determine the property.