Skip to content

Commit

Permalink
Error if both cv and mu are set. Add cv and mu to params
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdempsey90 committed Jan 22, 2025
1 parent d93b25e commit 9482ca2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/gas/gas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,18 @@ std::shared_ptr<StateDescriptor> Initialize(ParameterInput *pin,
cv = pin->GetReal("gas", "cv");
PARTHENON_REQUIRE(cv > 0, "Only positive cv allowed!");
mu = constants.GetKBCode() / ((gamma - 1.) * constants.GetAMUCode() * cv);
if (pin->DoesParameterExist("gas", "mu")) {
PARTHENON_FAIL("Cannot set both mu and cv in the input file. One is calculated "
"from the other!");
}
} else {
mu = pin->GetOrAddReal("gas", "mu", 1.);
PARTHENON_REQUIRE(mu > 0, "Only positive mean molecular weight allowed!");
cv = constants.GetKBCode() / ((gamma - 1.) * constants.GetAMUCode() * mu);
}
// Store these so they are available in outputs
params.Add("cv", cv);
params.Add("mu", mu);
auto zbar = pin->GetOrAddReal("gas", "zbar", 1.0);
EOS eos_host = singularity::IdealGas(gamma - 1., cv, {mu, zbar});
EOS eos_device = eos_host.GetOnDevice();
Expand Down

0 comments on commit 9482ca2

Please sign in to comment.