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

Flux differencing on simplicial elements #695

Merged
merged 65 commits into from
Jul 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
98dffee
implemented flux differencing volume kernel for SBP triangles
jlchan Jul 2, 2021
18e0289
renaming flux differencing elixir
jlchan Jul 2, 2021
8b0faa2
removing StructArrays from elixirs
jlchan Jul 2, 2021
cb6eaab
factoring type aliases into separate file
jlchan Jul 2, 2021
3223195
update type aliases
jlchan Jul 2, 2021
2ecbda2
implemented entropy stable flux differencing on triangular meshes
jlchan Jul 2, 2021
6f16420
removing StructArrays from tet elixir
jlchan Jul 2, 2021
9d7be5d
fixing bug in tet flux differencing
jlchan Jul 3, 2021
bba3dd7
clean up comments
jlchan Jul 3, 2021
847d428
adding inlines and mul-adds
jlchan Jul 3, 2021
8b1d646
changing tet mesh size in elixir (to satisfy 10 second test rule)
jlchan Jul 3, 2021
7454b4f
adding `using Tet` from StartUpDG
jlchan Jul 3, 2021
5f452b9
specializing `build_lazy_physical_derivative`
jlchan Jul 3, 2021
f38de44
minor rearrangement of `using ...` and trimming whitespace
jlchan Jul 4, 2021
e284d12
Merge branch 'dev' into jc/fluxdiff_general
jlchan Jul 6, 2021
3c722ca
reducing number of elements in tests (make them slightly cheaper)
jlchan Jul 6, 2021
201d8b7
adding simplicial flux differencing tests
jlchan Jul 6, 2021
5fe19e1
renaming type_aliases.jl -> types_and_traits.jl
jlchan Jul 6, 2021
0c05404
adding flux diff elixirs to docs
jlchan Jul 6, 2021
cb16a26
renaming type_aliases.jl -> types_and_traits.jl in Trixi.jl
jlchan Jul 6, 2021
fa1d6ab
adding MultiDG convenience constructor
jlchan Jul 6, 2021
5cc9542
Apply suggestions from code review
jlchan Jul 6, 2021
e3cfa75
Merge remote-tracking branch 'Trixi_fork/jc/fluxdiff' into jc/fluxdif…
jlchan Jul 6, 2021
07e94bc
Update examples/simplicial_2d_dg/elixir_euler_sbp_triangular_mesh_flu…
jlchan Jul 6, 2021
b193d6d
Merge remote-tracking branch 'Trixi_fork/jc/fluxdiff' into jc/fluxdif…
jlchan Jul 6, 2021
2d5ad64
renaming folder to `dg_multi`
jlchan Jul 7, 2021
d5808dd
removing extra l2, linf error printouts
jlchan Jul 7, 2021
b321371
fixing names of elixirs in docs
jlchan Jul 7, 2021
50464d3
trim whitespace
jlchan Jul 8, 2021
4c48bc0
Merge branch 'dev' into jc/fluxdiff
jlchan Jul 8, 2021
4c27665
Merge remote-tracking branch 'Trixi_fork/jc/fluxdiff' into jc/fluxdif…
jlchan Jul 8, 2021
ed5cb95
renaming flux_diff -> ec
jlchan Jul 8, 2021
7ec2239
increasing tspan for simplicial tests
jlchan Jul 8, 2021
c834c68
removing cruft [skip ci]
jlchan Jul 8, 2021
9178ff1
Apply suggestions from code review
jlchan Jul 12, 2021
dd0c6ad
fixing _ec name inconsistency in elixirs
jlchan Jul 12, 2021
798ef3a
Merge remote-tracking branch 'Trixi_fork/jc/fluxdiff' into jc/fluxdiff
jlchan Jul 12, 2021
e7d1fb0
Merge branch 'dev' into jc/fluxdiff
jlchan Jul 13, 2021
5d88797
Apply suggestions from code review
jlchan Jul 20, 2021
dbc8b85
Update src/solvers/dg_multi/fluxdiff.jl
jlchan Jul 20, 2021
2f9857d
adding hex elixir
jlchan Jul 20, 2021
32cfac2
removing cruft `solvers/dg_simplices` folder
jlchan Jul 20, 2021
9ebfe2d
making StartUpDG an explicit dependency
jlchan Jul 20, 2021
75c8f05
update elixirs
jlchan Jul 20, 2021
cfb5a48
MultiDG -> DGMulti
jlchan Jul 20, 2021
befd9f1
name clarifications + function specializiations
jlchan Jul 20, 2021
cd15c5c
combining dg_multi tests into a single `@testset`
jlchan Jul 20, 2021
353cb15
adding back commented out tests
jlchan Jul 20, 2021
3f975cd
removing unnecessary annotations
jlchan Jul 20, 2021
952701a
renaming type aliases for DGMulti{...}
jlchan Jul 20, 2021
381f626
elem_type -> element_type
jlchan Jul 22, 2021
149bfc3
minor formatting
jlchan Jul 22, 2021
ffb5f02
consolidating elixirs and updating docs
jlchan Jul 22, 2021
f09d588
renaming VX, ... -> vertex_coordinates_x, ...
jlchan Jul 22, 2021
ceb2585
adding periodic 3d dgmulti elixir + tests
jlchan Jul 22, 2021
13b1d48
renaming CI tests
jlchan Jul 22, 2021
fda35fb
Apply suggestions from code review
jlchan Jul 23, 2021
8177105
renaming dg_multi -> dgmulti
jlchan Jul 23, 2021
7c8ea1a
more renaming
jlchan Jul 23, 2021
361f2f5
fix indentation in docstring
jlchan Jul 23, 2021
a57870e
renaming dg_multi -> dgmulti in tests
jlchan Jul 23, 2021
c01f6c5
separating dgmulti elixirs into 2d/3d
jlchan Jul 23, 2021
0a37f8b
selectively importing/exporting from StartUpDG
jlchan Jul 23, 2021
827379e
adding compat bounds for StartUpDG
jlchan Jul 23, 2021
c7122fa
adding kwarg option for DGMulti
jlchan Jul 23, 2021
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
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ jobs:
- 2d_part1
- 2d_part2
- 2d_part3
- 2d_simplices
- 3d_simplices
- dgmulti
- 2d_mpi
- 2d_threaded
- 3d_part1
Expand Down
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
StartUpDG = "472ebc20-7c99-4d4b-9470-8fde4e9faa0f"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StrideArrays = "d1fa6d79-ef01-42a6-86c9-f7c551f8593b"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
Expand All @@ -47,6 +48,7 @@ RecipesBase = "1.1"
Reexport = "1.0"
Requires = "1.1"
StaticArrays = "1.0"
StartUpDG = "0.10.2"
StrideArrays = "0.1.11"
StructArrays = "0.6"
SummationByPartsOperators = "0.5.4"
Expand Down
22 changes: 14 additions & 8 deletions docs/src/meshes/mesh_data_meshes.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,20 @@ approximation on a triangle. There are also several parameters which can be twea
[StartUpDG.jl docs](https://jlchan.github.io/StartUpDG.jl/dev/RefElemData/#RefElemData-based-on-SBP-finite-differences).
Trixi will also specialize certain parts of the solver based on the `SBP` approximation type.

## Trixi elixirs on simplicial meshes
## Trixi elixirs on simplicial and tensor product element meshes

Example elixirs on simplicial meshes can be found in the `examples/simplicial_mesh` folder.
Some key elixirs to look at:
Example elixirs with triangular, quadrilateral, and tetrahedral meshes can be found in
the `examples/dgmulti_2d` and `examples/dgmulti_3d` folders. Some key elixirs to look at:

* `elixir_euler_triangular_mesh.jl`: basic weak form DG discretization on a uniform triangular mesh.
* `elixir_euler_periodic_triangular_mesh.jl`: same as above, but enforces periodicity in the ``x,y`` directions.
* `elixir_euler_triangulate_pkg_mesh.jl`: uses a `TriangulateIO` unstructured mesh generated by
* `examples/dgmulti_2d/elixir_euler_weakform.jl`: basic weak form DG discretization on a uniform triangular mesh.
Changing `element_type = Quad()` or `approximation_type = SBP()` will switch to a quadrilateral mesh
or an SBP-type discretization. Changing `surface_integral = SurfaceIntegralWeakForm(flux_ec)` and
`volume_integral = VolumeIntegralFluxDifferencing(flux_ec)` for some entropy conservative flux
(e.g., `flux_chandrashekar` or `flux_ranocha`) will switch to an entropy conservative formulation.
* `examples/dgmulti_2d/elixir_euler_triangulate_pkg_mesh.jl`: uses a `TriangulateIO` unstructured mesh generated by
[Triangulate.jl](https://github.com/JuliaGeometry/Triangulate.jl).
* `elixir_ape_sbp_triangular_mesh.jl`: uses a multi-dimensional SBP discretization in weak form.
* `elixir_euler_tet_mesh.jl`: basic weak form DG discretization on a uniform tet mesh.
* `examples/dgmulti_3d/elixir_euler_weakform.jl`: basic weak form DG discretization on a uniform tetrahedral mesh.
Changing `element_type = Hex()` will switch to a hexahedral mesh. Changing
`surface_integral = SurfaceIntegralWeakForm(flux_ec)` and
`volume_integral = VolumeIntegralFluxDifferencing(flux_ec)` for some entropy conservative flux
(e.g., `flux_chandrashekar` or `flux_ranocha`) will switch to an entropy conservative formulation.
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# !!! warning "Experimental features"

using Triangulate
using StartUpDG, StructArrays
using Trixi, OrdinaryDiffEq

polydeg = 3
rd = RefElemData(Tri(), polydeg)
dg = DG(rd, nothing #= mortar =#,
SurfaceIntegralWeakForm(FluxHLL()), VolumeIntegralWeakForm())
dg = DGMulti(polydeg = 3, element_type = Tri(),
surface_integral = SurfaceIntegralWeakForm(FluxHLL()),
volume_integral = VolumeIntegralWeakForm())

equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test

meshIO = StartUpDG.square_hole_domain(.25) # pre-defined Triangulate geometry in StartUpDG

# the pre-defined Triangulate geometry in StartUpDG has integer boundary tags. this routine
# the pre-defined Triangulate geometry in StartUpDG has integer boundary tags. this routine
# assigns boundary faces based on these integer boundary tags.
mesh = VertexMappedMesh(meshIO, rd, Dict(:bottom=>1, :right=>2, :top=>3, :left=>4))
mesh = VertexMappedMesh(meshIO, dg, Dict(:bottom=>1, :right=>2, :top=>3, :left=>4))

boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)
boundary_conditions = (; :bottom => boundary_condition_convergence_test,
Expand All @@ -26,10 +24,10 @@ boundary_conditions = (; :bottom => boundary_condition_convergence_test,
:left => boundary_condition_convergence_test)

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms,
boundary_conditions = boundary_conditions)
source_terms = source_terms,
boundary_conditions = boundary_conditions)

tspan = (0.0, 0.1)
tspan = (0.0, 0.2)
ode = semidiscretize(semi, tspan)

summary_callback = SummaryCallback()
Expand All @@ -41,9 +39,6 @@ callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation

dt0 = StartUpDG.estimate_h(rd,mesh.md) / StartUpDG.inverse_trace_constant(rd)
sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
dt = 0.5*dt0, save_everystep=false, callback=callbacks);
dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
summary_callback() # print the timer summary

l2,linf = analysis_callback(sol)
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# !!! warning "Experimental features"

using StartUpDG, StructArrays
using Trixi, OrdinaryDiffEq

polydeg = 3
rd = RefElemData(Quad(), polydeg)
dg = DG(rd, nothing #= mortar =#,
SurfaceIntegralWeakForm(FluxHLL()), VolumeIntegralWeakForm())
dg = DGMulti(polydeg = 3, element_type = Tri(), approximation_type = Polynomial(),
surface_integral = SurfaceIntegralWeakForm(FluxHLL()),
volume_integral = VolumeIntegralWeakForm())

equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_convergence_test
Expand All @@ -16,8 +14,10 @@ source_terms = source_terms_convergence_test
top_boundary(x,y,tol=50*eps()) = abs(y-1)<tol
rest_of_boundary(x,y,tol=50*eps()) = !top_boundary(x,y,tol)
is_on_boundary = Dict(:top => top_boundary, :rest => rest_of_boundary)
vertex_coordinates_x, vertex_coordinates_y, EToV = StartUpDG.uniform_mesh(rd.elementType, 8)
mesh = VertexMappedMesh(vertex_coordinates_x, vertex_coordinates_y, EToV, rd, is_on_boundary = is_on_boundary)

