-
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 (Clean branch) #1605
AMR for 1D Parabolic Eqs (Clean branch) #1605
Conversation
As an outlook: mutable struct CacheViscous2D{uEltype <: Real}
u_transformed::Array{uEltype, 4}
# IDEA: Use SVector for fixed sized vectors?
gradients::Vector{Array{uEltype, 4}}
flux_viscous::Vector{Array{uEltype, 4}}
# internal `resize!`able storage
_u_transformed::Vector{uEltype}
_gradients::Vector{Vector{uEltype}}
_flux_viscous::Vector{Vector{uEltype}}
function CacheViscous2D{uEltype}(n_vars::Integer, n_nodes::Integer, n_elements::Integer) where {uEltype <: Real}
new(Array{uEltype, 4}(undef, n_vars, n_nodes, n_nodes, n_elements),
[Array{uEltype, 4}(undef, n_vars, n_nodes, n_nodes, n_elements) for _ in 1:2],
[Array{uEltype, 4}(undef, n_vars, n_nodes, n_nodes, n_elements) for _ in 1:2],
Vector{uEltype}(undef, n_vars * n_nodes^2 * n_elements),
[Vector{uEltype}(undef, n_vars * n_nodes^2 * n_elements) for _ in 1:2],
[Vector{uEltype}(undef, n_vars * n_nodes^2 * n_elements) for _ in 1:2])
end
end with # Only one-dimensional `Array`s are `resize!`able in Julia.
# Hence, we use `Vector`s as internal storage and `resize!`
# them whenever needed. Then, we reuse the same memory by
# `unsafe_wrap`ping multi-dimensional `Array`s around the
# internal storage.
function Base.resize!(cache_viscous::Union{CacheViscous2D, CacheViscous3D}, capacity)
resize!(cache_viscous._u_transformed, capacity)
for dim in 1:length(cache_viscous._gradients)
resize!(cache_viscous._gradients[dim], capacity)
resize!(cache_viscous._flux_viscous[dim], capacity)
end
return nothing
end |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1605 +/- ##
==========================================
- Coverage 96.15% 88.00% -8.14%
==========================================
Files 414 416 +2
Lines 33956 34070 +114
==========================================
- Hits 32647 29983 -2664
- Misses 1309 4087 +2778
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Thanks for starting to tackle this! Note that convergence is very hard to show with AMR, since you essentially would need an analytical AMR controller that does the exact same refinement for different levels. So getting an EOC of 3.5 where 4 is the expectation seems reasonable to me. Note that we do not support parallel execution with MPI in 1D since it does not pay off (1D is sooooo cheap) |
Yeah, that is also why I chose the |
Since @sloede is taking care of this, I removed the review requests for Jesse and me. |
Co-authored-by: Michael Schlottke-Lakemper <[email protected]>
… into Parabolic_AMR_1D
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.
LGTM! Thanks a lot for this addition!
This is a cleaned-up version of #1602.
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.I tried to mark the additions for parabolic terms compared to the hyperbolic ones wherever they occur.
MPI has not (yet) been tested.
Convergence test:
For this elixir
The convergence study returns