Skip to content
Snippets Groups Projects
Commit 878b0022 authored by Rainer Weinberger's avatar Rainer Weinberger
Browse files

Example yee_2d, added error_*.txt output.

parent 695f5ded
No related branches found
No related tags found
No related merge requests found
......@@ -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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment