Skip to content

Commit 6dd8c6f

Browse files
UCaromelnicolasaunai
authored andcommitted
starting refactor
1 parent a14b876 commit 6dd8c6f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2646
-2090
lines changed

pyphare/pyphare/mock_mhd_simulator/__init__.py

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,14 @@ def add_double(path, val):
7979
add_double("mesh_size/z", simulation.dl[2])
8080
add_double("origin/z", simulation.origin[2])
8181

82-
add_double("godunov/resistivity", simulation.eta)
83-
add_double("godunov/hyper_resistivity", simulation.nu)
84-
add_double("godunov/heat_capacity_ratio", simulation.gamma)
85-
add_string("godunov/terms", simulation.terms)
86-
add_string("godunov/reconstruction", simulation.reconstruction)
87-
add_string("godunov/limiter", simulation.limiter)
88-
add_string("godunov/riemann", simulation.riemann)
82+
add_double("fv_method/resistivity", simulation.eta)
83+
add_double("fv_method/hyper_resistivity", simulation.nu)
84+
add_double("fv_method/heat_capacity_ratio", simulation.gamma)
85+
add_double("fv_euler/heat_capacity_ratio", simulation.gamma)
8986
add_double("to_primitive/heat_capacity_ratio", simulation.gamma)
9087
add_double("to_conservative/heat_capacity_ratio", simulation.gamma)
91-
add_string("integrator", simulation.integrator)
9288

9389
add_string("state/name", "state")
94-
add_string("state1/name", "state1")
95-
add_string("state2/name", "state2")
9690

9791
d = simulation.model.model_dict
9892

@@ -104,21 +98,3 @@ def add_double(path, val):
10498
addInitFunction("state/magnetic/initializer/y_component", fn_wrapper(d["by"]))
10599
addInitFunction("state/magnetic/initializer/z_component", fn_wrapper(d["bz"]))
106100
addInitFunction("state/pressure/initializer", fn_wrapper(d["p"]))
107-
108-
addInitFunction("state1/density/initializer", fn_wrapper(d["density"]))
109-
addInitFunction("state1/velocity/initializer/x_component", fn_wrapper(d["vx"]))
110-
addInitFunction("state1/velocity/initializer/y_component", fn_wrapper(d["vy"]))
111-
addInitFunction("state1/velocity/initializer/z_component", fn_wrapper(d["vz"]))
112-
addInitFunction("state1/magnetic/initializer/x_component", fn_wrapper(d["bx"]))
113-
addInitFunction("state1/magnetic/initializer/y_component", fn_wrapper(d["by"]))
114-
addInitFunction("state1/magnetic/initializer/z_component", fn_wrapper(d["bz"]))
115-
addInitFunction("state1/pressure/initializer", fn_wrapper(d["p"]))
116-
117-
addInitFunction("state2/density/initializer", fn_wrapper(d["density"]))
118-
addInitFunction("state2/velocity/initializer/x_component", fn_wrapper(d["vx"]))
119-
addInitFunction("state2/velocity/initializer/y_component", fn_wrapper(d["vy"]))
120-
addInitFunction("state2/velocity/initializer/z_component", fn_wrapper(d["vz"]))
121-
addInitFunction("state2/magnetic/initializer/x_component", fn_wrapper(d["bx"]))
122-
addInitFunction("state2/magnetic/initializer/y_component", fn_wrapper(d["by"]))
123-
addInitFunction("state2/magnetic/initializer/z_component", fn_wrapper(d["bz"]))
124-
addInitFunction("state2/pressure/initializer", fn_wrapper(d["p"]))

pyphare/pyphare/mock_mhd_simulator/simulator.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,25 @@ def pyMHD():
77
return importlib.import_module("pybindlibs.pyMHD")
88

99

10-
def make_cpp_simulator(dim, interp):
10+
def make_cpp_simulator(
11+
dim,
12+
interp,
13+
time_integrator,
14+
reconstruction,
15+
riemann,
16+
hall=False,
17+
resistivity=False,
18+
hyper_resistivity=False,
19+
limiter="",
20+
):
1121
import pybindlibs.pyMHD
1222

13-
make_sim = f"make_mhd_mock_simulator_{dim}_{interp}"
23+
hall_suffix = "_hall" if hall else ""
24+
resistivity_suffix = "_res" if resistivity else ""
25+
hyper_res_suffix = "_hyperres" if hyper_resistivity else ""
26+
limiter_suffix = f"_{limiter}" if limiter else ""
27+
28+
make_sim = f"make_mhd_mock_simulator_{dim}_{interp}_{time_integrator}_{reconstruction}{limiter_suffix}_{riemann}{hall_suffix}{resistivity_suffix}{hyper_res_suffix}"
1429
return getattr(pyMHD(), make_sim)()
1530

1631

@@ -35,9 +50,22 @@ def initialize(self):
3550
)
3651

3752
populateDict()
53+
54+
hall = getattr(self.simulation, "hall", False)
55+
resistivity = getattr(self.simulation, "resistivity", False)
56+
hyper_resistivity = getattr(self.simulation, "hyper_resistivity", False)
57+
limiter = getattr(self.simulation, "limiter", "")
58+
3859
self.cpp_sim = make_cpp_simulator(
3960
self.simulation.ndim,
4061
self.simulation.order,
62+
self.simulation.time_integrator,
63+
self.simulation.reconstruction,
64+
self.simulation.riemann,
65+
hall,
66+
resistivity,
67+
hyper_resistivity,
68+
limiter,
4169
)
4270

4371
def _check_init(self):

res/cmake/test.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ if (test AND ${PHARE_EXEC_LEVEL_MIN} GREATER 0) # 0 = no tests
3030
add_subdirectory(tests/core/numerics/faraday)
3131
add_subdirectory(tests/core/numerics/ohm)
3232
add_subdirectory(tests/core/numerics/ion_updater)
33+
add_subdirectory(tests/core/numerics/mock_mhd_simulator)
3334

3435

3536
add_subdirectory(tests/initializer)

0 commit comments

Comments
 (0)