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

WIP: Taal #187

Merged
merged 66 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
82f13f2
WIP: Taal
ranocha Sep 15, 2020
51586d3
WIP: Taal
ranocha Sep 16, 2020
9792c47
WIP: Taal
ranocha Sep 17, 2020
51459bb
WIP: Taal
ranocha Sep 17, 2020
6db0974
Taal: first working setup of examples/2d/parameters.jl with rudimenta…
ranocha Sep 17, 2020
e2d1b59
better condition for last step in AnalysisCallback
ranocha Sep 17, 2020
77d5c2c
fix 2D AMR
ranocha Sep 18, 2020
5821507
fix failing amnual test
ranocha Sep 18, 2020
cfdc01d
AliveCallback
ranocha Sep 18, 2020
7a72f9b
Taal: integrate and some more analysis routines
ranocha Sep 18, 2020
5c34cdc
Merge branch 'master' into hr/taal
ranocha Sep 19, 2020
fce1174
refactor analysis errors/integrals
ranocha Sep 19, 2020
0bdca05
set [compat] entries for examples
ranocha Sep 21, 2020
775c114
Taal: 2D split form without nonconservative terms
ranocha Sep 21, 2020
ed3c9ce
Taal, L2 mortars in 2D
ranocha Sep 21, 2020
06a6c8f
Taal: stepsize callback (2D)
ranocha Sep 22, 2020
18bae6b
Merge branch 'master' into hr/taal
ranocha Sep 22, 2020
0436fd2
Taal, SaveSolutionCallback
ranocha Sep 22, 2020
11f40fa
WIP: Taal, AMRCallback in 2D; need to decide and design [ci skip]
ranocha Sep 22, 2020
1da21e9
introduce wrap_array
ranocha Sep 23, 2020
e392b91
test Taal examples
ranocha Sep 23, 2020
9e66aef
structure Taal test output
ranocha Sep 23, 2020
f9294eb
add OrdinaryDiffEq as test dependency
ranocha Sep 23, 2020
91d81ac
Taal: test displaying components
ranocha Sep 23, 2020
24d8e6a
WIP: Taal, designing AMR indicators etc.
ranocha Sep 23, 2020
26d3b6d
Semidiscretization -> semi::SemidiscretizationHyperbolic
ranocha Sep 23, 2020
ea8d818
more printing tests
ranocha Sep 23, 2020
3cf584e
WIP: Taal, Jeans instability; TODO: source terms
ranocha Sep 23, 2020
d349a8d
Taal, first draft of source terms
ranocha Sep 24, 2020
f0860e6
Taal, Jeans instability; TODO: additional analysis quantities
ranocha Sep 24, 2020
fd479e3
Taal, Jeans instability with additional analysis quantities
ranocha Sep 24, 2020
cbfc680
Taal, saving solutions specific for SemidiscretizationEulerGravity
ranocha Sep 24, 2020
13b38af
Merge branch 'master' into hr/taal
ranocha Sep 24, 2020
5dad1ac
Taal: SumaryCallback
ranocha Sep 24, 2020
12c24c1
Taal: add TODO note [ci skip]
ranocha Sep 24, 2020
fb1b0ce
WIP: Taal, minor revisions based on comments of @sloeade and working …
ranocha Sep 24, 2020
094bce3
document floating point comparison in AliveCallback [ci skip]
ranocha Sep 24, 2020
de3c87b
Taal, WIP: AMR. TODO: debug ERROR: LoadError: AssertionError: bad cel…
ranocha Sep 24, 2020
2ef27f4
WIP: Taal, more output and debugging [ci skip]
ranocha Sep 25, 2020
057cc04
WIP: Taal, debugging AMR [ci skip]
ranocha Sep 25, 2020
6475605
WIP: Taal, debugging AMR [ci skip]
ranocha Sep 25, 2020
0aa2642
WIP: Taal, debugging AMR [ci skip]
ranocha Sep 25, 2020
1b09a0a
Taal: AMR works, need to adapt AMR for Euler+gravity
ranocha Sep 25, 2020
c5b3f4c
Taal: motivate/document wrap_array and use suffix _ode for un-wrapped…
ranocha Sep 26, 2020
6531e5f
Taal: shock-capturing; TODO: add tests, unify cache structure of indi…
ranocha Sep 27, 2020
ed902ce
Taal, test shock capturing
ranocha Sep 27, 2020
6fcacee
unify indicator interface for AMR and shock-capturing
ranocha Sep 28, 2020
8b40322
unify order of equations, basis similar to equations, solver
ranocha Sep 28, 2020
912316b
WIP: debug AMR
ranocha Sep 29, 2020
45ffc8e
Taal: refactor element variables for IO
ranocha Sep 29, 2020
0ffe9bb
WIP: AMRparameters_blast_wave_shockcapturing_amr.jl, non-reproducible…
ranocha Sep 29, 2020
82e9b74
WIP: parameters_blast_wave_shockcapturing_amr.jl, non-reproducible cr…
ranocha Sep 29, 2020
bb4bdae
WIP: parameters_blast_wave_shockcapturing_amr.jl, non-reproducible cr…
ranocha Sep 29, 2020
0e21797
Taal: Fix AMR; TODO: new test values require https://github.com/SciML…
ranocha Sep 30, 2020
e23a3c0
Taal: More documentation; restructured some parts
ranocha Sep 30, 2020
d268d9e
update AMR parameters of examples/2d/parameters_blast_wave_shockcaptu…
ranocha Sep 30, 2020
4b30990
Taal: migrate BC stuff
ranocha Sep 30, 2020
8009354
Taal: first support for MHD
ranocha Sep 30, 2020
04fd67f
Travis: also for dev and not on Julia nightly anymore
ranocha Oct 1, 2020
0042323
mention SciML ecosyste or ODEs in README [ci skip]
ranocha Oct 1, 2020
2c4f1cc
some more TODO notes [ci skip]
ranocha Oct 1, 2020
8f7523d
Merge branch 'master' into hr/taal
ranocha Oct 2, 2020
d1a6810
Taal: AMR for Euler with self-gravity and cleanup
ranocha Oct 2, 2020
24611d4
improve analysis using du
ranocha Oct 2, 2020
63b9fa4
update version requirement for OrdinaryDiffEq
ranocha Oct 4, 2020
abd7087
more printing tests
ranocha Oct 4, 2020
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
2 changes: 1 addition & 1 deletion .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} # optional
run: julia -e 'using CompatHelper; CompatHelper.main(; subdirs = ["", "test", "docs"])'
run: julia -e 'using CompatHelper; CompatHelper.main(; subdirs=["", "docs", "examples", "test"])'
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*.avi
*.ogv
**/Manifest.toml
out/
out*/
sloede marked this conversation as resolved.
Show resolved Hide resolved
docs/build
public/
coverage/
Expand Down
6 changes: 5 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name = "Trixi"
uuid = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb"
authors = ["Michael Schlottke-Lakemper <[email protected]>", "Gregor Gassner <[email protected]>", "Hendrik Ranocha <[email protected]>", "Andrew R. Winters <[email protected]>"]
version = "0.2.6-pre"
version = "0.3.0-pre"

