From e26710b3369e6137754581e8d6999d04629cf0cb Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 12 Nov 2024 11:35:21 +0100 Subject: [PATCH 01/11] Print in Full Precision --- src/callbacks_step/analysis.jl | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/callbacks_step/analysis.jl b/src/callbacks_step/analysis.jl index 0a26bbdbebe..13b439d8d55 100644 --- a/src/callbacks_step/analysis.jl +++ b/src/callbacks_step/analysis.jl @@ -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) @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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() @@ -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() @@ -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 @@ -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 @@ -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() From 5ad27e63d2021b4cae54142cf9fc1e2fef028ea7 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Tue, 12 Nov 2024 15:03:42 +0100 Subject: [PATCH 02/11] Apply suggestions from code review --- src/callbacks_step/analysis.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/callbacks_step/analysis.jl b/src/callbacks_step/analysis.jl index 13b439d8d55..eb05cbcc9c6 100644 --- a/src/callbacks_step/analysis.jl +++ b/src/callbacks_step/analysis.jl @@ -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(" %-21s", varnames(cons2cons, equations)[v]) + @printf(" %-14s", varnames(cons2cons, equations)[v]) end println() end @@ -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(" %-21s", varnames(cons2prim, equations)[v]) + @printf(" %-14s", varnames(cons2prim, equations)[v]) end println() From 03471274ee910d9fcda0697ffb29cd6f20974e00 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Wed, 13 Nov 2024 10:47:22 +0100 Subject: [PATCH 03/11] detect digits automatically --- src/callbacks_step/analysis.jl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/callbacks_step/analysis.jl b/src/callbacks_step/analysis.jl index 13b439d8d55..24a469a2abb 100644 --- a/src/callbacks_step/analysis.jl +++ b/src/callbacks_step/analysis.jl @@ -322,9 +322,9 @@ function (analysis_callback::AnalysisCallback)(u_ode, du_ode, integrator, semi) if mpi_isroot() && analysis_callback.save_analysis io = open(joinpath(analysis_callback.output_directory, analysis_callback.analysis_filename), "a") - @printf(io, "% 9d", iter) - @printf(io, " %10.15e", t) - @printf(io, " %10.15e", dt) + print(io, " ", iter) + print(io, " ", t) + print(io, " ", dt) else io = devnull end @@ -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.15e", l2_error[v]) + print(io, " ", l2_error[v]) end println() end @@ -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.15e", linf_error[v]) + print(io, " ", linf_error[v]) end println() end @@ -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.15e", err) + print(io, " ", err) end println() end @@ -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.15e", res) + print(io, " ", res) end end mpi_println() @@ -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.15e", l2_error_prim[v]) + print(io, " ", l2_error_prim[v]) end println() end @@ -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.15e", linf_error_prim[v]) + print(io, " ", linf_error_prim[v]) end println() end @@ -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.15e", res) + print(io, " ", res) end mpi_println() From 904879d2e32c54bf9752c711aa669637b19fe83d Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Wed, 13 Nov 2024 10:48:50 +0100 Subject: [PATCH 04/11] cons with old vrsion --- src/callbacks_step/analysis.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/callbacks_step/analysis.jl b/src/callbacks_step/analysis.jl index 063af70976b..07d1c16c15f 100644 --- a/src/callbacks_step/analysis.jl +++ b/src/callbacks_step/analysis.jl @@ -322,7 +322,7 @@ function (analysis_callback::AnalysisCallback)(u_ode, du_ode, integrator, semi) if mpi_isroot() && analysis_callback.save_analysis io = open(joinpath(analysis_callback.output_directory, analysis_callback.analysis_filename), "a") - print(io, " ", iter) + print(io, iter) print(io, " ", t) print(io, " ", dt) else From 622b5f7fd0daac8b6980cc09cfaf99b541065948 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 21 Nov 2024 10:03:49 +0100 Subject: [PATCH 05/11] cut down whitespaces --- src/callbacks_step/analysis.jl | 38 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/callbacks_step/analysis.jl b/src/callbacks_step/analysis.jl index 07d1c16c15f..f7025ab292e 100644 --- a/src/callbacks_step/analysis.jl +++ b/src/callbacks_step/analysis.jl @@ -163,42 +163,42 @@ 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, " %-21s", "time") - @printf(io, " %-21s", "dt") + @printf(io, "#timestep ") + @printf(io, "time ") + @printf(io, "dt ") if :l2_error in analysis_errors for v in varnames(cons2cons, equations) - @printf(io, " %-21s", "l2_"*v) + @printf(io, " l2_"*v) end end if :linf_error in analysis_errors for v in varnames(cons2cons, equations) - @printf(io, " %-21s", "linf_"*v) + @printf(io, " linf_"*v) end end if :conservation_error in analysis_errors for v in varnames(cons2cons, equations) - @printf(io, " %-21s", "cons_"*v) + @printf(io, " cons_"*v) end end if :residual in analysis_errors for v in varnames(cons2cons, equations) - @printf(io, " %-21s", "res_"*v) + @printf(io, " res_"*v) end end if :l2_error_primitive in analysis_errors for v in varnames(cons2prim, equations) - @printf(io, " %-21s", "l2_"*v) + @printf(io, " l2_"*v) end end if :linf_error_primitive in analysis_errors for v in varnames(cons2prim, equations) - @printf(io, " %-21s", "linf_"*v) + @printf(io, " linf_"*v) end end for quantity in analysis_integrals - @printf(io, " %-21s", pretty_form_ascii(quantity)) + @printf(io, " ", pretty_form_ascii(quantity)) end println(io) @@ -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") print(io, iter) - print(io, " ", t) - print(io, " ", dt) + print(io, " ", t) + print(io, " ", dt) else io = devnull end @@ -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]) - print(io, " ", l2_error[v]) + print(io, " ", l2_error[v]) end println() end @@ -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]) - print(io, " ", linf_error[v]) + print(io, " ", linf_error[v]) end println() end @@ -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) - print(io, " ", err) + print(io, " ", err) end println() end @@ -442,7 +442,7 @@ function (analysis_callback::AnalysisCallback)(io, du, u, u_ode, t, semi) end if mpi_isroot() @printf(" % 10.8e", res) - print(io, " ", res) + print(io, " ", res) end end mpi_println() @@ -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]) - print(io, " ", l2_error_prim[v]) + print(io, " ", l2_error_prim[v]) end println() end @@ -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]) - print(io, " ", linf_error_prim[v]) + print(io, " ", linf_error_prim[v]) end println() end @@ -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) - print(io, " ", res) + print(io, " ", res) end mpi_println() From 56244fd80d9d618dab6eee7e290d9f2f2d95c6ee Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 21 Nov 2024 10:12:59 +0100 Subject: [PATCH 06/11] print instead of @printf --- src/callbacks_step/analysis.jl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/callbacks_step/analysis.jl b/src/callbacks_step/analysis.jl index f7025ab292e..8a849e91a74 100644 --- a/src/callbacks_step/analysis.jl +++ b/src/callbacks_step/analysis.jl @@ -163,42 +163,42 @@ 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, "#timestep ") - @printf(io, "time ") - @printf(io, "dt ") + print(io, "#timestep ") + print(io, "time ") + print(io, "dt ") if :l2_error in analysis_errors for v in varnames(cons2cons, equations) - @printf(io, " l2_"*v) + print(io, "l2_" * v * " ") end end if :linf_error in analysis_errors for v in varnames(cons2cons, equations) - @printf(io, " linf_"*v) + print(io, "linf_" * v * " ") end end if :conservation_error in analysis_errors for v in varnames(cons2cons, equations) - @printf(io, " cons_"*v) + print(io, "cons_" * v * " ") end end if :residual in analysis_errors for v in varnames(cons2cons, equations) - @printf(io, " res_"*v) + print(io, "res_" * v * " ") end end if :l2_error_primitive in analysis_errors for v in varnames(cons2prim, equations) - @printf(io, " l2_"*v) + print(io, "l2_" * v * " ") end end if :linf_error_primitive in analysis_errors for v in varnames(cons2prim, equations) - @printf(io, " linf_"*v) + print(io, "linf_" * v * " ") end end for quantity in analysis_integrals - @printf(io, " ", pretty_form_ascii(quantity)) + print(io, pretty_form_ascii(quantity), " ") end println(io) From d8f0f199c2bcb941e71d059ecbf60c2a2b60ffdc Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Thu, 28 Nov 2024 10:51:50 +0100 Subject: [PATCH 07/11] Update src/callbacks_step/analysis.jl Co-authored-by: Michael Schlottke-Lakemper --- src/callbacks_step/analysis.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/callbacks_step/analysis.jl b/src/callbacks_step/analysis.jl index 8a849e91a74..26ab558715b 100644 --- a/src/callbacks_step/analysis.jl +++ b/src/callbacks_step/analysis.jl @@ -163,7 +163,7 @@ 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 - print(io, "#timestep ") + print(io, "timestep ") print(io, "time ") print(io, "dt ") if :l2_error in analysis_errors From 9ab356e45104b96145a02b84437d42ec147a12cd Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Thu, 28 Nov 2024 10:56:35 +0100 Subject: [PATCH 08/11] News entry --- NEWS.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/NEWS.md b/NEWS.md index 2f71c45e57e..d187371eb5a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,16 @@ Trixi.jl follows the interpretation of [semantic versioning (semver)](https://ju used in the Julia ecosystem. Notable changes will be documented in this file for human readability. +## Changes when updating to v0.10 from v0.9.x + +#### Changed + +- The `AnalysisCallback` output generated with the `save_analysis = true` option now prints + floating point numbers in their respective (full) precision. + Previously, only the first 8 digits where printed to file. + Furthermore, the names of the printed fields are now only seperated by a single whitespace, + in contrast to before where this where multiple, depending on the actual name of the printed data. + ## Changes in the v0.9 lifecycle #### Added From e01d142512f9cf7553a85462011fc6c4fc8760f4 Mon Sep 17 00:00:00 2001 From: Hendrik Ranocha Date: Thu, 28 Nov 2024 11:58:07 +0100 Subject: [PATCH 09/11] Apply suggestions from code review Co-authored-by: Joshua Lampert <51029046+JoshuaLampert@users.noreply.github.com> --- NEWS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS.md b/NEWS.md index d187371eb5a..c90efc77fad 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,8 +11,8 @@ for human readability. - The `AnalysisCallback` output generated with the `save_analysis = true` option now prints floating point numbers in their respective (full) precision. Previously, only the first 8 digits where printed to file. - Furthermore, the names of the printed fields are now only seperated by a single whitespace, - in contrast to before where this where multiple, depending on the actual name of the printed data. + Furthermore, the names of the printed fields are now only separated by a single white space, + in contrast to before where this were multiple, depending on the actual name of the printed data. ## Changes in the v0.9 lifecycle From b05556a941464d0ff91cd12eadc6f6176b394657 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Fri, 29 Nov 2024 08:50:04 +0100 Subject: [PATCH 10/11] Update NEWS.md --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index c90efc77fad..ee9b1eb1b9b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,7 +10,7 @@ for human readability. - The `AnalysisCallback` output generated with the `save_analysis = true` option now prints floating point numbers in their respective (full) precision. - Previously, only the first 8 digits where printed to file. + Previously, only the first 8 digits were printed to file. Furthermore, the names of the printed fields are now only separated by a single white space, in contrast to before where this were multiple, depending on the actual name of the printed data. From 0b88b1f4aa0ad9533928534dba3b628aef84ff29 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Thu, 5 Dec 2024 08:02:09 +0100 Subject: [PATCH 11/11] Bring back comment symbol --- src/callbacks_step/analysis.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/callbacks_step/analysis.jl b/src/callbacks_step/analysis.jl index 26ab558715b..8a849e91a74 100644 --- a/src/callbacks_step/analysis.jl +++ b/src/callbacks_step/analysis.jl @@ -163,7 +163,7 @@ 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 - print(io, "timestep ") + print(io, "#timestep ") print(io, "time ") print(io, "dt ") if :l2_error in analysis_errors