20 #include <athena/athena.hpp>
23 #include <athena/athena_arrays.hpp>
24 #include <athena/stride_iterator.hpp>
28 #include <athena/parameter_input.hpp>
30 #include <athena/coordinates/coordinates.hpp>
33 #include <athena/eos/eos.hpp>
36 #include <athena/hydro/hydro.hpp>
40 #include <athena/field/field.hpp>
43 #include <athena/mesh/mesh.hpp>
74 void MeshBlock::InitUserMeshBlockData(ParameterInput *pin) {
75 AllocateUserOutputVariables(2);
76 SetUserOutputVariableName(0,
"temp");
77 SetUserOutputVariableName(1,
"theta");
91 void MeshBlock::UserWorkBeforeOutput(ParameterInput *pin) {
98 for (
int j = js;
j <= je; ++
j)
99 for (
int i = is; i <= ie; ++i) {
104 user_out_var(0,
j, i) = pthermo->GetTemp(
this, k,
j, i);
105 user_out_var(1,
j, i) = pthermo->PotentialTemp(
this,
p0, k,
j, i);
128 Real dx = pmb->pcoord->dx1f(pmb->is);
129 Real dy = pmb->pcoord->dx2f(pmb->js);
137 for (
int j = pmb->js; j <= pmb->je; ++
j)
138 for (
int i = pmb->is; i <= pmb->ie; ++i) {
142 Real
temp = pthermo->GetTemp(pmb, pmb->ks,
j, i);
143 Real
theta = pthermo->PotentialTemp(pmb,
p0, pmb->ks,
j, i);
148 Real theta_ip1_j = pthermo->PotentialTemp(pmb,
p0, k,
j + 1, i);
149 Real theta_im1_j = pthermo->PotentialTemp(pmb,
p0, k,
j - 1, i);
150 Real theta_i_jp1 = pthermo->PotentialTemp(pmb,
p0, k,
j, i + 1);
151 Real theta_i_jm1 = pthermo->PotentialTemp(pmb,
p0, k,
j, i - 1);
168 u(IM1,
j, i) += dt *
K * w(IDN,
j, i) / (dx * dy) *
169 (w(IVX,
j, i - 1) + w(IVX,
j, i + 1) + w(IVX,
j - 1, i) +
170 w(IVX,
j + 1, i) - 4. * w(IVX,
j, i));
171 u(IM2,
j, i) += dt *
K * w(IDN,
j, i) / (dx * dy) *
172 (w(IVY,
j, i - 1) + w(IVY,
j, i + 1) + w(IVY,
j - 1, i) +
173 w(IVY,
j + 1, i) - 4. * w(IVY,
j, i));
178 (theta_ip1_j + theta_im1_j + theta_i_jp1 + theta_i_jm1 - 4. *
theta);
192 void Mesh::InitUserMeshData(ParameterInput *pin) {
195 Real gamma = pin->GetReal(
"hydro",
"gamma");
196 K = pin->GetReal(
"problem",
"K");
197 p0 = pin->GetReal(
"problem",
"p0");
198 Rd = pin->GetReal(
"thermodynamics",
"Rd");
199 cp = gamma / (gamma - 1.) *
Rd;
203 EnrollUserExplicitSourceFunction(
Diffusion);
210 void MeshBlock::ProblemGenerator(ParameterInput *pin) {
213 Real grav = -phydro->hsrc.GetG1();
217 Real
Ts = pin->GetReal(
"problem",
"Ts");
218 Real xc = pin->GetReal(
"problem",
"xc");
219 Real xr = pin->GetReal(
"problem",
"xr");
220 Real zc = pin->GetReal(
"problem",
"zc");
221 Real zr = pin->GetReal(
"problem",
"zr");
222 Real dT = pin->GetReal(
"problem",
"dT");
226 for (
int j = js;
j <= je; ++
j) {
227 for (
int i = is; i <= ie; ++i) {
233 Real
x1 = pcoord->x1v(i);
234 Real
x2 = pcoord->x2v(
j);
236 Real L = sqrt(
sqr((
x2 - xc) / xr) +
sqr((
x1 - zc) / zr));
243 if (L <= 1.)
temp += dT * (cos(M_PI * L) + 1.) / 2.;
245 phydro->w(IDN,
j, i) = phydro->w(IPR,
j, i) / (
Rd *
temp);
247 phydro->w(IVX,
j, i) = phydro->w(IVY,
j, i) = 0.;
256 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.
void Diffusion(MeshBlock *pmb, Real const time, Real const dt, AthenaArray< Real > const &w, AthenaArray< Real > const &r, AthenaArray< Real > const &bcc, AthenaArray< Real > &u, AthenaArray< Real > &s)