Computes the discrete divergence of face fluxes for each cell.
| Type | Intent | Optional | 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(:) |
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