Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
447 commits
Select commit Hold shift + click to select a range
95bcf53
remove stale import
jlchan Jan 30, 2026
a5e80ff
rename indicator cache variable
jlchan Jan 30, 2026
324b457
move regularized_ratio
jlchan Jan 30, 2026
de3a946
format expressions
jlchan Jan 30, 2026
11455a9
add mass basis comments
jlchan Jan 30, 2026
e4457b5
fix references and change T0 to Tc for critical temperature
jlchan Jan 30, 2026
48add39
change cons2prim -> cons2thermo, make cons2prim return (rho, v1, p)
jlchan Jan 30, 2026
ebb239d
rename q -> u_thermo
jlchan Jan 30, 2026
23435ec
use `integrate_reference_element` to calculate volume entropy residual
jlchan Jan 30, 2026
2da05e4
fix cons2prim -> cons2thermo in tests
jlchan Jan 30, 2026
afb7743
fix test
jlchan Jan 30, 2026
1c5f2c3
remove unused export
jlchan Jan 30, 2026
1516f3e
remove unused varnames
jlchan Jan 30, 2026
61bdc48
Merge branch 'jc/add_PR_EOS' into jc/add_PR
jlchan Jan 30, 2026
bc37976
renaming cons2prim -> cons2thermo
jlchan Jan 30, 2026
0676c63
remove initial conditions
jlchan Jan 31, 2026
47c1f08
add transcritical comment
jlchan Jan 31, 2026
4064b50
Apply suggestions from code review
jlchan Jan 31, 2026
7272fa5
move down
DanielDoehring Feb 2, 2026
0bcd705
make similar
DanielDoehring Feb 2, 2026
62bfe3a
consistent
DanielDoehring Feb 2, 2026
a69c83d
more
DanielDoehring Feb 2, 2026
65b6f2e
docstring
DanielDoehring Feb 2, 2026
e7d05ca
bf
DanielDoehring Feb 2, 2026
912ee89
rev
DanielDoehring Feb 2, 2026
7b076d7
Update src/equations/compressible_euler_2d.jl
DanielDoehring Feb 3, 2026
178fde8
exports
DanielDoehring Feb 3, 2026
f3a3ce3
dos
DanielDoehring Feb 3, 2026
62e9542
ds
DanielDoehring Feb 3, 2026
bb4656a
comment
DanielDoehring Feb 3, 2026
120924f
comment
DanielDoehring Feb 3, 2026
8133c10
change
DanielDoehring Feb 3, 2026
8bf0504
Merge branch 'jc/volume_integral_entropy_correction' of github.com:jl…
DanielDoehring Feb 3, 2026
2955ddb
comment
DanielDoehring Feb 3, 2026
2430b51
Merge branch 'main' into jc/volume_integral_entropy_correction
JoshuaLampert Feb 4, 2026
e0f634c
Merge branch 'main' into jc/add_PR_EOS
JoshuaLampert Feb 4, 2026
9831902
rename e -> e_internal
jlchan Feb 4, 2026
a7d6d8c
fix e_total -> e_{\text{total}} formatting
jlchan Feb 4, 2026
6ed719e
Merge remote-tracking branch 'jlchan/jc/add_PR_EOS' into jc/add_PR_EOS
jlchan Feb 4, 2026
bbd81ee
drop max EOS Newton iterations to 20
jlchan Feb 4, 2026
2a6221c
fix dropped "_internal"
jlchan Feb 4, 2026
9654a01
Apply suggestion from @ranocha
jlchan Feb 5, 2026
d271638
Apply suggestion from @ranocha
jlchan Feb 5, 2026
3607a51
Apply suggestion from @ranocha
jlchan Feb 5, 2026
0a57062
Apply suggestion from @ranocha
jlchan Feb 5, 2026
32ae354
test cons2thermo type stability
jlchan Feb 5, 2026
a04cdef
Merge remote-tracking branch 'jlchan/jc/add_PR_EOS' into jc/add_PR_EOS
jlchan Feb 5, 2026
92f57e3
format test
jlchan Feb 5, 2026
cc117bf
use @warn instead
jlchan Feb 5, 2026
80dd2f8
fix test
jlchan Feb 5, 2026
f6731cd
remove period for consistency
jlchan Feb 5, 2026
26c2a92
update e -> e_{\text{internal}} in docs
jlchan Feb 5, 2026
202a90f
update e -> e_internal for variable names
jlchan Feb 5, 2026
341a3c5
move dimension-agnostic functions into equations.jl
jlchan Feb 5, 2026
6d1cb85
add note in NEWS.md
jlchan Feb 5, 2026
646a315
fix e -> e_internal
jlchan Feb 5, 2026
7ba0b43
move shared routines into nonideal_compressible_euler.jl
jlchan Feb 5, 2026
97a455b
Merge branch 'main' into jc/volume_integral_entropy_correction
jlchan Feb 5, 2026
a815294
Apply suggestions from code review
DanielDoehring Feb 6, 2026
f421a8a
Merge branch 'main' into jc/volume_integral_entropy_correction
DanielDoehring Feb 6, 2026
5d8fd5b
Apply suggestions from code review
jlchan Feb 6, 2026
9bb0ecb
Merge branch 'main' into jc/add_PR_EOS
jlchan Feb 6, 2026
98921a8
format
jlchan Feb 6, 2026
19aa9a3
Merge branch 'main' into jc/volume_integral_entropy_correction
jlchan Feb 6, 2026
a5e0ad7
switch to specifying explicit IndicatorEntropyCorrection
jlchan Feb 6, 2026
7ca4359
Update examples/tree_1d_dgsem/elixir_euler_nonideal_transcritical_sho…
jlchan Feb 6, 2026
935cd6e
Merge branch 'main' into jc/add_PR_EOS
jlchan Feb 6, 2026
5dae0b1
Update src/equations/equation_of_state_peng_robinson.jl
jlchan Feb 6, 2026
0f6af48
Merge branch 'main' into jc/add_PR_EOS
jlchan Feb 6, 2026
6b5d864
Merge branch 'main' into jc/volume_integral_entropy_correction
DanielDoehring Feb 6, 2026
98bb0b3
add change to v0.15 section
jlchan Feb 6, 2026
15f0f0e
formatting
jlchan Feb 6, 2026
45fa79a
replace energy_internal -> energy_internal_specific
jlchan Feb 6, 2026
65fdc1d
update NEWS.md with more changes
jlchan Feb 6, 2026
e6f4e46
Merge branch 'jc/add_PR_EOS' into jc/add_PR
jlchan Feb 6, 2026
1a19d69
use energy_internal and energy_internal_specific
jlchan Feb 6, 2026
76bf781
reference terashima APEC properly
jlchan Feb 6, 2026
901b571
reference Terashima APEC paper properly
jlchan Feb 6, 2026
95217c9
Merge branch 'jc/add_PR_EOS' into jc/add_PR
jlchan Feb 6, 2026
ef4ab77
Merge branch 'main' into jc/add_PR
jlchan Feb 7, 2026
5120b83
Merge branch 'main' into jc/add_PR
jlchan Feb 7, 2026
4b7bedc
Merge branch 'main' into jc/volume_integral_entropy_correction
DanielDoehring Feb 8, 2026
aa71f77
Apply suggestion from @DanielDoehring
DanielDoehring Feb 8, 2026
6613e11
Merge branch 'main' into jc/volume_integral_entropy_correction
DanielDoehring Feb 8, 2026
260f28b
Merge branch 'main' into jc/add_PR
jlchan Feb 9, 2026
9a97a63
use nonideal eqs
DanielDoehring Feb 9, 2026
ff4661b
reuse eqs
DanielDoehring Feb 9, 2026
ac0c420
fix energy_internal in docstrings
jlchan Feb 9, 2026
fc0c0ac
fix tests
jlchan Feb 9, 2026
d639995
explicitly provide periodic BCs
jlchan Feb 9, 2026
92598a2
fix test name
jlchan Feb 9, 2026
9e60364
add more tests
jlchan Feb 9, 2026
eb68cc6
Update src/auxiliary/math.jl
jlchan Feb 9, 2026
7885f92
formatting
jlchan Feb 9, 2026
a57ca5d
more tests
jlchan Feb 9, 2026
b302900
fix velocity function
jlchan Feb 9, 2026
a32c9dc
allow for scalar function visualization using ScalarPlotData2D
jlchan Feb 10, 2026
9a0f148
add tests
jlchan Feb 10, 2026
b006dc2
add NEWS.md entry
jlchan Feb 10, 2026
aee486b
Update src/visualization/types.jl
jlchan Feb 10, 2026
088309e
fix test
jlchan Feb 10, 2026
c31e2f5
Merge branch 'jc/scalar_plot_data_func' into jc/volume_integral_entro…
jlchan Feb 10, 2026
5ecff5b
Update src/visualization/types.jl
jlchan Feb 10, 2026
77d53ce
reorder function args
jlchan Feb 10, 2026
77993b8
extend visualization to FDSBP
jlchan Feb 10, 2026
cf55222
add FDSBP vis test
jlchan Feb 10, 2026
2645da0
expand consistency test
jlchan Feb 10, 2026
e3e5844
Merge branch 'jc/scalar_plot_data_func' into jc/volume_integral_entro…
jlchan Feb 10, 2026
b0fe1bb
fix FDSBP vis test
jlchan Feb 10, 2026
ae61ee7
Merge branch 'jc/scalar_plot_data_func' into jc/volume_integral_entro…
jlchan Feb 10, 2026
51a7a80
add transcritical mixing test of wall BCs
jlchan Feb 10, 2026
d415a3a
fix tests
jlchan Feb 10, 2026
c092089
update modified sod with entropy correction test
jlchan Feb 10, 2026
7218675
fix u[1, ..] -> u[1, :, :, :]
jlchan Feb 10, 2026
ce6c407
Revert "fix u[1, ..] -> u[1, :, :, :]"
jlchan Feb 10, 2026
13576ce
fix u[1, ..] -> u[1, :, :, :]
jlchan Feb 10, 2026
bf0ba9c
print out directory and elixir to diagnose CI failures
jlchan Feb 10, 2026
2f1730d
fix cons2prim -> cons2thermo
jlchan Feb 10, 2026
a19b444
Apply suggestions from code review
jlchan Feb 10, 2026
934130f
update NEWS.md
jlchan Feb 10, 2026
2110f31
more test fixes
jlchan Feb 11, 2026
9856230
Merge branch 'jc/scalar_plot_data_func' into jc/volume_integral_entro…
jlchan Feb 11, 2026
993193d
try to fix tests again
jlchan Feb 11, 2026
4b9e779
Merge branch 'jc/scalar_plot_data_func' into jc/volume_integral_entro…
jlchan Feb 11, 2026
116315b
use clearer function argument names
jlchan Feb 11, 2026
ff5924d
fix tests again
jlchan Feb 11, 2026
5324977
Merge branch 'jc/scalar_plot_data_func' into jc/volume_integral_entro…
jlchan Feb 11, 2026
6b0c511
add one more test to improve coverage
jlchan Feb 11, 2026
7f26a13
Merge branch 'jc/scalar_plot_data_func' into jc/volume_integral_entro…
jlchan Feb 11, 2026
515b1c5
move initial condition into elixir
jlchan Feb 11, 2026
a8ae12e
test slip wall BCs
jlchan Feb 11, 2026
4864c7c
Apply suggestions from code review
jlchan Feb 11, 2026
2aa2bfc
unify reference_node_coordinates_2d
jlchan Feb 11, 2026
874a6d1
Apply suggestions from code review
jlchan Feb 11, 2026
4f28863
fix docstring mention of cons2prim behavior
jlchan Feb 11, 2026
017ca76
Update examples/tree_2d_dgsem/elixir_euler_peng_robinson_transcritica…
jlchan Feb 11, 2026
b6a252e
Update examples/tree_2d_dgsem/elixir_euler_peng_robinson_transcritica…
jlchan Feb 11, 2026
530bb9d
Update examples/tree_2d_dgsem/elixir_euler_peng_robinson_transcritica…
jlchan Feb 11, 2026
f8207bf
Update examples/tree_2d_dgsem/elixir_euler_peng_robinson_transcritica…
jlchan Feb 11, 2026
81b8396
remove max_abs_speed and min_max_speed_naive
jlchan Feb 11, 2026
c3a273d
rename f_rho_E -> f_rho_e_total
jlchan Feb 11, 2026
2ef0bff
Merge remote-tracking branch 'jlchan/jc/add_PR' into jc/add_PR
jlchan Feb 11, 2026
a1ec5e0
rename ke -> e_kinetic
jlchan Feb 11, 2026
9ca24da
remove unnecessary comment
jlchan Feb 11, 2026
fff9838
use e_total and e_internal consistently
jlchan Feb 11, 2026
6d208aa
rename d_rho_e_drho_at_const_p (use e_internal)
jlchan Feb 11, 2026
941deab
Merge branch 'jc/scalar_plot_data_func' into jc/volume_integral_entro…
jlchan Feb 11, 2026
9265b4e
Update test_unit.jl
jlchan Feb 11, 2026
6b39c67
Apply suggestions from code review
jlchan Feb 11, 2026
0f3b094
Merge remote-tracking branch 'origin/main' into jc/volume_integral_en…
jlchan Feb 11, 2026
a9ef378
Merge branch 'main' into jc/add_PR
jlchan Feb 11, 2026
74071a3
Update src/equations/nonideal_compressible_euler_2d.jl
jlchan Feb 11, 2026
aacc0eb
fix rho_e -> rho_e_internal
jlchan Feb 11, 2026
8886476
Apply suggestions from code review
JoshuaLampert Feb 11, 2026
156279f
Update test/test_tree_2d_euler.jl
jlchan Feb 11, 2026
f459988
add type tests
jlchan Feb 11, 2026
d7531a5
Merge branch 'jc/add_PR' into jc/volume_integral_entropy_correction
jlchan Feb 11, 2026
95a3864
Merge branch 'main' into jc/volume_integral_entropy_correction
jlchan Feb 11, 2026
8a5dd2d
add 2D nonideal entropy potentials
jlchan Feb 12, 2026
7de8a23
Merge branch 'main' into jc/volume_integral_entropy_correction
jlchan Feb 12, 2026
43aa69f
Merge remote-tracking branch 'jlchan/jc/volume_integral_entropy_corre…
jlchan Feb 12, 2026
629f9aa
switch to passing in volume integrals instead of fluxes
jlchan Feb 13, 2026
de603c6
update tests
jlchan Feb 13, 2026
9c9a4e0
add jet example
jlchan Feb 13, 2026
f2c284e
adding daru tenaud
jlchan Feb 13, 2026
157f6bf
Merge branch 'jc/volume_integral_entropy_correction' of https://githu…
jlchan Feb 13, 2026
617cab6
Merge branch 'main' into jc/volume_integral_entropy_correction
jlchan Feb 13, 2026
e070f05
fix test
jlchan Feb 13, 2026
c2eea3a
fix 2d test
jlchan Feb 13, 2026
97504dd
format
jlchan Feb 13, 2026
4e214bc
Apply suggestions from code review
jlchan Feb 13, 2026
30c1b45
fix negative sign
jlchan Feb 13, 2026
28a8115
Update src/equations/compressible_euler_1d.jl
jlchan Feb 13, 2026
12bd59e
Merge remote-tracking branch 'jlchan/jc/volume_integral_entropy_corre…
jlchan Feb 13, 2026
26096bc
Merge remote-tracking branch 'origin/main' into jc/volume_integral_en…
jlchan Feb 13, 2026
d48d212
remove VolumeIntegralEntropyCorrection from exports
jlchan Feb 13, 2026
04c5134
switch to using VolumeIntegralAdaptive
jlchan Feb 13, 2026
1a656ea
update docstring
jlchan Feb 13, 2026
a5c44b2
add back comma
jlchan Feb 13, 2026
f4fb656
remove unused `calc_volume_integral!` routines
jlchan Feb 13, 2026
d634cca
remove VolumeIntegralEntropyCorrection
jlchan Feb 13, 2026
c0c65e8
update Sod to include shock capturing
jlchan Feb 13, 2026
6f4fa25
add indicator EC with SC
jlchan Feb 13, 2026
b4b0366
fix calc integral with entropy correction
jlchan Feb 13, 2026
1f3e190
enable shock capturing + entropy correction
jlchan Feb 13, 2026
59bfc8d
update test
jlchan Feb 13, 2026
f164e18
format elixir
jlchan Feb 13, 2026
fff9fc5
adding keyword constructor for IndicatorEntropyCorrectionWithShockCap…
jlchan Feb 13, 2026
72a012f
fix
jlchan Feb 13, 2026
f0eed49
removing untested elixirs
jlchan Feb 13, 2026
906d22a
adding back dropped
jlchan Feb 13, 2026
1ac2344
fix type instability
jlchan Feb 14, 2026
0dba8c3
fix test
jlchan Feb 14, 2026
e652177
fix test
jlchan Feb 14, 2026
6e42bc8
Apply suggestions from code review
jlchan Feb 15, 2026
ba42f90
remove unnecessary docstring
jlchan Feb 15, 2026
b4e7e34
Merge branch 'main' into jc/volume_integral_entropy_correction
jlchan Feb 15, 2026
b39ecd4
Merge remote-tracking branch 'jlchan/jc/volume_integral_entropy_corre…
jlchan Feb 15, 2026
cd919d8
Merge branch 'main' into jc/volume_integral_entropy_correction
jlchan Feb 17, 2026
52bb55f
move definitions and rename
jlchan Feb 17, 2026
2e8ed00
renaming and moving definitions back
jlchan Feb 17, 2026
a408b07
move definitions around
jlchan Feb 17, 2026
13aea87
restructure
DanielDoehring Feb 18, 2026
b3795b3
rm
DanielDoehring Feb 18, 2026
08e9e66
Merge branch 'main' into jc/volume_integral_entropy_correction
DanielDoehring Feb 18, 2026
78dd0b8
merge
DanielDoehring Feb 18, 2026
7f54d77
Merge branch 'jc/volume_integral_entropy_correction' of github.com:jl…
DanielDoehring Feb 18, 2026
3384d62
Update src/solvers/dgsem/dgsem.jl
DanielDoehring Feb 18, 2026
79ef816
restruct
DanielDoehring Feb 18, 2026
1061750
Merge branch 'main' into jc/volume_integral_entropy_correction
DanielDoehring Feb 18, 2026
ccbec0d
Update src/callbacks_step/analysis_dg1d.jl
ranocha Feb 19, 2026
011d081
Merge branch 'main' into jc/volume_integral_entropy_correction
ranocha Feb 19, 2026
a5547b5
format
ranocha Feb 19, 2026
a9bef90
Fix surface_integral -> surface_integral_reference_element
ranocha Feb 19, 2026
5472b69
Apply suggestions from code review
jlchan Feb 19, 2026
9aa584f
Merge branch 'main' into Jesse_EntropyCorrection
DanielDoehring Feb 19, 2026
419dc99
Merge branch 'jc/volume_integral_entropy_correction' of github.com:jl…
DanielDoehring Feb 19, 2026
aec27cd
analysis
DanielDoehring Feb 19, 2026
dbdc856
Merge branch 'main' into Jesse_EntropyCorrection
DanielDoehring Feb 20, 2026
c176ee8
Apply suggestions from code review
jlchan Feb 20, 2026
176059e
unify docstring
jlchan Feb 20, 2026
05b9996
add NEWS.md entry
jlchan Feb 20, 2026
fd3e243
comment
DanielDoehring Feb 20, 2026
2172b3e
Merge branch 'main' into jc/volume_integral_entropy_correction
jlchan Feb 21, 2026
7a4ce6f
Apply suggestions from code review
jlchan Feb 21, 2026
dbebe97
clarify comments on volume/surface integrals
jlchan Feb 21, 2026
956e1c6
fix indicator printing
jlchan Feb 21, 2026
7b02fe5
remove one-element specialization of `entropy_change_reference_element`
jlchan Feb 21, 2026
ff7284e
Merge branch 'main' into jc/volume_integral_entropy_correction
jlchan Feb 22, 2026
8196951
Apply suggestions from code review
jlchan Feb 22, 2026
cd48a2f
fix renaming
jlchan Feb 22, 2026
6cb9da9
make signs consistent
jlchan Feb 22, 2026
98e38e9
improve test coverage
jlchan Feb 23, 2026
e966d25
Add create cache and reinit for `VolumeIntegralEntropyCorrection`
DanielDoehring Feb 23, 2026
b8cabe7
Merge branch 'main' into Jesse_EntropyCorrection
DanielDoehring Feb 23, 2026
86821f0
Merge remote-tracking branch 'jlchan/jc/volume_integral_entropy_corre…
jlchan Feb 23, 2026
65d446d
improve test coverage, use entropy correction in mixing test
jlchan Feb 23, 2026
b33190d
reuse shock capturing alpha array
jlchan Feb 23, 2026
9adb687
move elixir to correct spot
jlchan Feb 23, 2026
544841e
move resizing outside of calc_volume_integral
jlchan Feb 23, 2026
3dd41c9
add dropped `basis`
jlchan Feb 23, 2026
abd9729
remove unnecessary resizing
jlchan Feb 23, 2026
89d2a3c
use only `alpha_shock_capturing`
jlchan Feb 23, 2026
72df5d9
rm unnecessary specialization
DanielDoehring Feb 23, 2026
bc542cc
add one more test for coverage
jlchan Feb 24, 2026
734cd40
Merge remote-tracking branch 'jlchan/jc/volume_integral_entropy_corre…
jlchan Feb 24, 2026
ac74870
fix test
jlchan Feb 24, 2026
b6551da
put surface_flux back into elixir
jlchan Feb 24, 2026
17a5e1c
fix
jlchan Feb 24, 2026
950c487
use AMR, increase test coverage
jlchan Feb 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ This enables in particular adaptive mesh refinement for that solver-mesh combina
`volume_integral_blend_high_order`, and `volume_integral_blend_low_order` besides the usual `indicator` argument.
In particular, `volume_integral_default` may be e.g. `VolumeIntegralWeakForm` or `VolumeIntegralAdaptive`, i.e.,
the non-stabilized elements/cells are no longer restricted to `VolumeIntegralFluxDifferencing` only ([#2802]).
- Added `IndicatorEntropyCorrection`. When combined with `VolumeIntegralAdaptive`, this blends together a stabilized and non-stabilized
volume integral based on the violation of a volume entropy condition. `IndicatorEntropyCorrectionShockCapturingCombined` additionally
guides the blending by taking the maximum of the entropy correction indicator and a shock capturing indicator ([#2764]).
- The second-order subcell volume integral is no longer limited to reconstruction in primitive variables.
Instead, it is possible to reconstruct in custom variables, if functions `cons2recon` and `recon2cons` are provided to
`VolumeIntegralPureLGLFiniteVolumeO2` and `VolumeIntegralShockCapturingRRG`([#2817]).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,15 @@ end
initial_condition = initial_condition_transcritical_mixing

volume_flux = flux_terashima_etal
volume_integral = VolumeIntegralFluxDifferencing(volume_flux)
solver = DGSEM(polydeg = 3, volume_integral = volume_integral,
surface_flux = flux_lax_friedrichs)
surface_flux = FluxPlusDissipation(volume_flux, DissipationLocalLaxFriedrichs())

basis = LobattoLegendreBasis(3)
volume_integral_default = VolumeIntegralFluxDifferencing(volume_flux)
volume_integral_entropy_stable = VolumeIntegralPureLGLFiniteVolume(surface_flux)
volume_integral = VolumeIntegralAdaptive(IndicatorEntropyCorrection(equations, basis),
volume_integral_default,
volume_integral_entropy_stable)
solver = DGSEM(basis, surface_flux, volume_integral)

cells_per_dimension = (32, 16)
coordinates_min = (-0.5, -0.25)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
using OrdinaryDiffEqSSPRK
using Trixi

###############################################################################
# semidiscretization of the compressible Euler equations
equations = CompressibleEulerEquations1D(1.4)

function initial_condition_modified_sod(x, t, equations::CompressibleEulerEquations1D)
if x[1] < 0.3
return prim2cons(SVector(1, 0.75, 1), equations)
else
return prim2cons(SVector(0.125, 0.0, 0.1), equations)
end
end

initial_condition = initial_condition_modified_sod

volume_flux = flux_central
surface_flux = flux_lax_friedrichs
basis = LobattoLegendreBasis(3)
indicator_ec = IndicatorEntropyCorrection(equations, basis)
indicator_sc = IndicatorHennemannGassner(equations, basis,
alpha_max = 0.5,
alpha_min = 0.001,
alpha_smooth = true,
variable = density_pressure)
indicator = IndicatorEntropyCorrectionShockCapturingCombined(indicator_entropy_correction = indicator_ec,
indicator_shock_capturing = indicator_sc)

volume_integral_default = VolumeIntegralFluxDifferencing(volume_flux)
volume_integral_entropy_stable = VolumeIntegralPureLGLFiniteVolumeO2(basis,
volume_flux_fv = surface_flux)
volume_integral = VolumeIntegralAdaptive(indicator,
volume_integral_default,
volume_integral_entropy_stable)
solver = DGSEM(basis, surface_flux, volume_integral)

coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
initial_refinement_level = 3,
n_cells_max = 30_000,
periodicity = false)

boundary_conditions = (x_neg = BoundaryConditionDirichlet(initial_condition),
x_pos = BoundaryConditionDirichlet(initial_condition))
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver;
boundary_conditions = boundary_conditions)

###############################################################################
# ODE solvers, callbacks etc.

tspan = (0.0, 0.2)
ode = semidiscretize(semi, tspan)

summary_callback = SummaryCallback()

analysis_interval = 2000
analysis_callback = AnalysisCallback(semi, interval = analysis_interval)

alive_callback = AliveCallback(analysis_interval = analysis_interval)

save_solution = SaveSolutionCallback(interval = 100,
save_initial_solution = true,
save_final_solution = true,
solution_variables = cons2prim)

amr_indicator = IndicatorLöhner(semi, variable = first)
amr_controller = ControllerThreeLevel(semi, amr_indicator,
base_level = 3,
med_level = 4, med_threshold = 0.1,
max_level = 6, max_threshold = 0.15)
amr_interval = 50
amr_callback = AMRCallback(semi, amr_controller,
interval = amr_interval)

###############################################################################
# run the simulation

callbacks = CallbackSet(summary_callback, save_solution, amr_callback,
analysis_callback, alive_callback)
sol = solve(ode, SSPRK43();
abstol = 1e-6, reltol = 1e-4,
ode_default_options()..., callback = callbacks);
6 changes: 4 additions & 2 deletions examples/tree_2d_dgsem/elixir_euler_nonideal_density_wave.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ function Trixi.initial_condition_density_wave(x, t,
end
initial_condition = initial_condition_density_wave

polydeg = 3
basis = LobattoLegendreBasis(polydeg)
volume_flux = flux_terashima_etal
volume_integral = VolumeIntegralFluxDifferencing(volume_flux)
solver = DGSEM(polydeg = 3, volume_integral = volume_integral,
surface_flux = flux_lax_friedrichs)
surface_flux = flux_lax_friedrichs
solver = DGSEM(basis, surface_flux, volume_integral)

coordinates_min = (-1.0, -1.0)
coordinates_max = (1.0, 1.0)
Expand Down
1 change: 1 addition & 0 deletions src/Trixi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ export DG,
VolumeIntegralAdaptive, IndicatorEntropyChange,
IndicatorHennemannGassner,
VolumeIntegralUpwind,
IndicatorEntropyCorrection, IndicatorEntropyCorrectionShockCapturingCombined,
SurfaceIntegralWeakForm, SurfaceIntegralStrongForm,
SurfaceIntegralUpwind,
MortarL2
Expand Down
4 changes: 4 additions & 0 deletions src/auxiliary/math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -445,4 +445,8 @@ end
@inline function maxmod(sl, sr)
return 0.5f0 * (sign(sl) + sign(sr)) * max(abs(sl), abs(sr))
end

# Regularized approximation to the ratio a / b, which is numerically stable
# for b close to zero and approaches zero as b -> 0.
@inline regularized_ratio(a, b) = a * b / (eps(typeof(b)) + b^2)
end # @muladd
15 changes: 15 additions & 0 deletions src/equations/nonideal_compressible_euler_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -328,4 +328,19 @@ end
rho_e_internal = rho_e_total - 0.5f0 * rho_v1^2 / rho
return rho_e_internal
end

"""
entropy_potential(u, orientation_or_normal_direction,
equations::AbstractNonIdealCompressibleEulerEquations)

Calculate the entropy potential, which for the compressible Euler equations with general
EOS is ``p v_{\text{normal}} / T`` for the choice of [`entropy`](@ref) ``S(u) = -\rho s``.
"""
@inline function entropy_potential(u, orientation::Int,
equations::NonIdealCompressibleEulerEquations1D)
eos = equations.equation_of_state
V, v1, T = cons2thermo(u, equations)
p = pressure(V, T, eos)
return p * v1 / T
end
end # @muladd
21 changes: 21 additions & 0 deletions src/equations/nonideal_compressible_euler_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -561,4 +561,25 @@ end
rho_e_internal = rho_e_total - 0.5f0 * (rho_v1^2 + rho_v2^2) / rho
return rho_e_internal
end

@inline function entropy_potential(u, orientation::Int,
equations::NonIdealCompressibleEulerEquations2D)
eos = equations.equation_of_state
V, v1, v2, T = cons2thermo(u, equations)
p = pressure(V, T, eos)
if orientation == 1
return p * v1 / T
else # if orientation == 2
return p * v2 / T
end
end

@inline function entropy_potential(u, normal_direction,
equations::NonIdealCompressibleEulerEquations2D)
eos = equations.equation_of_state
V, v1, v2, T = cons2thermo(u, equations)
v_normal = v1 * normal_direction[1] + v2 * normal_direction[2]
p = pressure(V, T, eos)
return p * v_normal / T
end
end # @muladd
168 changes: 168 additions & 0 deletions src/solvers/dgsem/calc_volume_integral.jl
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,83 @@ end
return nothing
end

@inline function volume_integral_kernel!(du, u, element, mesh,
have_nonconservative_terms, equations,
volume_integral::VolumeIntegralEntropyCorrection,
dg::DGSEM, cache)
@unpack volume_integral_default, volume_integral_stabilized, indicator = volume_integral
@unpack scaling = indicator
@unpack alpha = indicator.cache
du_element_threaded = indicator.cache.volume_integral_values_threaded

# run default volume integral
volume_integral_kernel!(du, u, element, mesh,
have_nonconservative_terms, equations,
volume_integral_default, dg, cache)

# Check entropy production of "high order" volume integral.
#
# Note that, for `TreeMesh`, `dS_volume_integral` and `dS_true` are calculated
# on the reference element. For other mesh types, because ``dS_volume_integral`
# incorporates the scaled contravariant vectors, `dS_true` should
# be calculated on the physical element instead.
#
# Minus sign because of the flipped sign of the volume term in the DG RHS.
# No scaling by inverse Jacobian here, as there is no Jacobian multiplication
# in `integrate_reference_element`.
dS_volume_integral = -entropy_change_reference_element(du, u, element,
mesh, equations,
dg, cache)

# Compute true entropy change given by surface integral of the entropy potential
dS_true = surface_integral_reference_element(entropy_potential, u, element,
mesh, equations, dg, cache)

# This quantity should be ≤ 0 for an entropy stable volume integral, and
# exactly zero for an entropy conservative volume integral.
entropy_residual = dS_volume_integral - dS_true

if entropy_residual > 0
# Store "high order" result
du_FD_element = du_element_threaded[Threads.threadid()]
@views du_FD_element .= du[.., element]

# Reset pure flux-differencing volume integral
# Note that this assumes that the volume terms are computed first,
# before any surface terms are added.
du[.., element] .= zero(eltype(du))

# Calculate entropy stable volume integral contribution
volume_integral_kernel!(du, u, element, mesh,
have_nonconservative_terms, equations,
volume_integral_stabilized, dg, cache)

dS_volume_integral_stabilized = -entropy_change_reference_element(du, u,
element,
mesh,
equations, dg,
cache)

# Calculate difference between high and low order FV entropy production;
# this should provide positive entropy dissipation if `entropy_residual > 0`,
# assuming the stabilized volume integral is entropy stable.
entropy_dissipation = dS_volume_integral_stabilized - dS_volume_integral

# Calculate DG-FV blending factor
ratio = regularized_ratio(-entropy_residual, entropy_dissipation)
alpha_element = min(1, scaling * ratio) # TODO: replacing this with a differentiable version of `min`

# Save blending coefficient for visualization
alpha[element] = alpha_element

# Blend the high order method back in
@views du[.., element] .= alpha_element .* du[.., element] .+
(1 - alpha_element) .* du_FD_element
end

return nothing
end

function calc_volume_integral!(du, u, mesh,
have_nonconservative_terms, equations,
volume_integral, dg::DGSEM, cache)
Expand Down Expand Up @@ -153,4 +230,95 @@ function calc_volume_integral!(du, u, mesh,

return nothing
end

function calc_volume_integral!(du, u, mesh,
have_nonconservative_terms, equations,
volume_integral::VolumeIntegralEntropyCorrectionShockCapturingCombined,
dg::DGSEM, cache)
(; volume_integral_default, volume_integral_stabilized, indicator) = volume_integral
(; indicator_entropy_correction, indicator_shock_capturing) = indicator
(; scaling) = indicator_entropy_correction
du_element_threaded = indicator_entropy_correction.cache.volume_integral_values_threaded

# Calculate DG-FV blending factors α a-priori for: u_{DG-FV} = u_DG * (1 - α) + u_FV * α
# Note that we also reuse the `alpha_shock_capturing` array to store the indicator values for visualization.
alpha_shock_capturing = @trixi_timeit timer() "blending factors" indicator_shock_capturing(u,
mesh,
equations,
dg,
cache)

@threaded for element in eachelement(dg, cache)
# run default volume integral
volume_integral_kernel!(du, u, element, mesh,
have_nonconservative_terms, equations,
volume_integral_default, dg, cache)

# Check entropy production of "high order" volume integral.
#
# Note that, for `TreeMesh`, both volume and surface integrals are calculated
# on the reference element. For other mesh types, because the volume integral
# incorporates the scaled contravariant vectors, the surface integral should
# be calculated on the physical element instead.
#
# Minus sign because of the flipped sign of the volume term in the DG RHS.
# No scaling by inverse Jacobian here, as there is no Jacobian multiplication
# in `integrate_reference_element`.
dS_volume_integral = -entropy_change_reference_element(du, u, element,
mesh, equations,
dg, cache)

# Compute true entropy change given by surface integral of the entropy potential
dS_true = surface_integral_reference_element(entropy_potential, u, element,
mesh, equations, dg, cache)

# This quantity should be ≤ 0 for an entropy stable volume integral, and
# exactly zero for an entropy conservative volume integral.
entropy_residual = dS_volume_integral - dS_true

if entropy_residual > 0
# Store "high order" result
du_FD_element = du_element_threaded[Threads.threadid()]
@views du_FD_element .= du[.., element]

# Reset pure flux-differencing volume integral
# Note that this assumes that the volume terms are computed first,
# before any surface terms are added.
du[.., element] .= zero(eltype(du))

# Calculate entropy stable volume integral contribution
volume_integral_kernel!(du, u, element, mesh,
have_nonconservative_terms, equations,
volume_integral_stabilized, dg, cache)

dS_volume_integral_stabilized = -entropy_change_reference_element(du, u,
element,
mesh,
equations,
dg,
cache)

# Calculate difference between high and low order FV entropy production;
# this should provide positive entropy dissipation if `entropy_residual > 0`,
# assuming the stabilized volume integral is entropy stable.
entropy_dissipation = dS_volume_integral_stabilized - dS_volume_integral

# Calculate DG-FV blending factor as the minimum between the entropy correction
# indicator and shock capturing indicator
# TODO: replacing this with a differentiable version of `min`
ratio = regularized_ratio(-entropy_residual, entropy_dissipation)
alpha_element = min(1, max(alpha_shock_capturing[element], scaling * ratio))

# Save blending coefficient for visualization. Note that we overwrite the data
# in `alpha_shock_capturing[element]`.
alpha_shock_capturing[element] = alpha_element

# Blend the high order method back in
@views du[.., element] .= alpha_element .* du[.., element] .+
(1 - alpha_element) .* du_FD_element
end
end

return nothing
end
end # @muladd
3 changes: 3 additions & 0 deletions src/solvers/dgsem/dgsem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ end
Base.summary(io::IO, dg::DGSEM) = print(io, "DGSEM(polydeg=$(polydeg(dg)))")

include("compute_u_mean.jl")

include("containers.jl")

include("indicators.jl")
include("special_volume_integrals.jl")
include("calc_volume_integral.jl")
end # @muladd
Loading
Loading