-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add getter for number of dofs * change trixi_load_cell_average add parameter index and only get averaged of the variable at position index * fix: ensure Int32 * adapt reference value * add getter for all dofs values * adapt next value * add trixi_store_in_database proof of concept for creating data vectors in libelixirs which can be filled later by external applications * add trixi_ndofs_element * add tests * add missing parts in tests * fix tests * deallocate first * add trixi_load_prim to Fortran API * reference value * get doxygen right * add trixi_get_time, trixi_load_node_coordinates required in this PR, subject to change * implement source terms controller demonstrates source terms via database * libelixir with source terms via database * change Array to Vector * spelling * libelixir for baroclinic instability * remove method only required by steady state correction * Update LibTrixi.jl/examples/libelixir_p4est3d_euler_baroclinic_instability.jl Co-authored-by: Michael Schlottke-Lakemper <[email protected]> * make everything more consistent! * use const double * * missed merge conflict * transpose calloc args * add functions to get quadrature information * update CI badge URL * remove load_node_coordinates * add baroclinic instability elixir and controller * fix * clean up * add get_t8code_forest to Fortran interface * format * add trixi_store_in_database to Fortran interface * add fortran controller for baroclinic test case * remove parameter t was not used and cause either omitted parameter error or unused parameter warning using older GCCs * spelling * adapt min version according to main CMakeLists.txt * missed while merging * change default argument for DataBase parameter * remove deprecated export * test for get_time * add tests for trixi_store_in_database * need Int32 * cannot compare Refs * check based on address * relax error tolerance * remove deprecated example * new cubed sphere examples * remove deprecated libelixir * unify naming of libelixirs * fixes * adapt index.md to README.md * change to non-adaptive time integrator * missing controlers in ci checks * use zeros in initial data * missing renamings * time not needed anymore * tuned simulation parameters * itree and ielement need to be 0-based * one more to free * ouch... * less output * typo in docstring * adopt new t8code ForestWrapper * switch to newest t8code release * cubed sphere stuff only works with latest Trixi release * missed renaming * enable t8code for package compiler as well * review * filter out baroclinic example --------- Co-authored-by: Michael Schlottke-Lakemper <[email protected]> Co-authored-by: Benedict <[email protected]> Co-authored-by: Benedict Geihe <[email protected]>
- Loading branch information
1 parent
5131626
commit 0e0ea3d
Showing
23 changed files
with
620 additions
and
258 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
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
File renamed without changes.
File renamed without changes.
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
124 changes: 124 additions & 0 deletions
124
LibTrixi.jl/examples/libelixir_t8code3d_euler_tracer.jl
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,124 @@ | ||
# A manufactured solution of a circular wind with constant angular velocity | ||
# on a planetary-sized cubed sphere mesh with a blob detected by AMR | ||
# | ||
# Note that this libelixir is based on an elixir by Erik Faulhaber for Trixi.jl | ||
# Source: https://github.com/trixi-framework/Trixi.jl/blob/main/examples/p4est_3d_dgsem/elixir_euler_circular_wind_nonconforming.jl | ||
|
||
using OrdinaryDiffEq | ||
using Trixi | ||
using LinearAlgebra | ||
using LibTrixi | ||
|
||
|
||
function initial_condition_circular_wind(x, t, equations::CompressibleEulerEquations3D) | ||
radius_earth = 6.371229e6 | ||
lambda, phi, r = cart_to_sphere(x) | ||
|
||
p = 1e5 | ||
v1 = -10 * x[2] / radius_earth | ||
v2 = 10 * x[1] / radius_earth | ||
v3 = 0.0 | ||
rho = 1.0 + 0.1 * exp(-50 * ((lambda-1.0)^2/2.0 + (phi-0.4)^2)) + | ||
0.08 * exp(-100 * ((lambda-0.8)^2/4.0 + (phi-0.5)^2)) | ||
|
||
return prim2cons(SVector(rho, v1, v2, v3, p), equations) | ||
end | ||
|
||
@inline function source_terms_circular_wind(u, x, t, | ||
equations::CompressibleEulerEquations3D) | ||
radius_earth = 6.371229e6 | ||
rho = u[1] | ||
|
||
du1 = 0.0 | ||
du2 = -rho * (10 / radius_earth) * (10 * x[1] / radius_earth) | ||
du3 = -rho * (10 / radius_earth) * (10 * x[2] / radius_earth) | ||
du4 = 0.0 | ||
du5 = 0.0 | ||
|
||
return SVector(du1, du2, du3, du4, du5) | ||
end | ||
|
||
function cart_to_sphere(x) | ||
r = norm(x) | ||
lambda = atan(x[2], x[1]) | ||
if lambda < 0 | ||
lambda += 2 * pi | ||
end | ||
phi = asin(x[3] / r) | ||
|
||
return lambda, phi, r | ||
end | ||
|
||
|
||
# The function to create the simulation state needs to be named `init_simstate` | ||
function init_simstate() | ||
|
||
# compressible Euler equations | ||
gamma = 1.4 | ||
equations = CompressibleEulerEquations3D(gamma) | ||
|
||
# setup of the problem | ||
initial_condition = initial_condition_circular_wind | ||
|
||
boundary_conditions = Dict(:inside => boundary_condition_slip_wall, | ||
:outside => boundary_condition_slip_wall) | ||
|
||
# estimate for speed of sound | ||
surface_flux = FluxLMARS(374) | ||
solver = DGSEM(polydeg = 3, surface_flux = surface_flux) | ||
|
||
# increase trees_per_cube_face to 4 to get nicer results | ||
lat_lon_levels = 2 | ||
layers = 1 | ||
mesh = Trixi.T8codeMeshCubedSphere(lat_lon_levels, layers, 6.371229e6, 30000.0, | ||
polydeg = 3, initial_refinement_level = 0) | ||
|
||
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver, | ||
source_terms = source_terms_circular_wind, | ||
boundary_conditions = boundary_conditions) | ||
|
||
# increase number of days | ||
days = 0.1 | ||
tspan = (0.0, days * 24 * 60 * 60.0) | ||
|
||
ode = semidiscretize(semi, tspan) | ||
|
||
summary_callback = SummaryCallback() | ||
|
||
analysis_interval = 5000 | ||
analysis_callback = AnalysisCallback(semi, interval = analysis_interval) | ||
|
||
alive_callback = AliveCallback(analysis_interval = analysis_interval) | ||
|
||
save_solution = SaveSolutionCallback(interval = 2000, | ||
save_initial_solution = true, | ||
save_final_solution = true, | ||
solution_variables = cons2prim, | ||
output_directory = "out_tracer") | ||
|
||
amr_controller = ControllerThreeLevel(semi, IndicatorMax(semi, variable = first), | ||
base_level = 0, | ||
med_level = 1, med_threshold = 1.004, | ||
max_level = 3, max_threshold = 1.11) | ||
|
||
amr_callback = AMRCallback(semi, amr_controller, | ||
interval = 2000, | ||
adapt_initial_condition = true, | ||
adapt_initial_condition_only_refine = true) | ||
|
||
callbacks = CallbackSet(summary_callback, | ||
analysis_callback, | ||
alive_callback, | ||
amr_callback, | ||
save_solution) | ||
|
||
# use a Runge-Kutta method with automatic (error based) time step size control | ||
integrator = init(ode, RDPK3SpFSAL49(thread = OrdinaryDiffEq.False()); | ||
abstol = 1.0e-6, reltol = 1.0e-6, | ||
ode_default_options()..., callback = callbacks, maxiters=1e7); | ||
|
||
# create simulation state | ||
simstate = SimulationState(semi, integrator) | ||
|
||
return simstate | ||
end |
File renamed without changes.
Oops, something went wrong.