-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 2D multi-ion GLM-MHD equations for the TreeMesh solver (#2196)
* Added 2D GLM-MHD equations, examples and tests * Remove ES test * Compatibility for single precision * Changed initial condition back to double precision * Update reference to Hennemann et al. * Replaced all occurrences of 2.0f0 and 4.0f0 with 2 and 4 * Use a single elixir to test EC and EC+LLF * Removed duplicated code in the outer constructor for @reset * Renamed AbstractIdealMhdMultiIonEquations to AbstractIdealGlmMhdMultiIonEquations * GLM callback dispatches on AbstractIdealGlmMhdMultiIonEquations * Moved routines that will be used by all AbstractIdealGlmMhdMultiIonEquations from ideal_glm_mhd_multiion_2d.jl into ideal_glm_mhd_multiion.jl * Apply suggestions from code review Co-authored-by: Hendrik Ranocha <[email protected]> Co-authored-by: Michael Schlottke-Lakemper <[email protected]> * Apply suggestions from code review Co-authored-by: Hendrik Ranocha <[email protected]> * Added appropriate formatting to admonitions in docstrings * Apply suggestions from code review Co-authored-by: Michael Schlottke-Lakemper <[email protected]> * Make multi-ion GLM-MHD's initial condition initial_condition_weak_blast_wave compatible with single precision * Replaced divisions with multiplications * Changed code order... * Unexport get_component * Replace division with multiplication * Added unit tests for type stability * Added experimental admonitions * Update src/equations/ideal_glm_mhd_multiion_2d.jl * Apply suggestions from code review --------- Co-authored-by: Hendrik Ranocha <[email protected]> Co-authored-by: Michael Schlottke-Lakemper <[email protected]>
- Loading branch information
1 parent
721624b
commit 1488a74
Showing
10 changed files
with
1,401 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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,61 @@ | ||
|
||
using OrdinaryDiffEq | ||
using Trixi | ||
|
||
############################################################################### | ||
# semidiscretization of the ideal multi-ion MHD equations | ||
equations = IdealGlmMhdMultiIonEquations2D(gammas = (1.4, 1.667), | ||
charge_to_mass = (1.0, 2.0)) | ||
|
||
initial_condition = initial_condition_weak_blast_wave | ||
|
||
volume_flux = (flux_ruedaramirez_etal, flux_nonconservative_ruedaramirez_etal) | ||
surface_flux = (flux_ruedaramirez_etal, flux_nonconservative_ruedaramirez_etal) | ||
solver = DGSEM(polydeg = 3, surface_flux = surface_flux, | ||
volume_integral = VolumeIntegralFluxDifferencing(volume_flux)) | ||
|
||
coordinates_min = (-2.0, -2.0) | ||
coordinates_max = (2.0, 2.0) | ||
mesh = TreeMesh(coordinates_min, coordinates_max, | ||
initial_refinement_level = 4, | ||
n_cells_max = 10_000) | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, | ||
source_terms = source_terms_lorentz) | ||
|
||
############################################################################### | ||
# ODE solvers, callbacks etc. | ||
|
||
tspan = (0.0, 0.4) | ||
ode = semidiscretize(semi, tspan) | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_interval = 10 | ||
analysis_callback = AnalysisCallback(semi, interval = analysis_interval) | ||
alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
||
save_solution = SaveSolutionCallback(dt = 0.1, # interval=100, | ||
save_initial_solution = true, | ||
save_final_solution = true, | ||
solution_variables = cons2prim) | ||
|
||
cfl = 0.5 | ||
|
||
stepsize_callback = StepsizeCallback(cfl = cfl) | ||
|
||
glm_speed_callback = GlmSpeedCallback(glm_scale = 0.5, cfl = cfl) | ||
|
||
callbacks = CallbackSet(summary_callback, | ||
analysis_callback, alive_callback, | ||
save_solution, | ||
stepsize_callback, | ||
glm_speed_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); | ||
summary_callback() # print the timer summary |
This file contains 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 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 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 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.