compute_face_mass_flux Subroutine

private subroutine compute_face_mass_flux(mesh, flow, bc, transport, face_flux, mass_flux)

Computes density-weighted face mass flux from volumetric flux.

This keeps a globally valid face-centered mass flux for scalar and enthalpy transport. face_flux is volumetric flux in ; mass_flux is times that flux in . Both use owner-to-neighbor orientation.

In constant-density mode . In variable-density mode is the arithmetic face density from transport%rho for interior faces and the owner density on physical boundaries.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_mpi_t), intent(in) :: flow
type(bc_set_t), intent(in) :: bc
type(transport_properties_t), intent(in) :: transport
real(kind=rk), intent(in) :: face_flux(:)
real(kind=rk), intent(out) :: mass_flux(:)

Source Code

   subroutine compute_face_mass_flux(mesh, flow, bc, transport, face_flux, mass_flux)
      type(mesh_t), intent(in) :: mesh
      type(flow_mpi_t), intent(in) :: flow
      type(bc_set_t), intent(in) :: bc
      type(transport_properties_t), intent(in) :: transport
      real(rk), intent(in) :: face_flux(:)
      real(rk), intent(out) :: mass_flux(:)

      integer :: i, f, owner, nb
      real(rk) :: rho_face

      if (.not. allocated(transport%rho)) then
         call fatal_error('flow', 'transport rho must be allocated before mass-flux update')
      end if

      mass_flux = zero

      do i = 1, size(flow%owned_faces)
         f = flow%owned_faces(i)
         owner = mesh%faces(f)%owner
         nb = face_effective_neighbor(mesh, bc, f, owner)

         if (nb > 0) then
            rho_face = 0.5_rk * (transport%rho(owner) + transport%rho(nb))
         else
            rho_face = transport%rho(owner)
         end if

         mass_flux(f) = rho_face * face_flux(f)
      end do
   end subroutine compute_face_mass_flux