Skip to content

Commit

Permalink
[1D] Add unit tests for SolutionArray interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Feb 12, 2020
1 parent 85af6ac commit e2c6485
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions interfaces/cython/cantera/test/test_onedim.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,19 @@ def run_mix(self, phi, T, width, p, refine):
for rhou_j in self.sim.density * self.sim.u:
self.assertNear(rhou_j, rhou, 1e-4)

def test_solution_array_output(self):
self.run_mix(phi=1.0, T=300, width=2.0, p=1.0, refine=False)
arr = self.sim.to_solution_array()
self.assertArrayNear(self.sim.grid, arr.grid)
self.assertArrayNear(self.sim.T, arr.T)
for k in arr._extra.keys():
self.assertIn(k, self.sim._extra)

f2 = ct.FreeFlame(self.gas)
f2.from_solution_array(arr)
self.assertArrayNear(self.sim.grid, f2.grid)
self.assertArrayNear(self.sim.T, f2.T)

def test_mixture_averaged_case1(self):
self.run_mix(phi=0.65, T=300, width=0.03, p=1.0, refine=True)

Expand Down

0 comments on commit e2c6485

Please sign in to comment.