From 6bbdca7c1263cd1b108ea95224f14c60c2560fa6 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Wed, 26 Jul 2023 14:43:40 +0200 Subject: [PATCH 01/13] JacobianAD calls correct RHS for Hyperbolic-Parabolic --- src/semidiscretization/semidiscretization.jl | 9 --------- .../semidiscretization_hyperbolic.jl | 9 +++++++++ ...semidiscretization_hyperbolic_parabolic.jl | 19 +++++++++++++++++++ test/test_special_elixirs.jl | 9 +++++++++ 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/semidiscretization/semidiscretization.jl b/src/semidiscretization/semidiscretization.jl index fbdcd73e2a8..a7c2a3448fa 100644 --- a/src/semidiscretization/semidiscretization.jl +++ b/src/semidiscretization/semidiscretization.jl @@ -251,15 +251,6 @@ function jacobian_ad_forward(semi::AbstractSemidiscretization, t0, u0_ode) _jacobian_ad_forward(semi, t0, u0_ode, du_ode, config) end -function _jacobian_ad_forward(semi, t0, u0_ode, du_ode, config) - new_semi = remake(semi, uEltype = eltype(config)) - J = ForwardDiff.jacobian(du_ode, u0_ode, config) do du_ode, u_ode - Trixi.rhs!(du_ode, u_ode, new_semi, t0) - end - - return J -end - # This version is specialized to `StructArray`s used by some `DGMulti` solvers. # We need to convert the numerical solution vectors since ForwardDiff cannot # handle arrays of `SVector`s. diff --git a/src/semidiscretization/semidiscretization_hyperbolic.jl b/src/semidiscretization/semidiscretization_hyperbolic.jl index 50b2c21c14e..e3092a5b0a6 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic.jl @@ -353,4 +353,13 @@ function rhs!(du_ode, u_ode, semi::SemidiscretizationHyperbolic, t) return nothing end + +function _jacobian_ad_forward(semi::SemidiscretizationHyperbolic, t0, u0_ode, du_ode, config) + new_semi = remake(semi, uEltype = eltype(config)) + J = ForwardDiff.jacobian(du_ode, u0_ode, config) do du_ode, u_ode + Trixi.rhs!(du_ode, u_ode, new_semi, t0) + end + + return J +end end # @muladd diff --git a/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl b/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl index 8f1e38c891b..0aed3fc2d02 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl @@ -330,4 +330,23 @@ function rhs_parabolic!(du_ode, u_ode, semi::SemidiscretizationHyperbolicParabol return nothing end + +function rhs_hyperbolic_parabolic!(du_ode, u_ode, semi::SemidiscretizationHyperbolicParabolic, t) + @trixi_timeit timer() "hyperbolic-parabolic rhs!" begin + # Implementation of split ODE problem in OrdinaryDiffEq + du_ode_hyp = similar(du_ode) + rhs!(du_ode_hyp, u_ode, semi, t) + rhs_parabolic!(du_ode, u_ode, semi, t) + du_ode .+= du_ode_hyp + end +end + +function _jacobian_ad_forward(semi::SemidiscretizationHyperbolicParabolic, t0, u0_ode, du_ode, config) + new_semi = remake(semi, uEltype = eltype(config)) + J = ForwardDiff.jacobian(du_ode, u0_ode, config) do du_ode, u_ode + Trixi.rhs_hyperbolic_parabolic!(du_ode, u_ode, new_semi, t0) + end + + return J +end end # @muladd diff --git a/test/test_special_elixirs.jl b/test/test_special_elixirs.jl index 23017059eaa..d89c4027ccb 100644 --- a/test/test_special_elixirs.jl +++ b/test/test_special_elixirs.jl @@ -107,6 +107,15 @@ coverage = occursin("--code-coverage", cmd) && !occursin("--code-coverage=none", @test maximum(real, λ) < 10 * sqrt(eps(real(semi))) end + @timed_testset "Linear advection-diffusion" begin + trixi_include(@__MODULE__, joinpath(EXAMPLES_DIR, "tree_2d_dgsem", "elixir_advection_diffusion.jl"), + tspan=(0.0, 0.0), initial_refinement_level=2) + + J = jacobian_ad_forward(semi) + λ = eigvals(J) + @test maximum(real, λ) < 10 * sqrt(eps(real(semi))) + end + @timed_testset "Compressible Euler equations" begin trixi_include(@__MODULE__, joinpath(EXAMPLES_DIR, "tree_2d_dgsem", "elixir_euler_density_wave.jl"), tspan=(0.0, 0.0), initial_refinement_level=1) From 409fa7e883c6992bfd2c54ce80be4062c8c5d8fb Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Wed, 26 Jul 2023 15:06:36 +0200 Subject: [PATCH 02/13] Nonlinear test --- ...elixir_navierstokes_taylor_green_vortex.jl | 74 +++++++++++++++++++ test/test_special_elixirs.jl | 9 +++ 2 files changed, 83 insertions(+) create mode 100644 examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl new file mode 100644 index 00000000000..477ab2371e9 --- /dev/null +++ b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl @@ -0,0 +1,74 @@ + +using OrdinaryDiffEq +using Trixi + +############################################################################### +# semidiscretization of the compressible Navier-Stokes equations + +# TODO: parabolic; unify names of these accessor functions +prandtl_number() = 0.72 +mu() = 6.25e-4 # equivalent to Re = 1600 + +equations = CompressibleEulerEquations2D(1.4) +equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu=mu(), + Prandtl=prandtl_number()) + +""" + initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations2D) + +The classical inviscid Taylor-Green vortex. +""" +function initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations2D) + A = 1.0 # magnitude of speed + Ms = 0.1 # maximum Mach number + + rho = 1.0 + v1 = A * sin(x[1]) * cos(x[2]) + v2 = -A * cos(x[1]) * sin(x[2]) + p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms + p = p + 1.0/4.0 * A^2 * rho * (cos(2*x[1]) + cos(2*x[2])) + + return prim2cons(SVector(rho, v1, v2, p), equations) +end +initial_condition = initial_condition_taylor_green_vortex + +volume_flux = flux_ranocha +solver = DGSEM(polydeg=3, surface_flux=flux_hllc, + volume_integral=VolumeIntegralFluxDifferencing(volume_flux)) + +coordinates_min = (-1.0, -1.0) .* pi +coordinates_max = ( 1.0, 1.0) .* pi +mesh = TreeMesh(coordinates_min, coordinates_max, + initial_refinement_level=2, + n_cells_max=100_000) + + +semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic), + initial_condition, solver) + +############################################################################### +# ODE solvers, callbacks etc. + +tspan = (0.0, 20.0) +ode = semidiscretize(semi, tspan) + +summary_callback = SummaryCallback() + +analysis_interval = 50 +analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true, + extra_analysis_integrals=(energy_kinetic, + energy_internal)) + +alive_callback = AliveCallback(analysis_interval=analysis_interval,) + +callbacks = CallbackSet(summary_callback, + analysis_callback, + alive_callback) + +############################################################################### +# run the simulation + +time_int_tol = 1e-8 +sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol, + ode_default_options()..., callback=callbacks) +summary_callback() # print the timer summary \ No newline at end of file diff --git a/test/test_special_elixirs.jl b/test/test_special_elixirs.jl index d89c4027ccb..c05dfbdfca1 100644 --- a/test/test_special_elixirs.jl +++ b/test/test_special_elixirs.jl @@ -174,6 +174,15 @@ coverage = occursin("--code-coverage", cmd) && !occursin("--code-coverage=none", end end + @timed_testset "Navier-Stokes" begin + trixi_include(@__MODULE__, joinpath(EXAMPLES_DIR, "tree_2d_dgsem", "elixir_navierstokes_taylor_green_vortex.jl"), + tspan=(0.0, 0.0), initial_refinement_level=2) + + J = jacobian_ad_forward(semi) + λ = eigvals(J) + @test maximum(real, λ) < 0.2 + end + @timed_testset "MHD" begin trixi_include(@__MODULE__, joinpath(EXAMPLES_DIR, "tree_2d_dgsem", "elixir_mhd_alfven_wave.jl"), tspan=(0.0, 0.0), initial_refinement_level=0) From d07ad138c5898da0e933094e69339541ee6e6e27 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Wed, 26 Jul 2023 15:11:32 +0200 Subject: [PATCH 03/13] Format --- src/semidiscretization/semidiscretization_hyperbolic.jl | 3 ++- .../semidiscretization_hyperbolic_parabolic.jl | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/semidiscretization/semidiscretization_hyperbolic.jl b/src/semidiscretization/semidiscretization_hyperbolic.jl index e3092a5b0a6..6e9e0fce54c 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic.jl @@ -354,7 +354,8 @@ function rhs!(du_ode, u_ode, semi::SemidiscretizationHyperbolic, t) return nothing end -function _jacobian_ad_forward(semi::SemidiscretizationHyperbolic, t0, u0_ode, du_ode, config) +function _jacobian_ad_forward(semi::SemidiscretizationHyperbolic, t0, u0_ode, du_ode, + config) new_semi = remake(semi, uEltype = eltype(config)) J = ForwardDiff.jacobian(du_ode, u0_ode, config) do du_ode, u_ode Trixi.rhs!(du_ode, u_ode, new_semi, t0) diff --git a/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl b/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl index 0aed3fc2d02..3760fc9b80f 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl @@ -331,8 +331,9 @@ function rhs_parabolic!(du_ode, u_ode, semi::SemidiscretizationHyperbolicParabol return nothing end -function rhs_hyperbolic_parabolic!(du_ode, u_ode, semi::SemidiscretizationHyperbolicParabolic, t) - @trixi_timeit timer() "hyperbolic-parabolic rhs!" begin +function rhs_hyperbolic_parabolic!(du_ode, u_ode, + semi::SemidiscretizationHyperbolicParabolic, t) + @trixi_timeit timer() "hyperbolic-parabolic rhs!" begin # Implementation of split ODE problem in OrdinaryDiffEq du_ode_hyp = similar(du_ode) rhs!(du_ode_hyp, u_ode, semi, t) @@ -341,7 +342,8 @@ function rhs_hyperbolic_parabolic!(du_ode, u_ode, semi::SemidiscretizationHyperb end end -function _jacobian_ad_forward(semi::SemidiscretizationHyperbolicParabolic, t0, u0_ode, du_ode, config) +function _jacobian_ad_forward(semi::SemidiscretizationHyperbolicParabolic, t0, u0_ode, + du_ode, config) new_semi = remake(semi, uEltype = eltype(config)) J = ForwardDiff.jacobian(du_ode, u0_ode, config) do du_ode, u_ode Trixi.rhs_hyperbolic_parabolic!(du_ode, u_ode, new_semi, t0) From 73d387aa281295b5014feabfde1330adaff7b8be Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 28 Jul 2023 13:48:05 +0200 Subject: [PATCH 04/13] Bring default _jacobian_ad_forward back --- src/semidiscretization/semidiscretization.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/semidiscretization/semidiscretization.jl b/src/semidiscretization/semidiscretization.jl index a7c2a3448fa..fbdcd73e2a8 100644 --- a/src/semidiscretization/semidiscretization.jl +++ b/src/semidiscretization/semidiscretization.jl @@ -251,6 +251,15 @@ function jacobian_ad_forward(semi::AbstractSemidiscretization, t0, u0_ode) _jacobian_ad_forward(semi, t0, u0_ode, du_ode, config) end +function _jacobian_ad_forward(semi, t0, u0_ode, du_ode, config) + new_semi = remake(semi, uEltype = eltype(config)) + J = ForwardDiff.jacobian(du_ode, u0_ode, config) do du_ode, u_ode + Trixi.rhs!(du_ode, u_ode, new_semi, t0) + end + + return J +end + # This version is specialized to `StructArray`s used by some `DGMulti` solvers. # We need to convert the numerical solution vectors since ForwardDiff cannot # handle arrays of `SVector`s. From 32d6fd0c0299f54e87b4070aae863fc5d838a1ae Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 28 Jul 2023 13:55:32 +0200 Subject: [PATCH 05/13] CI for 2D Taylor-Green --- .../elixir_navierstokes_taylor_green_vortex.jl | 7 ++++--- test/test_parabolic_2d.jl | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl index 477ab2371e9..9804764a084 100644 --- a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl +++ b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl @@ -16,7 +16,8 @@ equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu=mu(), """ initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations2D) -The classical inviscid Taylor-Green vortex. +The classical inviscid Taylor-Green vortex, see for instance +https://en.wikipedia.org/wiki/Taylor%E2%80%93Green_vortex#Taylor%E2%80%93Green_vortex_solution """ function initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations2D) A = 1.0 # magnitude of speed @@ -39,7 +40,7 @@ solver = DGSEM(polydeg=3, surface_flux=flux_hllc, coordinates_min = (-1.0, -1.0) .* pi coordinates_max = ( 1.0, 1.0) .* pi mesh = TreeMesh(coordinates_min, coordinates_max, - initial_refinement_level=2, + initial_refinement_level=4, n_cells_max=100_000) @@ -49,7 +50,7 @@ semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabol ############################################################################### # ODE solvers, callbacks etc. -tspan = (0.0, 20.0) +tspan = (0.0, 5.0) ode = semidiscretize(semi, tspan) summary_callback = SummaryCallback() diff --git a/test/test_parabolic_2d.jl b/test/test_parabolic_2d.jl index 471b976e990..d289005d9ce 100644 --- a/test/test_parabolic_2d.jl +++ b/test/test_parabolic_2d.jl @@ -184,6 +184,13 @@ isdir(outdir) && rm(outdir, recursive=true) ) end + @trixi_testset "TreeMesh2D: elixir_navierstokes_taylor_green_vortex.jl" begin + @test_trixi_include(joinpath(examples_dir(), "tree_2d_dgsem", "elixir_navierstokes_taylor_green_vortex.jl"), + l2 = [0.0010585522770514217, 0.0032252997295576006, 0.0032252997295573655, 0.013346620522189805], + linf = [0.002938558550987347, 0.00679847425386948, 0.006798474253878917, 0.02891818436737026] + ) + end + @trixi_testset "P4estMesh2D: elixir_advection_diffusion_periodic.jl" begin @test_trixi_include(joinpath(examples_dir(), "p4est_2d_dgsem", "elixir_advection_diffusion_periodic.jl"), trees_per_dimension = (1, 1), initial_refinement_level = 2, tspan=(0.0, 0.5), From e27f915dc3f86a38ae5d0f4aed0137f1bf6c9dd0 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 28 Jul 2023 13:59:33 +0200 Subject: [PATCH 06/13] covered by standard version --- .../semidiscretization_hyperbolic.jl | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/semidiscretization/semidiscretization_hyperbolic.jl b/src/semidiscretization/semidiscretization_hyperbolic.jl index 6e9e0fce54c..50b2c21c14e 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic.jl @@ -353,14 +353,4 @@ function rhs!(du_ode, u_ode, semi::SemidiscretizationHyperbolic, t) return nothing end - -function _jacobian_ad_forward(semi::SemidiscretizationHyperbolic, t0, u0_ode, du_ode, - config) - new_semi = remake(semi, uEltype = eltype(config)) - J = ForwardDiff.jacobian(du_ode, u0_ode, config) do du_ode, u_ode - Trixi.rhs!(du_ode, u_ode, new_semi, t0) - end - - return J -end end # @muladd From 490d29bf16bf42b9044170885e35e84f7733f908 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 28 Jul 2023 14:21:09 +0200 Subject: [PATCH 07/13] implement rhs directly in jacobina_ad_forward --- ...semidiscretization_hyperbolic_parabolic.jl | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl b/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl index 3760fc9b80f..91a0bd008b8 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl @@ -331,22 +331,20 @@ function rhs_parabolic!(du_ode, u_ode, semi::SemidiscretizationHyperbolicParabol return nothing end -function rhs_hyperbolic_parabolic!(du_ode, u_ode, - semi::SemidiscretizationHyperbolicParabolic, t) - @trixi_timeit timer() "hyperbolic-parabolic rhs!" begin - # Implementation of split ODE problem in OrdinaryDiffEq - du_ode_hyp = similar(du_ode) - rhs!(du_ode_hyp, u_ode, semi, t) - rhs_parabolic!(du_ode, u_ode, semi, t) - du_ode .+= du_ode_hyp - end -end - function _jacobian_ad_forward(semi::SemidiscretizationHyperbolicParabolic, t0, u0_ode, du_ode, config) new_semi = remake(semi, uEltype = eltype(config)) + + du_ode_hyp = Vector{eltype(config)}(undef, length(du_ode)) J = ForwardDiff.jacobian(du_ode, u0_ode, config) do du_ode, u_ode - Trixi.rhs_hyperbolic_parabolic!(du_ode, u_ode, new_semi, t0) + for i in eachindex(du_ode) + du_ode_hyp[i] = du_ode[i] + end + + # Implementation of split ODE problem in OrdinaryDiffEq + rhs!(du_ode_hyp, u_ode, new_semi, t0) + rhs_parabolic!(du_ode, u_ode, new_semi, t0) + du_ode .+= du_ode_hyp end return J From 72165fd5f21aa6f128c0a59ad02bbb110017dcf3 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Sat, 29 Jul 2023 10:47:19 +0200 Subject: [PATCH 08/13] Update src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl Co-authored-by: Hendrik Ranocha --- .../semidiscretization_hyperbolic_parabolic.jl | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl b/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl index 91a0bd008b8..b12ecadb58b 100644 --- a/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl +++ b/src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl @@ -337,10 +337,6 @@ function _jacobian_ad_forward(semi::SemidiscretizationHyperbolicParabolic, t0, u du_ode_hyp = Vector{eltype(config)}(undef, length(du_ode)) J = ForwardDiff.jacobian(du_ode, u0_ode, config) do du_ode, u_ode - for i in eachindex(du_ode) - du_ode_hyp[i] = du_ode[i] - end - # Implementation of split ODE problem in OrdinaryDiffEq rhs!(du_ode_hyp, u_ode, new_semi, t0) rhs_parabolic!(du_ode, u_ode, new_semi, t0) From b890dc97e20966be7b98474a087896df61bbad5f Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 31 Jul 2023 09:47:47 +0200 Subject: [PATCH 09/13] Add reference for 3D Taylor-Green Vortex --- .../elixir_navierstokes_taylor_green_vortex.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl b/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl index 9cb73a462b7..8acf08bb26f 100644 --- a/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl +++ b/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl @@ -16,7 +16,11 @@ equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu=mu(), """ initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations3D) -The classical inviscid Taylor-Green vortex. +The classical inviscid Taylor-Green vortex, as found for instance in + +- Jonathan R. Bull and Antony Jameson + Simulation of the Compressible Taylor Green Vortex using High-Order Flux Reconstruction Schemes + [DOI: 10.2514/6.2014-3210](https://doi.org/10.2514/6.2014-3210) """ function initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations3D) A = 1.0 # magnitude of speed From 9ae711ffe421dbc8529013703d84ac73c9b1de50 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 31 Jul 2023 09:56:11 +0200 Subject: [PATCH 10/13] Update doc --- .../elixir_navierstokes_taylor_green_vortex.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl index 9804764a084..e0e77c1a302 100644 --- a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl +++ b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl @@ -16,8 +16,11 @@ equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu=mu(), """ initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations2D) -The classical inviscid Taylor-Green vortex, see for instance -https://en.wikipedia.org/wiki/Taylor%E2%80%93Green_vortex#Taylor%E2%80%93Green_vortex_solution +The classical inviscid Taylor-Green vortex in 2D. +This forms the basis behind the 3D case found for instance in + - Jonathan R. Bull and Antony Jameson + Simulation of the Compressible Taylor Green Vortex using High-Order Flux Reconstruction Schemes + [DOI: 10.2514/6.2014-3210](https://doi.org/10.2514/6.2014-3210) """ function initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations2D) A = 1.0 # magnitude of speed From acdbb379639f5400ea10924027d3d3b5961453ca Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 31 Jul 2023 10:01:19 +0200 Subject: [PATCH 11/13] Update tests 2D Taylor-Green Vortex --- .../elixir_navierstokes_taylor_green_vortex.jl | 6 +++--- test/test_parabolic_2d.jl | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl index e0e77c1a302..949589fe108 100644 --- a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl +++ b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl @@ -53,12 +53,12 @@ semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabol ############################################################################### # ODE solvers, callbacks etc. -tspan = (0.0, 5.0) +tspan = (0.0, 20.0) ode = semidiscretize(semi, tspan) summary_callback = SummaryCallback() -analysis_interval = 50 +analysis_interval = 100 analysis_callback = AnalysisCallback(semi, interval=analysis_interval, save_analysis=true, extra_analysis_integrals=(energy_kinetic, energy_internal)) @@ -72,7 +72,7 @@ callbacks = CallbackSet(summary_callback, ############################################################################### # run the simulation -time_int_tol = 1e-8 +time_int_tol = 1e-9 sol = solve(ode, RDPK3SpFSAL49(); abstol=time_int_tol, reltol=time_int_tol, ode_default_options()..., callback=callbacks) summary_callback() # print the timer summary \ No newline at end of file diff --git a/test/test_parabolic_2d.jl b/test/test_parabolic_2d.jl index 81cdc302e40..39da227c420 100644 --- a/test/test_parabolic_2d.jl +++ b/test/test_parabolic_2d.jl @@ -183,15 +183,15 @@ isdir(outdir) && rm(outdir, recursive=true) @trixi_testset "TreeMesh2D: elixir_navierstokes_lid_driven_cavity.jl" begin @test_trixi_include(joinpath(examples_dir(), "tree_2d_dgsem", "elixir_navierstokes_lid_driven_cavity.jl"), initial_refinement_level = 2, tspan=(0.0, 0.5), - l2 = [0.00015144571529699053, 0.018766076072331623, 0.007065070765652574, 0.0208399005734258], - linf = [0.0014523369373669048, 0.12366779944955864, 0.05532450997115432, 0.16099927805328207] + l2 = [0.0009282710243200006, 0.012454658292106657, 0.012454658292105363, 0.03049866515205495], + linf = [0.0024366464517627806, 0.0248316501260043, 0.024831650126004967, 0.06745989803815178] ) end @trixi_testset "TreeMesh2D: elixir_navierstokes_taylor_green_vortex.jl" begin @test_trixi_include(joinpath(examples_dir(), "tree_2d_dgsem", "elixir_navierstokes_taylor_green_vortex.jl"), - l2 = [0.0010585522770514217, 0.0032252997295576006, 0.0032252997295573655, 0.013346620522189805], - linf = [0.002938558550987347, 0.00679847425386948, 0.006798474253878917, 0.02891818436737026] + l2 = [0.0009279657228109691, 0.012454661988687185, 0.012454661988689886, 0.030487112728612178], + linf = [0.002435582543096171, 0.024824039368199546, 0.024824039368212758, 0.06731583711777489] ) end From a19bbdeca8aff33b86dc3cb340ddcc51bafc602a Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Mon, 31 Jul 2023 10:03:32 +0200 Subject: [PATCH 12/13] Fix copy-paste error --- test/test_parabolic_2d.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_parabolic_2d.jl b/test/test_parabolic_2d.jl index 39da227c420..e3bb1ed9fb1 100644 --- a/test/test_parabolic_2d.jl +++ b/test/test_parabolic_2d.jl @@ -183,8 +183,8 @@ isdir(outdir) && rm(outdir, recursive=true) @trixi_testset "TreeMesh2D: elixir_navierstokes_lid_driven_cavity.jl" begin @test_trixi_include(joinpath(examples_dir(), "tree_2d_dgsem", "elixir_navierstokes_lid_driven_cavity.jl"), initial_refinement_level = 2, tspan=(0.0, 0.5), - l2 = [0.0009282710243200006, 0.012454658292106657, 0.012454658292105363, 0.03049866515205495], - linf = [0.0024366464517627806, 0.0248316501260043, 0.024831650126004967, 0.06745989803815178] + l2 = [0.00015144571529699053, 0.018766076072331623, 0.007065070765652574, 0.0208399005734258], + linf = [0.0014523369373669048, 0.12366779944955864, 0.05532450997115432, 0.16099927805328207] ) end From c43e9bf563e1a75176d9483f595e8327f34e3b06 Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Tue, 8 Aug 2023 09:05:17 +0200 Subject: [PATCH 13/13] Viscous TGV comment --- .../tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl | 2 +- .../tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl index 949589fe108..c3cbc858f7b 100644 --- a/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl +++ b/examples/tree_2d_dgsem/elixir_navierstokes_taylor_green_vortex.jl @@ -16,7 +16,7 @@ equations_parabolic = CompressibleNavierStokesDiffusion2D(equations, mu=mu(), """ initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations2D) -The classical inviscid Taylor-Green vortex in 2D. +The classical viscous Taylor-Green vortex in 2D. This forms the basis behind the 3D case found for instance in - Jonathan R. Bull and Antony Jameson Simulation of the Compressible Taylor Green Vortex using High-Order Flux Reconstruction Schemes diff --git a/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl b/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl index 8acf08bb26f..5556831a59d 100644 --- a/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl +++ b/examples/tree_3d_dgsem/elixir_navierstokes_taylor_green_vortex.jl @@ -16,7 +16,7 @@ equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu=mu(), """ initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations3D) -The classical inviscid Taylor-Green vortex, as found for instance in +The classical viscous Taylor-Green vortex, as found for instance in - Jonathan R. Bull and Antony Jameson Simulation of the Compressible Taylor Green Vortex using High-Order Flux Reconstruction Schemes