Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parabolic Mortar for AMR P4estMesh{3} #1765

Merged
merged 174 commits into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from 169 commits
Commits
Show all changes
174 commits
Select commit Hold shift + click to select a range
b33cbc2
Clean branch
DanielDoehring Aug 14, 2023
7e32e24
Un-Comment
DanielDoehring Aug 14, 2023
5e1997b
un-comment
DanielDoehring Aug 14, 2023
54e328e
test coarsen
DanielDoehring Aug 14, 2023
a9e4cb7
remove redundancy
DanielDoehring Aug 14, 2023
ebb5865
Merge branch 'main' into Parabolic_AMR_1D
DanielDoehring Aug 15, 2023
4f72a09
Merge branch 'main' into Parabolic_AMR_1D
DanielDoehring Aug 15, 2023
70568f5
Merge branch 'main' into Parabolic_AMR_1D
DanielDoehring Aug 16, 2023
ebc9cc8
Remove support for passive terms
DanielDoehring Aug 18, 2023
9c766b9
expand resize
DanielDoehring Aug 18, 2023
c63e8b7
Merge branch 'Parabolic_AMR_1D' of github.com:DanielDoehring/Trixi.jl…
DanielDoehring Aug 18, 2023
82894d7
comments
DanielDoehring Aug 18, 2023
6ef88ca
format
DanielDoehring Aug 18, 2023
7e4a450
Merge branch 'main' into Parabolic_AMR_1D
DanielDoehring Aug 19, 2023
53f5991
Avoid code duplication
DanielDoehring Aug 20, 2023
daf6fc4
Merge branch 'Parabolic_AMR_1D' of github.com:DanielDoehring/Trixi.jl…
DanielDoehring Aug 20, 2023
cdfe93b
Update src/callbacks_step/amr_dg1d.jl
DanielDoehring Aug 22, 2023
0f2b779
comment
DanielDoehring Aug 22, 2023
376f99e
comment & format
DanielDoehring Aug 22, 2023
1dcfed4
Merge branch 'main' into Parabolic_AMR_1D
DanielDoehring Aug 22, 2023
baec78f
Merge branch 'main' into Parabolic_AMR_1D
DanielDoehring Aug 22, 2023
8526d16
Merge branch 'main' into Parabolic_AMR_1D
DanielDoehring Aug 22, 2023
826553f
Try to increase coverage
DanielDoehring Aug 28, 2023
9363b52
Merge branch 'Parabolic_AMR_1D' of github.com:DanielDoehring/Trixi.jl…
DanielDoehring Aug 28, 2023
d209629
Slightly more expressive names
DanielDoehring Aug 29, 2023
abce5ae
Merge branch 'main' into Parabolic_AMR_1D
DanielDoehring Aug 31, 2023
a7d56a1
Apply suggestions from code review
sloede Sep 1, 2023
133c6a6
Merge branch 'main' into Parabolic_AMR_1D
sloede Sep 1, 2023
d348b82
Merge branch 'main' into Parabolic_AMR_1D
DanielDoehring Sep 6, 2023
f87046d
Merge branch 'main' into Parabolic_AMR_1D
DanielDoehring Sep 6, 2023
0c7dcb0
Merge branch 'main' into Parabolic_AMR_1D
DanielDoehring Sep 7, 2023
abb6dfb
add specifier for 1d
DanielDoehring Sep 11, 2023
bfa3a24
Structs for resizing parabolic helpers
DanielDoehring Sep 11, 2023
40ad266
check if mortars are present
DanielDoehring Sep 11, 2023
4d1914b
reuse `reinitialize_containers!`
DanielDoehring Sep 11, 2023
70c8e66
resize calls for parabolic helpers
DanielDoehring Sep 11, 2023
a5db7d0
update analysis callbacks
DanielDoehring Sep 11, 2023
c9d98a2
Velocities for compr euler
DanielDoehring Sep 11, 2023
694e6bc
Init container
DanielDoehring Sep 11, 2023
07655a4
correct copy-paste error
DanielDoehring Sep 11, 2023
edd82ce
resize each dim
DanielDoehring Sep 11, 2023
ba1ef1b
add dispatch
DanielDoehring Sep 11, 2023
7d351e5
Add AMR for shear layer
DanielDoehring Sep 11, 2023
e608174
USe only amr shear layer
DanielDoehring Sep 11, 2023
6574bf5
first steps towards p4est parabolic amr
DanielDoehring Sep 11, 2023
4c35430
Add tests
DanielDoehring Sep 11, 2023
21d29f8
remove plots
DanielDoehring Sep 11, 2023
29bd213
Format
DanielDoehring Sep 11, 2023
cb3eac8
remove redundant line
DanielDoehring Sep 11, 2023
7e68d94
platform independent tests
DanielDoehring Sep 11, 2023
0eadf49
Merge branch 'main' into AMR_Parabolic_2D3D_Tree
DanielDoehring Sep 12, 2023
5c20c4f
No need for different flux_viscous comps after adding container_visco…
DanielDoehring Sep 12, 2023
a0b6e3a
Merge branch 'AMR_Parabolic_2D3D_Tree' of github.com:DanielDoehring/T…
DanielDoehring Sep 12, 2023
21ccff4
Laplace 3d
DanielDoehring Sep 12, 2023
06a7811
Merge branch 'main' into AMR_Parabolic_2D3D_Tree
DanielDoehring Sep 15, 2023
591132b
Merge branch 'main' into AMR_Parabolic_2D3D_Tree
DanielDoehring Sep 18, 2023
d1b8316
Merge branch 'main' into AMR_Parabolic_2D3D_Tree
DanielDoehring Sep 20, 2023
07cf0ba
Merge branch 'main' into AMR_Parabolic_2D3D_Tree
DanielDoehring Sep 20, 2023
8df117b
Longer times to allow converage to hit coarsen!
DanielDoehring Sep 20, 2023
ff77769
Merge branch 'AMR_Parabolic_2D3D_Tree' of github.com:DanielDoehring/T…
DanielDoehring Sep 20, 2023
cdaa865
Increase testing of Laplace 3D
DanielDoehring Sep 20, 2023
4699a10
Add tests for velocities
DanielDoehring Sep 20, 2023
306c9b0
Merge branch 'main' into AMR_Parabolic_2D3D_Tree
DanielDoehring Sep 20, 2023
0129b5e
Merge branch 'main' into AMR_Parabolic_2D3D_Tree
DanielDoehring Sep 22, 2023
ac1c1ca
Merge branch 'main' into AMR_Parabolic_2D3D_Tree
DanielDoehring Sep 22, 2023
5f0051c
Merge branch 'main' into AMR_Parabolic_2D3D_Tree
jlchan Oct 4, 2023
389d89c
remove comment
DanielDoehring Oct 5, 2023
03be339
Merge branch 'AMR_Parabolic_2D3D_Tree' of github.com:DanielDoehring/T…
DanielDoehring Oct 5, 2023
1d4486a
Merge branch 'main' into AMR_Parabolic_2D3D_Tree
DanielDoehring Oct 5, 2023
e6ac2d4
Merge remote-tracking branch 'DanielDoehring/AMR_Parabolic_2D3D_Tree'…
jlchan Oct 6, 2023
f86121f
add elixir for amr testing
jlchan Oct 6, 2023
27afc2d
adding commented out mortar routines in 2D
jlchan Oct 6, 2023
7943167
Adding Mortar to 2d dg parabolic term
apey236 Oct 6, 2023
a8173c7
remove testing snippet
jlchan Oct 7, 2023
5f4e8f3
fix comments
jlchan Oct 7, 2023
113bce5
add more arguments for dispatch
jlchan Oct 7, 2023
53c5c68
add some temporary todo notes
jlchan Oct 7, 2023
4c2ed6c
some updates for AP and KS
jlchan Oct 7, 2023
39cc7b8
specialize mortar_fluxes_to_elements
jlchan Oct 7, 2023
e33bcfa
BUGFIX: apply_jacobian_parabolic! was incorrect for P4estMesh
jlchan Oct 7, 2023
0ee3d3e
fixed rhs_parabolic! for mortars
jlchan Oct 7, 2023
2e23b36
more changes to elixir
jlchan Oct 7, 2023
e089803
indexing bug
jlchan Oct 7, 2023
5b4c4da
comments
jlchan Oct 7, 2023
3b58ee5
Merge branch 'main' into jc/amr_parabolic_p4est
jlchan Oct 9, 2023
41770d7
Adding the example for nonperiodic BCs with amr
apey236 Oct 9, 2023
00a460a
hopefully this fixes AMR boundaries for parabolic terms
jlchan Oct 9, 2023
6f46507
add elixir
jlchan Oct 9, 2023
2c7fdd8
Example with non periodic bopundary conditions
apey236 Oct 9, 2023
d0afe4a
remove cruft
jlchan Oct 9, 2023
333b136
Merge remote-tracking branch 'jlchan/jc/amr_parabolic_p4est' into jc/…
jlchan Oct 9, 2023
7e1dc7d
Merge branch 'main' into jc/amr_parabolic_p4est
jlchan Oct 12, 2023
cd78853
adding 2d amr parabolic
apey236 Nov 1, 2023
beff438
3D parabolic amr
apey236 Nov 2, 2023
223dcd7
TGV elixir
apey236 Nov 2, 2023
dc396d3
Creating test for AMR 3D parabolic
apey236 Dec 2, 2023
868d252
Formatting
apey236 Dec 2, 2023
5cbbb40
test formatting
apey236 Dec 2, 2023
203991e
Merge branch 'main' into ap/p4est_parabolic_amr_3d
DanielDoehring Dec 19, 2023
9ca962e
Update src/Trixi.jl
DanielDoehring Dec 19, 2023
b039c28
Update src/equations/compressible_euler_1d.jl
DanielDoehring Dec 19, 2023
491101f
Update src/equations/compressible_euler_2d.jl
DanielDoehring Dec 19, 2023
dc396a3
Update src/equations/compressible_euler_3d.jl
DanielDoehring Dec 19, 2023
6dee308
Update src/solvers/dgsem_tree/container_viscous_2d.jl
DanielDoehring Dec 19, 2023
7789b9f
Update src/solvers/dgsem_tree/container_viscous_2d.jl
DanielDoehring Dec 19, 2023
d77046d
Update src/solvers/dgsem_tree/container_viscous_2d.jl
DanielDoehring Dec 19, 2023
3ca6542
Update src/solvers/dgsem_tree/container_viscous_3d.jl
DanielDoehring Dec 19, 2023
72c5131
Update src/solvers/dgsem_tree/container_viscous_3d.jl
DanielDoehring Dec 19, 2023
70f9f4c
Update src/solvers/dgsem_tree/container_viscous_3d.jl
DanielDoehring Dec 19, 2023
1470879
Update src/solvers/dgsem_p4est/dg_2d_parabolic.jl
DanielDoehring Dec 19, 2023
030713b
Update src/solvers/dgsem_p4est/dg_2d_parabolic.jl
DanielDoehring Dec 19, 2023
d9c3f2f
Update src/solvers/dgsem_tree/dg_2d_parabolic.jl
DanielDoehring Dec 19, 2023
f836e8e
Update src/solvers/dgsem_tree/dg_2d_parabolic.jl
DanielDoehring Dec 19, 2023
97b546c
Update src/solvers/dgsem_tree/dg_2d_parabolic.jl
DanielDoehring Dec 19, 2023
1a70b13
Update src/solvers/dgsem_tree/dg_2d_parabolic.jl
DanielDoehring Dec 19, 2023
b0438ab
Update src/solvers/dgsem_tree/dg_2d_parabolic.jl
DanielDoehring Dec 19, 2023
b499d2c
Update src/solvers/dgsem_tree/dg_2d_parabolic.jl
DanielDoehring Dec 19, 2023
2d1e203
Update src/solvers/dgsem_tree/dg_2d_parabolic.jl
DanielDoehring Dec 19, 2023
5aa086a
Update src/solvers/dgsem_tree/dg_2d_parabolic.jl
DanielDoehring Dec 19, 2023
c555239
Update src/solvers/dgsem_tree/dg_2d_parabolic.jl
DanielDoehring Dec 19, 2023
da13ebb
Update test/test_parabolic_3d.jl
DanielDoehring Dec 19, 2023
020c5a9
Update src/solvers/dgsem_tree/dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
33d8122
Update src/solvers/dgsem_tree/dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
cfebbd3
Update src/solvers/dgsem_tree/dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
1547c15
Update src/solvers/dgsem_tree/dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
151905d
Update src/solvers/dgsem_tree/dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
31fbcb6
Update src/solvers/dgsem_tree/dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
6f8b005
Update src/solvers/dgsem_tree/dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
953d81b
Update src/solvers/dgsem_tree/dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
0a5ef79
Update src/solvers/dgsem_p4est/dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
c7345f8
Update src/solvers/dgsem_p4est/dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
a38060b
Update src/solvers/dgsem_p4est/dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
42b4b87
Update src/solvers/dgsem_p4est/dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
85340f7
Update src/solvers/dgsem_p4est/dg_2d_parabolic.jl
DanielDoehring Dec 19, 2023
0dd0b69
Update src/solvers/dgsem_p4est/dg_2d.jl
DanielDoehring Dec 19, 2023
d358613
Update src/solvers/dgsem_p4est/dg_2d_parabolic.jl
DanielDoehring Dec 19, 2023
8e90da6
Update src/solvers/dgsem_p4est/dg_2d_parabolic.jl
DanielDoehring Dec 19, 2023
42752a6
Update test/test_parabolic_3d.jl
DanielDoehring Dec 19, 2023
1d65458
Update test/test_parabolic_3d.jl
DanielDoehring Dec 19, 2023
85074bd
Update test/test_parabolic_3d.jl
DanielDoehring Dec 19, 2023
b3db182
Update examples/p4est_3d_dgsem/elixir_navierstokes_3d_blast_wave_amr.jl
DanielDoehring Dec 19, 2023
d82685c
Update examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vorte…
DanielDoehring Dec 19, 2023
f089564
Update examples/p4est_3d_dgsem/elixir_navierstokes_3d_blast_wave_amr.jl
DanielDoehring Dec 19, 2023
a559e4f
Update examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vorte…
DanielDoehring Dec 19, 2023
c1085a4
Update examples/p4est_3d_dgsem/elixir_navierstokes_3d_blast_wave_amr.jl
DanielDoehring Dec 19, 2023
e8b38a7
Update examples/p4est_3d_dgsem/elixir_navierstokes_3d_blast_wave_amr.jl
DanielDoehring Dec 19, 2023
1255213
Update examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vorte…
DanielDoehring Dec 19, 2023
1b0a530
Update examples/p4est_3d_dgsem/elixir_navierstokes_3d_blast_wave_amr.jl
DanielDoehring Dec 19, 2023
5bb3ddc
Update examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vorte…
DanielDoehring Dec 19, 2023
6f6ecc0
Update examples/p4est_3d_dgsem/elixir_navierstokes_3d_blast_wave_amr.jl
DanielDoehring Dec 19, 2023
d25c639
Update examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vorte…
DanielDoehring Dec 19, 2023
84d973d
Update dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
b749f10
Update test_parabolic_3d.jl
DanielDoehring Dec 19, 2023
bff694d
Update elixir_navierstokes_3d_blast_wave_amr.jl
DanielDoehring Dec 19, 2023
01dd0d2
Update elixir_navierstokes_taylor_green_vortex_amr.jl
DanielDoehring Dec 19, 2023
7edce73
Update dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
3f1107f
Update test_parabolic_3d.jl
DanielDoehring Dec 19, 2023
b91684f
Update test_parabolic_3d.jl
DanielDoehring Dec 19, 2023
4f00c9b
Update examples/p4est_3d_dgsem/elixir_navierstokes_3d_blast_wave_amr.jl
DanielDoehring Dec 19, 2023
095e117
Update elixir_navierstokes_3d_blast_wave_amr.jl
DanielDoehring Dec 19, 2023
d08c874
Update elixir_navierstokes_taylor_green_vortex_amr.jl
DanielDoehring Dec 19, 2023
a73cb3a
Update dg_3d_parabolic.jl
DanielDoehring Dec 19, 2023
bb0cb0e
Update test_parabolic_3d.jl
DanielDoehring Dec 19, 2023
3e35f96
Delete examples/p4est_3d_dgsem/elixir_navierstokes_3d_blast_wave_amr.jl
DanielDoehring Dec 20, 2023
8cf401e
Create elixir_navierstokes_blast_wave_amr.jl
DanielDoehring Dec 20, 2023
3a51498
Update test_parabolic_3d.jl
DanielDoehring Dec 20, 2023
d132dd4
Merge branch 'main' into ap/p4est_parabolic_amr_3d
DanielDoehring Dec 20, 2023
ba9ea53
Update NEWS.md
DanielDoehring Dec 20, 2023
e95cef4
Update NEWS.md
DanielDoehring Dec 20, 2023
e2bf5ce
Update src/solvers/dgsem_p4est/dg_3d_parabolic.jl
DanielDoehring Dec 20, 2023
f1dbdad
Update src/solvers/dgsem_p4est/dg_3d_parabolic.jl
DanielDoehring Dec 20, 2023
ebe69d4
Update src/solvers/dgsem_p4est/dg_3d_parabolic.jl
DanielDoehring Dec 20, 2023
2a32c30
Update src/solvers/dgsem_p4est/dg_3d_parabolic.jl
DanielDoehring Dec 20, 2023
7907788
Merge branch 'main' into ap/p4est_parabolic_amr_3d
jlchan Dec 22, 2023
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
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Trixi.jl follows the interpretation of [semantic versioning (semver)](https://ju
used in the Julia ecosystem. Notable changes will be documented in this file
for human readability.

## Changes in the v0.6 lifecycle

#### Added
- AMR for hyperbolic-parabolic equations on 3D `P4estMesh`

## Changes when updating to v0.6 from v0.5.x

#### Added
Expand Down
113 changes: 113 additions & 0 deletions examples/p4est_3d_dgsem/elixir_navierstokes_blast_wave_amr.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@

using OrdinaryDiffEq
using Trixi

###############################################################################
# semidiscretization of the compressible Navier-Stokes equations

# TODO: parabolic; unify names of these accessor functions
prandtl_number() = 0.72
mu() = 6.25e-4 # equivalent to Re = 1600

equations = CompressibleEulerEquations3D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(),
Prandtl = prandtl_number())

