forked from python-hydro/pyro2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_advection_nonuniform.py
More file actions
executable file
·37 lines (28 loc) · 1.12 KB
/
Copy pathtest_advection_nonuniform.py
File metadata and controls
executable file
·37 lines (28 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import pyro.advection_nonuniform.simulation as sn
from pyro.util import runparams
class TestSimulation:
@classmethod
def setup_class(cls):
""" this is run once for each class before any tests """
@classmethod
def teardown_class(cls):
""" this is run once for each class after all tests """
def setup_method(self):
""" this is run before each test """
self.rp = runparams.RuntimeParameters()
self.rp.params["mesh.nx"] = 8
self.rp.params["mesh.ny"] = 8
self.rp.params["particles.do_particles"] = 0
self.sim = sn.Simulation("advection_nonuniform", "test", self.rp)
self.sim.initialize()
def teardown_method(self):
""" this is run after each test """
self.rp = None
self.sim = None
def test_initializationst(self):
dens = self.sim.cc_data.get_var("density")
u = self.sim.cc_data.get_var("x-velocity")
v = self.sim.cc_data.get_var("y-velocity")
assert dens.min() == 1.0 and dens.max() == 1.0
assert u.min() == 1.0 and u.max() == 1.0
assert v.min() == 1.0 and v.max() == 1.0