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

Weak form modal DG methods on simplicial (and quad/hex meshes) #647

Merged
merged 132 commits into from
Jul 1, 2021

Conversation

jlchan
Copy link
Contributor

@jlchan jlchan commented Jun 16, 2021

After reading through @ranocha and @andrewwinters5000 new solvers, I think I have a better idea of how to structure mine. Closed #557 in favor of this PR, which I think will be better organized and more readable (hopefully).

Currently passes the "preserve constant state" test for CompressibleEulerEquations2D using a triangular DG discretization. Periodic entropy sine wave seems to work now too.

Todo:

  • Incorporate dissipation. Done, but only supports FluxPlusDissipation types.
  • new mesh type (draft interface with my ::MeshData)
  • imposing boundary conditions
  • add tests

I think I may save flux differencing for another PR so this one is more readable.

@codecov
Copy link

codecov bot commented Jun 17, 2021

Codecov Report

Merging #647 (2b66f3f) into dev (5a1c448) will increase coverage by 0.00%.
The diff coverage is 91.18%.

Impacted file tree graph

@@           Coverage Diff            @@
##              dev     #647    +/-   ##
========================================
  Coverage   93.63%   93.63%            
========================================
  Files         171      177     +6     
  Lines       16535    16763   +228     
========================================
+ Hits        15482    15696   +214     
- Misses       1053     1067    +14     
Flag Coverage Δ
unittests 93.63% <91.18%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/Trixi.jl 40.00% <11.11%> (-43.34%) ⬇️
...emidiscretization/semidiscretization_hyperbolic.jl 89.24% <25.00%> (ø)
src/equations/compressible_euler_3d.jl 94.94% <87.50%> (-0.10%) ⬇️
src/solvers/dg_simplices/mesh.jl 92.85% <92.85%> (ø)
src/solvers/dg_simplices/dg.jl 96.26% <96.26%> (ø)
src/solvers/dg_simplices/analysis.jl 97.36% <97.36%> (ø)
...implicial_2d_dg/elixir_euler_quadrilateral_mesh.jl 100.00% <100.00%> (ø)
...s/simplicial_2d_dg/elixir_euler_triangular_mesh.jl 100.00% <100.00%> (ø)
examples/simplicial_3d_dg/elixir_euler_tet_mesh.jl 100.00% <100.00%> (ø)
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5a1c448...2b66f3f. Read the comment docs.

@jlchan jlchan changed the title WIP: first draft of weak form modal DG methods Weak form modal DG methods on simplicial (and quad/hex meshes) Jun 29, 2021
@jlchan
Copy link
Contributor Author

jlchan commented Jun 29, 2021

@ranocha should be ready for merging. Went ahead and added tets too 😁

src/equations/compressible_euler_3d.jl Outdated Show resolved Hide resolved
examples/simplicial_mesh/elixir_euler_tet_mesh.jl Outdated Show resolved Hide resolved
src/solvers/dg_simplices/dg.jl Outdated Show resolved Hide resolved
src/solvers/dg_simplices/dg.jl Outdated Show resolved Hide resolved
src/solvers/dg_simplices/dg.jl Outdated Show resolved Hide resolved
examples/simplicial_mesh/elixir_euler_tet_mesh.jl Outdated Show resolved Hide resolved
@ranocha ranocha changed the base branch from main to dev June 30, 2021 04:59
@ranocha ranocha removed the request for review from sloede June 30, 2021 04:59
@sloede
Copy link
Member

sloede commented Jun 30, 2021

I started reviewing this. Not sure when it will be done, but it would be great if only necessary bug fixes could be pushed forth etime being, to reduce the rsik of one of my comments being gobbled by the changes.

@jlchan
Copy link
Contributor Author

jlchan commented Jun 30, 2021

@sloede Sounds good. Should leave @ranocha's comments until after you've had a chance to look at, or would you be OK if I addressed those first?

Copy link
Member

@sloede sloede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a first batch of comments (I haven't seen all files yet, though)

docs/make.jl Outdated Show resolved Hide resolved
docs/src/meshes/MeshDataMeshes.md Outdated Show resolved Hide resolved
src/Trixi.jl Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
test/test_examples_simplicial_mesh.jl Outdated Show resolved Hide resolved
test/runtests.jl Outdated Show resolved Hide resolved
examples/simplicial_mesh/elixir_euler_Triangulate_mesh.jl Outdated Show resolved Hide resolved
test/test_examples_simplicial_mesh.jl Outdated Show resolved Hide resolved
Comment on lines 13 to 16
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_euler_triangular_mesh.jl"),
l2 = [7.687514677136661e-5, 8.844681835345058e-5, 8.844681835367038e-5, 0.0002667915678724591],
linf = [0.00023033713406972467, 0.0001967281286732181, 0.00019672812868742895, 0.0004570579510136952]
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally, do these test adhere to the ten second rule and if not, would it be possible to make them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean the entire testset should run in under 10 seconds?

Copy link
Member

@ranocha ranocha Jun 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each test should run in under 10 seconds (roughly)

@@ -0,0 +1,47 @@
# !!! warning "Experimental features"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, is there another name than triangulate that is more descriptive? Without having dug into the details, I don't understand why there is a triangular_mesh and a triangulate_mesh. But maybe it's ok, if there is no better distinguishing characteristic!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm...the Triangulate_mesh is an unstructured mesh created by the Triangulate.jl package, which is also why it was capitalized previously.

Maybe eilxir_euler_triangulate_pkg_mesh.jl?

@sloede
Copy link
Member

sloede commented Jun 30, 2021

I've started to review this. Since changes pushed after I add a comment sometimes gobbles these comments, I'd prefer if only

@sloede Sounds good. Should leave @ranocha's comments until after you've had a chance to look at, or would you be OK if I addressed those first?

I just submitted a first round of comments, so you can go ahead and change away :-)

jlchan and others added 2 commits June 30, 2021 08:40
Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>
@jlchan jlchan mentioned this pull request Jun 30, 2021
22 tasks
@jlchan
Copy link
Contributor Author

jlchan commented Jun 30, 2021

@ranocha I think this should be ready to merge into dev after you get a chance to look over it.