cells_per_dimension = (8,8) # detected by `extract_initial_resolution` for convergence tests
vertex_coordinates_x, vertex_coordinates_y, EToV = StartUpDG.uniform_mesh(dg.basis.elementType, cells_per_dimension...)
mesh = VertexMappedMesh(vertex_coordinates_x, vertex_coordinates_y, EToV, dg, is_on_boundary = is_on_boundary)

boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)
boundary_conditions = (; :top => boundary_condition_convergence_test,
Expand All @@ -27,7 +27,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms,
boundary_conditions = boundary_conditions)

tspan = (0.0, 0.1)
tspan = (0.0, 0.4)
ode = semidiscretize(semi, tspan)

summary_callback = SummaryCallback()
Expand All @@ -39,9 +39,6 @@ callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation

dt0 = StartUpDG.estimate_h(rd,mesh.md) / StartUpDG.inverse_trace_constant(rd)
sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
dt = 0.5*dt0, save_everystep=false, callback=callbacks);
dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
summary_callback() # print the timer summary

l2,linf = analysis_callback(sol)
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# !!! warning "Experimental features"

using StartUpDG, StructArrays
using Trixi, OrdinaryDiffEq

polydeg = 3
rd = RefElemData(Tri(), polydeg) # equivalent to a "basis"
dg = DG(rd, nothing #= mortar =#,
SurfaceIntegralWeakForm(FluxHLL()), VolumeIntegralWeakForm())
dg = DGMulti(polydeg = 3, element_type = Tri(),
surface_integral = SurfaceIntegralWeakForm(FluxHLL()),
volume_integral = VolumeIntegralWeakForm())

