-
Notifications
You must be signed in to change notification settings - Fork 114
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 1D Parabolic Eqs #1602
AMR for 1D Parabolic Eqs #1602
Conversation
… into MortarsParabolic
… into MortarsParabolic
@@ -192,6 +192,15 @@ end | |||
amr_callback(u_ode, mesh_equations_solver_cache(semi)..., semi, t, iter; kwargs...) | |||
end | |||
|
|||
@inline function (amr_callback::AMRCallback)(u_ode::AbstractVector, | |||
semi::SemidiscretizationHyperbolicParabolic, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Special dispatch for specialized amr_callback
src/callbacks_step/amr.jl
Outdated
|
||
# refine solver | ||
@trixi_timeit timer() "solver" refine!(u_ode, adaptor, mesh, equations, dg, | ||
cache, cache_parabolic, elements_to_refine) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the cache_parabolic
here
src/callbacks_step/amr.jl
Outdated
|
||
# coarsen solver | ||
@trixi_timeit timer() "solver" coarsen!(u_ode, adaptor, mesh, equations, dg, | ||
cache, cache_parabolic, elements_to_remove) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note the cache_parabolic
here
resize!(elements, length(leaf_cell_ids)) | ||
init_elements!(elements, leaf_cell_ids, mesh, dg.basis) | ||
@assert nelements(dg, cache_parabolic) > old_n_elements | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Treatment for parabolic terms
src/callbacks_step/amr_dg1d.jl
Outdated
(nvariables(equations), nnodes(dg), nelements(dg, cache))) | ||
cache_parabolic.cache_viscous.flux_viscous = unsafe_wrap(Array, | ||
pointer(cache_parabolic.cache_viscous._flux_viscous), | ||
(nvariables(equations), nnodes(dg), nelements(dg, cache))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resize of cache_viscous
|
||
@unpack interfaces = cache_parabolic | ||
resize!(interfaces, count_required_interfaces(mesh, leaf_cell_ids)) | ||
init_interfaces!(interfaces, elements, mesh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addition for parabolic terms
|
||
@unpack boundaries = cache_parabolic | ||
resize!(boundaries, count_required_boundaries(mesh, leaf_cell_ids)) | ||
init_boundaries!(boundaries, elements, mesh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addition for parabolic terms
@unpack elements, cache_viscous = cache_parabolic | ||
resize!(elements, length(leaf_cell_ids)) | ||
init_elements!(elements, leaf_cell_ids, mesh, dg.basis) | ||
@assert nelements(dg, cache_parabolic) < old_n_elements |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addition for parabolic terms
src/callbacks_step/amr_dg1d.jl
Outdated
(nvariables(equations), nnodes(dg), nelements(dg, cache))) | ||
cache_parabolic.cache_viscous.flux_viscous = unsafe_wrap(Array, | ||
pointer(cache_parabolic.cache_viscous._flux_viscous), | ||
(nvariables(equations), nnodes(dg), nelements(dg, cache))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resizing cache_viscous
|
||
@unpack interfaces = cache_parabolic | ||
resize!(interfaces, count_required_interfaces(mesh, leaf_cell_ids)) | ||
init_interfaces!(interfaces, elements, mesh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addition for parabolic terms
|
||
@unpack boundaries = cache_parabolic | ||
resize!(boundaries, count_required_boundaries(mesh, leaf_cell_ids)) | ||
init_boundaries!(boundaries, elements, mesh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addition for parabolic terms
Codecov Report
@@ Coverage Diff @@
## main #1602 +/- ##
==========================================
+ Coverage 87.99% 96.08% +8.09%
==========================================
Files 406 408 +2
Lines 33499 33753 +254
==========================================
+ Hits 29475 32429 +2954
+ Misses 4024 1324 -2700
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
||
# refine solver | ||
@trixi_timeit timer() "solver" refine!(u_ode, adaptor, mesh, equations, dg, | ||
cache, cache_parabolic, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refine!
call with cache_parabolic
|
||
# coarsen solver | ||
@trixi_timeit timer() "solver" coarsen!(u_ode, adaptor, mesh, equations, dg, | ||
cache, cache_parabolic, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coarsen!
call with cache_parabolic
Thanks a lot for the PR! It looks like you started from some old branch instead of |
Related to #1147. To keep it simple this is for the moment only 1D.
Essentially, this is a lot copy-paste from the treatment for hyperbolic terms, with the addition of the
cache_viscous
datastructure for dynamic resizing.MPI has not (yet) been tested.
Convergence test:
For this elixir
The convergence study returns