Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions toolchain/mfc/case_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,17 @@ def check_phase_change(self):
relax = self.get("relax", "F") == "T"
relax_model = self.get("relax_model")
model_eqns = self.get("model_eqns")
num_fluids = self.get("num_fluids")
palpha_eps = self.get("palpha_eps")
ptgalpha_eps = self.get("ptgalpha_eps")

if not relax:
return

self.prohibit(
num_fluids is None or num_fluids < 2,
"phase change requires num_fluids >= 2 (liquid = 1, vapor = 2)",
)
self.prohibit(
(model_eqns not in (2, 3) or (model_eqns == 2 and relax_model not in (5, 6)) or (model_eqns == 3 and relax_model not in (1, 4, 5, 6))),
"phase change requires model_eqns==2 with relax_model in [5,6] or model_eqns==3 with relax_model in [1,4,5,6]",
Expand Down
30 changes: 30 additions & 0 deletions toolchain/mfc/test_case_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,36 @@ def test_accepts_valid_configuration(self):
self.assertAccepts(REACTIVE_BURN)


class TestPhaseChangeFluidPairing(ConstraintTestCase):
MSG = "phase change requires num_fluids >= 2 (liquid = 1, vapor = 2)"

def test_rejects_single_fluid(self):
self.assertRejects({**BASE, "relax": "T", "relax_model": 5}, self.MSG)

def test_rejects_unset_num_fluids(self):
params = {k: v for k, v in TWO_FLUID.items() if k != "num_fluids"}
self.assertRejects({**params, "relax": "T", "relax_model": 5}, self.MSG)

def test_accepts_two_fluids(self):
self.assertAccepts({**TWO_FLUID, "relax": "T", "relax_model": 5})

def test_accepts_three_fluids(self):
params = {
**TWO_FLUID,
"num_fluids": 3,
"fluid_pp(3)%gamma": 0.4,
"fluid_pp(3)%pi_inf": 0.0,
"patch_icpp(1)%alpha_rho(3)": 0.0,
"patch_icpp(1)%alpha(3)": 0.0,
"relax": "T",
"relax_model": 5,
}
self.assertAccepts(params)

def test_not_checked_when_disabled(self):
self.assertAccepts({**BASE, "relax": "F"})


class TestSyntheticTurbulence(ConstraintTestCase):
"""A 2D case with one fully specified forcing zone."""

Expand Down
Loading