compute_flow_diagnostics Subroutine

public subroutine compute_flow_diagnostics(mesh, flow, bc, params, fields, stats)

Aggregates global residuals, kinetic energy, and mass balance data.

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(case_params_t), intent(in) :: params
type(flow_fields_t), intent(in) :: fields
type(solver_stats_t), intent(inout) :: stats

Calls

proc~~compute_flow_diagnostics~~CallsGraph proc~compute_flow_diagnostics mod_flow_projection::compute_flow_diagnostics mpi_allreduce mpi_allreduce proc~compute_flow_diagnostics->mpi_allreduce proc~check_mpi mod_flow_projection::check_mpi proc~compute_flow_diagnostics->proc~check_mpi proc~compute_boundary_flux mod_flow_projection::compute_boundary_flux proc~compute_flow_diagnostics->proc~compute_boundary_flux proc~flow_global_max_owned mod_mpi_flow::flow_global_max_owned proc~compute_flow_diagnostics->proc~flow_global_max_owned proc~fatal_error mod_kinds::fatal_error proc~check_mpi->proc~fatal_error proc~patch_type_for_face mod_bc::patch_type_for_face proc~compute_boundary_flux->proc~patch_type_for_face proc~flow_global_max_owned->mpi_allreduce proc~check_mpi~2 mod_mpi_flow::check_mpi proc~flow_global_max_owned->proc~check_mpi~2 proc~profiler_start mod_profiler::profiler_start proc~flow_global_max_owned->proc~profiler_start proc~profiler_stop mod_profiler::profiler_stop proc~flow_global_max_owned->proc~profiler_stop proc~check_mpi~2->proc~fatal_error mpi_wtime mpi_wtime proc~profiler_start->mpi_wtime proc~find_or_create_timer mod_profiler::find_or_create_timer proc~profiler_start->proc~find_or_create_timer proc~profiler_stop->mpi_wtime proc~profiler_stop->proc~find_or_create_timer proc~record_edge mod_profiler::record_edge proc~profiler_stop->proc~record_edge

Called by

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

Source Code

   subroutine compute_flow_diagnostics(mesh, flow, bc, params, fields, stats)
      type(mesh_t), intent(in) :: mesh
      type(flow_mpi_t), intent(in) :: flow
      type(bc_set_t), intent(in) :: bc
      type(case_params_t), intent(in) :: params
      type(flow_fields_t), intent(in) :: fields
      type(solver_stats_t), intent(inout) :: stats

      real(rk) :: local_ke, global_ke
      real(rk) :: local_rms, global_rms
      real(rk) :: local_flux, global_flux
      integer :: c, ierr

      stats%max_divergence = flow_global_max_owned(flow, fields%div)

      local_rms = zero
      local_ke = zero

      do c = flow%first_cell, flow%last_cell
         local_rms = local_rms + fields%div(c) * fields%div(c)

         local_ke = local_ke + half * params%rho * mesh%cells(c)%volume * &
                    dot_product(fields%u(:, c), fields%u(:, c))
      end do

      call MPI_Allreduce(local_rms, global_rms, 1, MPI_DOUBLE_PRECISION, MPI_SUM, flow%comm, ierr)
      call check_mpi(ierr, 'diagnostic rms')

      call MPI_Allreduce(local_ke, global_ke, 1, MPI_DOUBLE_PRECISION, MPI_SUM, flow%comm, ierr)
      call check_mpi(ierr, 'diagnostic kinetic energy')

      stats%rms_divergence = sqrt(global_rms / max(real(mesh%ncells, rk), one))
      stats%kinetic_energy = global_ke

      call compute_boundary_flux(mesh, flow, bc, fields%face_flux, local_flux)

      call MPI_Allreduce(local_flux, global_flux, 1, MPI_DOUBLE_PRECISION, MPI_SUM, flow%comm, ierr)
      call check_mpi(ierr, 'diagnostic boundary flux')

      stats%net_boundary_flux = global_flux
   end subroutine compute_flow_diagnostics