boundary_velocity Subroutine

public subroutine boundary_velocity(mesh, bc, face_id, interior_velocity, value)

Evaluates the velocity vector at a boundary face.

Implements standard FV boundary evaluations: - Wall/Dirichlet: Returns the specified patch velocity. - Symmetry: Subtracts the normal component from the interior velocity. - Neumann/Periodic: Extrapolates the interior velocity to the face.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh

Mesh data structure.

type(bc_set_t), intent(in) :: bc

Boundary condition set.

integer, intent(in) :: face_id

ID of the boundary face.

real(kind=rk), intent(in) :: interior_velocity(3)
real(kind=rk), intent(out) :: value(3)

Called by

proc~~boundary_velocity~~CalledByGraph proc~boundary_velocity mod_bc::boundary_velocity proc~compute_momentum_rhs mod_flow_projection::compute_momentum_rhs proc~compute_momentum_rhs->proc~boundary_velocity proc~compute_predicted_face_flux mod_flow_projection::compute_predicted_face_flux proc~compute_predicted_face_flux->proc~boundary_velocity proc~advance_projection_step mod_flow_projection::advance_projection_step proc~advance_projection_step->proc~compute_momentum_rhs proc~advance_projection_step->proc~compute_predicted_face_flux program~lowmach_react_hex lowmach_react_hex program~lowmach_react_hex->proc~advance_projection_step

Source Code

   subroutine boundary_velocity(mesh, bc, face_id, interior_velocity, value)
      type(mesh_t), intent(in) :: mesh
      type(bc_set_t), intent(in) :: bc
      integer, intent(in) :: face_id
      real(rk), intent(in) :: interior_velocity(3)
      real(rk), intent(out) :: value(3)

      integer :: patch_id
      real(rk) :: nhat(3), un

      patch_id = mesh%faces(face_id)%patch
      if (patch_id <= 0) then
         value = interior_velocity
         return
      end if

      select case (bc%patches(patch_id)%velocity_type_id)
      case (bc_wall, bc_dirichlet)
         value = bc%patches(patch_id)%velocity
      case (bc_symmetry)
         nhat = mesh%faces(face_id)%normal
         un = dot_product(interior_velocity, nhat)
         value = interior_velocity - un * nhat
      case default
         value = interior_velocity
      end select
   end subroutine boundary_velocity