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

Implement AMR with p4est #618

Merged
merged 27 commits into from
Jun 9, 2021
Merged

Conversation

efaulhaber
Copy link
Member

@efaulhaber efaulhaber commented May 27, 2021

Sixth point of #584.
AMR now works as usual by replacing TreeMesh with P4estMesh, and it produces pretty much the same results.
Additionally, it works with unstructured and curved meshes.

Convergence analysis with elixir_advection_amr_solution_independent (polydeg=3):

l2
scalar
error     EOC
7.95e-05  -
3.99e-06  4.32
1.95e-07  4.35
mean      4.33
----------------------------------------------------------------------------------------------------
linf
scalar
error     EOC
7.45e-04  -
6.57e-05  3.50
5.32e-06  3.63
mean      3.57

@codecov
Copy link

codecov bot commented May 29, 2021

Codecov Report

Merging #618 (8ab220e) into dev (059f240) will decrease coverage by 0.19%.
The diff coverage is 90.79%.

❗ Current head 8ab220e differs from pull request most recent head 6a6a183. Consider uploading reports for the commit 6a6a183 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #618      +/-   ##
==========================================
- Coverage   93.46%   93.26%   -0.20%     
==========================================
  Files         138      154      +16     
  Lines       13998    15310    +1312     
==========================================
+ Hits        13083    14279    +1196     
- Misses        915     1031     +116     
Flag Coverage Δ
unittests 93.26% <90.79%> (-0.20%) ⬇️

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

Impacted Files Coverage Δ
...es/2d/elixir_advection_amr_solution_independent.jl 100.00% <ø> (ø)
examples/2d/elixir_ape_gaussian_source.jl 88.88% <ø> (ø)
src/callbacks_step/callbacks_step.jl 85.71% <ø> (ø)
src/callbacks_step/save_solution_dg.jl 95.89% <ø> (ø)
src/equations/compressible_euler_2d.jl 94.33% <ø> (-0.01%) ⬇️
src/mesh/mesh.jl 84.50% <ø> (ø)
src/solvers/dg_common.jl 93.93% <ø> (ø)
src/solvers/dg_curved/dg_2d.jl 96.66% <ø> (ø)
src/solvers/dg_tree/basis_lobatto_legendre.jl 89.20% <ø> (ø)
src/solvers/dg_unstructured_quad/dg.jl 75.00% <ø> (ø)
... and 54 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 d53db7d...6a6a183. Read the comment docs.

@efaulhaber efaulhaber force-pushed the p4est-non-conforming branch from 8757a43 to 1579c17 Compare May 30, 2021 21:17
@efaulhaber efaulhaber marked this pull request as ready for review June 1, 2021 21:54
@efaulhaber efaulhaber requested a review from sloede June 1, 2021 23:11
@efaulhaber efaulhaber requested a review from ranocha June 4, 2021 15:52
Copy link
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

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

Thanks a lot for working on this! I had a first look at this nice PR and it looks already quite good to me 👍 Please find below some comments/questions. I will look into the performance problems later.

src/callbacks_step/amr.jl Outdated Show resolved Hide resolved
src/mesh/p4est_mesh.jl Outdated Show resolved Hide resolved
src/mesh/p4est_mesh.jl Outdated Show resolved Hide resolved
test/test_examples_2d_p4est.jl Outdated Show resolved Hide resolved
@ranocha
Copy link
Member

ranocha commented Jun 5, 2021

#627 (performance of AMR with p4est) shouldn't block this. "Make it work, then make it fast". You did the first part, I can do the second one in another PR later. This one is already quite large and self-contained.

@efaulhaber efaulhaber requested a review from ranocha June 6, 2021 13:42
Copy link
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM and can be merged (moving the discussion on a keyword constructor somewhere else).

src/mesh/p4est_mesh.jl Outdated Show resolved Hide resolved
Copy link
Member

@ranocha ranocha left a comment

Choose a reason for hiding this comment

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

Thanks!

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.

Great stuff! I have a few question, but nothing that seems to be a show stopper! Thanks a lot for the good work and the reviews by @ranocha!

src/auxiliary/auxiliary.jl Show resolved Hide resolved
src/solvers/dg_unstructured_quad/dg_2d.jl Outdated Show resolved Hide resolved
src/callbacks_step/amr.jl Outdated Show resolved Hide resolved
src/callbacks_step/amr.jl Outdated Show resolved Hide resolved
src/solvers/dg_p4est/containers_2d.jl Outdated Show resolved Hide resolved
src/mesh/p4est_mesh.jl Show resolved Hide resolved
src/mesh/p4est_mesh.jl Outdated Show resolved Hide resolved
src/mesh/p4est_mesh.jl Outdated Show resolved Hide resolved
src/mesh/p4est_mesh.jl Outdated Show resolved Hide resolved
src/solvers/dg_p4est/containers.jl Show resolved Hide resolved
@efaulhaber efaulhaber requested a review from sloede June 9, 2021 16:19
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.

