From 53d20c29df89913f6c552f3a9341ae80cd0b936a Mon Sep 17 00:00:00 2001 From: bennibolm Date: Wed, 8 May 2024 14:18:12 +0200 Subject: [PATCH 1/2] Add one-sided limiting for nonlinear variables to tutorial --- docs/literate/src/files/subcell_shock_capturing.jl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/literate/src/files/subcell_shock_capturing.jl b/docs/literate/src/files/subcell_shock_capturing.jl index 8a98fdae28..396c887e46 100644 --- a/docs/literate/src/files/subcell_shock_capturing.jl +++ b/docs/literate/src/files/subcell_shock_capturing.jl @@ -96,7 +96,8 @@ positivity_variables_nonlinear = [pressure] # ### Local bounds # Second, Trixi.jl supports the limiting with local bounds for conservative variables using a -# two-sided Zalesak-type limiter ([Zalesak, 1979](https://doi.org/10.1016/0021-9991(79)90051-2)). +# two-sided Zalesak-type limiter ([Zalesak, 1979](https://doi.org/10.1016/0021-9991(79)90051-2)) +# and for general non-linear variables using a one-sided Newton-bisection algorithm. # They allow to avoid spurious oscillations within the global bounds and to improve the # shock-capturing capabilities of the method. The corresponding numerical admissibility conditions # are frequently formulated as local maximum or minimum principles. The local bounds are computed @@ -108,6 +109,11 @@ positivity_variables_nonlinear = [pressure] # the following. local_twosided_variables_cons = ["rho"] +# To limit non-linear variables locally, pass the variable function combined with the requested +# bound (`min` or `max`) as a tuple. For instance, to impose a lower local bound on the modified +# specific entropy by Guermond et al. use +local_onesided_variables_nonlinear = [(Trixi.entropy_guermond_etal, min)] + # ## Exemplary simulation # How to set up a simulation using the IDP limiting becomes clearer when looking at an exemplary # setup. This will be a simplified version of `tree_2d_dgsem/elixir_euler_blast_wave_sc_subcell.jl`. From 11303c34abf41c370d01e163eb879dfbfb6a6f7c Mon Sep 17 00:00:00 2001 From: bennibolm Date: Tue, 14 May 2024 16:49:10 +0200 Subject: [PATCH 2/2] Add docstring; link to documentation in tutorial --- docs/literate/src/files/subcell_shock_capturing.jl | 2 +- src/equations/compressible_euler_2d.jl | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/literate/src/files/subcell_shock_capturing.jl b/docs/literate/src/files/subcell_shock_capturing.jl index 396c887e46..f5924d813e 100644 --- a/docs/literate/src/files/subcell_shock_capturing.jl +++ b/docs/literate/src/files/subcell_shock_capturing.jl @@ -111,7 +111,7 @@ local_twosided_variables_cons = ["rho"] # To limit non-linear variables locally, pass the variable function combined with the requested # bound (`min` or `max`) as a tuple. For instance, to impose a lower local bound on the modified -# specific entropy by Guermond et al. use +# specific entropy [`Trixi.entropy_guermond_etal`](@ref), use local_onesided_variables_nonlinear = [(Trixi.entropy_guermond_etal, min)] # ## Exemplary simulation diff --git a/src/equations/compressible_euler_2d.jl b/src/equations/compressible_euler_2d.jl index 0614066806..d15c5c6535 100644 --- a/src/equations/compressible_euler_2d.jl +++ b/src/equations/compressible_euler_2d.jl @@ -2018,8 +2018,18 @@ end return cons2entropy(u, equations) end -# Calculate the modified specific entropy of Guermond et al. (2019): s_0 = p * rho^(-gamma) / (gamma-1). -# Note: This is *not* the "conventional" specific entropy s = ln(p / rho^(gamma)). +@doc raw""" + entropy_guermond_etal(u, equations::CompressibleEulerEquations2D) + +Calculate the modified specific entropy of Guermond et al. (2019): +```math +s_0 = p * \rho^{-\gamma} / (\gamma-1). +``` +Note: This is *not* the "conventional" specific entropy ``s = ln(p / \rho^\gamma)``. +- Guermond at al. (2019) + Invariant domain preserving discretization-independent schemes and convex limiting for hyperbolic systems. + [DOI: 10.1016/j.cma.2018.11.036](https://doi.org/10.1016/j.cma.2018.11.036) +""" @inline function entropy_guermond_etal(u, equations::CompressibleEulerEquations2D) rho, rho_v1, rho_v2, rho_e = u