[deps]
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def"
EllipsisNotation = "da5c29d0-fa7d-589e-88eb-ea29b0a81949"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand All @@ -19,6 +21,8 @@ Tullio = "bc48ee85-29a4-5162-ae0b-a64e1601d4bc"
UnPack = "3a884ed6-31ef-47d7-9d2a-63182c4928ed"

[compat]
DiffEqBase = "6.47"
DiffEqCallbacks = "2.14"
EllipsisNotation = "0.4"
HDF5 = "0.13"
LinearMaps = "2.7"
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ installation and postprocessing procedures. Its features include:
* Kinetic energy-preserving and entropy-stable split forms
* Entropy-stable shock capturing
* Positivity-preserving limiting
* Explicit low-storage Runge-Kutta time integration
* Compatible with the [SciML ecosystem for ordinary differential equations](https://diffeq.sciml.ai/latest/)
* [Explicit low-storage Runge-Kutta time integration](https://diffeq.sciml.ai/latest/solvers/ode_solve/#Explicit-Strong-Stability-Preserving-Runge-Kutta-Methods-for-Hyperbolic-PDEs-(Conservation-Laws))
* [Strong stability preserving methods](https://diffeq.sciml.ai/latest/solvers/ode_solve/#Low-Storage-Methods)
* CFL-based and error-based time step control
sloede marked this conversation as resolved.
Show resolved Hide resolved
* Square/cubic domains with periodic and weakly-enforced boundary conditions
* Multiple governing equations:
* Compressible Euler equations
Expand Down
99 changes: 99 additions & 0 deletions examples/2d/jeans_instability.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@

using OrdinaryDiffEq
using Trixi

###############################################################################
# semidiscretization of the compressible Euler equations
gamma = 5/3
equations_euler = CompressibleEulerEquations2D(gamma)

# TODO: Taal, define initial_conditions_jeans_instability here for Euler
initial_conditions = Trixi.initial_conditions_jeans_instability

polydeg = 3
solver_euler = DGSEM(polydeg, flux_hll)

coordinates_min = (0, 0)
coordinates_max = (1, 1)
mesh = TreeMesh(coordinates_min, coordinates_max,
initial_refinement_level=4,
n_cells_max=10_000)

semi_euler = SemidiscretizationHyperbolic(mesh, equations_euler, initial_conditions, solver_euler)


###############################################################################
# semidiscretization of the hyperbolic diffusion equations
resid_tol = 1.0e-4
equations_gravity = HyperbolicDiffusionEquations2D(resid_tol)

# TODO: Taal, define initial_conditions_jeans_instability here for gravity

solver_gravity = DGSEM(polydeg, flux_lax_friedrichs)

semi_gravity = SemidiscretizationHyperbolic(mesh, equations_gravity, initial_conditions, solver_gravity,
source_terms=source_terms_harmonic)


###############################################################################
# combining both semidiscretizations for Euler + self-gravity
parameters = ParametersEulerGravity(background_density=1.5e7, # aka rho0
gravitational_constant=6.674e-8, # aka G
cfl=2.4,
n_iterations_max=1000,
timestep_gravity=timestep_gravity_erk52_3Sstar!)

semi = SemidiscretizationEulerGravity(semi_euler, semi_gravity, parameters)
ranocha marked this conversation as resolved.
Show resolved Hide resolved


###############################################################################
# ODE solvers, callbacks etc.
tspan = (0.0, 5.0)
ode = semidiscretize(semi, tspan);

summary_callback = SummaryCallback()

stepsize_callback = StepsizeCallback(cfl=1.0)

save_solution = SaveSolutionCallback(interval=10,
save_initial_solution=true,
save_final_solution=true,
solution_variables=:primitive)
# TODO: Taal, IO
# restart_interval = 10

analysis_interval = 100
alive_callback = AliveCallback(analysis_interval=analysis_interval)

Trixi.pretty_form_repl(::Val{:energy_potential}) = "∑e_potential"
Trixi.pretty_form_file(::Val{:energy_potential}) = "e_potential"

function Trixi.analyze(::Val{:energy_potential}, du, u_euler, t, semi::SemidiscretizationEulerGravity)

u_gravity = Trixi.wrap_array(semi.cache.u_ode, semi.semi_gravity)

mesh, equations_euler, dg, cache = Trixi.mesh_equations_solver_cache(semi.semi_euler)
_, equations_gravity, _, _ = Trixi.mesh_equations_solver_cache(semi.semi_gravity)

e_potential = Trixi.integrate(mesh, equations_euler, dg, cache, u_euler, equations_gravity, u_gravity) do u, i, j, element, equations_euler, dg, equations_gravity, u_gravity
u_euler_local = Trixi.get_node_vars(u_euler, equations_euler, dg, i, j, element)
u_gravity_local = Trixi.get_node_vars(u_gravity, equations_gravity, dg, i, j, element)
# OBS! subtraction is specific to Jeans instability test where rho0 = 1.5e7
return (u_euler_local[1] - 1.5e7) * u_gravity_local[1]
end
return e_potential
end

analysis_callback = AnalysisCallback(semi_euler, interval=analysis_interval,
save_analysis=true,
extra_analysis_integrals=(entropy, energy_total, energy_kinetic, energy_internal, Val(:energy_potential)))

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


###############################################################################
# run the simulation
sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false), dt=stepsize_callback(ode),
save_everystep=false, callback=callbacks);
summary_callback() # print the timer summary
println("Number of gravity subcycles: ", semi.gravity_counter.ncalls_since_readout)
61 changes: 61 additions & 0 deletions examples/2d/parameters.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# TODO: Taal refactor, rename to
# - linear_advection.jl
# - advection_basic.jl
# or something similar? parameters.jl isn't really helpful...

using OrdinaryDiffEq
using Trixi

###############################################################################
# semidiscretization of the linear advection equation

advectionvelocity = (1.0, 1.0)
# advectionvelocity = (0.2, -0.3)
equations = LinearScalarAdvectionEquation2D(advectionvelocity)

initial_conditions = initial_conditions_convergence_test

surface_flux = flux_lax_friedrichs
solver = DGSEM(3, surface_flux)

coordinates_min = (-1, -1)
coordinates_max = ( 1, 1)
mesh = TreeMesh(coordinates_min, coordinates_max,
initial_refinement_level=4,
n_cells_max=30_000)


semi = SemidiscretizationHyperbolic(mesh, equations, initial_conditions, solver)


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

tspan = (0.0, 1.0)
ode = semidiscretize(semi, tspan);

summary_callback = SummaryCallback()

stepsize_callback = StepsizeCallback(cfl=1.6)

save_solution = SaveSolutionCallback(interval=100,
save_initial_solution=true,
save_final_solution=true,
solution_variables=:conservative)
# TODO: Taal, IO
# restart_interval = 10

analysis_interval = 100
alive_callback = AliveCallback(analysis_interval=analysis_interval)
analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
extra_analysis_integrals=(entropy, energy_total))

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


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

sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false), dt=stepsize_callback(ode),
save_everystep=false, callback=callbacks);
summary_callback() # print the timer summary
71 changes: 71 additions & 0 deletions examples/2d/parameters_amr.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# TODO: Taal refactor, rename to
# - linear_advection_amr.jl
# - advection_amr.jl
# or something similar?

using OrdinaryDiffEq
using Trixi

###############################################################################
# semidiscretization of the linear advection equation

advectionvelocity = (1.0, 1.0)
# advectionvelocity = (0.2, -0.3)
equations = LinearScalarAdvectionEquation2D(advectionvelocity)

initial_conditions = initial_conditions_gauss

surface_flux = flux_lax_friedrichs
solver = DGSEM(3, surface_flux)

coordinates_min = (-5, -5)
coordinates_max = ( 5, 5)
mesh = TreeMesh(coordinates_min, coordinates_max,
initial_refinement_level=4,
n_cells_max=30_000)


semi = SemidiscretizationHyperbolic(mesh, equations, initial_conditions, solver)


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

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

summary_callback = SummaryCallback()

amr_indicator = IndicatorThreeLevel(semi, IndicatorMax(semi),
base_level=4,
med_level=5, med_threshold=0.1,
max_level=6, max_threshold=0.6)
amr_callback = AMRCallback(semi, amr_indicator,
interval=5,
adapt_initial_conditions=true,
adapt_initial_conditions_only_refine=true)