LGTM!

@sloede sloede merged commit 0e07a12 into trixi-framework:dev Jun 9, 2021
sloede added a commit that referenced this pull request Jun 10, 2021
* Implement P4estMesh with periodic boundaries in 2D (#578)

* Add P4estMesh and implement unstructured calc_interface_flux!

* Comment indexfunction_reduced

* Save cell geometry in interpolation nodes instead of a mapping function

* Use P4est to compute node coordinates

* Extract interface information from p4est

* Make indexfunction_surface type stable

* Downgrade P4est_jll to 2.2

* Add P4est_jll as dependency

* Update Project.toml

* Update Project.toml

* Fix node_coordinates interpolation

* Add kwarg initial_refinement_level

* Add documentation of P4estMesh

* Remove trees_per_dimension to make P4estMesh truly unstructured

* Add proper show function

* Remove P4est_jll from dependencies

* Improve comments

* Destroy p4est data structures on exit

* Add test case for P4estMesh

* Implement suggestions

* Implement suggestions

* Revise constructor of P4estMesh to use kwargs

* Improve performance of indices2direction

* Fix mesh polydegs and stepsize for non-constant speeds

* Implement suggestions

* Implement save/restart with P4estMesh (#596)

* Replace @timeit_debug with @timed

* Implement save/restart for P4estMesh

* Return node_coordinates

* Change parameter basis to nodes to reuse function in Trixi2Vtk

* Add Trixi2Vtk dev tips to docs

* Fix docs

* Update docs/src/visualization.md

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* Update src/mesh/mesh_io.jl

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* Implement suggestions

Co-authored-by: Michael Schlottke-Lakemper <[email protected]>

* Implement non-periodic boundaries with P4estMesh (#598)

* Replace @timeit_debug with @timed

* Extract orientation from face info

* Reuse code from UnstructuredQuadMesh to implement non-periodic boundaries

* Fix save/restart

* Add nonperiodic example

* Add assertion

* Remove periodicity from P4estMesh

* Fix loading meshes from different paths

* Add constructor to build P4estMeshes from ABAQUS files

* Allow initial_refinement_level > 1

* Add mapping as additional parameter to P4estMesh from file

* Rename calc_node_coordinates! to avoid ambiguity

* Add curved p4est Euler FSP example

* Add documentation to new constructor

* Check BCs for integrity

* Add EOC test for non-periodic Euler on unstructured mesh

* Implement suggestions

* Implement suggestions

* Fix tests

* Implement suggestions

* Fix spacing

* Update P4est [compat] version to pass Windows/macOS tests (#619)

* Add support for static non-conforming P4estMeshes (no AMR) (#621)

* Prepare data structures for non-conforming meshes

* Implement prolong2mortars

* Implement mortar flux (not working yet)

* Fix mortar flux calculation

* Use global number of quadrants

* Include tests for P4estMesh

* Implement suggestions

* Add test for non-conforming P4estMesh

* Use Downloads.download

* Implement suggestions

* Fix tests

* Fix CI tests on macOS

* Implement AMR with p4est (#618)

* Implement AMR with p4est (needs debugging)

* Fix TreeMesh AMR

* Fix print_amr_information

* Fix refinement

* Fix CurvedMesh

* Fix AMR with p4est

* Add general print_amr_information for non-AMR meshes

* Fix boundary conditions with AMR

* Fix AMR on unstructured meshes

* Add tests for AMR with p4est

* Use Downloads: download

* Improve performance of P4estMesh

* Prepare PR

* Fix 2279806

* Remove some allocations from count_required functions

* Remove more allocations

* Implement suggestions

* Implement more suggestions

* Fix polydeg in show(P4estMesh)

* Destroy p4est data structures in inner constructor

* Update examples/2d/elixir_advection_amr_p4est_unstructured_flag.jl

Co-authored-by: Hendrik Ranocha <[email protected]>

* Update examples/2d/elixir_advection_p4est_non_conforming_flag.jl

Co-authored-by: Hendrik Ranocha <[email protected]>

* Make AMR controllers independent of the mesh

* Implement suggestions

* Fix e71913f

* Implement suggestions

* Fix 6a6a183

Co-authored-by: Hendrik Ranocha <[email protected]>

* Add test with different geometry and solver polydeg (#634)

* Increase coverage with `P4estMesh` (#635)

* Add test for non-periodic structured P4estMesh

* Add Euler gravity test with P4estMesh

* Remove nboundaries(UnstructuredQuadSortedBoundaryTypes)

* Move p4est Euler gravity tests to other p4est tests

* Add news entry for P4estMesh

* Fix a85c087 (#636)

Co-authored-by: Erik Faulhaber <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>
Co-authored-by: Hendrik Ranocha <[email protected]>
@efaulhaber efaulhaber deleted the p4est-non-conforming branch September 25, 2021 11:31
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