Skip to content

Commit

Permalink
Add bc that sets zero only at the incoming boundary
Browse files Browse the repository at this point in the history
...even when diffusion is present. This is in contrast to "zero" which
sets zero at the incoming boundary when no diffusion is present, but
zero at both boundaries when some diffusion is present. This may be
useful when numerical diffusion is present but is small compared to the
advection speed near the boundary.
  • Loading branch information
johnomotani committed Sep 12, 2023
1 parent e34aeb6 commit faf8707
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/initial_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2114,6 +2114,15 @@ function enforce_v_boundary_condition_local!(f, bc, speed, v_diffusion)
# 'upwind' boundary
f[end] = 0.0
end
elseif bc == "incoming_zero"
if speed[1] > 0.0
# 'upwind' boundary
f[1] = 0.0
end
if speed[end] < 0.0
# 'upwind' boundary
f[end] = 0.0
end
elseif bc == "both_zero"
f[1] = 0.0
f[end] = 0.0
Expand Down
2 changes: 2 additions & 0 deletions src/moment_kinetics_input.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,8 @@ function check_coordinate_input(coord, coord_name, io)
println(io,">$coord_name.bc = 'constant'. enforcing constant incoming BC in $coord_name.")
elseif coord.bc == "zero"
println(io,">$coord_name.bc = 'zero'. enforcing zero incoming BC in $coord_name.")
elseif coord.bc == "incoming_zero"
println(io,">$coord_name.bc = 'incoming_zero'. enforcing zero incoming BC in $coord_name (even when there is diffusion).")
elseif coord.bc == "both_zero"
println(io,">$coord_name.bc = 'both_zero'. enforcing zero BC in $coord_name.")
elseif coord.bc == "periodic"
Expand Down

0 comments on commit faf8707

Please sign in to comment.