Skip to content

Commit

Permalink
Fix boundary flux kernel with multiple dispatches (#39)
Browse files Browse the repository at this point in the history
* Start

* Add tags to tests
  • Loading branch information
huiyuxie authored Sep 14, 2024
1 parent 3bc7912 commit e1c9b8e
Show file tree
Hide file tree
Showing 15 changed files with 590 additions and 37 deletions.
14 changes: 8 additions & 6 deletions src/solvers/dg_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -526,13 +526,15 @@ function boundary_flux_kernel!(surface_flux_values, boundaries_u, node_coordinat

# TODO: Improve this part
if direction == 1
u_boundary = boundary_conditions[1].boundary_value_function(x, t, equations)
flux_node = surface_flux(u_boundary, u_inner, orientation, equations)
noncons_flux_node = nonconservative_flux(u_boundary, u_inner, orientation, equations)
flux_node = boundary_conditions[1](u_inner, orientation, direction, x, t, surface_flux,
equations)
noncons_flux_node = boundary_conditions[1](u_inner, orientation, direction, x, t,
nonconservative_flux, equations)
else
u_boundary = boundary_conditions[2].boundary_value_function(x, t, equations)
flux_node = surface_flux(u_inner, u_boundary, orientation, equations)
noncons_flux_node = nonconservative_flux(u_inner, u_boundary, orientation, equations)
flux_node = boundary_conditions[2](u_inner, orientation, direction, x, t, surface_flux,
equations)
noncons_flux_node = boundary_conditions[2](u_inner, orientation, direction, x, t,
nonconservative_flux, equations)
end

@inbounds begin
Expand Down
28 changes: 16 additions & 12 deletions src/solvers/dg_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -553,21 +553,25 @@ function boundary_flux_kernel!(surface_flux_values, boundaries_u, node_coordinat

# TODO: Improve this part
if direction == 1
u_boundary = boundary_conditions[1].boundary_value_function(x, t, equations)
flux_node = surface_flux(u_boundary, u_inner, orientation, equations)
noncons_flux_node = nonconservative_flux(u_boundary, u_inner, orientation, equations)
flux_node = boundary_conditions[1](u_inner, orientation, direction, x, t, surface_flux,
equations)
noncons_flux_node = boundary_conditions[1](u_inner, orientation, direction, x, t,
nonconservative_flux, equations)
elseif direction == 2
u_boundary = boundary_conditions[2].boundary_value_function(x, t, equations)
flux_node = surface_flux(u_inner, u_boundary, orientation, equations)
noncons_flux_node = nonconservative_flux(u_inner, u_boundary, orientation, equations)
flux_node = boundary_conditions[2](u_inner, orientation, direction, x, t, surface_flux,
equations)
noncons_flux_node = boundary_conditions[2](u_inner, orientation, direction, x, t,
nonconservative_flux, equations)
elseif direction == 3
u_boundary = boundary_conditions[3].boundary_value_function(x, t, equations)
flux_node = surface_flux(u_boundary, u_inner, orientation, equations)
noncons_flux_node = nonconservative_flux(u_boundary, u_inner, orientation, equations)
flux_node = boundary_conditions[3](u_inner, orientation, direction, x, t, surface_flux,
equations)
noncons_flux_node = boundary_conditions[3](u_inner, orientation, direction, x, t,
nonconservative_flux, equations)
else
u_boundary = boundary_conditions[4].boundary_value_function(x, t, equations)
flux_node = surface_flux(u_inner, u_boundary, orientation, equations)
noncons_flux_node = nonconservative_flux(u_inner, u_boundary, orientation, equations)
flux_node = boundary_conditions[4](u_inner, orientation, direction, x, t, surface_flux,
equations)
noncons_flux_node = boundary_conditions[4](u_inner, orientation, direction, x, t,
nonconservative_flux, equations)
end

@inbounds begin
Expand Down
10 changes: 9 additions & 1 deletion test/test_adevction_mortar.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
module TestLinearAdvectionMortar # with `nonconservative_terms::False`
module TestLinearAdvectionMortar

####################################################################### Tags
# Kernels:
# -`cuda_prolong2mortars!`
# - `cuda_mortar_flux!`
# Conditions:
# - `nonconservative_terms::False`
#######################################################################

include("test_trixigpu.jl")

Expand Down
9 changes: 9 additions & 0 deletions test/test_advection_basic.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
module TestLinearAdvectionBasic

####################################################################### Tags
# Kernels:
# - `cuda_xx!` (most basic kernels)
# Conditions:
# - `nonconservative_terms::False`
# - `volume_integral::VolumeIntegralWeakForm`
# - `periodicity = true` 1D, 2D, 3D
#######################################################################

include("test_trixigpu.jl")

# Test precision of the semidiscretization process
Expand Down
Loading

0 comments on commit e1c9b8e

Please sign in to comment.