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

AMR for parabolic terms in 2D & 3D on TreeMeshes #1629

Merged
merged 100 commits into from
Oct 25, 2023

Conversation

DanielDoehring
Copy link
Contributor

@DanielDoehring DanielDoehring commented Sep 11, 2023

Related to the work packages mentioned in #1147

This is supposed to be merged after #1602, since it is essentially a superset of the 1D case.

The new elixir elixir_navierstokes_shearlayer_amr.jl serves as a neat motivation for velocity-based indicators (see the changes in the compressible euler equations) and tree-AMR.

v1_SL

Grid_SL

Allocations occur only in the AMR section:

Summary CB
────────────────────────────────────────────────────────────────────────────────────────────────────
Trixi.jl simulation finished.  Final time: 0.7  Time steps: 1132 (accepted), 1202 (total)
────────────────────────────────────────────────────────────────────────────────────────────────────

 ───────────────────────────────────────────────────────────────────────────────────────
               Trixi.jl                        Time                    Allocations      
                                      ───────────────────────   ────────────────────────
           Tot / % measured:               11.6s /  94.7%           45.1MiB /  45.5%    

 Section                      ncalls     time    %tot     avg     alloc    %tot      avg
 ───────────────────────────────────────────────────────────────────────────────────────
 parabolic rhs!                10.8k    5.47s   49.7%   504μs   18.1KiB    0.1%    1.71B
   calculate gradient          10.8k    2.89s   26.3%   266μs   7.34KiB    0.0%    0.69B
     volume integral           10.8k    1.18s   10.8%   109μs     0.00B    0.0%    0.00B
     surface integral          10.8k    455ms    4.1%  42.0μs     0.00B    0.0%    0.00B
     Jacobian                  10.8k    414ms    3.8%  38.2μs     0.00B    0.0%    0.00B
     prolong2interfaces        10.8k    229ms    2.1%  21.1μs     0.00B    0.0%    0.00B
     prolong2mortars           10.8k    187ms    1.7%  17.3μs     0.00B    0.0%    0.00B
     interface flux            10.8k    185ms    1.7%  17.0μs     0.00B    0.0%    0.00B
     reset gradients           10.8k    119ms    1.1%  10.9μs     0.00B    0.0%    0.00B
     mortar flux               10.8k    105ms    1.0%  9.71μs     0.00B    0.0%    0.00B
     ~calculate gradient~      10.8k   9.25ms    0.1%   854ns   7.34KiB    0.0%    0.69B
     prolong2boundaries        10.8k    741μs    0.0%  68.3ns     0.00B    0.0%    0.00B
     boundary flux             10.8k    163μs    0.0%  15.0ns     0.00B    0.0%    0.00B
   volume integral             10.8k    611ms    5.6%  56.3μs     0.00B    0.0%    0.00B
   calculate viscous fluxes    10.8k    566ms    5.1%  52.2μs     0.00B    0.0%    0.00B
   transform variables         10.8k    328ms    3.0%  30.2μs     0.00B    0.0%    0.00B
   prolong2interfaces          10.8k    278ms    2.5%  25.6μs     0.00B    0.0%    0.00B
   prolong2mortars             10.8k    214ms    1.9%  19.8μs     0.00B    0.0%    0.00B
   surface integral            10.8k    193ms    1.8%  17.8μs     0.00B    0.0%    0.00B
   interface flux              10.8k    176ms    1.6%  16.3μs     0.00B    0.0%    0.00B
   mortar flux                 10.8k    105ms    1.0%  9.70μs     0.00B    0.0%    0.00B
   reset ∂u/∂t                 10.8k   58.4ms    0.5%  5.39μs     0.00B    0.0%    0.00B
   Jacobian                    10.8k   35.5ms    0.3%  3.27μs     0.00B    0.0%    0.00B
   ~parabolic rhs!~            10.8k   12.5ms    0.1%  1.15μs   10.8KiB    0.1%    1.02B
   prolong2boundaries          10.8k    697μs    0.0%  64.3ns     0.00B    0.0%    0.00B
   boundary flux               10.8k    168μs    0.0%  15.5ns     0.00B    0.0%    0.00B
 rhs!                          10.8k    5.40s   49.1%   498μs   9.33KiB    0.0%    0.88B
   volume integral             10.8k    2.43s   22.1%   224μs     0.00B    0.0%    0.00B
   interface flux              10.8k    1.46s   13.3%   134μs     0.00B    0.0%    0.00B
   mortar flux                 10.8k    915ms    8.3%  84.3μs     0.00B    0.0%    0.00B
   surface integral            10.8k    190ms    1.7%  17.5μs     0.00B    0.0%    0.00B
   prolong2mortars             10.8k    154ms    1.4%  14.2μs     0.00B    0.0%    0.00B
   prolong2interfaces          10.8k    154ms    1.4%  14.2μs     0.00B    0.0%    0.00B
   reset ∂u/∂t                 10.8k   57.4ms    0.5%  5.29μs     0.00B    0.0%    0.00B
   Jacobian                    10.8k   37.3ms    0.3%  3.44μs     0.00B    0.0%    0.00B
   ~rhs!~                      10.8k   10.3ms    0.1%   950ns   9.33KiB    0.0%    0.88B
   prolong2boundaries          10.8k    625μs    0.0%  57.6ns     0.00B    0.0%    0.00B
   boundary flux               10.8k    178μs    0.0%  16.4ns     0.00B    0.0%    0.00B
   source terms                10.8k    177μs    0.0%  16.4ns     0.00B    0.0%    0.00B
 analyze solution                  3    101ms    0.9%  33.6ms   3.81MiB   18.6%  1.27MiB
 AMR                              22   23.6ms    0.2%  1.07ms   14.7MiB   71.8%   685KiB
   refine                         22   12.6ms    0.1%   572μs   6.03MiB   29.4%   281KiB
     mesh                         19   7.59ms    0.1%   400μs    228KiB    1.1%  12.0KiB
       refine_unbalanced!         19   4.75ms    0.0%   250μs   4.50KiB    0.0%     243B
       rebalance!                 40   2.65ms    0.0%  66.1μs   86.0KiB    0.4%  2.15KiB
       ~mesh~                     19    200μs    0.0%  10.5μs    138KiB    0.7%  7.25KiB
     solver                       19   4.94ms    0.0%   260μs   5.79MiB   28.2%   312KiB
     ~refine~                     22   43.3μs    0.0%  1.97μs   16.2KiB    0.1%     753B
   coarsen                        22   10.1ms    0.1%   461μs   8.36MiB   40.8%   389KiB
     mesh                         22   5.71ms    0.1%   259μs    121KiB    0.6%  5.51KiB
     solver                       22   3.73ms    0.0%   170μs   6.16MiB   30.0%   287KiB
     ~coarsen~                    22    707μs    0.0%  32.1μs   2.08MiB   10.1%  96.9KiB
   indicator                      22    561μs    0.0%  25.5μs    159KiB    0.8%  7.22KiB
   ~AMR~                          22    267μs    0.0%  12.1μs    186KiB    0.9%  8.48KiB
 initial condition AMR             1   1.23ms    0.0%  1.23ms   1.95MiB    9.5%  1.95MiB
   AMR                             2   1.12ms    0.0%   559μs   1.95MiB    9.5%  0.98MiB
     refine                        2    863μs    0.0%   432μs    589KiB    2.8%   295KiB
       solver                      1    474μs    0.0%   474μs    569KiB    2.7%   569KiB
       mesh                        1    386μs    0.0%   386μs   16.8KiB    0.1%  16.8KiB
         refine_unbalanced!        1    375μs    0.0%   375μs      576B    0.0%     576B
         ~mesh~                    1   9.57μs    0.0%  9.57μs   13.1KiB    0.1%  13.1KiB
         rebalance!                1   1.37μs    0.0%  1.37μs   3.22KiB    0.0%  3.22KiB
       ~refine~                    2   2.64μs    0.0%  1.32μs   3.45KiB    0.0%  1.73KiB
     ~AMR~                         2    218μs    0.0%   109μs   1.35MiB    6.6%   692KiB
     indicator                     2   37.5μs    0.0%  18.8μs   26.2KiB    0.1%  13.1KiB
     coarsen                       2    385ns    0.0%   192ns      128B    0.0%    64.0B
   ~initial condition AMR~         1    108μs    0.0%   108μs      752B    0.0%     752B
 ───────────────────────────────────────────────────────────────────────────────────────

