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

L2 Mortars for Parabolic Terms on TreeMeshes #1571

Merged
merged 64 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
0bbe913
First try mortars for parabolic terms
DanielDoehring Jul 17, 2023
fb4efa9
Use correct interface values in calc_fstar!
DanielDoehring Jul 17, 2023
db048cb
Format parabolic 2d dgsem
DanielDoehring Jul 17, 2023
f8c3403
Remove unused function parameters
DanielDoehring Jul 18, 2023
e9d16c7
L2 Mortars for 3D DGSEM TreeMesh
DanielDoehring Jul 18, 2023
a9185a5
Format
DanielDoehring Jul 18, 2023
90ce643
Back to original example
DanielDoehring Jul 18, 2023
b37774e
Dispatch 2D DGSEm rhs_parabolic for p4est and classic tree
DanielDoehring Jul 18, 2023
2149cfd
Re-use standard prolong2mortars in gradient comp
DanielDoehring Jul 18, 2023
e0fda81
Merge branch 'main' into MortarsParabolic
ranocha Jul 18, 2023
06a8488
Merge branch 'main' into MortarsParabolic
DanielDoehring Jul 19, 2023
e3ad723
Back to original version
DanielDoehring Jul 19, 2023
b751d40
Merge branch 'MortarsParabolic' of github.com:DanielDoehring/Trixi.jl…
DanielDoehring Jul 19, 2023
567938c
Merge branch 'main' into MortarsParabolic
DanielDoehring Jul 19, 2023
7e732c7
Add tests for L2 mortars for hyp-para
DanielDoehring Jul 20, 2023
1a26201
Merge branch 'MortarsParabolic' of github.com:DanielDoehring/Trixi.jl…
DanielDoehring Jul 20, 2023
f5b1e62
remove whitespaces
DanielDoehring Jul 20, 2023
e6969cf
Use original analysis callback
DanielDoehring Jul 20, 2023
46ec996
Test Taylor-Green with different integrator
DanielDoehring Jul 20, 2023
051b2bf
Remove whitespace
DanielDoehring Jul 21, 2023
04199a4
check coverage status
DanielDoehring Jul 23, 2023
db785d9
Merge branch 'main' into MortarsParabolic
DanielDoehring Jul 23, 2023
290a41f
Stick to CK2N54 for 3D test
DanielDoehring Jul 24, 2023
ac37b7e
Merge branch 'main' into MortarsParabolic
DanielDoehring Jul 24, 2023
6dc252b
Merge branch 'main' into MortarsParabolic
DanielDoehring Jul 25, 2023
491c923
Add more explicit dispatch
DanielDoehring Jul 25, 2023
5b5d433
Less invasive treatment for mortars and p4est
DanielDoehring Jul 25, 2023
bb68ee3
Revert "Add more explicit dispatch"
DanielDoehring Jul 25, 2023
073612e
Merge branch 'MortarsParabolicP4estCompat' into MortarsParabolic
DanielDoehring Jul 25, 2023
7f816e2
More explicit dispatch
DanielDoehring Jul 25, 2023
6cdca4a
Merge branch 'main' into MortarsParabolic
DanielDoehring Jul 25, 2023
e05d112
Remove additional end
DanielDoehring Jul 25, 2023
38e731d
Merge branch 'MortarsParabolic' of github.com:DanielDoehring/Trixi.jl…
DanielDoehring Jul 25, 2023
a17b1bd
Merge branch 'main' into MortarsParabolic
DanielDoehring Jul 26, 2023
5247b4e
Merge branch 'main' into MortarsParabolic
DanielDoehring Jul 26, 2023
e539f41
Merge branch 'main' into MortarsParabolic
ranocha Jul 28, 2023
c1db7ac
Remove doubled implementations
DanielDoehring Jul 28, 2023
be3b067
kepp main updated with true main
DanielDoehring Jul 28, 2023
3a82e4a
Add comment
DanielDoehring Jul 29, 2023
83b54f8
Merge branch 'MortarsParabolic' of github.com:DanielDoehring/Trixi.jl…
DanielDoehring Jul 29, 2023
5650162
Merge branch 'main' into MortarsParabolic
DanielDoehring Jul 29, 2023
e66b831
comment parabolic 3d
DanielDoehring Jul 29, 2023
1c8efd5
Merge branch 'main' into MortarsParabolic
DanielDoehring Jul 30, 2023
b7bd74f
whitespace
DanielDoehring Jul 30, 2023
797d2d5
Merge branch 'MortarsParabolic' of github.com:DanielDoehring/Trixi.jl…
DanielDoehring Jul 30, 2023
06a4196
Avoid allocations in parabolic boundary fluxes
DanielDoehring Jul 31, 2023
7f9c752
Merge branch 'main' into main
DanielDoehring Jul 31, 2023
6ac6011
Merge branch 'main' into MortarsParabolic
DanielDoehring Aug 1, 2023
c9bb0ee
Update src/solvers/dgsem_tree/dg_2d_parabolic.jl
DanielDoehring Aug 1, 2023
d7f2568
Update src/solvers/dgsem_tree/dg_3d_parabolic.jl
DanielDoehring Aug 1, 2023
a1f3e99
Update src/solvers/dgsem_tree/dg_3d_parabolic.jl
DanielDoehring Aug 1, 2023
207b253
Merge branch 'MortarsParabolic' of github.com:DanielDoehring/Trixi.jl…
DanielDoehring Aug 1, 2023
9dff7de
revert alloc BC (other PR)
DanielDoehring Aug 2, 2023
0936b3b
Revert alloc BC (other PR)
DanielDoehring Aug 2, 2023
67e064a
Name & News
DanielDoehring Aug 2, 2023
0b51b32
Update NEWS.md
DanielDoehring Aug 2, 2023
d13bf12
Update src/solvers/dgsem_p4est/dg_2d_parabolic.jl
DanielDoehring Aug 8, 2023
15fe6b2
Update src/solvers/dgsem_p4est/dg_3d_parabolic.jl
DanielDoehring Aug 8, 2023
1caa657
Check allocations
DanielDoehring Aug 8, 2023
ac15951
Merge branch 'MortarsParabolic' of github.com:DanielDoehring/Trixi.jl…
DanielDoehring Aug 8, 2023
f433665
Merge branch 'main' into MortarsParabolic
DanielDoehring Aug 8, 2023
2b1124d
Merge branch 'main' into MortarsParabolic
DanielDoehring Aug 8, 2023
f5974f0
Merge branch 'main' into MortarsParabolic
ranocha Aug 9, 2023
28ebfac
Merge branch 'main' into MortarsParabolic
DanielDoehring Aug 9, 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
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ are listed in alphabetical order:
* Jesse Chan
* Lars Christmann
* Christof Czernik
* Daniel Doehring
* Patrick Ersing
* Erik Faulhaber
* Gregor Gassner
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ for human readability.
#### Added

- Experimental support for 3D parabolic diffusion terms has been added.
- Non-uniform `TreeMesh` available for hyperbolic-parabolic equations.
- Capability to set truly discontinuous initial conditions in 1D.
- Wetting and drying feature and examples for 1D and 2D shallow water equations

Expand Down
91 changes: 91 additions & 0 deletions src/solvers/dgsem_p4est/dg_2d_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,97 @@ function create_cache_parabolic(mesh::P4estMesh{2}, equations_hyperbolic::Abstra
return cache
end

# TODO: Remove in favor of the implementation for the TreeMesh
# once the P4estMesh can handle mortars as well
function rhs_parabolic!(du, u, t, mesh::P4estMesh{2},
DanielDoehring marked this conversation as resolved.
Show resolved Hide resolved
equations_parabolic::AbstractEquationsParabolic,
initial_condition, boundary_conditions_parabolic, source_terms,
dg::DG, parabolic_scheme, cache, cache_parabolic)
(; u_transformed, gradients, flux_viscous) = cache_parabolic

# Convert conservative variables to a form more suitable for viscous flux calculations
@trixi_timeit timer() "transform variables" begin
transform_variables!(u_transformed, u, mesh, equations_parabolic,
dg, parabolic_scheme, cache, cache_parabolic)
end

# Compute the gradients of the transformed variables
@trixi_timeit timer() "calculate gradient" begin
calc_gradient!(gradients, u_transformed, t, mesh, equations_parabolic,
boundary_conditions_parabolic, dg, cache, cache_parabolic)
end

# Compute and store the viscous fluxes
@trixi_timeit timer() "calculate viscous fluxes" begin
calc_viscous_fluxes!(flux_viscous, gradients, u_transformed, mesh,
equations_parabolic, dg, cache, cache_parabolic)
end

# The remainder of this function is essentially a regular rhs! for parabolic
# equations (i.e., it computes the divergence of the viscous fluxes)
#
# OBS! In `calc_viscous_fluxes!`, the viscous flux values at the volume nodes of each element have
# been computed and stored in `fluxes_viscous`. In the following, we *reuse* (abuse) the
# `interfaces` and `boundaries` containers in `cache_parabolic` to interpolate and store the
# *fluxes* at the element surfaces, as opposed to interpolating and storing the *solution* (as it
# is done in the hyperbolic operator). That is, `interfaces.u`/`boundaries.u` store *viscous flux values*
# and *not the solution*. The advantage is that a) we do not need to allocate more storage, b) we
# do not need to recreate the existing data structure only with a different name, and c) we do not
# need to interpolate solutions *and* gradients to the surfaces.

# TODO: parabolic; reconsider current data structure reuse strategy

# Reset du
@trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache)

