Skip to content

Commit

Permalink
Merge branch 'main' into lhllc
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWibking authored May 8, 2023
2 parents aaba430 + 75e826c commit 163ebee
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 65 deletions.
2 changes: 1 addition & 1 deletion external/parthenon
40 changes: 20 additions & 20 deletions src/hydro/hydro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,34 +517,34 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin) {
pkg->AddParam("nscalars", nscalars);

std::vector<std::string> cons_labels(nhydro);
cons_labels[IDN] = "Density";
cons_labels[IM1] = "MomentumDensity1";
cons_labels[IM2] = "MomentumDensity2";
cons_labels[IM3] = "MomentumDensity3";
cons_labels[IEN] = "TotalEnergyDensity";
cons_labels[IDN] = "density";
cons_labels[IM1] = "momentum_density_1";
cons_labels[IM2] = "momentum_density_2";
cons_labels[IM3] = "momentum_density_3";
cons_labels[IEN] = "total_energy_density";
if (fluid == Fluid::glmmhd) {
cons_labels[IB1] = "MagneticField1";
cons_labels[IB2] = "MagneticField2";
cons_labels[IB3] = "MagneticField3";
cons_labels[IPS] = "MagneticPhi";
cons_labels[IB1] = "magnetic_field_1";
cons_labels[IB2] = "magnetic_field_2";
cons_labels[IB3] = "magnetic_field_3";
cons_labels[IPS] = "magnetic_psi";
}

// TODO(pgrete) check if this could be "one-copy" for two stage SSP integrators
std::vector<std::string> prim_labels(nhydro);
prim_labels[IDN] = "Density";
prim_labels[IV1] = "Velocity1";
prim_labels[IV2] = "Velocity2";
prim_labels[IV3] = "Velocity3";
prim_labels[IPR] = "Pressure";
prim_labels[IDN] = "density";
prim_labels[IV1] = "velocity_1";
prim_labels[IV2] = "velocity_2";
prim_labels[IV3] = "velocity_3";
prim_labels[IPR] = "pressure";
if (fluid == Fluid::glmmhd) {
prim_labels[IB1] = "MagneticField1";
prim_labels[IB2] = "MagneticField2";
prim_labels[IB3] = "MagneticField3";
prim_labels[IPS] = "MagneticPhi";
prim_labels[IB1] = "magnetic_field_1";
prim_labels[IB2] = "magnetic_field_2";
prim_labels[IB3] = "magnetic_field_3";
prim_labels[IPS] = "magnetic_psi";
}
for (auto i = 0; i < nscalars; i++) {
cons_labels.emplace_back("Scalar_" + std::to_string(i));
prim_labels.emplace_back("Scalar_" + std::to_string(i));
cons_labels.emplace_back("scalar_density_" + std::to_string(i));
prim_labels.emplace_back("scalar_" + std::to_string(i));
}

Metadata m(
Expand Down
14 changes: 8 additions & 6 deletions tst/regression/test_suites/cluster_hse/cluster_hse.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,10 @@ def rk4(f, y0, T):
return False

profile_comparison_vars = (
(analytic_P, he_sphere_P, "Pressure"),
(analytic_K, he_sphere_K, "Entropy"),
(analytic_rho, he_sphere_rho, "Density"),
(analytic_g, he_sphere_g, "Gravity"),
(analytic_P, he_sphere_P, "pressure"),
(analytic_K, he_sphere_K, "entropy"),
(analytic_rho, he_sphere_rho, "density"),
(analytic_g, he_sphere_g, "gravity"),
)

fig, axes = plt.subplots(2, 2)
Expand Down Expand Up @@ -442,8 +442,10 @@ def analytic_gold(Z, Y, X, analytic_var):
return analytic_interp

analytic_components = {
"Pressure": lambda Z, Y, X, time: analytic_gold(Z, Y, X, analytic_P).v,
"Density": lambda Z, Y, X, time: analytic_gold(Z, Y, X, analytic_rho).v,
"prim_pressure": lambda Z, Y, X, time: analytic_gold(Z, Y, X, analytic_P).v,
"prim_density": lambda Z, Y, X, time: analytic_gold(
Z, Y, X, analytic_rho
).v,
}

# Use a very loose tolerance, linf relative error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,19 +259,29 @@ def Analyse(self, parameters):
return False

analytic_uniform_gas_components = {
"Density": lambda Z, Y, X, time: (np.ones_like(X) * self.uniform_gas_rho)
"prim_density": lambda Z, Y, X, time: (
np.ones_like(X) * self.uniform_gas_rho
)
.in_units("code_mass*code_length**-3")
.v,
"Velocity1": lambda Z, Y, X, time: (np.ones_like(X) * self.uniform_gas_ux)
"prim_velocity_1": lambda Z, Y, X, time: (
np.ones_like(X) * self.uniform_gas_ux
)
.in_units("code_length*code_time**-1")
.v,
"Velocity2": lambda Z, Y, X, time: (np.ones_like(X) * self.uniform_gas_uy)
"prim_velocity_2": lambda Z, Y, X, time: (
np.ones_like(X) * self.uniform_gas_uy
)
.in_units("code_length*code_time**-1")
.v,
"Velocity3": lambda Z, Y, X, time: (np.ones_like(X) * self.uniform_gas_uz)
"prim_velocity_3": lambda Z, Y, X, time: (
np.ones_like(X) * self.uniform_gas_uz
)
.in_units("code_length*code_time**-1")
.v,
"Pressure": lambda Z, Y, X, time: (np.ones_like(X) * self.uniform_gas_pres)
"prim_pressure": lambda Z, Y, X, time: (
np.ones_like(X) * self.uniform_gas_pres
)
.in_units("code_mass*code_length**-1*code_time**-2")
.v,
}
Expand Down Expand Up @@ -307,27 +317,15 @@ def zero_corrected_linf_err(gold, test):

# FIXME: TODO(forrestglines) For now this is hard coded - a component mapping should be done by phdf
prim_col_dict = {
"Density": 0,
"Velocity1": 1,
"Velocity2": 2,
"Velocity3": 3,
"Pressure": 4,
"density": 0,
"pressure": 4,
}

rho = unyt.unyt_array(
prim[:, prim_col_dict["Density"]], "code_mass*code_length**-3"
)
ux = unyt.unyt_array(
prim[:, prim_col_dict["Velocity1"]], "code_length*code_time**-1"
)
uy = unyt.unyt_array(
prim[:, prim_col_dict["Velocity2"]], "code_length*code_time**-1"
)
uz = unyt.unyt_array(
prim[:, prim_col_dict["Velocity3"]], "code_length*code_time**-1"
prim[:, prim_col_dict["density"]], "code_mass*code_length**-3"
)
pres = unyt.unyt_array(
prim[:, prim_col_dict["Pressure"]],
prim[:, prim_col_dict["pressure"]],
"code_mass*code_length**-1*code_time**-2",
)

Expand Down Expand Up @@ -356,7 +354,7 @@ def zero_corrected_linf_err(gold, test):
{
k: v
for k, v in analytic_uniform_gas_components.items()
if k != "Pressure"
if k != "prim_pressure"
},
err_func=zero_corrected_linf_err,
tol=self.machine_epsilon,
Expand All @@ -373,27 +371,15 @@ def zero_corrected_linf_err(gold, test):

# FIXME: TODO(forrestglines) For now this is hard coded - a component mapping should be done by phdf
prim_col_dict = {
"Density": 0,
"Velocity1": 1,
"Velocity2": 2,
"Velocity3": 3,
"Pressure": 4,
"density": 0,
"pressure": 4,
}

rho = unyt.unyt_array(
prim[prim_col_dict["Density"]], "code_mass*code_length**-3"
)
ux = unyt.unyt_array(
prim[prim_col_dict["Velocity1"]], "code_length*code_time**-1"
)
uy = unyt.unyt_array(
prim[prim_col_dict["Velocity2"]], "code_length*code_time**-1"
)
uz = unyt.unyt_array(
prim[prim_col_dict["Velocity3"]], "code_length*code_time**-1"
prim[prim_col_dict["density"]], "code_mass*code_length**-3"
)
pres = unyt.unyt_array(
prim[prim_col_dict["Pressure"]],
prim[prim_col_dict["pressure"]],
"code_mass*code_length**-1*code_time**-2",
)

Expand Down

0 comments on commit 163ebee

Please sign in to comment.