17 #include <athena/athena.hpp>
18 #include <athena/athena_arrays.hpp>
19 #include <athena/coordinates/coordinates.hpp>
20 #include <athena/eos/eos.hpp>
21 #include <athena/field/field.hpp>
22 #include <athena/hydro/hydro.hpp>
23 #include <athena/mesh/mesh.hpp>
24 #include <athena/parameter_input.hpp>
25 #include <athena/stride_iterator.hpp>
40 void MeshBlock::InitUserMeshBlockData(ParameterInput *pin) {
41 AllocateUserOutputVariables(2);
42 SetUserOutputVariableName(0,
"temp");
43 SetUserOutputVariableName(1,
"theta");
47 void MeshBlock::UserWorkBeforeOutput(ParameterInput *pin) {
50 Real gamma = peos->GetGamma();
51 for (
int k = ks; k <= ke; ++k)
52 for (
int j = js;
j <= je; ++
j)
53 for (
int i = is; i <= ie; ++i) {
54 user_out_var(0, k,
j, i) = pthermo->GetTemp(
this, k,
j, i);
55 user_out_var(1, k,
j, i) = pthermo->PotentialTemp(
this,
p0, k,
j, i);
60 void Mesh::InitUserMeshData(ParameterInput *pin) {
61 p0 = pin->GetReal(
"problem",
"p0");
68 void MeshBlock::ProblemGenerator(ParameterInput *pin) {
70 Real gamma = pin->GetReal(
"hydro",
"gamma");
71 Real grav = -phydro->hsrc.GetG1();
72 Real
Ts = pin->GetReal(
"problem",
"Ts");
73 Real
Rd = pin->GetReal(
"thermodynamics",
"Rd");
74 Real
cp = gamma / (gamma - 1.) *
Rd;
76 Real xc = pin->GetReal(
"problem",
"xc");
77 Real yc = pin->GetReal(
"problem",
"yc");
78 Real zc = pin->GetReal(
"problem",
"zc");
79 Real s = pin->GetReal(
"problem",
"s");
80 Real
a = pin->GetReal(
"problem",
"a");
81 Real dT = pin->GetReal(
"problem",
"dT");
85 pin->GetOrAddBoolean(
"problem",
"uniform_bubble",
false);
88 for (
int k = ks; k <= ke; ++k)
89 for (
int j = js;
j <= je; ++
j)
90 for (
int i = is; i <= ie; ++i) {
91 Real
x1 = pcoord->x1v(i);
92 Real
x2 = pcoord->x2v(
j);
93 Real x3 = pcoord->x3v(k);
94 Real
r = sqrt((x3 - yc) * (x3 - yc) + (
x2 - xc) * (
x2 - xc) +
95 (
x1 - zc) * (
x1 - zc));
99 temp += dT * pow(phydro->w(IPR, k,
j, i) /
p0,
Rd /
cp);
100 else if (!uniform_bubble)
101 temp += dT * exp(-(
r -
a) * (
r -
a) / (s * s)) *
102 pow(phydro->w(IPR, k,
j, i) /
p0,
Rd /
cp);
103 phydro->w(IDN, k,
j, i) = phydro->w(IPR, k,
j, i) / (
Rd *
temp);
104 phydro->w(IVX, k,
j, i) = phydro->w(IVY, k,
j, i) = 0.;
108 peos->PrimitiveToConserved(phydro->w, pfield->bcc, phydro->u, pcoord, is, ie,
static Thermodynamics const * GetInstance()
Return a pointer to the one and only instance of Thermodynamics.