@ranocha ranocha merged commit b37468f into trixi-framework:dev Jul 1, 2021
ranocha added a commit that referenced this pull request Jul 27, 2021
* Weak form modal DG methods on simplicial (and quad/hex meshes) (#647)

* first draft of weak form modal DG methods

* fix naming of new folder

* adding structarrays and Trixi interface stuff

* adding calc_source!

* adding sandbox folder for experiments

todo: remove later

* new VertexMappedMesh type

introduces a wrapper around MeshData and boundary tags

* adding timers

* removing "has_nonconservative_terms" for now

* updating scratch elixir

* adding draft of BoundaryStateDirichlet/Wall

* updating elixir

* updating elixir for testing

* adding specialization for nodal SBP methods

* minor

minor formatting and docstring edits, removing an unnecessary type annotation, renaming variables

* formatting + fixed BC bug

* working elixir with weak form DG on triangles

* calc_error_norms returns component-wise errors

* removing unused boundary condition code

* adding `func` to calc_error_norms

* making AbstractMeshData !<: AbstractMesh

* minor formatting

* adding periodic/non-periodic elixirs

* remove unused type alias / annotations

* adding integrate

* adding analysis callback code

adding analysis to Trixi.jl, moving analysis out of dg.jl

* removing extra ::AbstractVector annotation

* adding tests

* adding `2d_tri` tests to CI

* force add Manifest.toml

* Revert "force add Manifest.toml"

This reverts commit 74a9a46.

* adding ape triangular example

* modified @requires statements

make it so that Trixi @requires both StructArrays/StartUpDG for triangular mesh

* switch to L2 projection for compute_coefficients

* removing cruft "sandbox" testing folder

* formatting (2-space tabs, alignment)

* renaming folder 

dg_tri -> dg_triangles

* Update src/solvers/dg_triangles/mesh.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update .github/workflows/ci.yml

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update examples/triangular_mesh_2D/elixir_ape_triangular_mesh.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update examples/triangular_mesh_2D/elixir_ape_triangular_mesh.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update src/solvers/dg_triangles/mesh.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update examples/triangular_mesh_2D/elixir_euler_triangular_mesh.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update examples/triangular_mesh_2D/elixir_euler_periodic_triangular_mesh.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update src/solvers/dg_triangles/dg.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update test/test_examples_2d_triangular_mesh.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update test/runtests.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update src/solvers/dg_triangles/dg.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update src/solvers/dg_triangles/dg.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update src/solvers/dg_triangles/dg.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update src/solvers/dg_triangles/dg.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update src/solvers/dg_triangles/mesh.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update src/solvers/dg_triangles/mesh.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* adding new elixirs + tagging as experimental

* using `each___` for iteration

* minor doc changes

* update NEWS.md

* compat bounds

* fix eltype in analysis

* update path dg_tri -> dg_triangles

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* caught mistake in L2 norm computation

* fixed elixir name: euler -> ape

* adding convergence elixir

* adding compat with StartUpDG@0.9.1

new SBP type selector API. minor version bump was to avoid conflict in exporting DGSEM...

* remove SBP() from convergence + bump test project.toml versions

* renaming folder dg_triangles - > dg_simplices

* Apply suggestions from code review 

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* fixing bug in digest_boundary_conditions for triangles

* specializing source_terms in calc_sources!

* change dg_triangles -> dg_simplices in Trixi.jl

* adding Triangulate VertexMappedMesh constructor

* adding example using Triangulate

* specializing digest_boundary_conditions to avoid ambiguity

* adding docs for simplicial meshes

* update gitignore for MacOS

ignore .DS_Store

* updating docs [skip ci]

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* updating docs

- capping lines at 100 columns
- replacing N -> polydeg
- replacing md.sJ -> md.Jf
- adding more descriptions of quadrature rules and SBP nodes
- finishing descriptions of plotting-related fields in RefElemData

* replacing N -> polydeg in elixirs

* replacing md.sJ -> md.Jf in solver code

* bump StartUpDG compat

* specializing existing `digest_boundary_conditions` routines 

- restricting x_neg, x_pos, ... unpacking routines to mesh::TreeMesh

* Apply suggestions from code review 

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* removing elixir which duplicates coverage


updating elixirs for CI tests

set up parameters to reduce runtimes

* updating # todos

- # todo -> # Todo: simplices, removing old todos.
- fixing todo for calc_error_norms


updating todos in dg.jl

* updating `each___` iteration function names

* adding @threaded

* adding Base.show for VertexMappedMesh

* adding Octavian

- adding Octavian to Project.toml
- adding `using Octavian` to `Trixi.jl`

* updating l2, linf errors for test for triangular elixirs

* updating test/Project.toml

- temporarily removing Plots.jl to test CI on the PR

* trying Octavian: matmul!

* Update test/test_examples_2d_triangular_mesh.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* fixing linf::MVector issue

- `similar(::SVector)` returns an `MVector`, so I replaced it

* selectively using Octavian `matmul!` 

revert to `mul!` for 5-argument multiply with vector arguments. Octavian hangs (see JuliaLinearAlgebra/Octavian.jl#103)

* compat bound for Octavian, reverting OrdinaryDiffEq compat

* fixing bugs for SBP-type discretizations

- specialize `mul_by!` for UniformScaling
- using LinearAlgebra: UniformScaling 
- dispatch on subtype of SBP

* fixing Octavian compat

had put Octavian compat in test/Project.toml instead of Project.toml

* fixing thread-related bug

- adding threading and preallocated thread arrays

other minor change: removed unnecessary StructArray conversion in `compute_coefficients`

* update `todo` label for Octavian.matmul!

* update NEWS.md with simplicial mesh updates

* renaming elixirs and test: triangular_mesh -> simplicial_mesh

* adding support for 3D tet meshes

- made most simplicial routines dimension-agnostic

* added `min_max_speed_naive` for CompressibleEulerEquations3D

* updating NEWS.md with tet meshes

* fixing test naming: 2d_triangles -> simplices

* updating docs with news about simplices

* adding minor comments 

* VertexMappedMesh: fix order of type parameters

* Apply suggestions from code review

Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update docs/make.jl

Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>

* reorganizing simplicial examples 

new folders: `simplicial_2d_dg` and `simplicial_3d_dg`

* resolving issue with `mul_by!` dispatch for UniformScaling

- defaults to `mul!` for `A::UniformScaling`

* renaming/reorganizing simplicial tests in ci

* updating docs with tentative name for Triangulate.jl elixir

* adding Plots.jl v1.16 to test compat

* adding convergence test for triangular mesh

* updating `eachdim(mesh)`, also `@inline`ing `each___` functions

Co-authored-by: Jesse Chan <jesse.chan@rice.edu>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>

* renaming cache variables in preparation for flux differencing

* adding StructArrays and LazyArrays in prep for flux differencing

* Replacing .1 -> 0.1, .5 -> 0.5

* fixing spacing in `mesh_data_meshes.md` docs

* fixing elixir comments

* adding `TODO` comment to `nelements(solver, cache)`

* removing fluxdiff.jl from Trixi 

to be added in #695

* updating VertexMappedMesh

- swapping Dim -> NDIMS 
- removing Tv, Ti from VertexMappedMesh type parameters

* replacing @trixi_testset with outer @testset + inner @trixi_testset

* renaming variables

- VX, VY, VZ -> vertex_coordinates_x, ...
- Dim -> NDIMS
- invMQrstTrW -> weak_differentiation matrices

* renaming DG{<:RefElemData,...} -> MultiDG{...}

* Update src/Trixi.jl

Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>

* adding name to contributors in AUTHORS.md [skip ci]

* fix Plots compat in test/Project.toml

* genenralize print_boundary_conditions

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* adding Markdown indentation to docs

* add pretty printing for boundary conditions

* add Base.summary printing for MultiDG types

* implementing `nelements(mesh, dg, cache)` for analysis

* moving files to appropriate folders

* reducing allocations in `calc_boundary_flux!`

* Flux differencing on simplicial elements (#695)

* implemented flux differencing volume kernel for SBP triangles

* renaming flux differencing elixir

* removing StructArrays from elixirs

* factoring type aliases into separate file

* update type aliases 

more restrictive subtyping

* implemented entropy stable flux differencing on triangular meshes

tet meshes still have some bugs

* removing StructArrays from tet elixir

* fixing bug in tet flux differencing

* clean up comments

* adding inlines and mul-adds

* changing tet mesh size in elixir (to satisfy 10 second test rule)

* adding `using Tet` from StartUpDG

* specializing `build_lazy_physical_derivative` 

restricting to `VertexMappedMesh{NDIMS, <:Union{Tri, Tet}}`, which have constant geometric terms. Will specialize later to include affine quad/hex meshes. 

Todo: specialize for curved meshes.

* minor rearrangement of `using ...` and trimming whitespace

* reducing number of elements in tests (make them slightly cheaper)

* adding simplicial flux differencing tests

* renaming type_aliases.jl -> types_and_traits.jl

- also updating PolyDGFluxDiff and SBPDGFluxDiff to use MultiDG type

* adding flux diff elixirs to docs

* renaming type_aliases.jl -> types_and_traits.jl in Trixi.jl

* adding MultiDG convenience constructor

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* Update examples/simplicial_2d_dg/elixir_euler_sbp_triangular_mesh_flux_diff.jl

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* renaming folder to `dg_multi`

* removing extra l2, linf error printouts

* fixing names of elixirs in docs

* trim whitespace

* renaming flux_diff -> ec

* increasing tspan for simplicial tests

* removing cruft

* Apply suggestions from code review

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* fixing _ec name inconsistency in elixirs

* Apply suggestions from code review

Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>

* Update src/solvers/dg_multi/fluxdiff.jl

Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>

* adding hex elixir

* removing cruft `solvers/dg_simplices` folder

* making StartUpDG an explicit dependency

* update elixirs

- use `DGMulti` constructor
- updating function signatures which involve `RefElemData`
- remove `using StartUpDG`

* MultiDG -> DGMulti



MultiDG -> DGMulti

* name clarifications + function specializiations

* combining dg_multi tests into a single `@testset`

* adding back commented out tests

* removing unnecessary annotations

* renaming type aliases for DGMulti{...}

- removed PolyDGFluxDiff, replaced with DGMultiFluxDiff{Polynomial}
- removed SBPDGFluxDiff, replaced with DGMultiFluxDiff{SBP}

* elem_type -> element_type

* minor formatting

* consolidating elixirs and updating docs

- switching from multiple elixirs to just using `trixi_include` to change parameters in a few elixirs
- minor formatting


minor formatting

* renaming VX, ... -> vertex_coordinates_x, ...

* adding periodic 3d dgmulti elixir + tests

* renaming CI tests

* Apply suggestions from code review

Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* renaming dg_multi -> dgmulti

* more renaming

- dg_multi -> dgmulti 
- estimate_dt(dg, mesh) -> estimate_dt(mesh, dg)

* fix indentation in docstring

* renaming dg_multi -> dgmulti in tests

* separating dgmulti elixirs into 2d/3d

* selectively importing/exporting from StartUpDG

* adding compat bounds for StartUpDG

* adding kwarg option for DGMulti

passed onto RefElemData

Co-authored-by: Jesse Chan <jesse.chan@rice.edu>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>

* moving function definitions to after DGMulti defined

* moving "includes" to appropriate locations

* update .codecov.yml

* add VertexMappedMesh to overview table

* fix docstring

* fix hadamard_sum_A_transposed

* update test compat bounds

* use at-muladd

* Update test/Project.toml

Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>

* removing let blocks

* add solver/discretization type to overview table

* updating docs with new `DGMulti` solver info

* minor changes to docs

* add some cross references to the docs

Co-authored-by: Jesse Chan <jesse.chan@rice.edu>
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>
Co-authored-by: Hendrik Ranocha <mail@ranocha.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants