Skip to content
Merged
Show file tree
Hide file tree
Changes from 33 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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
# this version of modified sod uses a 100x density and pressure jump
return prim2cons(SVector(0.0125, 0.0, 0.01), equations)
end
end

initial_condition = initial_condition_modified_sod

volume_flux = flux_central
surface_flux = flux_lax_friedrichs
basis = LobattoLegendreBasis(3)
volume_integral = VolumeIntegralEntropyCorrection(equations, basis;
volume_flux_dg = volume_flux,
volume_flux_fv = surface_flux)
solver = DGSEM(basis, surface_flux, volume_integral)

coordinates_min = 0.0
coordinates_max = 1.0
mesh = TreeMesh(coordinates_min, coordinates_max,
initial_refinement_level = 6,
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)

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

callbacks = CallbackSet(summary_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 src/Trixi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export density, pressure, density_pressure, velocity, temperature,
equilibrium_distribution,
waterheight, waterheight_pressure
export entropy, entropy_thermodynamic, entropy_math, entropy_guermond_etal,
energy_total, energy_kinetic, energy_internal,
energy_total, energy_kinetic, energy_internal, entropy_potential,
energy_magnetic, cross_helicity, magnetic_field, divergence_cleaning_field,
enstrophy, vorticity
export lake_at_rest_error
Expand All @@ -271,6 +271,7 @@ export DG,
VolumeIntegralShockCapturingHG, VolumeIntegralShockCapturingRRG,
IndicatorHennemannGassner,
VolumeIntegralUpwind,
VolumeIntegralEntropyCorrection,
SurfaceIntegralWeakForm, SurfaceIntegralStrongForm,
SurfaceIntegralUpwind,
MortarL2
Expand Down Expand Up @@ -317,7 +318,8 @@ export load_mesh, load_time, load_timestep, load_timestep!, load_dt,
load_adaptive_time_integrator!

export ControllerThreeLevel, ControllerThreeLevelCombined,
IndicatorLöhner, IndicatorLoehner, IndicatorMax
IndicatorLöhner, IndicatorLoehner, IndicatorMax,
IndicatorEntropyCorrection

export PositivityPreservingLimiterZhangShu, EntropyBoundedLimiter

Expand Down
31 changes: 31 additions & 0 deletions src/callbacks_step/analysis_dg1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,37 @@ function calc_error_norms(func, u, t, analyzer,
return l2_error, linf_error
end

# integrate `du_local` against the entropy variables evaluated at `u`
function integrate_against_entropy_variables(du_local, u, element,
mesh::AbstractMesh{1},
equations, dg::DGSEM, cache, args...)
(; weights) = dg.basis

# we integrate over the reference element since `du` is calculated by
# a weak form-like volume integral, and should already be scaled by the
# Jacobian factor.

integral = zero(eltype(u))

for i in eachnode(dg)
du_node = get_node_vars(du_local, equations, dg, i)
u_node = get_node_vars(u, equations, dg, i, element)
integral = integral +
weights[i] * dot(cons2entropy(u_node, equations), du_node)
end

return integral
end
Comment thread
jlchan marked this conversation as resolved.
Outdated

# calculate surface integral of func(u, orientation, equations) * normal
function surface_integral(func::Func, u, element, mesh::TreeMesh{1}, equations,
dg::DGSEM, cache) where {Func}
u_left = get_node_vars(u, equations, dg, 1, element)
u_right = get_node_vars(u, equations, dg, nnodes(dg), element)
surface_integral = (func(u_right, 1, equations) - func(u_left, 1, equations))
return surface_integral
end
Comment thread
ranocha marked this conversation as resolved.

function integrate_via_indices(func::Func, u,
mesh::TreeMesh{1}, equations, dg::DGSEM, cache,
args...; normalize = true) where {Func}
Expand Down
45 changes: 45 additions & 0 deletions src/callbacks_step/analysis_dg2d.jl
Comment thread
ranocha marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,51 @@ function calc_error_norms(func, u, t, analyzer,
return l2_error, linf_error
end

# integrate `du_local` against the entropy variables evaluated at `u`
function integrate_against_entropy_variables(du_local, u, element,
mesh::AbstractMesh{2},
equations, dg::DGSEM, cache, args...)
(; weights) = dg.basis

jacobian_1d = inv(cache.elements.inverse_jacobian[element]) # O(h)

integral = zero(eltype(u))

for j in eachnode(dg), i in eachnode(dg)
du_node = get_node_vars(du_local, equations, dg, i, j)
u_node = get_node_vars(u, equations, dg, i, j, element)
integral = integral +
weights[i] * weights[j] *
dot(cons2entropy(u_node, equations), du_node)
end

return integral * jacobian_1d
end
Comment thread
jlchan marked this conversation as resolved.
Outdated

# calculate surface integral of func(u, equations) * normal
function surface_integral(func::Func, u, element, mesh::TreeMesh{2}, equations,
dg::DGSEM, cache) where {Func}
surface_integral = zero(real(dg))
for ii in eachnode(dg)
# x direction
u_left = get_node_vars(u, equations, dg, 1, ii, element)
u_right = get_node_vars(u, equations, dg, nnodes(dg), ii, element)
surface_integral = surface_integral +
dg.basis.weights[ii] *
(func(u_right, 1, equations) - func(u_left, 1, equations))

# y direction
u_left = get_node_vars(u, equations, dg, ii, 1, element)
u_right = get_node_vars(u, equations, dg, ii, nnodes(dg), element)
surface_integral = surface_integral +
dg.basis.weights[ii] *
(func(u_right, 2, equations) - func(u_left, 2, equations))
end

jacobian_1d = inv(cache.elements.inverse_jacobian[element]) # O(h)
return surface_integral * jacobian_1d
end

function integrate_via_indices(func::Func, u,
mesh::TreeMesh{2}, equations, dg::DGSEM, cache,
args...; normalize = true) where {Func}
Expand Down
15 changes: 15 additions & 0 deletions src/equations/compressible_euler_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1147,4 +1147,19 @@ of total energy and kinetic energy.
@inline function energy_internal(cons, equations::CompressibleEulerEquations1D)
return energy_total(cons, equations) - energy_kinetic(cons, equations)
end

@doc raw"""
entropy_potential(u, orientation::Int, equations::CompressibleEulerEquations1D)
Comment thread
DanielDoehring marked this conversation as resolved.
Outdated

Calculate the entropy potential, which for the compressible Euler equations is simply
momentum for the choice of entropy ``S(u) = \frac{\rho s}{\gamma - 1}``.

"Entropy stable high order discontinuous Galerkin methods with suitable quadrature rules
for hyperbolic conservation laws" by Chen and Shu (2017).
<http://dx.doi.org/10.1016/j.jcp.2017.05.025>
"""
Comment thread
jlchan marked this conversation as resolved.
@inline function entropy_potential(u, orientation::Int,
equations::CompressibleEulerEquations1D)
return u[2]
Comment thread
jlchan marked this conversation as resolved.
end
end # @muladd
19 changes: 19 additions & 0 deletions src/equations/compressible_euler_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2230,6 +2230,25 @@ end
return energy_total(cons, equations) - energy_kinetic(cons, equations)
end

@doc raw"""
entropy_potential(u, orientation::Int, equations::CompressibleEulerEquations1D)
Comment thread
DanielDoehring marked this conversation as resolved.
Outdated

Calculate the entropy potential, which for the compressible Euler equations is simply
the momentum for the choice of entropy ``S(u) = \frac{\rho s}{\gamma - 1}``.

"Entropy stable high order discontinuous Galerkin methods with suitable quadrature rules
for hyperbolic conservation laws" by Chen and Shu (2017).
<http://dx.doi.org/10.1016/j.jcp.2017.05.025>
"""
@inline function entropy_potential(u, orientation::Int,
Comment thread
jlchan marked this conversation as resolved.
equations::CompressibleEulerEquations2D)
if orientation == 1
return u[2]
else # if orientation == 2
return u[3]
end
end

# State validation for Newton-bisection method of subcell IDP limiting
@inline function Base.isvalid(u, equations::CompressibleEulerEquations2D)
if u[1] <= 0 || pressure(u, equations) <= 0
Expand Down
14 changes: 14 additions & 0 deletions src/equations/nonideal_compressible_euler_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,18 @@ end
rho_e = rho_e_total - 0.5f0 * rho_v1^2 / rho
return rho_e
end

"""
entropy_potential(u, orientation::Int, equations::CompressibleEulerEquations1D)

Calculate the entropy potential, which for the compressible Euler equations with general
EOS is ``p v_i / T`` for the choice of entropy ``S(u) = \rho s``.
Comment thread
jlchan marked this conversation as resolved.
Outdated
"""
@inline function entropy_potential(u, orientation::Int,
Comment thread
jlchan marked this conversation as resolved.
equations::NonIdealCompressibleEulerEquations1D)
eos = equations.equation_of_state
V, v1, T = cons2prim(u, equations)
p = pressure(V, T, eos)
return p * v1 / T
end
end # @muladd
63 changes: 63 additions & 0 deletions src/solvers/dg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,69 @@ function Base.show(io::IO, mime::MIME"text/plain",
end
end

"""
VolumeIntegralEntropyCorrection(equations, basis;
volume_flux_dg=flux_central,
volume_flux_fv=flux_lax_friedrichs,
scaling = true)

Entropy correction volume integral type for DG methods using a convex blending of
the **first-order** finite volume method with numerical flux `volume_flux_fv` and the
[`VolumeIntegralFluxDifferencing`](@ref) with volume flux `volume_flux_dg`.
The amount of blending is determined by the violation of a cell entropy equality by
the volume integral.

`scaling ≥ 1` arbitrarily scales the blending parameter by a constant, increasing
the amount of the subcell FV added in. This can be used to add shock capturing-like
behavior.

The use of `VolumeIntegralEntropyCorrection` requires either
`entropy_potential(u, orientation, equations)` for TreeMesh, or
`entropy_potential(u, normal_direction, equations)` for other mesh types
to be defined.
"""
struct VolumeIntegralEntropyCorrection{VolumeFluxDG, VolumeFluxFV, Indicator} <:
AbstractVolumeIntegralShockCapturing
volume_flux_dg::VolumeFluxDG # symmetric, e.g. split-form or entropy-conservative
volume_flux_fv::VolumeFluxFV # non-symmetric in general, e.g. entropy-dissipative
indicator::Indicator
end

function VolumeIntegralEntropyCorrection(equations, basis;
volume_flux_dg = flux_central,
volume_flux_fv = flux_lax_friedrichs,
scaling = true)
indicator = IndicatorEntropyCorrection(equations, basis; scaling)
Comment thread
DanielDoehring marked this conversation as resolved.
Outdated
return VolumeIntegralEntropyCorrection{typeof(volume_flux_dg),
typeof(volume_flux_fv),
typeof(indicator)}(volume_flux_dg,
volume_flux_fv,
indicator)
end

function Base.show(io::IO, mime::MIME"text/plain",
integral::VolumeIntegralEntropyCorrection)
@nospecialize integral # reduce precompilation time

if get(io, :compact, false)
show(io, integral)
else
summary_header(io, "VolumeIntegralEntropyCorrection")
summary_line(io, "volume flux DG", integral.volume_flux_dg)
summary_line(io, "volume flux FV", integral.volume_flux_fv)
summary_line(io, "indicator", integral.indicator |> typeof |> nameof)
show(increment_indent(io), mime, integral.indicator)
summary_footer(io)
end
end

function get_element_variables!(element_variables, u, mesh, equations,
volume_integral::VolumeIntegralEntropyCorrection,
dg, cache)
element_variables[:indicator_shock_capturing] = volume_integral.indicator.cache.alpha
return nothing
end

# Abstract supertype for first-order `VolumeIntegralPureLGLFiniteVolume` and
# second-order `VolumeIntegralPureLGLFiniteVolumeO2` subcell-based finite volume
# volume integrals.
Expand Down
70 changes: 70 additions & 0 deletions src/solvers/dgsem/calc_volume_integral.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,74 @@ function calc_volume_integral!(du, u, mesh,

return nothing
end

@inline regularized_ratio(a, b) = a * b / (eps(b) + b^2)
Comment thread
jlchan marked this conversation as resolved.
Outdated

function calc_volume_integral!(du, u, mesh,
have_nonconservative_terms, equations,
volume_integral::VolumeIntegralEntropyCorrection,
Comment thread
jlchan marked this conversation as resolved.
Outdated
dg::DGSEM, cache)
(; volume_flux_dg, volume_flux_fv, indicator) = volume_integral
du_element_threaded = indicator.cache.indicator_threaded
(; scaling) = indicator
(; alpha) = indicator.cache
resize!(alpha, nelements(dg, cache))

@threaded for element in eachelement(dg, cache)
flux_differencing_kernel!(du, u, element, mesh,
have_nonconservative_terms, equations,
volume_flux_dg, dg, cache)

# check entropy production of "high order" volume integral
volume_integral_entropy_vars = integrate_against_entropy_variables(view(du, ..,
element),
u, element,
mesh,
equations,
dg, cache)
surface_integral_entropy_potential = surface_integral(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 = -(volume_integral_entropy_vars +
surface_integral_entropy_potential)
Comment thread
DanielDoehring marked this conversation as resolved.
Outdated

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

# Reset pure flux-differencing volume integral
du[.., element] .= zero(eltype(du))
Comment thread
jlchan marked this conversation as resolved.

# Calculate FV volume integral contribution
fv_kernel!(du, u, mesh,
have_nonconservative_terms, equations,
volume_flux_fv, dg, cache, element)

# calculate difference between high and low order FV integral;
# this should be entropy dissipative if entropy_residual > 0.
@views du_element .= (du_element .- du[.., element])

entropy_dissipation = integrate_against_entropy_variables(du_element, u,
element,
mesh, equations,
dg, cache)

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

# save blending coefficient for visualization
alpha[element] = theta

# blend the high order method back in
@views du[.., element] .= du[.., element] .+ (1 - theta) .* du_element
end
end

return nothing
end
end # @muladd
Loading
Loading