@DanielDoehring DanielDoehring removed the request for review from sloede October 21, 2023 13:16
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 addition! Looks very good overall, I have left a few - mostly minor - comments and suggestions.

src/Trixi.jl Outdated Show resolved Hide resolved
src/equations/compressible_euler_1d.jl Outdated Show resolved Hide resolved
src/equations/laplace_diffusion_3d.jl Outdated Show resolved Hide resolved
src/solvers/dgsem_tree/containers.jl Show resolved Hide resolved
src/solvers/dgsem_tree/dg_2d_parabolic.jl Show resolved Hide resolved
@jlchan
Copy link
Contributor

jlchan commented Oct 24, 2023

@DanielDoehring are there any open issues you would like to resolve, or is this ready for us to review again?

@DanielDoehring
Copy link
Contributor Author

@DanielDoehring are there any open issues you would like to resolve, or is this ready for us to review again?

No, nothing from my side. I plan to open the issues we discussed once this is merged to be able to reference the actual code.

jlchan
jlchan previously approved these changes Oct 24, 2023
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. Thanks a lot for this super useful new feature!

If @ranocha agrees as well, this can be merged imho

@jlchan
Copy link
Contributor

jlchan commented Oct 24, 2023

Ok, please request a review when ready then

@sloede
Copy link
Member

sloede commented Oct 24, 2023

Ok, please request a review when ready then

Ah, I'm sorry. I missed that @ranocha was not involved in the previous review process of this PR, I mixed this up with another PR.

Hendrik, I do not think that it is super necessary for you to review this PR then, since most of the structural decisions had already been introduced by the 1D AMR PR. Just let us know if you plan to have a look, otherwise we can go ahead and merge this once tests pass.

@sloede sloede merged commit 4d22141 into trixi-framework:main Oct 25, 2023
31 checks passed
@DanielDoehring DanielDoehring deleted the AMR_Parabolic_2D3D_Tree branch October 25, 2023 12:33
@torrilhon torrilhon mentioned this pull request Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants