Second order finite volume integral in 2D#85
Second order finite volume integral in 2D#85sbairos wants to merge 12 commits intoDanielDoehring:mainfrom
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. |
|
Could you add one more iteration of the convergence test? If that yields the expected order you can open this PR at the main repo |
… up to 4 levels of refinement on 8GB of RAM
|
So I actually wasn't able to do an additional level of Without this change, I was seeing: |
|
Oh okay, yeah looks good! Can you also check one of the |
|
Ahh good idea with trying |
|
okay, crashing in the first timestep indeed seems to hint that something is wrong. You might need to check if there are anny differences between the already implemented plain first-order finite volume integral between 1D and 2D |
|
Alright, finally figured it out and you were correct. Turns out that in 2D, Anyways, here's the |
DanielDoehring
left a comment
There was a problem hiding this comment.
Good job!
I have a couple minor requests, but overall this looks quite good!
|
You can also take a look at trixi-framework#2678 where I revisited some comments to the FV subcell method. |
| @test_allocations(Trixi.rhs!, semi, sol, 1000) | ||
| end | ||
|
|
||
| @trixi_testset "elixir_euler_free_stream.jl (O2 full reconstruction)" begin |
There was a problem hiding this comment.
I had to do reconstruction_O2_full instead of reconstruction_O2_inner here because inner was crashing after around 70 iterations with:
LoadError: DomainError with -1.7433242556262465:
sqrt was called with a negative real argument but will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
DomainError detected in the user `f` function. This occurs when the domain of a function is violated.
For example, `log(-1.0)` is undefined because `log` of a real number is defined to only output real
numbers, but `log` of a negative number is complex valued and therefore Julia throws a DomainError
by default. Cases to be aware of include:
* `log(x)`, `sqrt(x)`, `cbrt(x)`, etc. where `x<0`
* `x^y` for `x<0` floating point `y` (example: `(-1.0)^(1/2) == im`)
Within the context of SciML, this error can occur within the solver process even if the domain constraint
would not be violated in the solution due to adaptivity. For example, an ODE solver or optimization
routine may check a step at `new_u` which violates the domain constraint, and if violated reject the
step and use a smaller `dt`. However, the throwing of this error will have halted the solving process.
Thus the recommended fix is to replace this function with the equivalent ones from NaNMath.jl
(https://github.com/JuliaMath/NaNMath.jl) which returns a NaN instead of an error. The solver will then
effectively use the NaN within the error control routines to reject the out of bounds step. Additionally,
one could perform a domain transformation on the variables so that such an issue does not occur in the
definition of `f`.
For more information, check out the following FAQ page:
https://docs.sciml.ai/Optimization/stable/API/FAQ/#The-Solver-Seems-to-Violate-Constraints-During-the-Optimization,-Causing-DomainErrors,-What-Can-I-Do-About-That?
Stacktrace:
[1] throw_complex_domainerror(f::Symbol, x::Float64)
@ Base.Math ./math.jl:33
[2] sqrt
@ ./math.jl:686 [inlined]
[3] flux_hllc(u_ll::SVector{4, Float64}, u_rr::SVector{4, Float64}, normal_direction::SVector{2, Float64}, equations::CompressibleEulerEquations2D{Float64})
@ Trixi ~/trixi/Trixi.jl/src/equations/compressible_euler_2d.jl:1810
[4] calcflux_fvO2!
@ ~/trixi/Trixi.jl/src/solvers/dgsem_structured/dg_2d.jl:325 [inlined]
[5] fvO2_kernel!
@ ~/trixi/Trixi.jl/src/solvers/dgsem_tree/dg_2d.jl:314 [inlined]
[6] macro expansion
@ ~/trixi/Trixi.jl/src/solvers/dgsem_tree/dg_2d.jl:341 [inlined]
[7] macro expansion
@ ~/.julia/packages/Polyester/almvr/src/closure.jl:525 [inlined]
[8] macro expansion
@ ~/trixi/Trixi.jl/src/auxiliary/auxiliary.jl:213 [inlined]
(stack trace goes on but is full of excessively huge calls after this that won't be displayed here well)
There was a problem hiding this comment.
Ok, if that works fine - have you tried reducing the CFL? Since the spatial discretization changes you might need to adapt CFL as well.
|
Looks good! You can open the PR at the main repo soon! |
I mostly just copied what you had in trixi-framework#2022 but made it run in 2D.
Convergence seems decent.