function initial_condition_3d_blast_wave(x, t, equations::CompressibleEulerEquations3D)
rho_c = 1.0
p_c = 1.0
u_c = 0.0

rho_o = 0.125
p_o = 0.1
u_o = 0.0

rc = 0.5
r = sqrt(x[1]^2 + x[2]^2 + x[3]^2)
if r < rc
rho = rho_c
v1 = u_c
v2 = u_c
v3 = u_c
p = p_c
else
rho = rho_o
v1 = u_o
v2 = u_o
v3 = u_o
p = p_o
end

return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
initial_condition = initial_condition_3d_blast_wave

surface_flux = flux_lax_friedrichs
volume_flux = flux_ranocha
polydeg = 3
basis = LobattoLegendreBasis(polydeg)
indicator_sc = IndicatorHennemannGassner(equations, basis,
alpha_max = 1.0,
alpha_min = 0.001,
alpha_smooth = true,
variable = density_pressure)
volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
volume_flux_dg = volume_flux,
volume_flux_fv = surface_flux)

solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
volume_integral = volume_integral)

coordinates_min = (-1.0, -1.0, -1.0) .* pi
coordinates_max = (1.0, 1.0, 1.0) .* pi

trees_per_dimension = (4, 4, 4)

mesh = P4estMesh(trees_per_dimension, polydeg = 3,
coordinates_min = coordinates_min, coordinates_max = coordinates_max,
periodicity = (true, true, true), initial_refinement_level = 1)

semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
initial_condition, solver)

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

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

summary_callback = SummaryCallback()

analysis_interval = 100
analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
save_solution = SaveSolutionCallback(interval = analysis_interval,
save_initial_solution = true,
save_final_solution = true,
solution_variables = cons2prim)

amr_indicator = IndicatorLöhner(semi, variable = Trixi.density)

amr_controller = ControllerThreeLevel(semi, amr_indicator,
base_level = 0,
med_level = 1, med_threshold = 0.05,
max_level = 3, max_threshold = 0.1)
amr_callback = AMRCallback(semi, amr_controller,
interval = 10,
adapt_initial_condition = true,
adapt_initial_condition_only_refine = true)

alive_callback = AliveCallback(analysis_interval = analysis_interval)

callbacks = CallbackSet(summary_callback,
analysis_callback,
alive_callback,
amr_callback,
save_solution)

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

time_int_tol = 1e-8
sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
106 changes: 106 additions & 0 deletions examples/p4est_3d_dgsem/elixir_navierstokes_taylor_green_vortex_amr.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@

using OrdinaryDiffEq
using Trixi

###############################################################################
# semidiscretization of the compressible Navier-Stokes equations

# TODO: parabolic; unify names of these accessor functions
prandtl_number() = 0.72
mu() = 6.25e-4 # equivalent to Re = 1600

equations = CompressibleEulerEquations3D(1.4)
equations_parabolic = CompressibleNavierStokesDiffusion3D(equations, mu = mu(),
Prandtl = prandtl_number())

"""
initial_condition_taylor_green_vortex(x, t, equations::CompressibleEulerEquations3D)

The classical Taylor-Green vortex.
"""
function initial_condition_taylor_green_vortex(x, t,
equations::CompressibleEulerEquations3D)
A = 1.0 # magnitude of speed
Ms = 0.1 # maximum Mach number

rho = 1.0
v1 = A * sin(x[1]) * cos(x[2]) * cos(x[3])
v2 = -A * cos(x[1]) * sin(x[2]) * cos(x[3])
v3 = 0.0
p = (A / Ms)^2 * rho / equations.gamma # scaling to get Ms
p = p +
1.0 / 16.0 * A^2 * rho *
(cos(2 * x[1]) * cos(2 * x[3]) + 2 * cos(2 * x[2]) + 2 * cos(2 * x[1]) +
cos(2 * x[2]) * cos(2 * x[3]))

return prim2cons(SVector(rho, v1, v2, v3, p), equations)
end
initial_condition = initial_condition_taylor_green_vortex

@inline function vel_mag(u, equations::CompressibleEulerEquations3D)
rho, rho_v1, rho_v2, rho_v3, _ = u
return sqrt(rho_v1^2 + rho_v2^2 + rho_v3^2) / rho
end

