-
Notifications
You must be signed in to change notification settings - Fork 105
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
Remove normal_direction_ll
for nonconservative terms
#2062
base: main
Are you sure you want to change the base?
Changes from 9 commits
bf728f7
aaf0166
10dc9cf
cc40791
974b3ba
47dab1a
c69719b
66c5bd8
d25e179
95d846a
4e13e6d
681430d
2684172
038e1e3
72cf490
be1f9e2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,14 +71,14 @@ struct BoundaryConditionDoNothing end | |
orientation_or_normal_direction, | ||
direction::Integer, x, t, surface_flux, | ||
equations) | ||
return flux(u_inner, orientation_or_normal_direction, equations) | ||
return surface_flux(u_inner, u_inner, orientation_or_normal_direction, equations) | ||
end | ||
|
||
# This version can be called by hyperbolic solvers on unstructured, curved meshes | ||
@inline function (::BoundaryConditionDoNothing)(u_inner, | ||
outward_direction::AbstractVector, | ||
x, t, surface_flux, equations) | ||
return flux(u_inner, outward_direction, equations) | ||
return surface_flux(u_inner, u_inner, outward_direction, equations) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
end | ||
|
||
# This version can be called by parabolic solvers | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,19 +196,13 @@ end | |
flux_nonconservative_powell(u_ll, u_rr, orientation::Integer, | ||
equations::IdealGlmMhdEquations2D) | ||
flux_nonconservative_powell(u_ll, u_rr, | ||
normal_direction_ll ::AbstractVector, | ||
normal_direction_average::AbstractVector, | ||
normal_direction::AbstractVector, | ||
equations::IdealGlmMhdEquations2D) | ||
|
||
Non-symmetric two-point flux discretizing the nonconservative (source) term of | ||
Powell and the Galilean nonconservative term associated with the GLM multiplier | ||
of the [`IdealGlmMhdEquations2D`](@ref). | ||
|
||
On curvilinear meshes, this nonconservative flux depends on both the | ||
contravariant vector (normal direction) at the current node and the averaged | ||
one. This is different from numerical fluxes used to discretize conservative | ||
terms. | ||
|
||
## References | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be mentioned here that this term is not exactly equivalent to the one proposed by Bohm et al., as the "metrics dealiasing" is done in a different manner. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added an additional comment about this to the docstring in 95d846a |
||
- Marvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, | ||
Florian Hindenlang, Joachim Saur | ||
|
@@ -254,8 +248,7 @@ terms. | |
end | ||
|
||
@inline function flux_nonconservative_powell(u_ll, u_rr, | ||
normal_direction_ll::AbstractVector, | ||
normal_direction_average::AbstractVector, | ||
normal_direction::AbstractVector, | ||
equations::IdealGlmMhdEquations2D) | ||
rho_ll, rho_v1_ll, rho_v2_ll, rho_v3_ll, rho_e_ll, B1_ll, B2_ll, B3_ll, psi_ll = u_ll | ||
rho_rr, rho_v1_rr, rho_v2_rr, rho_v3_rr, rho_e_rr, B1_rr, B2_rr, B3_rr, psi_rr = u_rr | ||
|
@@ -265,14 +258,9 @@ end | |
v3_ll = rho_v3_ll / rho_ll | ||
v_dot_B_ll = v1_ll * B1_ll + v2_ll * B2_ll + v3_ll * B3_ll | ||
|
||
# Note that `v_dot_n_ll` uses the `normal_direction_ll` (contravariant vector | ||
# at the same node location) while `B_dot_n_rr` uses the averaged normal | ||
# direction. The reason for this is that `v_dot_n_ll` depends only on the left | ||
# state and multiplies some gradient while `B_dot_n_rr` is used to compute | ||
# the divergence of B. | ||
v_dot_n_ll = v1_ll * normal_direction_ll[1] + v2_ll * normal_direction_ll[2] | ||
B_dot_n_rr = B1_rr * normal_direction_average[1] + | ||
B2_rr * normal_direction_average[2] | ||
v_dot_n_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] | ||
B_dot_n_rr = B1_rr * normal_direction[1] + | ||
B2_rr * normal_direction[2] | ||
|
||
# Powell nonconservative term: (0, B_1, B_2, B_3, v⋅B, v_1, v_2, v_3, 0) | ||
# Galilean nonconservative term: (0, 0, 0, 0, ψ v_{1,2}, 0, 0, 0, v_{1,2}) | ||
|
@@ -300,8 +288,9 @@ of the [`IdealGlmMhdEquations2D`](@ref). | |
|
||
This implementation uses a non-conservative term that can be written as the product | ||
of local and symmetric parts. It is equivalent to the non-conservative flux of Bohm | ||
et al. (`flux_nonconservative_powell`) for conforming meshes but it yields different | ||
results on non-conforming meshes(!). | ||
et al. [`flux_nonconservative_powell`](@ref) for conforming meshes but it yields different | ||
results on non-conforming meshes(!). On curvilinear meshes this formulation applies the | ||
local normal direction compared to the averaged one used in [`flux_nonconservative_powell`](@ref). | ||
patrickersing marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The two other flux functions with the same name return either the local | ||
or symmetric portion of the non-conservative flux based on the type of the | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,19 +224,13 @@ end | |
flux_nonconservative_powell(u_ll, u_rr, orientation::Integer, | ||
equations::IdealGlmMhdEquations3D) | ||
flux_nonconservative_powell(u_ll, u_rr, | ||
normal_direction_ll ::AbstractVector, | ||
normal_direction_average::AbstractVector, | ||
normal_direction::AbstractVector, | ||
equations::IdealGlmMhdEquations3D) | ||
|
||
Non-symmetric two-point flux discretizing the nonconservative (source) term of | ||
Powell and the Galilean nonconservative term associated with the GLM multiplier | ||
of the [`IdealGlmMhdEquations3D`](@ref). | ||
|
||
On curvilinear meshes, this nonconservative flux depends on both the | ||
contravariant vector (normal direction) at the current node and the averaged | ||
one. This is different from numerical fluxes used to discretize conservative | ||
terms. | ||
|
||
## References | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
- Marvin Bohm, Andrew R.Winters, Gregor J. Gassner, Dominik Derigs, | ||
Florian Hindenlang, Joachim Saur | ||
|
@@ -292,8 +286,7 @@ terms. | |
end | ||
|
||
@inline function flux_nonconservative_powell(u_ll, u_rr, | ||
normal_direction_ll::AbstractVector, | ||
normal_direction_average::AbstractVector, | ||
normal_direction::AbstractVector, | ||
equations::IdealGlmMhdEquations3D) | ||
rho_ll, rho_v1_ll, rho_v2_ll, rho_v3_ll, rho_e_ll, B1_ll, B2_ll, B3_ll, psi_ll = u_ll | ||
rho_rr, rho_v1_rr, rho_v2_rr, rho_v3_rr, rho_e_rr, B1_rr, B2_rr, B3_rr, psi_rr = u_rr | ||
|
@@ -303,16 +296,11 @@ end | |
v3_ll = rho_v3_ll / rho_ll | ||
v_dot_B_ll = v1_ll * B1_ll + v2_ll * B2_ll + v3_ll * B3_ll | ||
|
||
# Note that `v_dot_n_ll` uses the `normal_direction_ll` (contravariant vector | ||
# at the same node location) while `B_dot_n_rr` uses the averaged normal | ||
# direction. The reason for this is that `v_dot_n_ll` depends only on the left | ||
# state and multiplies some gradient while `B_dot_n_rr` is used to compute | ||
# the divergence of B. | ||
v_dot_n_ll = v1_ll * normal_direction_ll[1] + v2_ll * normal_direction_ll[2] + | ||
v3_ll * normal_direction_ll[3] | ||
B_dot_n_rr = B1_rr * normal_direction_average[1] + | ||
B2_rr * normal_direction_average[2] + | ||
B3_rr * normal_direction_average[3] | ||
v_dot_n_ll = v1_ll * normal_direction[1] + v2_ll * normal_direction[2] + | ||
v3_ll * normal_direction[3] | ||
B_dot_n_rr = B1_rr * normal_direction[1] + | ||
B2_rr * normal_direction[2] + | ||
B3_rr * normal_direction[3] | ||
|
||
# Powell nonconservative term: (0, B_1, B_2, B_3, v⋅B, v_1, v_2, v_3, 0) | ||
# Galilean nonconservative term: (0, 0, 0, 0, ψ v_{1,2,3}, 0, 0, 0, v_{1,2,3}) | ||
|
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.
Why do we need to use
surface_flux
here? isn't that adding computational complexity for the same output?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 became necessary, since we now also apply the boundary condition for nonconservative terms.
When you call
BoundaryConditionDoNothing
with nonconservative terms, the old implementation still evaluates the innerflux
instead of the inner nonconservative term. Therefore, we erroneously impose the conservative flux twice.For conservative fluxes this increases the computational complexity, but the modification is necessary to return a consistent boundary condition for both conservative and nonconservative terms.