Skip to content

Commit

Permalink
hall regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jordidj committed Jan 31, 2022
1 parent 6d8ea3a commit b4f8ca9
Show file tree
Hide file tree
Showing 7 changed files with 1,729 additions and 0 deletions.
Binary file not shown.
816 changes: 816 additions & 0 deletions tests/regression_tests/answers/answer_hall_adiabatic_homo.log

Large diffs are not rendered by default.

Binary file not shown.
816 changes: 816 additions & 0 deletions tests/regression_tests/answers/answer_hall_harris_sheet.log

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions tests/regression_tests/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
from regression_tests.test_multi_iso_atmo import iso_atmo_beta_half_setup
from regression_tests.test_multi_photospheric_fluxtube import photospheric_tube_setup

from regression_tests.test_hall_adiabatic_homo import hall_adiabatic_homo
from regression_tests.test_hall_harris_sheet import hall_harris_sheet

# retrieve test setups
tests_to_run = [
Expand Down Expand Up @@ -87,6 +89,8 @@
suydam_setup,
taylor_couette_setup,
tokamak_setup,
hall_adiabatic_homo,
hall_harris_sheet,
]
multirun_tests = [
constant_current_setup,
Expand Down
39 changes: 39 additions & 0 deletions tests/regression_tests/test_hall_adiabatic_homo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import numpy as np

hall_adiabatic_homo = {
"name": "hall_adiabatic_homo",
"config": {
"geometry": "Cartesian",
"x_start": 0,
"x_end": 1000,
"gridpoints": 51,
"parameters": {
"k2": np.pi * np.sin(np.pi / 6),
"k3": np.pi * np.cos(np.pi / 6),
"cte_rho0": 1.0,
"cte_T0": 1.0,
"cte_B02": 0.0,
"cte_B03": 1.0,
},
"equilibrium_type": "adiabatic_homo",
"hall_mhd": True,
"electron_fraction": 0.5,
"cgs_units": True,
"unit_density": 1.7e-14,
"unit_magneticfield": 10,
"unit_length": 7.534209349981049e-9,
"logging_level": 0,
"show_results": False,
"write_eigenfunctions": True,
},
"all_eigenvalues_real": True,
"image_limits": [
{"xlims": (-600, 600), "ylims": (-0.05, 0.05), "RMS_TOLERANCE": 2.5},
{"xlims": (-50, 50), "ylims": (-0.05, 0.05)},
],
"eigenfunctions": [
{"eigenvalue": 0.7877457},
{"eigenvalue": 4.0167199},
{"eigenvalue": 9.4880654},
],
}
54 changes: 54 additions & 0 deletions tests/regression_tests/test_hall_harris_sheet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import pytest
import numpy as np

hall_harris_sheet = {
"name": "hall_harris_sheet",
"config": {
"geometry": "Cartesian",
"x_start": -15,
"x_end": 15,
"gridpoints": 51,
"parameters": {
"k2": 0.155,
"k3": 0.01,
"alpha": 1,
"cte_rho0": 1.0,
"cte_B02": 1.0,
"cte_B03": 5.0,
"eq_bool": False,
},
"equilibrium_type": "harris_sheet",
"resistivity": True,
"use_fixed_resistivity": True,
"fixed_eta_value": 10 ** (-4.0),
"hall_mhd": True,
"electron_fraction": 0.5,
"cgs_units": True,
"unit_density": 1.7e-14,
"unit_magneticfield": 10,
"unit_length": 7.534209349981049e-9,
"incompressible": True,
"logging_level": 0,
"show_results": False,
"write_eigenfunctions": False,
"write_matrices": False,
},
"image_limits": [
{"xlims": (-375, 375), "ylims": (-11, 0.5)},
{"xlims": (-30, 30), "ylims": (-3, 0.3)},
{"xlims": (-0.6, 0.6), "ylims": (-1.2, 0.1)},
{"xlims": (-0.5, 0.5), "ylims": (-0.2, 0.02)},
],
}
parametrisation = dict(
argnames="setup",
argvalues=[hall_harris_sheet],
ids=[hall_harris_sheet["name"]],
)


@pytest.mark.parametrize(**parametrisation)
def test_eta_value(ds_test, setup):
eta_value = 1e-4
assert setup["config"]["fixed_eta_value"] == pytest.approx(eta_value)
assert np.all(ds_test.equilibria.get("eta") == pytest.approx(eta_value))

0 comments on commit b4f8ca9

Please sign in to comment.