From fcab6a9e50531e5a77e0de77f2f369d75c5a7716 Mon Sep 17 00:00:00 2001 From: Daniel Doehring Date: Sat, 21 Oct 2023 17:58:50 +0200 Subject: [PATCH] Add comments explaining why weak form is only for conserved terms (#1676) * Add comments explaining why weak form is only for conserved terms * Update src/solvers/dg.jl Co-authored-by: Andrew Winters * Update src/solvers/dgsem_structured/dg_2d.jl Co-authored-by: Andrew Winters * Update src/solvers/dg.jl Co-authored-by: Andrew Winters * Update src/solvers/dgsem_structured/dg_3d.jl Co-authored-by: Andrew Winters * Update src/solvers/dgsem_structured/dg_2d.jl Co-authored-by: Andrew Winters * Update src/solvers/dgsem_tree/dg_2d.jl Co-authored-by: Andrew Winters * Update src/solvers/dgsem_tree/dg_1d.jl Co-authored-by: Andrew Winters * Update src/solvers/dgsem_tree/dg_3d.jl Co-authored-by: Andrew Winters * Update src/solvers/dgsem_tree/dg_2d.jl Co-authored-by: Andrew Winters * Update src/solvers/dgsem_tree/dg_3d.jl Co-authored-by: Andrew Winters * Update src/solvers/dgsem_structured/dg_3d.jl Co-authored-by: Andrew Winters * Update src/solvers/dgsem_tree/dg_1d.jl Co-authored-by: Andrew Winters * Update src/solvers/dg.jl Co-authored-by: Hendrik Ranocha --------- Co-authored-by: Andrew Winters Co-authored-by: Hendrik Ranocha --- src/solvers/dg.jl | 5 +++++ src/solvers/dgsem_structured/dg_2d.jl | 7 +++++++ src/solvers/dgsem_structured/dg_3d.jl | 7 +++++++ src/solvers/dgsem_tree/dg_1d.jl | 7 +++++++ src/solvers/dgsem_tree/dg_2d.jl | 7 +++++++ src/solvers/dgsem_tree/dg_3d.jl | 7 +++++++ 6 files changed, 40 insertions(+) diff --git a/src/solvers/dg.jl b/src/solvers/dg.jl index 30b4f67474f..91ad59b76b6 100644 --- a/src/solvers/dg.jl +++ b/src/solvers/dg.jl @@ -40,6 +40,11 @@ standard textbooks. Nodal Discontinuous Galerkin Methods: Algorithms, Analysis, and Applications [doi: 10.1007/978-0-387-72067-8](https://doi.org/10.1007/978-0-387-72067-8) + +`VolumeIntegralWeakForm()` is only implemented for conserved terms as +non-conservative terms should always be discretized in conjunction with a flux-splitting scheme, +see [`VolumeIntegralFluxDifferencing`](@ref). +This treatment is required to achieve, e.g., entropy-stability or well-balancedness. """ struct VolumeIntegralWeakForm <: AbstractVolumeIntegral end diff --git a/src/solvers/dgsem_structured/dg_2d.jl b/src/solvers/dgsem_structured/dg_2d.jl index 3e8ce759b30..25a0eea096f 100644 --- a/src/solvers/dgsem_structured/dg_2d.jl +++ b/src/solvers/dgsem_structured/dg_2d.jl @@ -49,6 +49,13 @@ function rhs!(du, u, t, return nothing end +#= +`weak_form_kernel!` is only implemented for conserved terms as +non-conservative terms should always be discretized in conjunction with a flux-splitting scheme, +see `flux_differencing_kernel!`. +This treatment is required to achieve, e.g., entropy-stability or well-balancedness. +See also https://github.com/trixi-framework/Trixi.jl/issues/1671#issuecomment-1765644064 +=# @inline function weak_form_kernel!(du, u, element, mesh::Union{StructuredMesh{2}, UnstructuredMesh2D, diff --git a/src/solvers/dgsem_structured/dg_3d.jl b/src/solvers/dgsem_structured/dg_3d.jl index 0e6bf8a2ac0..cdb085e9008 100644 --- a/src/solvers/dgsem_structured/dg_3d.jl +++ b/src/solvers/dgsem_structured/dg_3d.jl @@ -49,6 +49,13 @@ function rhs!(du, u, t, return nothing end +#= +`weak_form_kernel!` is only implemented for conserved terms as +non-conservative terms should always be discretized in conjunction with a flux-splitting scheme, +see `flux_differencing_kernel!`. +This treatment is required to achieve, e.g., entropy-stability or well-balancedness. +See also https://github.com/trixi-framework/Trixi.jl/issues/1671#issuecomment-1765644064 +=# @inline function weak_form_kernel!(du, u, element, mesh::Union{StructuredMesh{3}, P4estMesh{3}}, diff --git a/src/solvers/dgsem_tree/dg_1d.jl b/src/solvers/dgsem_tree/dg_1d.jl index b5bb076f3b7..4a0747d1c09 100644 --- a/src/solvers/dgsem_tree/dg_1d.jl +++ b/src/solvers/dgsem_tree/dg_1d.jl @@ -144,6 +144,13 @@ function calc_volume_integral!(du, u, return nothing end +#= +`weak_form_kernel!` is only implemented for conserved terms as +non-conservative terms should always be discretized in conjunction with a flux-splitting scheme, +see `flux_differencing_kernel!`. +This treatment is required to achieve, e.g., entropy-stability or well-balancedness. +See also https://github.com/trixi-framework/Trixi.jl/issues/1671#issuecomment-1765644064 +=# @inline function weak_form_kernel!(du, u, element, mesh::Union{TreeMesh{1}, StructuredMesh{1}}, nonconservative_terms::False, equations, diff --git a/src/solvers/dgsem_tree/dg_2d.jl b/src/solvers/dgsem_tree/dg_2d.jl index c30d0a8e01a..7ecf4c00032 100644 --- a/src/solvers/dgsem_tree/dg_2d.jl +++ b/src/solvers/dgsem_tree/dg_2d.jl @@ -194,6 +194,13 @@ function calc_volume_integral!(du, u, return nothing end +#= +`weak_form_kernel!` is only implemented for conserved terms as +non-conservative terms should always be discretized in conjunction with a flux-splitting scheme, +see `flux_differencing_kernel!`. +This treatment is required to achieve, e.g., entropy-stability or well-balancedness. +See also https://github.com/trixi-framework/Trixi.jl/issues/1671#issuecomment-1765644064 +=# @inline function weak_form_kernel!(du, u, element, mesh::TreeMesh{2}, nonconservative_terms::False, equations, diff --git a/src/solvers/dgsem_tree/dg_3d.jl b/src/solvers/dgsem_tree/dg_3d.jl index acdab900cd1..3364187e93c 100644 --- a/src/solvers/dgsem_tree/dg_3d.jl +++ b/src/solvers/dgsem_tree/dg_3d.jl @@ -223,6 +223,13 @@ function calc_volume_integral!(du, u, return nothing end +#= +`weak_form_kernel!` is only implemented for conserved terms as +non-conservative terms should always be discretized in conjunction with a flux-splitting scheme, +see `flux_differencing_kernel!`. +This treatment is required to achieve, e.g., entropy-stability or well-balancedness. +See also https://github.com/trixi-framework/Trixi.jl/issues/1671#issuecomment-1765644064 +=# @inline function weak_form_kernel!(du, u, element, mesh::TreeMesh{3}, nonconservative_terms::False, equations,