-
Couldn't load subscription status.
- Fork 1
Hyperbolic-Parabolic elixir using SCT #81
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
base: main
Are you sure you want to change the base?
Conversation
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. |
examples/tree_2d_dgsem/elixir_advection_diffusion_implicit_sparse_jacobian.jl
Outdated
Show resolved
Hide resolved
examples/tree_2d_dgsem/elixir_advection_diffusion_implicit_sparse_jacobian.jl
Outdated
Show resolved
Hide resolved
d529252 to
f59c8dc
Compare
examples/tree_2d_dgsem/elixir_advection_diffusion_implicit_sparse_jacobian.jl
Outdated
Show resolved
Hide resolved
examples/tree_2d_dgsem/elixir_advection_diffusion_implicit_sparse_jacobian.jl
Outdated
Show resolved
Hide resolved
examples/tree_2d_dgsem/elixir_advection_diffusion_implicit_sparse_jacobian.jl
Outdated
Show resolved
Hide resolved
examples/tree_2d_dgsem/elixir_advection_diffusion_implicit_sparse_jacobian.jl
Outdated
Show resolved
Hide resolved
examples/tree_2d_dgsem/elixir_navierstokes_convergence_implicit_sparse_jacobian.jl
Outdated
Show resolved
Hide resolved
examples/tree_2d_dgsem/elixir_navierstokes_convergence_implicit_sparse_jacobian.jl
Outdated
Show resolved
Hide resolved
examples/tree_2d_dgsem/elixir_navierstokes_convergence_implicit_sparse_jacobian.jl
Outdated
Show resolved
Hide resolved
src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl
Outdated
Show resolved
Hide resolved
src/semidiscretization/semidiscretization_hyperbolic_parabolic.jl
Outdated
Show resolved
Hide resolved
examples/tree_2d_dgsem/elixir_advection_diffusion_implicit_sparse_jacobian.jl
Outdated
Show resolved
Hide resolved
examples/tree_2d_dgsem/elixir_advection_diffusion_implicit_sparse_jacobian.jl
Outdated
Show resolved
Hide resolved
examples/tree_2d_dgsem/elixir_navierstokes_convergence_implicit_sparse_jacobian.jl
Outdated
Show resolved
Hide resolved
examples/tree_2d_dgsem/elixir_advection_diffusion_implicit_sparse_jacobian.jl
Outdated
Show resolved
Hide resolved
c83217c to
b7ab829
Compare
| ### Compare sparsity pattern based on hyperbolic-parabolic ### | ||
| ### problem with sparsity pattern of parabolic-only problem ### | ||
|
|
||
| # We construct a semidiscretization just as we did previously, but this time with advection_velocity=0 | ||
| equations_hyperbolic_no_advection = LinearScalarAdvectionEquation1D(0) | ||
| equations_parabolic_no_advection = LaplaceDiffusion1D(diffusivity(), equations_hyperbolic_no_advection) | ||
|
|
||
| semi_jac_type_no_advection = SemidiscretizationHyperbolicParabolic(mesh, | ||
| (equations_hyperbolic_no_advection, | ||
| equations_parabolic_no_advection), | ||
| initial_condition, solver, | ||
| uEltype = jac_eltype) | ||
| ode_jac_type_no_advection = semidiscretize(semi_jac_type_no_advection, tspan) | ||
|
|
||
| # Do sparsity detection on our semidiscretization with advection turned off | ||
| rhs_parabolic_wrapped! = (du_ode, u0_ode) -> Trixi.rhs_parabolic!(du_ode, u0_ode, semi_jac_type_no_advection, tspan[1]) | ||
|
|
||
| jac_prototype_parabolic_no_advection = jacobian_sparsity(rhs_parabolic_wrapped!, du_ode, u0_ode, jac_detector) | ||
|
|
||
| coloring_result_no_advection = coloring(jac_prototype_parabolic_no_advection, coloring_prob, coloring_alg) | ||
| coloring_vec_parabolic_no_advection = column_colors(coloring_result) | ||
|
|
||
| # Given that the stencil for parabolic solvers are always larger than those of hyperbolic solvers, | ||
| # the sparsity detection will never depend on the hyperbolic part of the problem | ||
| @assert(jac_prototype_parabolic == jac_prototype_parabolic_no_advection) | ||
| @assert(coloring_vec_parabolic == coloring_vec_parabolic_no_advection) |
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.
This is my comparison of advection_velocity=0 with the normal advection velocity. I'm not sure how convincing it is, though, since we don't actually ever do sparsity detection on the rhs!() function. Should I also include the rhs!() in this comparison (I guess in the previous section we would add it and in this section we could leave it out)?
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.
Yes, please use the entire rhs! 👍
| # Default `AutoForwardDiff()` is not yet working, see | ||
| # https://github.com/trixi-framework/Trixi.jl/issues/2369 | ||
| SBDF2(; autodiff = AutoFiniteDiff()); | ||
| abstol = time_int_tol, reltol = time_int_tol, dt = 0.0005, |
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.
dt here has to be very small because for larger dt such as for 0.005, the simulation stops due to instability.
This means that this elixir is quite slow (it runs for ~180s even though the timespan it covers is only 0.05). I did try the other IMEX methods here and they were all approximately equally slow
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.
Hm okay, what about looser tolerances?
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.
Unfortunately, it looks like the tolerances don't seem to help for larger timespans. I originally started with tspan=(0.0, 0.5) but using dt=0.005 or larger, it fails at around the 30th timestep even for time_int_tol=1e-1.
Using the larger timespan, it only starts working when dt=0.0005 but then it ends up taking ~2500s so I had to also decrease tspan by an order of magnitude in order to make it run in a "reasonable" runtime of ~170s.
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.
Hm, could you try a different integrator? Maybe something different performs better
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.
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.
I spent some more time looking into this this morning and it really does seem like the smaller step size is just needed for these implicit Euler schemes.
The error that always comes up is:
┌ Warning: Newton steps could not converge and algorithm is not adaptive. Use a lower dt.
└ @ SciMLBase ~/.julia/packages/SciMLBase/wfZCo/src/integrator_interface.jl:637
The following changes made the simulation crash with this error in an earlier timestep:
- Increasing the
solver'spolydegfrom3to4 - Increasing the
mesh'spolydegfrom3to4 - Increasing the
trees_per_dimensionfrom(4, 4)to(8, 8) - Increasing
initial_refinement_levelfrom2to3
Which was surprising to me because I would have thought that having a finer mesh would have led to fewer discontinuities.
Also, I've found that at least for the higher polydeg change, if I keep this very small dt, it can run successfully (it just takes even longer). I've yet to see the program crash when dt=0.0005. I'll keep trying the other settings, it's just a slow process since it takes a really long time to run with any of these changed and dt so small
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.
Okay, that explains the poor behaviour, thanks for investigating this!
No description provided.