stepsize_callback = StepsizeCallback(cfl=1.6)

save_solution = SaveSolutionCallback(interval=100,
save_initial_solution=true,
save_final_solution=true,
solution_variables=:primitive)
# TODO: Taal, IO
# restart_interval = 10

analysis_interval = 100
alive_callback = AliveCallback(analysis_interval=analysis_interval)
analysis_callback = AnalysisCallback(semi, interval=analysis_interval,
extra_analysis_integrals=(entropy,))

# TODO: Taal decide, first AMR or save solution etc.
callbacks = CallbackSet(summary_callback, amr_callback, stepsize_callback, save_solution, analysis_callback, alive_callback);


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

sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false), dt=stepsize_callback(ode),
save_everystep=false, callback=callbacks);
summary_callback() # print the timer summary
65 changes: 65 additions & 0 deletions examples/2d/parameters_blast_wave_shockcapturing.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# TODO: Taal refactor, rename to
# - euler_blast_wave_shockcapturing.jl
# or something similar?

using OrdinaryDiffEq
using Trixi

###############################################################################
# semidiscretization of the compressible Euler equations

equations = CompressibleEulerEquations2D(1.4)

initial_conditions = initial_conditions_blast_wave

surface_flux = flux_lax_friedrichs
volume_flux = flux_chandrashekar
basis = LobattoLegendreBasis(3)
indicator_sc = IndicatorHennemannGassner(equations, basis,
alpha_max=0.5,
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(basis, surface_flux, volume_integral)

coordinates_min = (-2, -2)
coordinates_max = ( 2, 2)
mesh = TreeMesh(coordinates_min, coordinates_max,
initial_refinement_level=6,
n_cells_max=10_000)


semi = SemidiscretizationHyperbolic(mesh, equations, initial_conditions, solver)


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

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

summary_callback = SummaryCallback()

stepsize_callback = StepsizeCallback(cfl=1.0)

save_solution = SaveSolutionCallback(interval=100,
save_initial_solution=true,
save_final_solution=true,
solution_variables=:primitive)

analysis_interval = 100
alive_callback = AliveCallback(analysis_interval=analysis_interval)
analysis_callback = AnalysisCallback(semi, interval=analysis_interval)

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


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

sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false), dt=stepsize_callback(ode),
save_everystep=false, callback=callbacks);
summary_callback() # print the timer summary
2 changes: 1 addition & 1 deletion examples/2d/parameters_blast_wave_shockcapturing.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ initial_refinement_level = 6
####################################################################################################
# I/O
# save_initial_solution = false
solution_interval = 10
solution_interval = 100
solution_variables = "primitive"
restart_interval = 0
Loading