volume_flux = flux_ranocha
solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs,
volume_integral = VolumeIntegralFluxDifferencing(volume_flux))

coordinates_min = (-1.0, -1.0, -1.0) .* pi
coordinates_max = (1.0, 1.0, 1.0) .* pi

trees_per_dimension = (2, 2, 2)

mesh = P4estMesh(trees_per_dimension, polydeg = 3,
coordinates_min = coordinates_min, coordinates_max = coordinates_max,
periodicity = (true, true, true), initial_refinement_level = 0)

semi = SemidiscretizationHyperbolicParabolic(mesh, (equations, equations_parabolic),
initial_condition, solver)

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

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

summary_callback = SummaryCallback()

analysis_interval = 50
analysis_callback = AnalysisCallback(semi, interval = analysis_interval,
save_analysis = true,
extra_analysis_integrals = (energy_kinetic,
energy_internal,
enstrophy))
save_solution = SaveSolutionCallback(interval = 100,
save_initial_solution = true,
save_final_solution = true,
solution_variables = cons2prim)

amr_indicator = IndicatorLöhner(semi, variable = vel_mag)

amr_controller = ControllerThreeLevel(semi, amr_indicator,
base_level = 0,
med_level = 1, med_threshold = 0.1,
max_level = 3, max_threshold = 0.2)