# Calculate volume integral
@trixi_timeit timer() "volume integral" begin
calc_volume_integral!(du, flux_viscous, mesh, equations_parabolic, dg, cache)
end

# Prolong solution to interfaces
@trixi_timeit timer() "prolong2interfaces" begin
prolong2interfaces!(cache_parabolic, flux_viscous, mesh, equations_parabolic,
dg.surface_integral, dg, cache)
end

# Calculate interface fluxes
@trixi_timeit timer() "interface flux" begin
calc_interface_flux!(cache_parabolic.elements.surface_flux_values, mesh,
equations_parabolic, dg, cache_parabolic)
end

# Prolong solution to boundaries
@trixi_timeit timer() "prolong2boundaries" begin
prolong2boundaries!(cache_parabolic, flux_viscous, mesh, equations_parabolic,
dg.surface_integral, dg, cache)
end

# Calculate boundary fluxes
@trixi_timeit timer() "boundary flux" begin
calc_boundary_flux_divergence!(cache_parabolic, t,
boundary_conditions_parabolic, mesh,
equations_parabolic,
dg.surface_integral, dg)
end

# TODO: parabolic; extend to mortars
@assert nmortars(dg, cache) == 0

# Calculate surface integrals
@trixi_timeit timer() "surface integral" begin
calc_surface_integral!(du, u, mesh, equations_parabolic,
dg.surface_integral, dg, cache_parabolic)
end

# Apply Jacobian from mapping to reference element
@trixi_timeit timer() "Jacobian" begin
apply_jacobian_parabolic!(du, mesh, equations_parabolic, dg, cache_parabolic)
end

return nothing
end

