Aggregates global residuals, kinetic energy, and mass balance data.
| Type | Intent | Optional | 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 |
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