Skip to content

Commit 589beb1

Browse files
VolumeIntegrals: Default fluxes, keyword constructors (#2617)
* `VolumeIntegrals`: Default fluxes, keyword constructors * fix * surfInts, kw O2 * bf * rev * rev * fix
1 parent d52e08d commit 589beb1

File tree

6 files changed

+28
-11
lines changed

6 files changed

+28
-11
lines changed

examples/structured_1d_dgsem/elixir_euler_source_terms_nonperiodic_fvO2.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ boundary_conditions = (x_neg = boundary_condition,
2020
polydeg = 8 # Governs in this case only the number of subcells
2121
basis = LobattoLegendreBasis(polydeg)
2222
surface_flux = flux_hll
23-
volume_integral = VolumeIntegralPureLGLFiniteVolumeO2(basis, surface_flux,
23+
volume_integral = VolumeIntegralPureLGLFiniteVolumeO2(basis,
24+
volume_flux_fv = surface_flux,
2425
reconstruction_mode = reconstruction_O2_inner,
2526
slope_limiter = vanLeer)
2627
solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,

examples/structured_2d_dgsem/elixir_euler_ec.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ initial_condition = initial_condition_weak_blast_wave
1111
###############################################################################
1212
# Get the DG approximation space
1313

14-
volume_flux = flux_ranocha
14+
volume_integral = VolumeIntegralFluxDifferencing(volume_flux = flux_ranocha)
1515
solver = DGSEM(polydeg = 4, surface_flux = flux_ranocha,
16-
volume_integral = VolumeIntegralFluxDifferencing(volume_flux))
16+
volume_integral = volume_integral)
1717

1818
###############################################################################
1919
# Get the curved quad mesh from a mapping function

examples/tree_1d_dgsem/elixir_euler_convergence_pure_fv.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ equations = CompressibleEulerEquations1D(1.4)
88

99
initial_condition = initial_condition_convergence_test
1010

11+
volume_integral = VolumeIntegralPureLGLFiniteVolume(volume_flux_fv = flux_hllc)
1112
solver = DGSEM(polydeg = 3, surface_flux = flux_hllc,
12-
volume_integral = VolumeIntegralPureLGLFiniteVolume(flux_hllc))
13+
volume_integral = volume_integral)
1314

1415
coordinates_min = 0.0
1516
coordinates_max = 2.0

examples/tree_1d_dgsem/elixir_euler_convergence_pure_fvO2.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ initial_condition = initial_condition_convergence_test
1212
polydeg = 3 # Governs in this case only the number of subcells
1313
basis = LobattoLegendreBasis(polydeg)
1414
surface_flux = flux_hllc
15-
volume_integral = VolumeIntegralPureLGLFiniteVolumeO2(basis, surface_flux,
15+
volume_integral = VolumeIntegralPureLGLFiniteVolumeO2(basis,
16+
volume_flux_fv = surface_flux,
1617
reconstruction_mode = reconstruction_O2_full,
1718
slope_limiter = monotonized_central)
1819
solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,

src/solvers/dg.jl

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ create_cache(mesh, equations, ::VolumeIntegralWeakForm, dg, uEltype) = NamedTupl
9090

9191
"""
9292
VolumeIntegralFluxDifferencing(volume_flux)
93+
VolumeIntegralFluxDifferencing(; volume_flux = flux_central)
9394
9495
Volume integral type for DG methods based on SBP operators and flux differencing
9596
using a symmetric two-point `volume_flux`. This `volume_flux` needs to satisfy
@@ -117,6 +118,10 @@ struct VolumeIntegralFluxDifferencing{VolumeFlux} <: AbstractVolumeIntegral
117118
volume_flux::VolumeFlux
118119
end
119120

121+
function VolumeIntegralFluxDifferencing(; volume_flux = flux_central)
122+
return VolumeIntegralFluxDifferencing{typeof(volume_flux)}(volume_flux)
123+
end
124+
120125
function Base.show(io::IO, ::MIME"text/plain", integral::VolumeIntegralFluxDifferencing)
121126
@nospecialize integral # reduce precompilation time
122127

@@ -192,6 +197,7 @@ abstract type AbstractVolumeIntegralPureLGLFiniteVolume <: AbstractVolumeIntegra
192197

193198
"""
194199
VolumeIntegralPureLGLFiniteVolume(volume_flux_fv)
200+
VolumeIntegralPureLGLFiniteVolume(; volume_flux_fv = flux_lax_friedrichs)
195201
196202
A volume integral that only uses the subcell finite volume schemes of the
197203
[`VolumeIntegralShockCapturingHG`](@ref).
@@ -214,6 +220,10 @@ struct VolumeIntegralPureLGLFiniteVolume{VolumeFluxFV} <:
214220
end
215221
# TODO: Figure out if this can also be used for Gauss nodes, not just LGL, and adjust the name accordingly
216222

223+
function VolumeIntegralPureLGLFiniteVolume(; volume_flux_fv = flux_lax_friedrichs)
224+
return VolumeIntegralPureLGLFiniteVolume{typeof(volume_flux_fv)}(volume_flux_fv)
225+
end
226+
217227
function Base.show(io::IO, ::MIME"text/plain",
218228
integral::VolumeIntegralPureLGLFiniteVolume)
219229
@nospecialize integral # reduce precompilation time
@@ -229,7 +239,8 @@ function Base.show(io::IO, ::MIME"text/plain",
229239
end
230240

231241
"""
232-
VolumeIntegralPureLGLFiniteVolumeO2(basis::Basis, volume_flux_fv;
242+
VolumeIntegralPureLGLFiniteVolumeO2(basis::Basis;
243+
volume_flux_fv = flux_lax_friedrichs,
233244
reconstruction_mode = reconstruction_O2_full,
234245
slope_limiter = minmod)
235246
@@ -275,7 +286,8 @@ struct VolumeIntegralPureLGLFiniteVolumeO2{RealT <: Real, Basis, VolumeFluxFV,
275286
slope_limiter::Limiter # which type of slope limiter function
276287
end
277288

278-
function VolumeIntegralPureLGLFiniteVolumeO2(basis::Basis, volume_flux_fv;
289+
function VolumeIntegralPureLGLFiniteVolumeO2(basis::Basis;
290+
volume_flux_fv = flux_lax_friedrichs,
279291
reconstruction_mode = reconstruction_O2_full,
280292
slope_limiter = minmod) where {Basis}
281293
# Suffices to store only the intermediate boundaries of the sub-cell elements
@@ -309,7 +321,8 @@ end
309321

310322
"""
311323
VolumeIntegralSubcellLimiting(limiter;
312-
volume_flux_dg, volume_flux_fv)
324+
volume_flux_dg = flux_central,
325+
volume_flux_fv = flux_lax_friedrichs)
313326
314327
A subcell limiting volume integral type for DG methods based on subcell blending approaches
315328
with a low-order FV method. Used with limiter [`SubcellLimiterIDP`](@ref).
@@ -327,8 +340,9 @@ struct VolumeIntegralSubcellLimiting{VolumeFluxDG, VolumeFluxFV, Limiter} <:
327340
limiter::Limiter
328341
end
329342

330-
function VolumeIntegralSubcellLimiting(limiter; volume_flux_dg,
331-
volume_flux_fv)
343+
function VolumeIntegralSubcellLimiting(limiter;
344+
volume_flux_dg = flux_central,
345+
volume_flux_fv = flux_lax_friedrichs)
332346
VolumeIntegralSubcellLimiting{typeof(volume_flux_dg), typeof(volume_flux_fv),
333347
typeof(limiter)}(volume_flux_dg, volume_flux_fv,
334348
limiter)

test/test_tree_1d_euler.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ end
5858
@trixi_testset "elixir_euler_convergence_pure_fv.jl (O2, constant reconstruction)" begin
5959
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_convergence_pure_fv.jl"),
6060
volume_integral=VolumeIntegralPureLGLFiniteVolumeO2(LobattoLegendreBasis(3),
61-
flux_hllc,
61+
volume_flux_fv = flux_hllc,
6262
reconstruction_mode = reconstruction_constant,
6363
slope_limiter = central_slope),
6464
l2=[

0 commit comments

Comments
 (0)