function calc_gradient!(gradients, u_transformed, t,
mesh::P4estMesh{2}, equations_parabolic,
boundary_conditions_parabolic, dg::DG,
Expand Down
99 changes: 99 additions & 0 deletions src/solvers/dgsem_p4est/dg_3d_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,105 @@ function create_cache_parabolic(mesh::P4estMesh{3}, equations_hyperbolic::Abstra
return cache
end

# This file collects all methods that have been updated to work with parabolic systems of equations
#
# assumptions: parabolic terms are of the form div(f(u, grad(u))) and
# will be discretized first order form as follows:
# 1. compute grad(u)
# 2. compute f(u, grad(u))
# 3. compute div(f(u, grad(u))) (i.e., the "regular" rhs! call)
# boundary conditions will be applied to both grad(u) and div(f(u, grad(u))).
# TODO: Remove in favor of the implementation for the TreeMesh
# once the P4estMesh can handle mortars as well
function rhs_parabolic!(du, u, t, mesh::P4estMesh{3},
DanielDoehring marked this conversation as resolved.
Show resolved Hide resolved
equations_parabolic::AbstractEquationsParabolic,
initial_condition, boundary_conditions_parabolic, source_terms,
dg::DG, parabolic_scheme, cache, cache_parabolic)
@unpack u_transformed, gradients, flux_viscous = cache_parabolic

# Convert conservative variables to a form more suitable for viscous flux calculations
@trixi_timeit timer() "transform variables" begin
transform_variables!(u_transformed, u, mesh, equations_parabolic,
dg, parabolic_scheme, cache, cache_parabolic)
end

# Compute the gradients of the transformed variables
@trixi_timeit timer() "calculate gradient" begin
calc_gradient!(gradients, u_transformed, t, mesh, equations_parabolic,
boundary_conditions_parabolic, dg, cache, cache_parabolic)
end

# Compute and store the viscous fluxes
@trixi_timeit timer() "calculate viscous fluxes" begin
calc_viscous_fluxes!(flux_viscous, gradients, u_transformed, mesh,
equations_parabolic, dg, cache, cache_parabolic)
end

# The remainder of this function is essentially a regular rhs! for parabolic
# equations (i.e., it computes the divergence of the viscous fluxes)
#
# OBS! In `calc_viscous_fluxes!`, the viscous flux values at the volume nodes of each element have
# been computed and stored in `fluxes_viscous`. In the following, we *reuse* (abuse) the
# `interfaces` and `boundaries` containers in `cache_parabolic` to interpolate and store the
# *fluxes* at the element surfaces, as opposed to interpolating and storing the *solution* (as it
# is done in the hyperbolic operator). That is, `interfaces.u`/`boundaries.u` store *viscous flux values*
# and *not the solution*. The advantage is that a) we do not need to allocate more storage, b) we
# do not need to recreate the existing data structure only with a different name, and c) we do not
# need to interpolate solutions *and* gradients to the surfaces.

# TODO: parabolic; reconsider current data structure reuse strategy

# Reset du
@trixi_timeit timer() "reset ∂u/∂t" reset_du!(du, dg, cache)

# Calculate volume integral
@trixi_timeit timer() "volume integral" begin
calc_volume_integral!(du, flux_viscous, mesh, equations_parabolic, dg, cache)
end

# Prolong solution to interfaces
@trixi_timeit timer() "prolong2interfaces" begin
prolong2interfaces!(cache_parabolic, flux_viscous, mesh, equations_parabolic,
dg.surface_integral, dg, cache)
end

# Calculate interface fluxes
@trixi_timeit timer() "interface flux" begin
calc_interface_flux!(cache_parabolic.elements.surface_flux_values, mesh,
equations_parabolic, dg, cache_parabolic)
end

# Prolong solution to boundaries
@trixi_timeit timer() "prolong2boundaries" begin
prolong2boundaries!(cache_parabolic, flux_viscous, mesh, equations_parabolic,
dg.surface_integral, dg, cache)
end

# Calculate boundary fluxes
@trixi_timeit timer() "boundary flux" begin
calc_boundary_flux_divergence!(cache_parabolic, t,
boundary_conditions_parabolic,
mesh, equations_parabolic,
dg.surface_integral, dg)
end

# TODO: parabolic; extend to mortars
@assert nmortars(dg, cache) == 0

# Calculate surface integrals
@trixi_timeit timer() "surface integral" begin
calc_surface_integral!(du, u, mesh, equations_parabolic,
dg.surface_integral, dg, cache_parabolic)
end

# Apply Jacobian from mapping to reference element
@trixi_timeit timer() "Jacobian" begin
apply_jacobian_parabolic!(du, mesh, equations_parabolic, dg, cache_parabolic)
end

return nothing
end

function calc_gradient!(gradients, u_transformed, t,
mesh::P4estMesh{3}, equations_parabolic,
boundary_conditions_parabolic, dg::DG,
Expand Down
Loading
Loading