lowmach_cell_divu Function

private function lowmach_cell_divu(mesh, fields, c) result(value)

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_fields_t), intent(in) :: fields
integer, intent(in) :: c

Return Value real(kind=rk)


Source Code

   real(rk) function lowmach_cell_divu(mesh, fields, c) result(value)
      type(mesh_t), intent(in) :: mesh
      type(flow_fields_t), intent(in) :: fields
      integer, intent(in) :: c

      integer :: lf, fid
      real(rk) :: vol, flux_out

      value = 0.0_rk
      if (.not. allocated(fields%face_flux)) return
      if (c < 1 .or. c > mesh%ncells) return

      vol = mesh%cells(c)%volume
      if (vol <= 0.0_rk) return

      do lf = 1, mesh%ncell_faces(c)
         fid = mesh%cell_faces(lf, c)
         if (mesh%faces(fid)%owner == c) then
            flux_out = fields%face_flux(fid)
         else
            flux_out = -fields%face_flux(fid)
         end if
         value = value + flux_out / vol
      end do

   end function lowmach_cell_divu