Support for purely parabolic PDEs via SemidiscretizationParabolic#2874
Support for purely parabolic PDEs via SemidiscretizationParabolic#2874tristanmontoya wants to merge 89 commits intomainfrom
SemidiscretizationParabolic#2874Conversation
Co-authored-by: Daniel Doehring <daniel.doehring@rwth-aachen.de>
Co-authored-by: Daniel Doehring <daniel.doehring@rwth-aachen.de>
Co-authored-by: Daniel Doehring <daniel.doehring@rwth-aachen.de>
Co-authored-by: Daniel Doehring <daniel.doehring@rwth-aachen.de>
Co-authored-by: Daniel Doehring <daniel.doehring@rwth-aachen.de>
Co-authored-by: Daniel Doehring <daniel.doehring@rwth-aachen.de>
Co-authored-by: Daniel Doehring <daniel.doehring@rwth-aachen.de>
Co-authored-by: Daniel Doehring <daniel.doehring@rwth-aachen.de>
Co-authored-by: Daniel Doehring <daniel.doehring@rwth-aachen.de>
Co-authored-by: Daniel Doehring <daniel.doehring@rwth-aachen.de>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Review checklistThis checklist is meant to assist creators of PRs (to let them know what reviewers will typically look for) and reviewers (to guide them in a structured review process). Items do not need to be checked explicitly for a PR to be eligible for merging. Purpose and scope
Code quality
Documentation
Testing
Performance
Verification
Created with ❤️ by the Trixi.jl community. |
SemidiscretizationParaboblicSemidiscretizationParabolic
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2874 +/- ##
========================================
Coverage 97.08% 97.08%
========================================
Files 611 616 +5
Lines 47580 47690 +110
========================================
+ Hits 46189 46297 +108
- Misses 1391 1393 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
|
Benchmarks now added to PR description. |
|
@vchuravy I assume the buildkite failures are unrelated to this PR? |
CI for AMDGPU doesn't have very many runners so that can sometimes be a bit slower. |
examples/tree_1d_dgsem/elixir_diffusion_ldg_amr_boundary_layer.jl
Outdated
Show resolved
Hide resolved
| function rhs!(du_ode, u_ode, semi::SemidiscretizationParabolic, t) | ||
| @unpack mesh, equations, boundary_conditions, source_terms, solver, solver_parabolic, cache, cache_parabolic = semi |
There was a problem hiding this comment.
Do we really want this to be rhs! instead of rhs_parabolic!?
There was a problem hiding this comment.
This way, we don't have to specialize semidiscretize, which assumes the function is called rhs! in the generic case. Otherwise, we'd have to make semidiscretize for SemidiscretizationParabolic do the exact same thing as for a generic AbstractSemidiscretization, except renaming rhs! to rhs_parabolic!.
I also think the naming makes intuitive sense in that it designates the "right-hand side for a parabolic semidiscretization" rather than "the parabolic right-hand side of a semidiscretization" (the latter for which rhs_parabolic! makes sense in the context of a hyperbolic-parabolic problem).
There was a problem hiding this comment.
For clarity, I would rather argue that our current rhs! should be rhs_hyperbolic!. This is how we basically use it. Using rhs_parabolic! for parabolic terms would appear more natural to me.
Maybe you can add this to the agenda of the next Trixi.jl meeting? I would like to get input from a few additional people.
There was a problem hiding this comment.
Sure, I'll add it to the agenda. I see your point, and I'm not against the idea, but then we can't fall back to semidiscretize(::AbstractSemidiscretization) for both hyperbolic and parabolic problems unless we add another layer to make the outermost rhs! call dispatch directly to rhs_parabolic! or rhs_hyperbolic! as needed. Otherwise, I think there would be a lot of repeated code.
There was a problem hiding this comment.
Can't we have a small dispatch of the form default_rhs(::SemidiscretizationParabolic) = rhs_parabolic! and similarly for SemidiscretizationHyperbolic that is used in semidiscretize?
Co-authored-by: Hendrik Ranocha <ranocha@users.noreply.github.com>
| * Several scalar conservation laws (e.g., linear advection, Burgers' equation, LWR traffic flow) | ||
| * Linear diffusion/heat equation |
There was a problem hiding this comment.
The main purpose of this PR is to add
SemidiscretizationParabolicto handle purely parabolic PDEs, including the new typesLinearDiffusionEquation1DandLinearDiffusionEquation2D. It builds upon #2868, which renames "viscous" to "parabolic" when referring more generally to parabolic PDEs rather than fluid viscosity.Implementation notes
equationsstruct and doesn't require an unused hyperbolic partrhs!is specialized onSemidiscretizationParabolicto callrhs_parabolic!only.cacheandcache_parabolicanalogously toSemidiscretizationHyperbolicParabolicsolverandsolver_parabolic, with the latter used to dispatch the formulation for the parabolic terms, e.g., BR1 or LDG.SemidiscretizationHyperbolicParabolicto include modular hyperbolic and parabolic components, in addition to "base" equation-independent features. As a first step, however, I have not modified any of the structure for mixed hyperbolic-parabolic problems.Elixirs changed/added
examples/tree_1d_dgsem/elixir_diffusion_ldg.jl: migrated from zero-advection hyperbolic-parabolic setup to pure diffusion viaLinearDiffusionEquation1DandSemidiscretizationParabolic.examples/tree_1d_dgsem/elixir_diffusion_ldg_newton_krylov.jl: updated the Newton-Krylov pure-diffusion example to use the dedicated parabolic API.examples/tree_2d_dgsem/elixir_diffusion_steady_state_linear_map.jl: switched the steady-state 2D diffusion example to LinearDiffusionEquation2D and SemidiscretizationParabolic.examples/tree_1d_dgsem/elixir_diffusion_ldg_amr_boundary_layer.jl: new pure-diffusion AMR example with a boundary layer and mixed Dirichlet/Neumann boundary conditions.Benchmarks
For a simple 1D diffusion example, I get a speedup of just under 1.5x by using a purely parabolic semidiscretization rather than a hyperbolic-parabolic semidiscretization with zero advection velocity (which was previously the only way to solve parabolic problems). Using this benchmark script, I get the following output:
Other changes
AUTHORS.md.README.mdas an example of a scalar conservation law, as it is the canonical parabolic problem and users should know that it is supported.NEWS.mdhas been updated to include this change as part of the v0.16 lifecycle.LLM/AI usage
OpenAI Codex was used to generate some of the initial code. As the author of this PR, I have reviewed the code in its entirety and take full responsibility for its content.