amr_callback = AMRCallback(semi, amr_controller,
interval = 5,
adapt_initial_condition = false,
adapt_initial_condition_only_refine = false)

alive_callback = AliveCallback(analysis_interval = analysis_interval)

callbacks = CallbackSet(summary_callback,
analysis_callback,
alive_callback,
amr_callback,
save_solution)

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

time_int_tol = 1e-8
sol = solve(ode, RDPK3SpFSAL49(); abstol = time_int_tol, reltol = time_int_tol,
ode_default_options()..., callback = callbacks)
summary_callback() # print the timer summary
4 changes: 2 additions & 2 deletions src/callbacks_step/amr_dg2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function refine!(u_ode::AbstractVector, adaptor, mesh::Union{TreeMesh{2}, P4estM
end

function refine!(u_ode::AbstractVector, adaptor,
mesh::Union{TreeMesh{2}, P4estMesh{2}, TreeMesh{3}},
mesh::Union{TreeMesh{2}, P4estMesh{2}, TreeMesh{3}, P4estMesh{3}},
equations, dg::DGSEM, cache, cache_parabolic,
elements_to_refine)
# Call `refine!` for the hyperbolic part, which does the heavy lifting of
Expand Down Expand Up @@ -299,7 +299,7 @@ function coarsen!(u_ode::AbstractVector, adaptor,
end

function coarsen!(u_ode::AbstractVector, adaptor,
mesh::Union{TreeMesh{2}, P4estMesh{2}, TreeMesh{3}},
mesh::Union{TreeMesh{2}, P4estMesh{2}, TreeMesh{3}, P4estMesh{3}},
equations, dg::DGSEM, cache, cache_parabolic,
elements_to_remove)
# Call `coarsen!` for the hyperbolic part, which does the heavy lifting of
Expand Down
1 change: 1 addition & 0 deletions src/equations/laplace_diffusion_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function varnames(variable_mapping, equations_parabolic::LaplaceDiffusion3D)
varnames(variable_mapping, equations_parabolic.equations_hyperbolic)
end

# no orientation specified since the flux is vector-valued
function flux(u, gradients, orientation::Integer, equations_parabolic::LaplaceDiffusion3D)
dudx, dudy, dudz = gradients
if orientation == 1
Expand Down
Loading
Loading