face_neighbor_weight Function

private function face_neighbor_weight(mesh, bc, face_id, cell_id, nb) result(w_nb)

Computes the linear interpolation weight for a neighbor cell.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(bc_set_t), intent(in) :: bc
integer, intent(in) :: face_id
integer, intent(in) :: cell_id
integer, intent(in) :: nb

Return Value real(kind=rk)


Calls

proc~~face_neighbor_weight~~CallsGraph proc~face_neighbor_weight mod_flow_projection::face_neighbor_weight proc~fatal_error mod_kinds::fatal_error proc~face_neighbor_weight->proc~fatal_error proc~outward_normal mod_flow_projection::outward_normal proc~face_neighbor_weight->proc~outward_normal proc~patch_type_for_face mod_bc::patch_type_for_face proc~face_neighbor_weight->proc~patch_type_for_face

Called by

proc~~face_neighbor_weight~~CalledByGraph proc~face_neighbor_weight mod_flow_projection::face_neighbor_weight proc~face_linear_scalar mod_flow_projection::face_linear_scalar proc~face_linear_scalar->proc~face_neighbor_weight proc~face_linear_vector mod_flow_projection::face_linear_vector proc~face_linear_vector->proc~face_neighbor_weight proc~compute_momentum_rhs mod_flow_projection::compute_momentum_rhs proc~compute_momentum_rhs->proc~face_linear_vector proc~pressure_gradient_cell mod_flow_projection::pressure_gradient_cell proc~compute_momentum_rhs->proc~pressure_gradient_cell proc~compute_predicted_face_flux mod_flow_projection::compute_predicted_face_flux proc~compute_predicted_face_flux->proc~face_linear_vector proc~correct_cell_velocity mod_flow_projection::correct_cell_velocity proc~correct_cell_velocity->proc~face_linear_scalar proc~pressure_gradient_cell->proc~face_linear_scalar 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 proc~advance_projection_step->proc~correct_cell_velocity program~lowmach_react_hex lowmach_react_hex program~lowmach_react_hex->proc~advance_projection_step

Source Code

   function face_neighbor_weight(mesh, bc, face_id, cell_id, nb) result(w_nb)
      type(mesh_t), intent(in) :: mesh
      type(bc_set_t), intent(in) :: bc
      integer, intent(in) :: face_id
      integer, intent(in) :: cell_id
      integer, intent(in) :: nb
      real(rk) :: w_nb

      integer :: pair_face
      integer :: btype
      real(rk) :: nvec(3)
      real(rk) :: d_owner
      real(rk) :: d_nb
      real(rk) :: d_total

      if (nb <= 0) then
         w_nb = zero
         return
      end if

      nvec = outward_normal(mesh, face_id, cell_id)

      d_owner = abs(dot_product(mesh%faces(face_id)%center - &
                                mesh%cells(cell_id)%center, nvec))

      if (mesh%faces(face_id)%neighbor == 0) then
         btype = patch_type_for_face(mesh, bc, face_id)

         if (btype == bc_periodic) then
            pair_face = mesh%faces(face_id)%periodic_face

            if (pair_face <= 0) then
               call fatal_error('flow', 'periodic face has no paired face')
            end if

            d_nb = abs(dot_product(mesh%cells(nb)%center - &
                                   mesh%faces(pair_face)%center, nvec))
         else
            d_nb = abs(dot_product(mesh%cells(nb)%center - &
                                   mesh%faces(face_id)%center, nvec))
         end if
      else
         d_nb = abs(dot_product(mesh%cells(nb)%center - &
                                mesh%faces(face_id)%center, nvec))
      end if

      d_total = max(d_owner + d_nb, tiny_safe)

      w_nb = d_owner / d_total
   end function face_neighbor_weight