energy_face_normal_distance Function

private function energy_face_normal_distance(mesh, bc, face_id, cell_id, nb) result(dist)

Normal distance used for cell-cell and cell-boundary temperature gradients.

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~~energy_face_normal_distance~~CallsGraph proc~energy_face_normal_distance mod_energy::energy_face_normal_distance proc~energy_outward_normal mod_energy::energy_outward_normal proc~energy_face_normal_distance->proc~energy_outward_normal proc~fatal_error mod_kinds::fatal_error proc~energy_face_normal_distance->proc~fatal_error proc~patch_type_for_face mod_bc::patch_type_for_face proc~energy_face_normal_distance->proc~patch_type_for_face

Called by

proc~~energy_face_normal_distance~~CalledByGraph proc~energy_face_normal_distance mod_energy::energy_face_normal_distance proc~advance_energy_transport mod_energy::advance_energy_transport proc~advance_energy_transport->proc~energy_face_normal_distance program~lowmach_react_hex lowmach_react_hex program~lowmach_react_hex->proc~advance_energy_transport

Source Code

   function energy_face_normal_distance(mesh, bc, face_id, cell_id, nb) result(dist)
      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) :: dist

      integer :: pair_face
      integer :: btype
      real(rk) :: nvec(3)

      nvec = energy_outward_normal(mesh, face_id, cell_id)

      if (nb > 0) then
         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('energy', 'periodic face has no paired face')
               end if

               dist = abs(dot_product(mesh%faces(face_id)%center - &
                                      mesh%cells(cell_id)%center, nvec)) + &
                      abs(dot_product(mesh%cells(nb)%center - &
                                      mesh%faces(pair_face)%center, nvec))

               dist = max(dist, tiny_safe)
               return
            end if
         end if

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

      dist = max(dist, tiny_safe)
   end function energy_face_normal_distance