Skip to content

Commit

Permalink
Merge branch 'pgrete/bump-parth-for-rr' into pgrete/reflect
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrete committed Sep 4, 2024
2 parents 8472c7e + 5ee71f6 commit bc88578
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ jobs:
build/tst/regression/outputs/aniso_therm_cond_gauss_conv/cond.png
build/tst/regression/outputs/field_loop/field_loop.png
build/tst/regression/outputs/riemann_hydro/shock_tube.png
build/tst/regression/outputs/turbulence/parthenon.hst
build/tst/regression/outputs/turbulence/parthenon.out1.hst
retention-days: 3

6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@
### Fixed (not changing behavior/API/variables/...)

### Infrastructure
- [[PR 114]](https://github.com/parthenon-hpc-lab/athenapk/pull/109) Bump Parthenon to latest develop (2024-05-29)
- [[PR 114]](https://github.com/parthenon-hpc-lab/athenapk/pull/114) Bump Parthenon 24.08 and Kokkos to 4.4.00
- [[PR 112]](https://github.com/parthenon-hpc-lab/athenapk/pull/112) Add dev container configuration
- [[PR 105]](https://github.com/parthenon-hpc-lab/athenapk/pull/105) Bump Parthenon to latest develop (2024-03-13)
- [[PR 84]](https://github.com/parthenon-hpc-lab/athenapk/pull/84) Added `CHANGELOG.md`

### Removed (removing behavior/API/varaibles/...)

### Incompatibilities (i.e. breaking changes)
- [[PR 114]](https://github.com/parthenon-hpc-lab/athenapk/pull/109) Bump Parthenon to latest develop (2024-05-29)
- [[PR 114]](https://github.com/parthenon-hpc-lab/athenapk/pull/114) Bump Parthenon 24.08 and Kokkos to 4.4.00
- Changed signature of `UserWorkBeforeOutput` to include `SimTime` as last paramter
- Fixes bitwise idential restarts for AMR simulations (the derefinement counter is now included)
- Order of operations in flux-correction has changed (expect round-off error differences to previous results for AMR sims)
- History outputs now carry the output block number, i.e., a file previously called parthenon.hst might now be called parthenon.out1.hst
- History outputs now contain two additional columns (cycle number and meshblock counts), which changes/shifts the column indices (hint: use the column headers to parse the contents and do not rely on fixed indices as they may also vary between different pgen due to custom/pgen-dependent content in the history file)
- [[PR 97]](https://github.com/parthenon-hpc-lab/athenapk/pull/97)
- Removes original `schure.cooling` cooling curve as it had unknown origin.
- To avoid confusion, only cooling table for a single solar metallicity are supported
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,15 @@ def get_ref(x, Bx, field_cfg):
outname = get_outname(all_cfgs[step])
data_filename = f"{parameters.output_path}/parthenon.{outname}.final.phdf"
data_file = phdf.phdf(data_filename)
prim = data_file.Get("prim")
zz, yy, xx = data_file.GetVolumeLocations()
mask = yy == yy[0]
temp = prim[4][mask]
# Flatten=true (default) is currently (Sep 24) broken so we manually flatten
components = data_file.GetComponents(
data_file.Info["ComponentNames"], flatten=False
)
temp = components["prim_pressure"].ravel()[
mask
] # because of gamma = 2.0 and rho = 1 -> p = e = T
x = xx[mask]
res, field_cfg, int_cfg = all_cfgs[step]
row = res_cfgs.index(res)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

class TestCase(utils.test_case.TestCaseAbs):
def Prepare(self, parameters, step):

assert parameters.num_ranks <= 4, "Use <= 4 ranks for diffusion test."

res = res_cfgs[step - 1]
Expand Down Expand Up @@ -78,8 +77,14 @@ def Analyse(self, parameters):
for res in res_cfgs:
data_filename = f"{parameters.output_path}/parthenon.{res}.final.phdf"
data_file = phdf.phdf(data_filename)
prim = data_file.Get("prim")
T = prim[4] # because of gamma = 2.0 and rho = 1 -> p = e = T
# Flatten=true (default) is currently (Sep 24) broken so we manually flatten
components = data_file.GetComponents(
data_file.Info["ComponentNames"], flatten=False
)
T = components[
"prim_pressure"
].ravel() # because of gamma = 2.0 and rho = 1 -> p = e = T

zz, yy, xx = data_file.GetVolumeLocations()
r = np.sqrt(xx**2 + yy**2)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

class TestCase(utils.test_case.TestCaseAbs):
def Prepare(self, parameters, step):

assert parameters.num_ranks <= 4, "Use <= 4 ranks for diffusion test."

# 2D reference case again
Expand Down Expand Up @@ -110,8 +109,13 @@ def Analyse(self, parameters):
for step in range(1, 5):
data_filename = f"{parameters.output_path}/parthenon.{step}.final.phdf"
data_file = phdf.phdf(data_filename)
prim = data_file.Get("prim")
T = prim[4] # because of gamma = 2.0 and rho = 1 -> p = e = T
# Flatten=true (default) is currently (Sep 24) broken so we manually flatten
components = data_file.GetComponents(
data_file.Info["ComponentNames"], flatten=False
)
T = components[
"prim_pressure"
].ravel() # because of gamma = 2.0 and rho = 1 -> p = e = T
zz, yy, xx = data_file.GetVolumeLocations()
if step == 1 or step == 2:
r = np.sqrt(xx**2 + yy**2)
Expand Down
30 changes: 12 additions & 18 deletions tst/regression/test_suites/cluster_hse/cluster_hse.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,21 +211,15 @@ def AnalyseInitPert(self, parameters):
# flatten array as prim var are also flattended
cell_vol = cell_vol.ravel()

prim = data_file.Get("prim")

# FIXME: For now this is hard coded - a component mapping should be done by phdf
prim_col_dict = {
"velocity_1": 1,
"velocity_2": 2,
"velocity_3": 3,
"magnetic_field_1": 5,
"magnetic_field_2": 6,
"magnetic_field_3": 7,
}

vx = prim[prim_col_dict["velocity_1"]]
vy = prim[prim_col_dict["velocity_2"]]
vz = prim[prim_col_dict["velocity_3"]]
# Flatten=true (default) is currently (Sep 24) broken so we manually flatten
components = data_file.GetComponents(
data_file.Info["ComponentNames"], flatten=False
)
rho = components["prim_density"].ravel()
vx = components["prim_velocity_1"].ravel()
vy = components["prim_velocity_2"].ravel()
vz = components["prim_velocity_3"].ravel()
pres = components["prim_pressure"].ravel()

# volume weighted rms velocity
rms_v = np.sqrt(
Expand All @@ -243,9 +237,9 @@ def AnalyseInitPert(self, parameters):
f"Expected {self.sigma_v.in_units('code_velocity')} but got {rms_v}\n"
)

bx = prim[prim_col_dict["magnetic_field_1"]]
by = prim[prim_col_dict["magnetic_field_2"]]
bz = prim[prim_col_dict["magnetic_field_3"]]
bx = components["prim_magnetic_field_1"].ravel()
by = components["prim_magnetic_field_2"].ravel()
bz = components["prim_magnetic_field_3"].ravel()

# volume weighted rms magnetic field
rms_b = np.sqrt(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,19 +310,16 @@ def zero_corrected_linf_err(gold, test):
analyze_status = False

data_file = phdf.phdf(data_filename)
prim = data_file.Get("prim")

# FIXME: TODO(forrestglines) For now this is hard coded - a component mapping should be done by phdf
prim_col_dict = {
"density": 0,
"pressure": 4,
}
# Flatten=true (default) is currently (Sep 24) broken so we manually flatten
components = data_file.GetComponents(
data_file.Info["ComponentNames"], flatten=False
)

rho = unyt.unyt_array(
prim[prim_col_dict["density"], :], "code_mass*code_length**-3"
components["prim_density"].ravel(), "code_mass*code_length**-3"
)
pres = unyt.unyt_array(
prim[prim_col_dict["pressure"], :],
components["prim_pressure"].ravel(),
"code_mass*code_length**-1*code_time**-2",
)

Expand Down Expand Up @@ -364,19 +361,16 @@ def zero_corrected_linf_err(gold, test):
analyze_status = False

data_file = phdf.phdf(data_filename)
prim = data_file.Get("prim")

# FIXME: TODO(forrestglines) For now this is hard coded - a component mapping should be done by phdf
prim_col_dict = {
"density": 0,
"pressure": 4,
}
# Flatten=true (default) is currently (Sep 24) broken so we manually flatten
components = data_file.GetComponents(
data_file.Info["ComponentNames"], flatten=False
)

rho = unyt.unyt_array(
prim[prim_col_dict["density"]], "code_mass*code_length**-3"
components["prim_density"].ravel(), "code_mass*code_length**-3"
)
pres = unyt.unyt_array(
prim[prim_col_dict["pressure"]],
components["prim_pressure"].ravel(),
"code_mass*code_length**-1*code_time**-2",
)

Expand Down
6 changes: 3 additions & 3 deletions tst/regression/test_suites/field_loop/field_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ def Analyse(self, parameters):

for step in range(len(all_cfgs)):
outname = get_outname(all_cfgs[step])
data_filename = f"{parameters.output_path}/{outname}.hst"
data_filename = f"{parameters.output_path}/{outname}.out1.hst"
data = np.genfromtxt(data_filename)

res, method = all_cfgs[step]
row = method_cfgs.index(method)
p[row, 0].plot(data[:, 0], data[:, 8] / data[0, 8], label=outname)
p[row, 1].plot(data[:, 0], data[:, 10], label=outname)
p[row, 0].plot(data[:, 0], data[:, 10] / data[0, 10], label=outname)
p[row, 1].plot(data[:, 0], data[:, 12], label=outname)

p[0, 0].set_title("Emag(t)/Emag(0)")
p[0, 1].set_title("rel DivB")
Expand Down
12 changes: 7 additions & 5 deletions tst/regression/test_suites/riemann_hydro/riemann_hydro.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@

class TestCase(utils.test_case.TestCaseAbs):
def Prepare(self, parameters, step):

method, init_cond = all_cfgs[step - 1]

nx1 = method["nx1"]
Expand Down Expand Up @@ -126,10 +125,13 @@ def Analyse(self, parameters):

data_filename = f"{parameters.output_path}/parthenon.{step + 1}.final.phdf"
data_file = phdf.phdf(data_filename)
prim = data_file.Get("prim")
rho = prim[0]
vx = prim[1]
pres = prim[4]
# Flatten=true (default) is currently (Sep 24) broken so we manually flatten
components = data_file.GetComponents(
data_file.Info["ComponentNames"], flatten=False
)
rho = components["prim_density"].ravel()
vx = components["prim_velocity_1"].ravel()
pres = components["prim_pressure"].ravel()
zz, yy, xx = data_file.GetVolumeLocations()

label = (
Expand Down
8 changes: 3 additions & 5 deletions tst/regression/test_suites/turbulence/turbulence.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

class TestCase(utils.test_case.TestCaseAbs):
def Prepare(self, parameters, step):

parameters.driver_cmd_line_args = [
"parthenon/output2/dt=-1",
"parthenon/output3/dt=-1",
Expand All @@ -31,7 +30,6 @@ def Prepare(self, parameters, step):
return parameters

def Analyse(self, parameters):

sys.path.insert(
1,
parameters.parthenon_path
Expand All @@ -40,17 +38,17 @@ def Analyse(self, parameters):

success = True

data_filename = f"{parameters.output_path}/parthenon.hst"
data_filename = f"{parameters.output_path}/parthenon.out1.hst"
data = np.genfromtxt(data_filename)

# Check Ms
if not (data[-1, -3] > 0.45 and data[-1, -3] < 0.50):
print("ERROR: Mismatch in Ms")
print(f"ERROR: Mismatch in Ms={data[-1, -3]}")
success = False

# Check Ma
if not (data[-1, -2] > 12.8 and data[-1, -2] < 13.6):
print("ERROR: Mismatch in Ma")
print(f"ERROR: Mismatch in Ma={data[-1, -2]}")
success = False

return success

0 comments on commit bc88578

Please sign in to comment.