Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoArtiano committed Dec 10, 2024
1 parent 31f1e0a commit eb1ccdd
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 26 deletions.
21 changes: 11 additions & 10 deletions src/equations/equations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,19 +203,20 @@ end
# Dirichlet-type boundary condition for equations with non-conservative terms for use with UnstructuredMesh2D
# Note: For unstructured we lose the concept of an "absolute direction"
@inline function (boundary_condition::BoundaryConditionDirichlet)(u_inner,
normal_direction::AbstractVector,
x, t,
surface_flux_functions::Tuple,
equations)
normal_direction::AbstractVector,
x, t,
surface_flux_functions::Tuple,
equations)
surface_flux_function, nonconservative_flux_function = surface_flux_functions

# get the external value of the solution
u_boundary = boundary_condition.boundary_value_function(x, t, equations)
# get the external value of the solution
u_boundary = boundary_condition.boundary_value_function(x, t, equations)

# Calculate boundary flux
flux = surface_flux_function(u_inner, u_boundary, normal_direction, equations)
noncons = nonconservative_flux_function(u_inner, u_boundary, normal_direction, equations)
return flux + 0.5f0 * noncons
# Calculate boundary flux
flux = surface_flux_function(u_inner, u_boundary, normal_direction, equations)
noncons = nonconservative_flux_function(u_inner, u_boundary, normal_direction,
equations)
return flux + 0.5f0 * noncons
end

# operator types used for dispatch on parabolic boundary fluxes
Expand Down
10 changes: 6 additions & 4 deletions src/equations/shallow_water_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,15 @@ For details see Section 9.2.5 of the book:
if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
flux = surface_flux_function(u_inner, u_boundary, orientation_or_normal,
equations)
noncons = nonconservative_flux_function(u_inner, u_boundary, orientation_or_normal,
equations)
noncons = nonconservative_flux_function(u_inner, u_boundary,
orientation_or_normal,
equations)
else # u_boundary is "left" of boundary, u_inner is "right" of boundary
flux = surface_flux_function(u_boundary, u_inner, orientation_or_normal,
equations)
noncons = nonconservative_flux_function(u_boundary, u_inner, orientation_or_normal,
equations)
noncons = nonconservative_flux_function(u_boundary, u_inner,
orientation_or_normal,
equations)
end

return flux + 0.5f0 * noncons
Expand Down
16 changes: 9 additions & 7 deletions src/equations/shallow_water_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,8 @@ For details see Section 9.2.5 of the book:
x, t,
surface_flux_functions,
equations::ShallowWaterEquations2D)

surface_flux_function, nonconservative_flux_function = surface_flux_functions

# normalize the outward pointing direction
normal = normal_direction / norm(normal_direction)

Expand All @@ -199,8 +198,9 @@ For details see Section 9.2.5 of the book:

# calculate the boundary flux
flux = surface_flux_function(u_inner, u_boundary, normal_direction, equations)
noncons = nonconservative_flux_function(u_inner, u_boundary, normal_direction, equations)

noncons = nonconservative_flux_function(u_inner, u_boundary, normal_direction,
equations)

return flux + 0.5f0 * noncons
end

Expand All @@ -214,7 +214,7 @@ Should be used together with [`TreeMesh`](@ref).
direction, x, t,
surface_flux_functions,
equations::ShallowWaterEquations2D)
# The boundary conditions for the non-conservative term are identically 0 here.
# The boundary conditions for the non-conservative term are identically 0 here.
surface_flux_function, nonconservative_flux_function = surface_flux_functions
## get the appropriate normal vector from the orientation
if orientation == 1
Expand All @@ -226,10 +226,12 @@ Should be used together with [`TreeMesh`](@ref).
# Calculate boundary flux
if iseven(direction) # u_inner is "left" of boundary, u_boundary is "right" of boundary
flux = surface_flux_function(u_inner, u_boundary, orientation, equations)
noncons = nonconservative_flux_function(u_inner, u_boundary, orientation, equations)
noncons = nonconservative_flux_function(u_inner, u_boundary, orientation,
equations)
else # u_boundary is "left" of boundary, u_inner is "right" of boundary
flux = surface_flux_function(u_boundary, u_inner, orientation, equations)
noncons = nonconservative_flux_function(u_boundary, u_inner, orientation, equations)
noncons = nonconservative_flux_function(u_boundary, u_inner, orientation,
equations)
end

return flux + 0.5f0 * noncons
Expand Down
4 changes: 2 additions & 2 deletions src/solvers/dgsem_p4est/dg_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ end
boundary_index)
@unpack boundaries = cache
@unpack node_coordinates, contravariant_vectors = cache.elements


# Extract solution data from boundary container
u_inner = get_node_vars(boundaries.u, equations, dg, node_index, boundary_index)
Expand All @@ -364,7 +363,8 @@ end

# Call pointwise numerical flux function for the conservative part
# in the normal direction on the boundary
flux_ = boundary_condition(u_inner, normal_direction, x, t, surface_integral.surface_flux, equations)
flux_ = boundary_condition(u_inner, normal_direction, x, t,
surface_integral.surface_flux, equations)

# Copy flux to element storage in the correct orientation
for v in eachvariable(equations)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_tree/dg_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ function calc_boundary_flux_by_direction!(surface_flux_values::AbstractArray{<:A
u_inner = u_rr
end
x = get_node_coords(node_coordinates, equations, dg, boundary)

flux = boundary_condition(u_inner, orientations[boundary], direction, x, t,
surface_integral.surface_flux,
equations)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/dgsem_tree/dg_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ function calc_boundary_flux_by_direction!(surface_flux_values::AbstractArray{<:A
end
x = get_node_coords(node_coordinates, equations, dg, i, boundary)
flux = boundary_condition(u_inner, orientations[boundary], direction, x, t,
surface_integral.surface_flux,
surface_integral.surface_flux,
equations)

# Copy flux to left and right element storage
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/dgsem_unstructured/dg_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,8 @@ end

# Call pointwise numerical flux function for the conservative part
# in the normal direction on the boundary
flux = boundary_condition(u_inner, outward_direction, x, t, surface_integral.surface_flux, equations)
flux = boundary_condition(u_inner, outward_direction, x, t,
surface_integral.surface_flux, equations)

# Compute pointwise nonconservative numerical flux at the boundary.

Expand Down

0 comments on commit eb1ccdd

Please sign in to comment.