equations = CompressibleEulerEquations2D(1.4)
initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test

vertex_coordinates_x, vertex_coordinates_y, EToV = StartUpDG.uniform_mesh(rd.elementType, 8)
mesh = VertexMappedMesh(vertex_coordinates_x, vertex_coordinates_y, EToV, rd, is_periodic=(true,true))
vertex_coordinates_x, vertex_coordinates_y, EToV = StartUpDG.uniform_mesh(dg.basis.elementType, 4)
mesh = VertexMappedMesh(vertex_coordinates_x, vertex_coordinates_y, EToV, dg, is_periodic=(true,true))
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms)

tspan = (0.0, 0.1)
tspan = (0.0, 0.4)
ode = semidiscretize(semi, tspan)

summary_callback = SummaryCallback()
Expand All @@ -29,9 +27,6 @@ callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation

dt0 = StartUpDG.estimate_h(rd,mesh.md) / StartUpDG.inverse_trace_constant(rd)
sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
dt = 0.5*dt0, save_everystep=false, callback=callbacks);
dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
summary_callback() # print the timer summary

l2,linf = analysis_callback(sol)
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
# !!! warning "Experimental features"

using StartUpDG, StructArrays
using Trixi, OrdinaryDiffEq

polydeg = 3
rd = RefElemData(Tet(), polydeg)
dg = DG(rd, nothing #= mortar =#,
SurfaceIntegralWeakForm(FluxHLL()), VolumeIntegralWeakForm())
dg = DGMulti(polydeg = 3, element_type = Tet(),
surface_integral = SurfaceIntegralWeakForm(FluxHLL()),
volume_integral = VolumeIntegralWeakForm())

equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test

# example where we tag two separate boundary segments of the mesh
top_boundary(x, y, z, tol=50*eps()) = abs(y - 1) < tol
top_boundary(x, y, z, tol=50*eps()) = abs(y - 1) < tol
rest_of_boundary(x, y, z, tol=50*eps()) = !top_boundary(x, y, z, tol)
is_on_boundary = Dict(:top => top_boundary, :rest => rest_of_boundary)
VX, VY, VZ, EToV = StartUpDG.uniform_mesh(Tet(), 4)
mesh = VertexMappedMesh(VX, VY, VZ, EToV, rd, is_on_boundary = is_on_boundary)
vertex_coordinates_x, vertex_coordinates_y, vertex_coordinates_z, EToV = StartUpDG.uniform_mesh(dg.basis.elementType, 4)
mesh = VertexMappedMesh((vertex_coordinates_x, vertex_coordinates_y, vertex_coordinates_z), EToV,
dg, is_on_boundary = is_on_boundary)

boundary_condition_convergence_test = BoundaryConditionDirichlet(initial_condition)
boundary_conditions = (; :top => boundary_condition_convergence_test,
:rest => boundary_condition_convergence_test)

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms,
boundary_conditions = boundary_conditions)
source_terms = source_terms,
boundary_conditions = boundary_conditions)

tspan = (0.0, 0.1)
ode = semidiscretize(semi, tspan)
Expand All @@ -39,9 +38,6 @@ callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)
###############################################################################
# run the simulation

dt0 = StartUpDG.estimate_h(rd,mesh.md) / StartUpDG.inverse_trace_constant(rd)
sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
dt = 0.5*dt0, save_everystep=false, callback=callbacks);
dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
summary_callback() # print the timer summary

l2,linf = analysis_callback(sol)
34 changes: 34 additions & 0 deletions examples/dgmulti_3d/elixir_euler_weakform_periodic.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# !!! warning "Experimental features"

using Trixi, OrdinaryDiffEq

dg = DGMulti(polydeg = 3, element_type = Tet(),
surface_integral = SurfaceIntegralWeakForm(FluxHLL()),
volume_integral = VolumeIntegralWeakForm())

equations = CompressibleEulerEquations3D(1.4)
initial_condition = initial_condition_convergence_test
source_terms = source_terms_convergence_test

vertex_coordinates_x, vertex_coordinates_y, vertex_coordinates_z, EToV = StartUpDG.uniform_mesh(dg.basis.elementType, 4)
mesh = VertexMappedMesh((vertex_coordinates_x, vertex_coordinates_y, vertex_coordinates_z), EToV, dg,
is_periodic = (true, true, true))

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg,
source_terms = source_terms)

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

summary_callback = SummaryCallback()
alive_callback = AliveCallback(alive_interval=10)
analysis_interval = 100
analysis_callback = AnalysisCallback(semi, interval=analysis_interval, uEltype=real(dg))
callbacks = CallbackSet(summary_callback, alive_callback, analysis_callback)

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

sol = solve(ode, CarpenterKennedy2N54(williamson_condition=false),
dt = 0.5 * estimate_dt(mesh, dg), save_everystep=false, callback=callbacks);
summary_callback() # print the timer summary
47 changes: 0 additions & 47 deletions examples/simplicial_2d_dg/elixir_ape_sbp_triangular_mesh.jl

This file was deleted.

47 changes: 0 additions & 47 deletions examples/simplicial_2d_dg/elixir_euler_triangular_mesh.jl

This file was deleted.

Loading