Skip to content

Commit

Permalink
Print in Full Precision
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring committed Nov 12, 2024
1 parent 7f6a860 commit e26710b
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/callbacks_step/analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -164,41 +164,41 @@ function initialize!(cb::DiscreteCallback{Condition, Affect!}, u_ode, du_ode, t,
# write header of output file
open(joinpath(output_directory, analysis_filename), "w") do io
@printf(io, "#%-8s", "timestep")
@printf(io, " %-14s", "time")
@printf(io, " %-14s", "dt")
@printf(io, " %-21s", "time")
@printf(io, " %-21s", "dt")
if :l2_error in analysis_errors
for v in varnames(cons2cons, equations)
@printf(io, " %-14s", "l2_"*v)
@printf(io, " %-21s", "l2_"*v)
end
end
if :linf_error in analysis_errors
for v in varnames(cons2cons, equations)
@printf(io, " %-14s", "linf_"*v)
@printf(io, " %-21s", "linf_"*v)
end
end
if :conservation_error in analysis_errors
for v in varnames(cons2cons, equations)
@printf(io, " %-14s", "cons_"*v)
@printf(io, " %-21s", "cons_"*v)
end
end
if :residual in analysis_errors
for v in varnames(cons2cons, equations)
@printf(io, " %-14s", "res_"*v)
@printf(io, " %-21s", "res_"*v)
end
end
if :l2_error_primitive in analysis_errors
for v in varnames(cons2prim, equations)
@printf(io, " %-14s", "l2_"*v)
@printf(io, " %-21s", "l2_"*v)
end
end
if :linf_error_primitive in analysis_errors
for v in varnames(cons2prim, equations)
@printf(io, " %-14s", "linf_"*v)
@printf(io, " %-21s", "linf_"*v)
end
end

for quantity in analysis_integrals
@printf(io, " %-14s", pretty_form_ascii(quantity))
@printf(io, " %-21s", pretty_form_ascii(quantity))
end

println(io)
Expand Down Expand Up @@ -323,8 +323,8 @@ function (analysis_callback::AnalysisCallback)(u_ode, du_ode, integrator, semi)
io = open(joinpath(analysis_callback.output_directory,
analysis_callback.analysis_filename), "a")
@printf(io, "% 9d", iter)
@printf(io, " %10.8e", t)
@printf(io, " %10.8e", dt)
@printf(io, " %10.15e", t)
@printf(io, " %10.15e", dt)
else
io = devnull
end
Expand Down Expand Up @@ -377,7 +377,7 @@ function (analysis_callback::AnalysisCallback)(io, du, u, u_ode, t, semi)
mpi_isroot()
print(" Variable: ")
for v in eachvariable(equations)
@printf(" %-14s", varnames(cons2cons, equations)[v])
@printf(" %-21s", varnames(cons2cons, equations)[v])
end
println()
end
Expand All @@ -393,7 +393,7 @@ function (analysis_callback::AnalysisCallback)(io, du, u, u_ode, t, semi)
print(" L2 error: ")
for v in eachvariable(equations)
@printf(" % 10.8e", l2_error[v])
@printf(io, " % 10.8e", l2_error[v])
@printf(io, " % 10.15e", l2_error[v])
end
println()
end
Expand All @@ -403,7 +403,7 @@ function (analysis_callback::AnalysisCallback)(io, du, u, u_ode, t, semi)
print(" Linf error: ")
for v in eachvariable(equations)
@printf(" % 10.8e", linf_error[v])
@printf(io, " % 10.8e", linf_error[v])
@printf(io, " % 10.15e", linf_error[v])
end
println()
end
Expand All @@ -420,7 +420,7 @@ function (analysis_callback::AnalysisCallback)(io, du, u, u_ode, t, semi)
for v in eachvariable(equations)
err = abs(state_integrals[v] - initial_state_integrals[v])
@printf(" % 10.8e", err)
@printf(io, " % 10.8e", err)
@printf(io, " % 10.15e", err)
end
println()
end
Expand All @@ -442,7 +442,7 @@ function (analysis_callback::AnalysisCallback)(io, du, u, u_ode, t, semi)
end
if mpi_isroot()
@printf(" % 10.8e", res)
@printf(io, " % 10.8e", res)
@printf(io, " % 10.15e", res)
end
end
mpi_println()
Expand All @@ -457,7 +457,7 @@ function (analysis_callback::AnalysisCallback)(io, du, u, u_ode, t, semi)
if mpi_isroot()
print(" Variable: ")
for v in eachvariable(equations)
@printf(" %-14s", varnames(cons2prim, equations)[v])
@printf(" %-21s", varnames(cons2prim, equations)[v])
end
println()

Expand All @@ -466,7 +466,7 @@ function (analysis_callback::AnalysisCallback)(io, du, u, u_ode, t, semi)
print(" L2 error prim.: ")
for v in eachvariable(equations)
@printf("%10.8e ", l2_error_prim[v])
@printf(io, " % 10.8e", l2_error_prim[v])
@printf(io, " % 10.15e", l2_error_prim[v])
end
println()
end
Expand All @@ -476,7 +476,7 @@ function (analysis_callback::AnalysisCallback)(io, du, u, u_ode, t, semi)
print(" Linf error pri.:")
for v in eachvariable(equations)
@printf("%10.8e ", linf_error_prim[v])
@printf(io, " % 10.8e", linf_error_prim[v])
@printf(io, " % 10.15e", linf_error_prim[v])
end
println()
end
Expand Down Expand Up @@ -581,7 +581,7 @@ function analyze_integrals(analysis_integrals::NTuple{N, Any}, io, du, u, t,
if mpi_isroot()
@printf(" %-12s:", pretty_form_utf(quantity))
@printf(" % 10.8e", res)
@printf(io, " % 10.8e", res)
@printf(io, " % 10.15e", res)
end
mpi_println()

Expand Down

0 comments on commit e26710b

Please sign in to comment.