Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DNM] restart reproducer for turbulence pgen #120

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 168 additions & 0 deletions inputs/restart_reproducer.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<comment>
problem = Turbulence with parabolic forcing profile (using few driving modes)
reference = to be written, see https://gitlab.com/pgrete/kathena/wikis/turbulence for now

<job>
problem_id = turbulence

<parthenon/output1>
file_type = hst # History data dump
dt = 0.05 # time increment between outputs

<parthenon/output2>
file_type = hdf5 # Binary data dump
variables = prim,acc # variables to be output
dt = 0.05 # time increment between outputs
id = prim
single_precision_output = true

<parthenon/output3>
file_type = rst # Binary data dump
dt = 0.05 # time increment between outputs
id = restart

<parthenon/time>
cfl = 0.3 # The Courant, Friedrichs, & Lewy (CFL) Number
nlim = 100000 # cycle limit
tlim = 0.15 # time limit
integrator = vl2 # time integration algorithm
ncycle_out_mesh = -500 # print mesh structure every 500 cyles and on refinement

<parthenon/mesh>
nghost = 2
nx1 = 64 # Number of zones in X1-direction
x1min = 0.0 # minimum value of X1
x1max = 1.0 # maximum value of X1
ix1_bc = periodic # inner-X1 boundary flag
ox1_bc = periodic # outer-X1 boundary flag

nx2 = 64 # Number of zones in X2-direction
x2min = 0.0 # minimum value of X2
x2max = 1.0 # maximum value of X2
ix2_bc = periodic # inner-X2 boundary flag
ox2_bc = periodic # outer-X2 boundary flag

nx3 = 64 # Number of zones in X3-direction
x3min = 0.0 # minimum value of X3
x3max = 1.0 # maximum value of X3
ix3_bc = periodic # inner-X3 boundary flag
ox3_bc = periodic # outer-X3 boundary flag

pack_size = -1 # pack all blocks in a single pack (currently required)

<parthenon/meshblock>
nx1 = 32
nx2 = 32
nx3 = 32

<hydro>
fluid = glmmhd
eos = adiabatic
riemann = hlle
reconstruction = plm
gamma = 1.0001 # gamma = C_p/C_v

<problem/turbulence>
rho0 = 1.0 # initial mean density
p0 = 1.0 # initial mean pressure
b0 = 0.01 # initial magnetic field (x-direction)
b_config = 0 # 0 - net flux; 1 - no net flux uniform B; 2 - non net flux sin B; 4 - field loop
kpeak = 2.0 # characteristic wavenumber
corr_time = 1.0 # autocorrelation time of the OU forcing process
rseed = 20190729 # random seed of the OU forcing process
sol_weight = 1.0 # solenoidal weight of the acceleration field
accel_rms = 0.5 # root mean square value of the acceleration field
num_modes = 30 # number of wavemodes

<modes>
k_1_0 = +2
k_1_1 = -1
k_1_2 = +0
k_2_0 = +1
k_2_1 = +0
k_2_2 = +2
k_3_0 = +1
k_3_1 = +1
k_3_2 = -1
k_4_0 = +2
k_4_1 = +0
k_4_2 = +1
k_5_0 = +0
k_5_1 = +0
k_5_2 = -1
k_6_0 = +1
k_6_1 = -1
k_6_2 = -2
k_7_0 = +0
k_7_1 = +0
k_7_2 = -2
k_8_0 = +1
k_8_1 = +0
k_8_2 = -1
k_9_0 = +0
k_9_1 = +2
k_9_2 = +1
k_10_0 = +0
k_10_1 = -1
k_10_2 = +2
k_11_0 = +0
k_11_1 = +0
k_11_2 = +2
k_12_0 = +0
k_12_1 = +2
k_12_2 = -1
k_13_0 = +2
k_13_1 = +1
k_13_2 = +1
k_14_0 = +1
k_14_1 = -1
k_14_2 = +0
k_15_0 = +0
k_15_1 = -1
k_15_2 = -1
k_16_0 = +1
k_16_1 = +0
k_16_2 = +1
k_17_0 = +0
k_17_1 = -1
k_17_2 = +1
k_18_0 = +0
k_18_1 = +1
k_18_2 = +0
k_19_0 = +1
k_19_1 = -1
k_19_2 = +1
k_20_0 = +2
k_20_1 = +1
k_20_2 = -1
k_21_0 = +0
k_21_1 = -1
k_21_2 = -2
k_22_0 = +2
k_22_1 = -1
k_22_2 = +1
k_23_0 = +0
k_23_1 = +1
k_23_2 = +1
k_24_0 = +1
k_24_1 = -2
k_24_2 = +1
k_25_0 = +1
k_25_1 = -2
k_25_2 = +0
k_26_0 = +1
k_26_1 = +2
k_26_2 = +0
k_27_0 = +1
k_27_1 = -2
k_27_2 = -1
k_28_0 = +2
k_28_1 = -1
k_28_2 = -1
k_29_0 = +1
k_29_1 = +2
k_29_2 = -1
k_30_0 = +1
k_30_1 = +1
k_30_2 = +2

33 changes: 33 additions & 0 deletions reproducer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh

set -x

NRANKS=8
BUILD_TYPE=Release

# compile
rm -rf build
mkdir build
cd build
cmake .. -DPARTHENON_ENABLE_PYTHON_MODULE_CHECK=OFF -DCMAKE_BUILD_TYPE=$BUILD_TYPE
cmake --build .
cd ..

# first run
mpirun -np $NRANKS ./build/bin/athenaPK -i inputs/restart_reproducer.in

# move outputs to avoid being overwritten
mkdir first_run
mv parthenon.* first_run

# restart run
mpirun -np $NRANKS ./build/bin/athenaPK -r first_run/parthenon.restart.00001.rhdf

## compare first outputs after restart

echo "\nComparing second outputs after restart..."
h5diff first_run/parthenon.prim.00002.phdf parthenon.prim.00002.phdf
h5diff first_run/parthenon.restart.00002.rhdf parthenon.restart.00002.rhdf

## compare with internal tool
uv run external/parthenon/scripts/python/packages/parthenon_tools/parthenon_tools/phdf_diff.py parthenon.restart.00002.rhdf first_run/parthenon.restart.00002.rhdf
Loading