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

Print Analysis in Full Precision to File #2155

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
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
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)
DanielDoehring marked this conversation as resolved.
Show resolved Hide resolved
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])
DanielDoehring marked this conversation as resolved.
Show resolved Hide resolved
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])
DanielDoehring marked this conversation as resolved.
Show resolved Hide resolved
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
Loading