From f942af93570600f0a3e0a78875486ed1070d75ee Mon Sep 17 00:00:00 2001 From: patrickersing Date: Thu, 5 Sep 2024 16:03:33 +0200 Subject: [PATCH 1/5] remove normal_direction_ll --- src/equations/numerical_fluxes.jl | 7 ++-- src/equations/shallow_water_multilayer_2d.jl | 10 +++--- src/equations/shallow_water_two_layer_2d.jl | 16 ++++----- src/equations/shallow_water_wet_dry_2d.jl | 37 +++++++------------- 4 files changed, 27 insertions(+), 43 deletions(-) diff --git a/src/equations/numerical_fluxes.jl b/src/equations/numerical_fluxes.jl index 1d282fa..de1c514 100644 --- a/src/equations/numerical_fluxes.jl +++ b/src/equations/numerical_fluxes.jl @@ -33,8 +33,7 @@ const flux_hll_chen_noelle = FluxHLL(min_max_speed_chen_noelle) # unstructured meshes. These can depend on both the contravariant vectors (normal direction) at # the current node and the averaged ones. @inline function (numflux::Trixi.FluxHydrostaticReconstruction)(u_ll, u_rr, - normal_direction_ll, - normal_direction_average, + normal_direction, equations::Trixi.AbstractEquations) @unpack numerical_flux, hydrostatic_reconstruction = numflux @@ -42,8 +41,8 @@ const flux_hll_chen_noelle = FluxHLL(min_max_speed_chen_noelle) u_ll_star, u_rr_star = hydrostatic_reconstruction(u_ll, u_rr, equations) # Use the reconstructed states to compute the nonconservative surface flux - return numerical_flux(u_ll_star, u_rr_star, normal_direction_ll, - normal_direction_average, + return numerical_flux(u_ll_star, u_rr_star, + normal_direction, equations) end end diff --git a/src/equations/shallow_water_multilayer_2d.jl b/src/equations/shallow_water_multilayer_2d.jl index 555f18b..ad59766 100644 --- a/src/equations/shallow_water_multilayer_2d.jl +++ b/src/equations/shallow_water_multilayer_2d.jl @@ -451,8 +451,7 @@ end flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer, equations::ShallowWaterMultiLayerEquations2D) flux_nonconservative_ersing_etal(u_ll, u_rr, - normal_direction_ll::AbstractVector, - normal_direction_average::AbstractVector, + normal_direction::AbstractVector, equations::ShallowWaterMultiLayerEquations2D) Non-symmetric path-conservative two-point flux discretizing the nonconservative (source) term @@ -509,8 +508,7 @@ In the two-layer setting this combination is equivalent to the fluxes in: end @inline function flux_nonconservative_ersing_etal(u_ll, u_rr, - normal_direction_ll::AbstractVector, - normal_direction_average::AbstractVector, + normal_direction::AbstractVector, equations::ShallowWaterMultiLayerEquations2D) # Pull the necessary left and right state information h_ll = waterheight(u_ll, equations) @@ -537,8 +535,8 @@ end f_hv += g * h_ll[i] * h_jump[j] end end - setlayer!(f, f_h, f_hv * normal_direction_average[1], - f_hv * normal_direction_average[2], i, equations) + setlayer!(f, f_h, f_hv * normal_direction[1], + f_hv * normal_direction[2], i, equations) end return SVector(f) diff --git a/src/equations/shallow_water_two_layer_2d.jl b/src/equations/shallow_water_two_layer_2d.jl index 6f4ccfe..12abe85 100644 --- a/src/equations/shallow_water_two_layer_2d.jl +++ b/src/equations/shallow_water_two_layer_2d.jl @@ -322,8 +322,7 @@ end flux_nonconservative_ersing_etal(u_ll, u_rr, orientation::Integer, equations::ShallowWaterTwoLayerEquations2D) flux_nonconservative_ersing_etal(u_ll, u_rr, - normal_direction_ll::AbstractVector, - normal_direction_average::AbstractVector, + normal_direction::AbstractVector, equations::ShallowWaterTwoLayerEquations2D) !!! warning "Experimental code" @@ -382,8 +381,7 @@ For further details see: end @inline function flux_nonconservative_ersing_etal(u_ll, u_rr, - normal_direction_ll::AbstractVector, - normal_direction_average::AbstractVector, + normal_direction::AbstractVector, equations::ShallowWaterTwoLayerEquations2D) # Pull the necessary left and right state information h_upper_ll, h_lower_ll = waterheight(u_ll, equations) @@ -396,17 +394,17 @@ end h_lower_jump = (h_lower_rr - h_lower_ll) b_jump = (b_rr - b_ll) - # Note this routine only uses the `normal_direction_average` and the average of the + # Note this routine only uses the `normal_direction` and the average of the # bottom topography to get a quadratic split form DG gradient on curved elements return SVector(zero(eltype(u_ll)), - normal_direction_average[1] * equations.gravity * h_upper_ll * + normal_direction[1] * equations.gravity * h_upper_ll * (b_jump + h_lower_jump), - normal_direction_average[2] * equations.gravity * h_upper_ll * + normal_direction[2] * equations.gravity * h_upper_ll * (b_jump + h_lower_jump), zero(eltype(u_ll)), - normal_direction_average[1] * equations.gravity * h_lower_ll * + normal_direction[1] * equations.gravity * h_lower_ll * (b_jump + equations.r * h_upper_jump), - normal_direction_average[2] * equations.gravity * h_lower_ll * + normal_direction[2] * equations.gravity * h_lower_ll * (b_jump + equations.r * h_upper_jump), zero(eltype(u_ll))) end diff --git a/src/equations/shallow_water_wet_dry_2d.jl b/src/equations/shallow_water_wet_dry_2d.jl index 76fd761..a3c197a 100644 --- a/src/equations/shallow_water_wet_dry_2d.jl +++ b/src/equations/shallow_water_wet_dry_2d.jl @@ -243,8 +243,7 @@ end flux_nonconservative_wintermeyer_etal(u_ll, u_rr, orientation::Integer, equations::ShallowWaterEquationsWetDry2D) flux_nonconservative_wintermeyer_etal(u_ll, u_rr, - normal_direction_ll ::AbstractVector, - normal_direction_average::AbstractVector, + normal_direction::AbstractVector, equations::ShallowWaterEquationsWetDry2D) Non-symmetric two-point volume flux discretizing the nonconservative (source) term @@ -271,12 +270,10 @@ Further details are available in the papers: end @inline function Trixi.flux_nonconservative_wintermeyer_etal(u_ll, u_rr, - normal_direction_ll::AbstractVector, - normal_direction_average::AbstractVector, + normal_direction::AbstractVector, equations::ShallowWaterEquationsWetDry2D) return Trixi.flux_nonconservative_wintermeyer_etal(u_ll, u_rr, - normal_direction_ll, - normal_direction_average, + normal_direction, equations.basic_swe) end @@ -284,8 +281,7 @@ end flux_nonconservative_fjordholm_etal(u_ll, u_rr, orientation::Integer, equations::ShallowWaterEquationsWetDry2D) flux_nonconservative_fjordholm_etal(u_ll, u_rr, - normal_direction_ll ::AbstractVector, - normal_direction_average::AbstractVector, + normal_direction::AbstractVector, equations::ShallowWaterEquationsWetDry2D) Non-symmetric two-point surface flux discretizing the nonconservative (source) term of @@ -312,12 +308,10 @@ and for curvilinear 2D case in the paper: end @inline function Trixi.flux_nonconservative_fjordholm_etal(u_ll, u_rr, - normal_direction_ll::AbstractVector, - normal_direction_average::AbstractVector, + normal_direction::AbstractVector, equations::ShallowWaterEquationsWetDry2D) Trixi.flux_nonconservative_fjordholm_etal(u_ll, u_rr, - normal_direction_ll, - normal_direction_average, + normal_direction, equations.basic_swe) end @@ -407,8 +401,7 @@ end flux_nonconservative_audusse_etal(u_ll, u_rr, orientation::Integer, equations::ShallowWaterEquationsWetDry2D) flux_nonconservative_audusse_etal(u_ll, u_rr, - normal_direction_ll ::AbstractVector, - normal_direction_average::AbstractVector, + normal_direction::AbstractVector, equations::ShallowWaterEquationsWetDry2D) Non-symmetric two-point surface flux that discretizes the nonconservative (source) term. @@ -433,12 +426,10 @@ Further details for the hydrostatic reconstruction and its motivation can be fou end @inline function Trixi.flux_nonconservative_audusse_etal(u_ll, u_rr, - normal_direction_ll::AbstractVector, - normal_direction_average::AbstractVector, + normal_direction::AbstractVector, equations::ShallowWaterEquationsWetDry2D) return Trixi.flux_nonconservative_audusse_etal(u_ll, u_rr, - normal_direction_ll, - normal_direction_average, + normal_direction, equations.basic_swe) end @@ -447,8 +438,7 @@ end orientation::Integer, equations::ShallowWaterEquationsWetDry2D) flux_nonconservative_chen_noelle(u_ll, u_rr, - normal_direction_ll ::AbstractVector, - normal_direction_average ::AbstractVector, + normal_direction::AbstractVector, equations::ShallowWaterEquationsWetDry2D) Non-symmetric two-point surface flux that discretizes the nonconservative (source) term. @@ -497,8 +487,7 @@ Further details on the hydrostatic reconstruction and its motivation can be foun end @inline function flux_nonconservative_chen_noelle(u_ll, u_rr, - normal_direction_ll::AbstractVector, - normal_direction_average::AbstractVector, + normal_direction::AbstractVector, equations::ShallowWaterEquationsWetDry2D) # Pull the water height and bottom topography on the left h_ll, _, _, b_ll = u_ll @@ -515,9 +504,9 @@ end # Copy the reconstructed water height for easier to read code h_ll_star = u_ll_star[1] - f2 = -normal_direction_average[1] * equations.gravity * (h_ll_star + h_ll) * + f2 = -normal_direction[1] * equations.gravity * (h_ll_star + h_ll) * (b_ll - b_star) - f3 = -normal_direction_average[2] * equations.gravity * (h_ll_star + h_ll) * + f3 = -normal_direction[2] * equations.gravity * (h_ll_star + h_ll) * (b_ll - b_star) # First and last equations do not have a nonconservative flux From c570f42477e0ece1169cb47c3649d16403186b43 Mon Sep 17 00:00:00 2001 From: patrickersing Date: Thu, 10 Oct 2024 14:05:05 +0200 Subject: [PATCH 2/5] update Trixi.jl version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index b6adc02..167f5ca 100644 --- a/Project.toml +++ b/Project.toml @@ -19,5 +19,5 @@ Printf = "1" Roots = "2.1.6" Static = "0.3, 0.4, 0.5, 0.6, 0.7, 0.8" StaticArrays = "1" -Trixi = "0.8.7" +Trixi = "0.9" julia = "1.8" From 26bf20ae2f5ee7e47d2a1e9211b45aa41f13d19e Mon Sep 17 00:00:00 2001 From: patrickersing Date: Thu, 10 Oct 2024 14:17:42 +0200 Subject: [PATCH 3/5] update Trixi.jl version in tests --- test/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Project.toml b/test/Project.toml index ff4b5ba..7db0602 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -12,7 +12,7 @@ OrdinaryDiffEq = "6.49.1" Printf = "1" Roots = "2.1.6" Test = "1" -Trixi = "0.8.7" +Trixi = "0.9" [preferences.OrdinaryDiffEq] PrecompileAutoSpecialize = false From 366e8c0754bd6f15040daa1a510aa8d8237ecd45 Mon Sep 17 00:00:00 2001 From: patrickersing Date: Thu, 10 Oct 2024 15:10:15 +0200 Subject: [PATCH 4/5] remove superfluous version of FluxHydrostaticReconstruction --- src/equations/numerical_fluxes.jl | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/equations/numerical_fluxes.jl b/src/equations/numerical_fluxes.jl index de1c514..e8eb9ea 100644 --- a/src/equations/numerical_fluxes.jl +++ b/src/equations/numerical_fluxes.jl @@ -29,20 +29,4 @@ For complete details see Section 2.4 of the following reference """ const flux_hll_chen_noelle = FluxHLL(min_max_speed_chen_noelle) -# Additional version of `FluxHydrostaticReconstruction` to add support for nonconservative fluxes on -# unstructured meshes. These can depend on both the contravariant vectors (normal direction) at -# the current node and the averaged ones. -@inline function (numflux::Trixi.FluxHydrostaticReconstruction)(u_ll, u_rr, - normal_direction, - equations::Trixi.AbstractEquations) - @unpack numerical_flux, hydrostatic_reconstruction = numflux - - # Create the reconstructed left/right solution states in conservative form - u_ll_star, u_rr_star = hydrostatic_reconstruction(u_ll, u_rr, equations) - - # Use the reconstructed states to compute the nonconservative surface flux - return numerical_flux(u_ll_star, u_rr_star, - normal_direction, - equations) -end end From fa4aebd460f697a3e8a06a52380bee9881b6c2b1 Mon Sep 17 00:00:00 2001 From: patrickersing Date: Thu, 10 Oct 2024 15:23:32 +0200 Subject: [PATCH 5/5] apply formatter --- src/equations/numerical_fluxes.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/equations/numerical_fluxes.jl b/src/equations/numerical_fluxes.jl index e8eb9ea..a523388 100644 --- a/src/equations/numerical_fluxes.jl +++ b/src/equations/numerical_fluxes.jl @@ -28,5 +28,4 @@ For complete details see Section 2.4 of the following reference [DOI: 10.1137/15M1053074](https://doi.org/10.1137/15M1053074) """ const flux_hll_chen_noelle = FluxHLL(min_max_speed_chen_noelle) - end