-
Notifications
You must be signed in to change notification settings - Fork 121
EC mortars: Tree 2D #2302
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
Draft
DanielDoehring
wants to merge
31
commits into
trixi-framework:main
Choose a base branch
from
DanielDoehring:EC_Mortars
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
EC mortars: Tree 2D #2302
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
2cc5d87
investigate EC mortars
DanielDoehring e5b12a3
get it to precompile
DanielDoehring 21d4346
experiment with EC mortars
DanielDoehring 9134d3b
debug ec
DanielDoehring d7ece12
running, but unstable version
DanielDoehring 781372c
debug ec mortars
DanielDoehring d49d567
shorten
DanielDoehring 34efa0e
Some allocs left
DanielDoehring e48fcdf
something seems wrong
DanielDoehring bb9c52f
continue on EC mortars
DanielDoehring 03036e6
Merge branch 'main' into EC_Mortars
DanielDoehring 0527a0b
revisit ec mortars
DanielDoehring 4bb8cc0
non-crashing version
DanielDoehring b251a43
Merge branch 'main' into EC_Mortars
DanielDoehring 49afd6d
move u t second place
DanielDoehring 4ea78cb
comments + error solving (hopefully)
DanielDoehring 00a7dd0
debug
DanielDoehring 0e9f6c5
Merge branch 'main' into EC_Mortars
DanielDoehring bddffff
fmt
DanielDoehring 2a54f97
Add docu and u for every dim
DanielDoehring dde26c4
test + shortening
DanielDoehring c4c545b
Merge branch 'main' into EC_Mortars
DanielDoehring 9328e42
Apply suggestions from code review
DanielDoehring 4fa7a15
shorten
DanielDoehring 1b7116d
comment
DanielDoehring 416bde9
do not change parabolic
DanielDoehring 257e177
revert
DanielDoehring 00c29dd
Merge branch 'main' into EC_Mortars
DanielDoehring 8616985
loop order as in original draft
DanielDoehring 8d1b42d
Merge branch 'EC_Mortars' of github.com:DanielDoehring/Trixi.jl into …
DanielDoehring d3085f0
Merge branch 'main' into EC_Mortars
DanielDoehring File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
106 changes: 106 additions & 0 deletions
106
examples/tree_2d_dgsem/elixir_euler_vortex_mortar_ec.jl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
|
||
using OrdinaryDiffEqSSPRK, OrdinaryDiffEqLowStorageRK | ||
using Trixi | ||
|
||
############################################################################### | ||
# semidiscretization of the compressible Euler equations | ||
|
||
equations = CompressibleEulerEquations2D(1.4) | ||
|
||
""" | ||
initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D) | ||
|
||
The classical isentropic vortex test case of | ||
- Chi-Wang Shu (1997) | ||
Essentially Non-Oscillatory and Weighted Essentially Non-Oscillatory | ||
Schemes for Hyperbolic Conservation Laws | ||
[NASA/CR-97-206253](https://ntrs.nasa.gov/citations/19980007543) | ||
""" | ||
function initial_condition_isentropic_vortex(x, t, equations::CompressibleEulerEquations2D) | ||
# needs appropriate mesh size, e.g. [-10,-10]x[10,10] | ||
# for error convergence: make sure that the end time is such that the vortex is back at the initial state!! | ||
# for the current velocity and domain size: t_end should be a multiple of 20s | ||
# initial center of the vortex | ||
inicenter = SVector(0.0, 0.0) | ||
# size and strength of the vortex | ||
iniamplitude = 5.0 | ||
# base flow | ||
rho = 1.0 | ||
v1 = 1.0 | ||
v2 = 1.0 | ||
vel = SVector(v1, v2) | ||
p = 25.0 | ||
rt = p / rho # ideal gas equation | ||
t_loc = 0 | ||
cent = inicenter + vel * t_loc # advection of center | ||
# ATTENTION: handle periodic BC, but only for v1 = v2 = 1.0 (!!!!) | ||
|
||
cent = x - cent # distance to center point | ||
|
||
# cent = cross(iniaxis, cent) # distance to axis, tangent vector, length r | ||
# cross product with iniaxis = [0, 0, 1] | ||
cent = SVector(-cent[2], cent[1]) | ||
r2 = cent[1]^2 + cent[2]^2 | ||
du = iniamplitude / (2 * π) * exp(0.5 * (1 - r2)) # vel. perturbation | ||
dtemp = -(equations.gamma - 1) / (2 * equations.gamma * rt) * du^2 # isentropic | ||
rho = rho * (1 + dtemp)^(1 / (equations.gamma - 1)) | ||
vel = vel + du * cent | ||
v1, v2 = vel | ||
p = p * (1 + dtemp)^(equations.gamma / (equations.gamma - 1)) | ||
prim = SVector(rho, v1, v2, p) | ||
return prim2cons(prim, equations) | ||
end | ||
initial_condition = initial_condition_isentropic_vortex | ||
|
||
polydeg = 3 | ||
|
||
#surface_flux = flux_ranocha # For truly entropy-conservative spatial discretization | ||
surface_flux = flux_lax_friedrichs # For convergence test | ||
|
||
basis = LobattoLegendreBasis(Float64, polydeg) | ||
solver = DGSEM(basis, surface_flux, | ||
VolumeIntegralFluxDifferencing(flux_ranocha), | ||
MortarEC(basis)) | ||
|
||
coordinates_min = (-10.0, -10.0) | ||
coordinates_max = (10.0, 10.0) | ||
|
||
# Add refinement patch | ||
refinement_patch = ((type = "box", coordinates_min = (-5.0, -5.0), | ||
coordinates_max = (5.0, 5.0)),) | ||
mesh = TreeMesh(coordinates_min, coordinates_max, | ||
initial_refinement_level = 3, | ||
refinement_patches = refinement_patch, | ||
n_cells_max = 100_000) | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
tspan = (0.0, 20.0) | ||
ode = semidiscretize(semi, tspan) | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_interval = 100 | ||
analysis_callback = AnalysisCallback(semi, interval = analysis_interval, | ||
extra_analysis_errors = (:conservation_error,), | ||
save_analysis = true, | ||
analysis_filename = "analysis.dat", | ||
extra_analysis_integrals = (entropy,)) | ||
|
||
alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
||
stepsize_callback = StepsizeCallback(cfl = 1.4) | ||
|
||
callbacks = CallbackSet(summary_callback, | ||
analysis_callback, alive_callback, | ||
stepsize_callback) | ||
|
||
############################################################################### | ||
# run the simulation | ||
|
||
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false); | ||
dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback | ||
save_everystep = false, callback = callbacks); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.