compute_flux_divergence Subroutine

private subroutine compute_flux_divergence(mesh, flow, face_flux, local_div)

Computes the discrete divergence of face fluxes for each cell.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_mpi_t), intent(in) :: flow
real(kind=rk), intent(in) :: face_flux(:)
real(kind=rk), intent(out) :: local_div(:)

Called by

proc~~compute_flux_divergence~~CalledByGraph proc~compute_flux_divergence mod_flow_projection::compute_flux_divergence proc~advance_projection_step mod_flow_projection::advance_projection_step proc~advance_projection_step->proc~compute_flux_divergence program~lowmach_react_hex lowmach_react_hex program~lowmach_react_hex->proc~advance_projection_step

Source Code

   subroutine compute_flux_divergence(mesh, flow, face_flux, local_div)
      type(mesh_t), intent(in) :: mesh
      type(flow_mpi_t), intent(in) :: flow
      real(rk), intent(in) :: face_flux(:)
      real(rk), intent(out) :: local_div(:)

      integer :: c, lf, f
      real(rk) :: sgn

      local_div = zero

      do c = flow%first_cell, flow%last_cell
         do lf = 1, mesh%ncell_faces(c)
            f = mesh%cell_faces(lf, c)

            if (mesh%faces(f)%owner == c) then
               sgn = one
            else
               sgn = -one
            end if

            local_div(c) = local_div(c) + sgn * face_flux(f) / mesh%cells(c)%volume
         end do
      end do
   end subroutine compute_flux_divergence