Alamo
Gas.cpp
Go to the documentation of this file.
1#include <vector>
2#include <cmath>
3#include <memory>
4#include "Util/Util.H"
5#include "Set/Base.H"
6#include "Set/Set.H"
7#include "Model/Gas/Gas.H"
10#include "Model/Gas/EOS/EOS.H"
11
12namespace Model {
13namespace Gas {
14
15// Methods that need to be defined by inherited class
16
17// Thermodynamic quantities
18double Gas::cp_mol(double T, Set::Patch<const Set::Scalar>& X, int i, int j, int k) const {
19 // Specific heat (constant pressure), J/(kmol-K)
20 if (!thermo) Util::Abort(INFO, "[Gas::cp_mol] No Thermo model attached.");
21 return thermo->cp_mol(T, X, i , j, k);
22}
23double Gas::enthalpy_mol(double T, Set::Patch<const Set::Scalar>& X, int i, int j, int k) const {
24 // Specific enthalpy, J/kmol)
25 if (!thermo) Util::Abort(INFO, "[Gas::enthalpy_mol] No Thermo model attached.");
26 return thermo->enthalpy_mol(T, X, i , j, k);
27}
28double Gas::entropy_mol(double T, Set::Patch<const Set::Scalar>& X, int i, int j, int k) const {
29 // specific entropy, J/(kmol-K)
30 if (!thermo) Util::Abort(INFO, "[Gas::entropy_mol] No Thermo model attached.");
31 return thermo->entropy_mol(T, X, i , j, k);
32}
33
34// Transport quantities
35double Gas::dynamic_viscosity(double T, Set::Patch<const Set::Scalar>& X, int i, int j, int k) const {
36 // Dynamic viscosity, Pa-s
37 if (!transport) Util::Abort(INFO, "[Gas::dynamic_viscosity] No Transport model attached.");
38 return transport->dynamic_viscosity(T, X, i , j, k);
39}
40double Gas::thermal_conductivity(double T, Set::Patch<const Set::Scalar>& X, int i, int j, int k) const {
41 // Thermal conductivity coefficient, W/(m-K)
42 if (!transport) Util::Abort(INFO, "[Gas::thermal_conductivity] No Transport model attached.");
43 return transport->thermal_conductivity(T, X, i , j, k);
44}
45void Gas::diffusion_coeffs(Set::Patch<Set::Scalar>& DKM, double T, double P, Set::Patch<const Set::Scalar>& X, int i, int j, int k) {
46 // Species diffusion coefficients, m^2/s
47 if (!transport) Util::Abort(INFO, "[Gas::diffusion_coeffs] No Transport model attached.");
48 return transport->diffusion_coeffs(DKM, T, P, X, i , j, k);
49}
50
51// EOS
53 double density, double momentumx, double momentumy, double E, double Tguess,
54 Set::Patch<const Set::Scalar>& X, int i, int j, int k, double rtol) const {
55 // Temperature, K
56 if (!eos) Util::Abort(INFO, "[Gas::ComputeT] No EOS model attached.");
57 return eos->ComputeT(density, momentumx, momentumy, E, Tguess, X, i , j, k, rtol);
58}
60 double pressure, double density,
61 Set::Patch<const Set::Scalar>& X, int i, int j, int k) const {
62 // Temperature, K
63 if (!eos) Util::Abort(INFO, "[Gas::ComputeT] No EOS model attached.");
64 return eos->ComputeT(pressure, density, X, i , j, k);
65}
66double Gas::ComputeP(double density, double T, Set::Patch<const Set::Scalar>& X, int i, int j, int k) const {
67 // Pressure, Pa
68 if (!eos) Util::Abort(INFO, "[Gas::ComputeP] No EOS model attached.");
69 return eos->ComputeP(density, T, X, i , j, k);
70}
72 double density, double momentumx, double momentumy, double T,
73 Set::Patch<const Set::Scalar>& X, int i, int j, int k) const {
74 // Energy, J/m^3
75 if (!eos) Util::Abort(INFO, "[Gas::ComputeE] No EOS model attached.");
76 return eos->ComputeE(density, momentumx, momentumy, T, X, i , j, k);
77}
78
79} // namespace Gas
80} // namespace Model
#define X(name)
#define INFO
Definition Util.H:24
virtual double ComputeE(double density, double momentumx, double momentumy, double T, Set::Patch< const Set::Scalar > &X, int i, int j, int k) const =0
virtual double ComputeP(double density, double T, Set::Patch< const Set::Scalar > &X, int i, int j, int k) const =0
virtual double ComputeT(double density, double momentumx, double momentumy, double E, double Tguess, Set::Patch< const Set::Scalar > &X, int i, int j, int k, double rtol) const =0
double ComputeP(double density, double T, Set::Patch< const Set::Scalar > &X, int i, int j, int k) const
Definition Gas.cpp:66
double ComputeT(double density, double momentumx, double momentumy, double E, double Tguess, Set::Patch< const Set::Scalar > &X, int i, int j, int k, double rtol=1e-12) const
Definition Gas.cpp:52
Thermo::Thermo * thermo
Definition Gas.H:23
double entropy_mol(double T, Set::Patch< const Set::Scalar > &X, int i, int j, int k) const
Definition Gas.cpp:28
void diffusion_coeffs(Set::Patch< Set::Scalar > &DKM, double T, double P, Set::Patch< const Set::Scalar > &X, int i, int j, int k)
Definition Gas.cpp:45
double dynamic_viscosity(double T, Set::Patch< const Set::Scalar > &X, int i, int j, int k) const
Definition Gas.cpp:35
double thermal_conductivity(double T, Set::Patch< const Set::Scalar > &X, int i, int j, int k) const
Definition Gas.cpp:40
double cp_mol(double T, Set::Patch< const Set::Scalar > &X, int i, int j, int k) const
Definition Gas.cpp:18
EOS::EOS * eos
Definition Gas.H:25
double ComputeE(double density, double momentumx, double momentumy, double T, Set::Patch< const Set::Scalar > &X, int i, int j, int k) const
Definition Gas.cpp:71
double enthalpy_mol(double T, Set::Patch< const Set::Scalar > &X, int i, int j, int k) const
Definition Gas.cpp:23
Transport::Transport * transport
Definition Gas.H:24
virtual double entropy_mol(double T, Set::Patch< const Set::Scalar > &X, int i, int j, int k) const =0
virtual double enthalpy_mol(double T, Set::Patch< const Set::Scalar > &X, int i, int j, int k) const =0
virtual double cp_mol(double T, Set::Patch< const Set::Scalar > &X, int i, int j, int k) const =0
virtual double dynamic_viscosity(double T, Set::Patch< const Set::Scalar > &X, int i, int j, int k) const =0
virtual double thermal_conductivity(double T, Set::Patch< const Set::Scalar > &X, int i, int j, int k) const =0
virtual void diffusion_coeffs(Set::Patch< Set::Scalar > &DKM, double T, double P, Set::Patch< const Set::Scalar > &X, int i, int j, int k)=0
Eigen::Matrix< amrex::Real, AMREX_SPACEDIM, 1 > Vector
Definition Base.H:19
void Abort(const char *msg)
Definition Util.cpp:268