pressure_gradient_cell Subroutine

private subroutine pressure_gradient_cell(mesh, bc, p, cell_id, gradp)

Calculates the pressure gradient at a cell center using Gauss's Theorem.

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(bc_set_t), intent(in) :: bc
real(kind=rk), intent(in) :: p(:)
integer, intent(in) :: cell_id
real(kind=rk), intent(out) :: gradp(3)

Calls

proc~~pressure_gradient_cell~~CallsGraph proc~pressure_gradient_cell mod_flow_projection::pressure_gradient_cell proc~boundary_pressure mod_bc::boundary_pressure proc~pressure_gradient_cell->proc~boundary_pressure proc~boundary_pressure_type mod_bc::boundary_pressure_type proc~pressure_gradient_cell->proc~boundary_pressure_type proc~face_effective_neighbor mod_bc::face_effective_neighbor proc~pressure_gradient_cell->proc~face_effective_neighbor proc~face_linear_scalar mod_flow_projection::face_linear_scalar proc~pressure_gradient_cell->proc~face_linear_scalar proc~outward_normal mod_flow_projection::outward_normal proc~pressure_gradient_cell->proc~outward_normal proc~is_periodic_face mod_bc::is_periodic_face proc~face_effective_neighbor->proc~is_periodic_face proc~face_neighbor_weight mod_flow_projection::face_neighbor_weight proc~face_linear_scalar->proc~face_neighbor_weight proc~face_neighbor_weight->proc~outward_normal proc~fatal_error mod_kinds::fatal_error proc~face_neighbor_weight->proc~fatal_error proc~patch_type_for_face mod_bc::patch_type_for_face proc~face_neighbor_weight->proc~patch_type_for_face proc~is_periodic_face->proc~patch_type_for_face

Called by

proc~~pressure_gradient_cell~~CalledByGraph proc~pressure_gradient_cell mod_flow_projection::pressure_gradient_cell proc~compute_momentum_rhs mod_flow_projection::compute_momentum_rhs proc~compute_momentum_rhs->proc~pressure_gradient_cell proc~advance_projection_step mod_flow_projection::advance_projection_step proc~advance_projection_step->proc~compute_momentum_rhs program~lowmach_react_hex lowmach_react_hex program~lowmach_react_hex->proc~advance_projection_step

Source Code

   subroutine pressure_gradient_cell(mesh, bc, p, cell_id, gradp)
      type(mesh_t), intent(in) :: mesh
      type(bc_set_t), intent(in) :: bc
      real(rk), intent(in) :: p(:)
      integer, intent(in) :: cell_id
      real(rk), intent(out) :: gradp(3)

      integer :: lf, f, nb
      real(rk) :: nvec(3)
      real(rk) :: pf
      logical :: is_dirichlet

      gradp = zero

      do lf = 1, mesh%ncell_faces(cell_id)
         f = mesh%cell_faces(lf, cell_id)
         nvec = outward_normal(mesh, f, cell_id)

         nb = face_effective_neighbor(mesh, bc, f, cell_id)

         if (nb > 0) then
            pf = face_linear_scalar(mesh, bc, f, cell_id, nb, p(cell_id), p(nb))
         else
            if (boundary_pressure_type(mesh, bc, f) == bc_dirichlet) then
               call boundary_pressure(mesh, bc, f, p(cell_id), pf, is_dirichlet)
            else
               pf = p(cell_id)
            end if
         end if

         gradp = gradp + pf * nvec * mesh%faces(f)%area
      end do

      gradp = gradp / mesh%cells(cell_id)%volume
   end subroutine pressure_gradient_cell