Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into TrixiSW-separation
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickersing committed Feb 1, 2024
2 parents 1d3e112 + dfd632e commit 09893bf
Show file tree
Hide file tree
Showing 105 changed files with 2,502 additions and 765 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ for human readability.
- `flux_hllc` on non-cartesian meshes for `CompressibleEulerEquations{2,3}D`
- Different boundary conditions for quad/hex meshes in Abaqus format, even if not generated by HOHQMesh,
can now be digested by Trixi in 2D and 3D.
- Subcell (positivity) limiting support for nonlinear variables in 2D for `TreeMesh`

## Changes when updating to v0.6 from v0.5.x

Expand Down
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
EllipsisNotation = "da5c29d0-fa7d-589e-88eb-ea29b0a81949"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
Expand Down Expand Up @@ -57,6 +58,7 @@ ConstructionBase = "1.3"
DataStructures = "0.18.15"
DiffEqBase = "6 - 6.143"
DiffEqCallbacks = "2.25"
Downloads = "1.6"
EllipsisNotation = "1.0"
FillArrays = "0.13.2, 1"
ForwardDiff = "0.10.18"
Expand Down
9 changes: 3 additions & 6 deletions benchmark/elixir_2d_euler_vortex_unstructured.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -49,11 +48,9 @@ end
initial_condition = initial_condition_isentropic_vortex
solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs)

default_mesh_file = joinpath(@__DIR__, "mesh_uniform_cartesian.mesh")
isfile(default_mesh_file) ||
download("https://gist.githubusercontent.com/ranocha/f4ea19ba3b62348968c971db43d7798b/raw/a506abb9479c020920cf6068c142670fc1a9aadc/mesh_uniform_cartesian.mesh",
default_mesh_file)
mesh_file = default_mesh_file
mesh_file = Trixi.download("https://gist.githubusercontent.com/ranocha/f4ea19ba3b62348968c971db43d7798b/raw/a506abb9479c020920cf6068c142670fc1a9aadc/mesh_uniform_cartesian.mesh",
joinpath(@__DIR__, "mesh_uniform_cartesian.mesh"))

mesh = UnstructuredMesh2D(mesh_file, periodicity = true)

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)
Expand Down
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ makedocs(
],
"Time integration" => "time_integration.md",
"Callbacks" => "callbacks.md",
"Coupling" => "multi-physics_coupling.md"
],
"Advanced topics & developers" => [
"Conventions" =>"conventions.md",
Expand Down
46 changes: 46 additions & 0 deletions docs/src/multi-physics_coupling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# [Multi-physics coupling](@id multi-physics-coupling)
A complex simulation can consist of different spatial domains in which
different equations are being solved, different numerical methods being used
or the grid structure is different.
One example would be a fluid in a tank and an extended hot plate attached to it.
We would then like to solve the Navier-Stokes equations in the fluid domain
and the heat conduction equations in the plate.
The coupling would happen at the interface through the exchange of thermal energy.


## Converter coupling
It may happen that the two systems to be coupled do not share any variables, but
share some of the physics.
In such a situation, the same physics is just represented in a different form and with
a different set of variables.
This is the case, for instance assuming two domains, if there is a fluid system in one domain
and a Vlasov system in the other domain.
In that case we would have variables representing distribution functions of
the Vlasov system on one side and variables representing the mechanical quantities, like density,
of the fluid system.
To translate the fields from one description to the other one needs to use
converter functions.
These functions need to be hand tailored by the user in the elixir file where each
pair of coupled systems requires two coupling functions, one for each direction.

In the general case, we have a system $A$ with $m$ variables
$u_{A,i}, \: i = 1, \dots, m$ and another
system $B$ with $n$ variables $u_{B,j}, \: j = 1, \dots, n$.
We then define two coupling functions, one that transforms $u_A$ into $u_B$
and one that goes the other way.

In their minimal form they take the position vector $x$, state vector $u$
and the equations of the two coupled systems
and return the transformed variables.
By passing the equations we can make use of their parameters, if they are required.
Examples can be seen in `examples/structured_2d_dgsem/elixir_advection_coupled.jl`.


## Warning about binary compatibility
Currently the coordinate values on the nodes can differ by machine precision when
simulating the mesh and when splitting the mesh in multiple domains.
This is an issue coming from the coordinate interpolation on the nodes.
As a result, running a simulation in a single system and in two coupled domains
may result in a difference of the order of the machine precision.
While this is not an issue for most practical problems, it is best to keep this in mind when comparing test runs.

9 changes: 2 additions & 7 deletions examples/dgmulti_2d/elixir_euler_hohqmesh.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -30,12 +29,8 @@ dg = DGMulti(polydeg = 8, element_type = Quad(), approximation_type = SBP(),

###############################################################################
# Get the curved quad mesh from a file (downloads the file if not available locally)

default_mesh_file = joinpath(@__DIR__, "mesh_trixi_unstructured_mesh_docs.mesh")
isfile(default_mesh_file) ||
download("https://gist.githubusercontent.com/andrewwinters5000/52056f1487853fab63b7f4ed7f171c80/raw/9d573387dfdbb8bce2a55db7246f4207663ac07f/mesh_trixi_unstructured_mesh_docs.mesh",
default_mesh_file)
mesh_file = default_mesh_file
mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000/52056f1487853fab63b7f4ed7f171c80/raw/9d573387dfdbb8bce2a55db7246f4207663ac07f/mesh_trixi_unstructured_mesh_docs.mesh",
joinpath(@__DIR__, "mesh_trixi_unstructured_mesh_docs.mesh"))

mesh = DGMultiMesh(dg, mesh_file)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -31,10 +30,8 @@ Trixi.validate_faces(faces)
mapping_flag = Trixi.transfinite_mapping(faces)

# Unstructured mesh with 24 cells of the square domain [-1, 1]^n
mesh_file = joinpath(@__DIR__, "square_unstructured_2.inp")
isfile(mesh_file) ||
download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
mesh_file)
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
joinpath(@__DIR__, "square_unstructured_2.inp"))

