...
 
......@@ -45,6 +45,8 @@ DeltaMaxAllowed = 0.03 * (FloatType(CellsPerDimension) / 40.0)**-1.4
""" loop over all output files """
i_file = 0
status = 0
error_data = []
while True:
""" try to read in snapshot """
directory = simulation_directory+"/output/"
......@@ -112,6 +114,8 @@ while True:
## internal energy
abs_delta_utherm = np.abs(Uthermal - Uthermal_ref)
L1_utherm = np.average(abs_delta_utherm, weights = Volume)
error_data.append(np.array([L1_dens, L1_vel, L1_utherm], dtype=FloatType))
""" printing results """
print("Gresho_2d: L1 error of " + filename +":")
......@@ -177,9 +181,11 @@ while True:
""" criteria for failing the test """
if L1_dens > DeltaMaxAllowed or L1_vel > DeltaMaxAllowed or L1_utherm > DeltaMaxAllowed:
sys.exit(-1)
status = 1
i_file += 1
np.savetxt(simulation_directory+"/error_%03d.txt"%CellsPerDimension, np.array(error_data, dtype=FloatType))
print("normal exit")
""" normal exit """
sys.exit(0)
sys.exit(status)
""" @package ./examples/Gresho_2d/create.py
Code that creates 2d Gresho vortex initial conditions
created by Rainer Weinberger, last modified 21.02.2019 -- comments welcome
created by Rainer Weinberger, last modified 20.03.2020 -- comments welcome
"""
#### load libraries
......@@ -19,7 +19,10 @@ FloatType = np.float64 # double precision: np.float64, for single use np.float3
IntType = np.int32
Boxsize = FloatType(1.0)
CellsPerDimension = IntType(40)
if len(sys.argv) > 3:
CellsPerDimension = IntType(sys.argv[3])
else:
CellsPerDimension = IntType(40)
## parameters
density_0 = 1.0
......
""" @package ./examples/Yee_2d/check.py
Code that checks results of 2d Yee vortex problem
created by Rainer Weinberger, last modified 07.01.2018 -- comments welcome
created by Rainer Weinberger, last modified 20.03.2020 -- comments welcome
"""
#### load libraries
......@@ -44,6 +44,8 @@ DeltaMaxAllowed = 0.005 * (FloatType(CellsPerDimension) / 50.0)**-2
""" loop over all output files """
i_file = 0
status = 0
error_data = []
while True:
""" try to read in snapshot """
directory = simulation_directory+"/output/"
......@@ -94,6 +96,8 @@ while True:
## internal energy
abs_delta_utherm = np.abs(Uthermal - Uthermal_ref)
L1_utherm = np.average(abs_delta_utherm, weights=Volume)
error_data.append(np.array([L1_dens, L1_vel, L1_utherm], dtype=FloatType))
""" printing results """
print("Yee_2d: L1 error of " + filename +":")
......@@ -146,9 +150,11 @@ while True:
""" criteria for failing the test """
if L1_dens > DeltaMaxAllowed or L1_vel > DeltaMaxAllowed or L1_utherm > DeltaMaxAllowed:
sys.exit(1)
status = 1
i_file += 1
np.savetxt(simulation_directory+"/error_%03d.txt"%CellsPerDimension, np.array(error_data, dtype=FloatType))
""" normal exit """
sys.exit(0)
sys.exit(status)