Skip to content

Commit 8b20f3f

Browse files
committed
make sure the blast wave works
Sanity check on the linearwavetest
1 parent abb46fb commit 8b20f3f

File tree

4 files changed

+86
-8
lines changed

4 files changed

+86
-8
lines changed
File renamed without changes.

test/HD/SedovBlastWave/idefix.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Grid]
2-
X1-grid 1 -0.5 128 u 0.5
3-
X2-grid 1 -0.5 128 u 0.5
4-
X3-grid 1 -0.5 128 u 0.5
2+
X1-grid 1 -0.5 64 u 0.5
3+
X2-grid 1 -0.5 64 u 0.5
4+
X3-grid 1 -0.5 64 u 0.5
55

66
[TimeIntegrator]
77
CFL 0.9

test/MHD/LinearWaveTest/python/testidefix.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@
99
from pytools.dump_io import readDump
1010
import numpy as np
1111
import matplotlib.pyplot as plt
12+
import argparse
13+
14+
parser = argparse.ArgumentParser()
15+
parser.add_argument("-noplot",
16+
default=False,
17+
help="disable plotting",
18+
action="store_true")
19+
20+
21+
args, unknown=parser.parse_known_args()
22+
1223

1324
def getError(rep):
1425
try:
@@ -29,9 +40,10 @@ def getError(rep):
2940
Q2=Q2-np.mean(Q2)
3041
print(key+" error=%e"%((np.mean(np.abs(Q1-Q2)))*1e6))
3142
err=err + (np.mean(np.abs(Q1-Q2)))**2
32-
plt.figure()
33-
plt.contourf(V.data[key][:,:,16]-U.data[key][:,:,16])
34-
plt.title(key)
43+
if(not args.noplot):
44+
plt.figure()
45+
plt.contourf(V.data[key][:,:,16]-U.data[key][:,:,16])
46+
plt.title(key)
3547

3648

3749
err = err/len(keylist)
@@ -41,4 +53,13 @@ def getError(rep):
4153

4254
error = getError("..")
4355
print("Error=%e"%(error*1e6))
44-
plt.show()
56+
57+
if(not args.noplot):
58+
plt.show()
59+
60+
if error*1e6<3e-2:
61+
print("SUCCESS")
62+
sys.exit(0)
63+
else:
64+
print("Failed")
65+
sys.exit(1)

test/checks_mpi.sh

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
rep_2D_mpi_list="HD/MachReflection HD/ViscousFlowPastCylinder HD/FargoPlanet MHD/OrszagTang"
4-
rep_3D_mpi_list="HD/SedovBlastWave MHD/AmbipolarCshock3D MHD/AxisFluxTube MHD/LinearWaveTest MHD/FargoMHDSpherical MHD/OrszagTang3D"
4+
rep_3D_mpi_list="MHD/AmbipolarCshock3D MHD/AxisFluxTube MHD/LinearWaveTest MHD/FargoMHDSpherical MHD/OrszagTang3D"
55

66
# refer to the parent dir of this file, wherever this is called from
77
# a python equivalent is e.g.
@@ -102,5 +102,62 @@ for rep in $rep_3D_mpi_list; do
102102
cd $TEST_DIR
103103
done
104104

105+
# Blast wave test
106+
rep="HD/SedovBlastWave"
107+
108+
## Cartesian blast
109+
cp -R $TEST_DIR/$rep $TMP_DIR/$rep
110+
cd $TMP_DIR/$rep
111+
echo "***********************************************"
112+
echo "Configuring $rep"
113+
echo "Using $TMP_DIR/$rep as working directory"
114+
echo "***********************************************"
115+
rm -f CMakeCache.txt
116+
cmake $IDEFIX_DIR -DIdefix_MPI=ON $options
117+
echo "***********************************************"
118+
echo "Making $rep"
119+
echo "***********************************************"
120+
make clean; make -j 10
121+
122+
ini="idefix.ini"
123+
echo "***********************************************"
124+
echo "Running $rep with $ini"
125+
echo "***********************************************"
126+
mpirun -np 8 ./idefix -i $ini -dec 2 2 2 -nolog
127+
128+
cd python
129+
echo "***********************************************"
130+
echo "Testing $rep with $ini"
131+
echo "***********************************************"
132+
python3 testidefix.py -noplot -i ../$ini
133+
cd ..
134+
135+
## Spherical blast
136+
echo "***********************************************"
137+
echo "Configuring $rep in spherical geometry"
138+
echo "Using $TMP_DIR/$rep as working directory"
139+
echo "***********************************************"
140+
rm -f CMakeCache.txt
141+
cmake $IDEFIX_DIR -DIdefix_MPI=ON -DIdefix_DEFS=definitions-spherical.hpp $options
142+
echo "***********************************************"
143+
echo "Making $rep"
144+
echo "***********************************************"
145+
make clean; make -j 10
146+
147+
ini="idefix-spherical.ini"
148+
echo "***********************************************"
149+
echo "Running $rep with $ini"
150+
echo "***********************************************"
151+
mpirun -np 8 ./idefix -i $ini -dec 2 2 2 -nolog
152+
153+
cd python
154+
echo "***********************************************"
155+
echo "Testing $rep with $ini"
156+
echo "***********************************************"
157+
python3 testidefix.py -noplot -i ../$ini
158+
159+
cd $TEST_DIR
160+
161+
105162
echo "Cleaning temporary directory $TMP_DIR"
106163
rm -rf $TMP_DIR

0 commit comments

Comments
 (0)