mesh = P4estMesh{2}(mesh_file, polydeg = 3,
mapping = mapping_flag,
Expand Down
7 changes: 2 additions & 5 deletions examples/p4est_2d_dgsem/elixir_advection_unstructured_flag.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -29,10 +28,8 @@ Trixi.validate_faces(faces)
mapping_flag = Trixi.transfinite_mapping(faces)

# Unstructured mesh with 24 cells of the square domain [-1, 1]^n
mesh_file = joinpath(@__DIR__, "square_unstructured_2.inp")
isfile(mesh_file) ||
download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
mesh_file)
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
joinpath(@__DIR__, "square_unstructured_2.inp"))

mesh = P4estMesh{2}(mesh_file, polydeg = 3,
mapping = mapping_flag,
Expand Down
7 changes: 2 additions & 5 deletions examples/p4est_2d_dgsem/elixir_euler_blast_wave_amr.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -50,10 +49,8 @@ volume_integral = VolumeIntegralShockCapturingHG(indicator_sc;
solver = DGSEM(basis, surface_flux, volume_integral)

# Unstructured mesh with 48 cells of the square domain [-1, 1]^n
mesh_file = joinpath(@__DIR__, "square_unstructured_1.inp")
isfile(mesh_file) ||
download("https://gist.githubusercontent.com/efaulhaber/a075f8ec39a67fa9fad8f6f84342cbca/raw/a7206a02ed3a5d3cadacd8d9694ac154f9151db7/square_unstructured_1.inp",
mesh_file)
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/a075f8ec39a67fa9fad8f6f84342cbca/raw/a7206a02ed3a5d3cadacd8d9694ac154f9151db7/square_unstructured_1.inp",
joinpath(@__DIR__, "square_unstructured_1.inp"))

mesh = P4estMesh{2}(mesh_file, polydeg = 3, initial_refinement_level = 1)

Expand Down
8 changes: 2 additions & 6 deletions examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -99,11 +98,8 @@ solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
volume_integral = volume_integral)

# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "abaqus_double_mach.inp")
isfile(default_mesh_file) ||
download("https://gist.githubusercontent.com/andrewwinters5000/a0806ef0d03cf5ea221af523167b6e32/raw/61ed0eb017eb432d996ed119a52fb041fe363e8c/abaqus_double_mach.inp",
default_mesh_file)
mesh_file = default_mesh_file
mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000/a0806ef0d03cf5ea221af523167b6e32/raw/61ed0eb017eb432d996ed119a52fb041fe363e8c/abaqus_double_mach.inp",
joinpath(@__DIR__, "abaqus_double_mach.inp"))

mesh = P4estMesh{2}(mesh_file)

Expand Down
8 changes: 2 additions & 6 deletions examples/p4est_2d_dgsem/elixir_euler_forward_step_amr.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -104,11 +103,8 @@ solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
volume_integral = volume_integral)

# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "abaqus_forward_step.inp")
isfile(default_mesh_file) ||
download("https://gist.githubusercontent.com/andrewwinters5000/b346ee6aa5446687f128eab8b37d52a7/raw/cd1e1d43bebd8d2631a07caec45585ec8456ca4c/abaqus_forward_step.inp",
default_mesh_file)
mesh_file = default_mesh_file
mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000/b346ee6aa5446687f128eab8b37d52a7/raw/cd1e1d43bebd8d2631a07caec45585ec8456ca4c/abaqus_forward_step.inp",
joinpath(@__DIR__, "abaqus_forward_step.inp"))

mesh = P4estMesh{2}(mesh_file)

Expand Down
7 changes: 2 additions & 5 deletions examples/p4est_2d_dgsem/elixir_euler_free_stream.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -31,10 +30,8 @@ end
# Get the uncurved mesh from a file (downloads the file if not available locally)

# Unstructured mesh with 48 cells of the square domain [-1, 1]^n
mesh_file = joinpath(@__DIR__, "square_unstructured_1.inp")
isfile(mesh_file) ||
download("https://gist.githubusercontent.com/efaulhaber/a075f8ec39a67fa9fad8f6f84342cbca/raw/a7206a02ed3a5d3cadacd8d9694ac154f9151db7/square_unstructured_1.inp",
mesh_file)
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/a075f8ec39a67fa9fad8f6f84342cbca/raw/a7206a02ed3a5d3cadacd8d9694ac154f9151db7/square_unstructured_1.inp",
joinpath(@__DIR__, "square_unstructured_1.inp"))

# Map the unstructured mesh with the mapping above
mesh = P4estMesh{2}(mesh_file, polydeg = 3, mapping = mapping, initial_refinement_level = 1)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -31,10 +30,8 @@ mapping_flag = Trixi.transfinite_mapping(faces)

# Get the uncurved mesh from a file (downloads the file if not available locally)
# Unstructured mesh with 24 cells of the square domain [-1, 1]^n
mesh_file = joinpath(@__DIR__, "square_unstructured_2.inp")
isfile(mesh_file) ||
download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
mesh_file)
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
joinpath(@__DIR__, "square_unstructured_2.inp"))

mesh = P4estMesh{2}(mesh_file, polydeg = 3,
mapping = mapping_flag,
Expand Down
8 changes: 2 additions & 6 deletions examples/p4est_2d_dgsem/elixir_euler_supersonic_cylinder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#
# Keywords: supersonic flow, shock capturing, AMR, unstructured curved mesh, positivity preservation, compressible Euler, 2D

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -82,11 +81,8 @@ solver = DGSEM(polydeg = polydeg, surface_flux = surface_flux,
volume_integral = volume_integral)

# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "abaqus_cylinder_in_channel.inp")
isfile(default_mesh_file) ||
download("https://gist.githubusercontent.com/andrewwinters5000/a08f78f6b185b63c3baeff911a63f628/raw/addac716ea0541f588b9d2bd3f92f643eb27b88f/abaqus_cylinder_in_channel.inp",
default_mesh_file)
mesh_file = default_mesh_file
mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000/a08f78f6b185b63c3baeff911a63f628/raw/addac716ea0541f588b9d2bd3f92f643eb27b88f/abaqus_cylinder_in_channel.inp",
joinpath(@__DIR__, "abaqus_cylinder_in_channel.inp"))

mesh = P4estMesh{2}(mesh_file)

Expand Down
8 changes: 2 additions & 6 deletions examples/p4est_2d_dgsem/elixir_euler_wall_bc_amr.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -39,11 +38,8 @@ solver = DGSEM(polydeg = 5, surface_flux = flux_lax_friedrichs,
volume_integral = VolumeIntegralFluxDifferencing(volume_flux))

# Get the unstructured quad mesh from a file (downloads the file if not available locally)
default_mesh_file = joinpath(@__DIR__, "abaqus_gingerbread_man.inp")
isfile(default_mesh_file) ||
download("https://gist.githubusercontent.com/andrewwinters5000/0e9e990a04b5105d1d2e3096a6e41272/raw/0d924b1d7e7d3cc1070a6cc22fe1d501687aa6dd/abaqus_gingerbread_man.inp",
default_mesh_file)
mesh_file = default_mesh_file
mesh_file = Trixi.download("https://gist.githubusercontent.com/andrewwinters5000/0e9e990a04b5105d1d2e3096a6e41272/raw/0d924b1d7e7d3cc1070a6cc22fe1d501687aa6dd/abaqus_gingerbread_man.inp",
joinpath(@__DIR__, "abaqus_gingerbread_man.inp"))

mesh = P4estMesh{2}(mesh_file)

Expand Down
7 changes: 2 additions & 5 deletions examples/p4est_2d_dgsem/elixir_mhd_rotor.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -69,10 +68,8 @@ function mapping_twist(xi, eta)
return SVector(x, y)
end

