diff --git a/test/general/test_composite.cpp b/test/general/test_composite.cpp index 2cd7a9b798d..86ed9374c4b 100644 --- a/test/general/test_composite.cpp +++ b/test/general/test_composite.cpp @@ -59,6 +59,9 @@ TEST(SolutionArray, simple) auto gas = newSolution("h2o2.yaml", "", "none"); auto arr = SolutionArray::create(gas, 5); + ASSERT_EQ(gas->transportModel(), "none"); + ASSERT_EQ(arr->transportModel(), "none"); + ASSERT_EQ(arr->size(), 5); ASSERT_EQ(arr->meta(), AnyMap()); diff --git a/test/python/test_composite.py b/test/python/test_composite.py index eed1faddb85..9a1b7d89091 100644 --- a/test/python/test_composite.py +++ b/test/python/test_composite.py @@ -487,11 +487,30 @@ def test_append_scrambled_input(self): @pytest.mark.skipif("native" not in ct.hdf_support(), reason="Cantera compiled without HDF support") - def test_import_no_norm_data(self): + def test_import_no_norm_data_h5(self): outfile = self.test_work_path / "solutionarray_no_norm.h5" outfile.unlink(missing_ok=True) gas = ct.Solution("h2o2.yaml") + gas.transport_model = "multicomponent" + gas.set_unnormalized_mole_fractions(np.full(gas.n_species, 0.3)) + states = ct.SolutionArray(gas, 5) + states.save(outfile, "group0") + + gas_new = ct.Solution("h2o2.yaml") + b = ct.SolutionArray(gas_new) + b.restore(outfile, "group0") #, normalize=False) + assert states.T == approx(b.T) + assert states.P == approx(b.P) + assert states.X == approx(b.X) + assert gas_new.transport_model == "multicomponent" + + def test_import_no_norm_data_yaml(self): + outfile = self.test_work_path / "solutionarray_no_norm.yaml" + outfile.unlink(missing_ok=True) + + gas = ct.Solution("h2o2.yaml") + gas.transport_model = "multicomponent" gas.set_unnormalized_mole_fractions(np.full(gas.n_species, 0.3)) states = ct.SolutionArray(gas, 5) states.save(outfile, "group0") @@ -502,6 +521,7 @@ def test_import_no_norm_data(self): assert states.T == approx(b.T) assert states.P == approx(b.P) assert states.X == approx(b.X) + assert gas_new.transport_model == "multicomponent" def check_arrays(self, a, b, rtol=1e-8): assert a.T == approx(b.T, rel=rtol) diff --git a/test/python/test_onedim.py b/test/python/test_onedim.py index f0dffaaed81..3b8d3692fe0 100644 --- a/test/python/test_onedim.py +++ b/test/python/test_onedim.py @@ -217,6 +217,15 @@ def solve_multi(self): assert self.sim.transport_model == 'multicomponent' + data = self.test_work_path / f"multicomponent.yaml" + data.unlink(missing_ok=True) + group = "multicomponent" + self.sim.save(data, group) + + arr = ct.SolutionArray(self.sim.gas) + arr.restore(data, "multicomponent/flame") + assert arr.transport_model == "multicomponent" + def test_flow_type(self): Tin = 300 p = ct.one_atm