mesh_file = joinpath(@__DIR__, "square_unstructured_2.inp")
isfile(mesh_file) ||
download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
mesh_file)
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/63ff2ea224409e55ee8423b3a33e316a/raw/7db58af7446d1479753ae718930741c47a3b79b7/square_unstructured_2.inp",
joinpath(@__DIR__, "square_unstructured_2.inp"))

mesh = P4estMesh{2}(mesh_file,
polydeg = 4,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -49,10 +48,8 @@ function mapping(xi, eta, zeta)
end

# Unstructured mesh with 48 cells of the cube domain [-1, 1]^3
mesh_file = joinpath(@__DIR__, "cube_unstructured_2.inp")
isfile(mesh_file) ||
download("https://gist.githubusercontent.com/efaulhaber/b8df0033798e4926dec515fc045e8c2c/raw/b9254cde1d1fb64b6acc8416bc5ccdd77a240227/cube_unstructured_2.inp",
mesh_file)
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/b8df0033798e4926dec515fc045e8c2c/raw/b9254cde1d1fb64b6acc8416bc5ccdd77a240227/cube_unstructured_2.inp",
joinpath(@__DIR__, "cube_unstructured_2.inp"))

# Mesh polydeg of 2 (half the solver polydeg) to ensure FSP (see above).
mesh = P4estMesh{3}(mesh_file, polydeg = 2,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -46,10 +45,8 @@ function mapping(xi, eta, zeta)
end

# Unstructured mesh with 68 cells of the cube domain [-1, 1]^3
mesh_file = joinpath(@__DIR__, "cube_unstructured_1.inp")
isfile(mesh_file) ||
download("https://gist.githubusercontent.com/efaulhaber/d45c8ac1e248618885fa7cc31a50ab40/raw/37fba24890ab37cfa49c39eae98b44faf4502882/cube_unstructured_1.inp",
mesh_file)
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/d45c8ac1e248618885fa7cc31a50ab40/raw/37fba24890ab37cfa49c39eae98b44faf4502882/cube_unstructured_1.inp",
joinpath(@__DIR__, "cube_unstructured_1.inp"))

mesh = P4estMesh{3}(mesh_file, polydeg = 3,
mapping = mapping,
Expand Down
7 changes: 2 additions & 5 deletions examples/p4est_3d_dgsem/elixir_euler_ec.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -46,10 +45,8 @@ function mapping(xi_, eta_, zeta_)
end

# Unstructured mesh with 48 cells of the cube domain [-1, 1]^3
mesh_file = joinpath(@__DIR__, "cube_unstructured_2.inp")
isfile(mesh_file) ||
download("https://gist.githubusercontent.com/efaulhaber/b8df0033798e4926dec515fc045e8c2c/raw/b9254cde1d1fb64b6acc8416bc5ccdd77a240227/cube_unstructured_2.inp",
mesh_file)
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/b8df0033798e4926dec515fc045e8c2c/raw/b9254cde1d1fb64b6acc8416bc5ccdd77a240227/cube_unstructured_2.inp",
joinpath(@__DIR__, "cube_unstructured_2.inp"))

mesh = P4estMesh{3}(mesh_file, polydeg = 5,
mapping = mapping,
Expand Down
7 changes: 2 additions & 5 deletions examples/p4est_3d_dgsem/elixir_euler_free_stream.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

using Downloads: download
using OrdinaryDiffEq
using Trixi

Expand Down Expand Up @@ -47,10 +46,8 @@ function mapping(xi_, eta_, zeta_)
end

# Unstructured mesh with 68 cells of the cube domain [-1, 1]^3
mesh_file = joinpath(@__DIR__, "cube_unstructured_1.inp")
isfile(mesh_file) ||
download("https://gist.githubusercontent.com/efaulhaber/d45c8ac1e248618885fa7cc31a50ab40/raw/37fba24890ab37cfa49c39eae98b44faf4502882/cube_unstructured_1.inp",
mesh_file)
mesh_file = Trixi.download("https://gist.githubusercontent.com/efaulhaber/d45c8ac1e248618885fa7cc31a50ab40/raw/37fba24890ab37cfa49c39eae98b44faf4502882/cube_unstructured_1.inp",
joinpath(@__DIR__, "cube_unstructured_1.inp"))

# Mesh polydeg of 2 (half the solver polydeg) to ensure FSP (see above).
mesh = P4estMesh{3}(mesh_file, polydeg = 2,
Expand Down
Loading

0 comments on commit 09893bf

Please sign in to comment.