lowmach_debug_value Function

private function lowmach_debug_value(mesh, fields, transport, c, name) result(value)

Arguments

Type IntentOptional Attributes Name
type(mesh_t), intent(in) :: mesh
type(flow_fields_t), intent(in) :: fields
type(transport_properties_t), intent(in) :: transport
integer, intent(in) :: c
character(len=*), intent(in) :: name

Return Value real(kind=rk)


Source Code

   real(rk) function lowmach_debug_value(mesh, fields, transport, c, name) result(value)
      type(mesh_t), intent(in) :: mesh
      type(flow_fields_t), intent(in) :: fields
      type(transport_properties_t), intent(in) :: transport
      integer, intent(in) :: c
      character(len=*), intent(in) :: name

      real(rk) :: divu, s_current, s_projection
      real(rk) :: rho_current, rho_projection, rho_floor
      real(rk) :: div_mass, ugrad_rho, source_advective, source_history
      real(rk) :: continuity_residual

      value = 0.0_rk
      rho_floor = tiny(1.0_rk)

      divu = lowmach_cell_divu(mesh, fields, c)
      div_mass = lowmach_cell_div_mass_flux(mesh, fields, c)
      s_current = lowmach_cell_source_current(fields, c)
      s_projection = lowmach_cell_source_projection(fields, c)
      rho_current = lowmach_cell_rho_current(transport, c)
      rho_projection = lowmach_cell_rho_projection(fields, transport, c)

      ugrad_rho = lowmach_cell_u_dot_grad_rho(mesh, fields, transport, c)
      if (rho_current > rho_floor) then
         source_advective = -ugrad_rho / rho_current
      else
         source_advective = 0.0_rk
      end if
      source_history = s_current - source_advective

      ! Since rho_old is advanced after source construction, this visualization
      ! estimate reconstructs d(rho)/dt from the history-source component:
      ! S_history = (rho_old - rho)/(rho dt) = -drho_dt/rho.
      continuity_residual = -rho_current * source_history + div_mass

      select case (trim(name))
      case ('lowmach_source_current')
         value = s_current
      case ('lowmach_source_projection')
         value = s_projection
      case ('lowmach_source_difference')
         value = s_current - s_projection
      case ('divu_recomputed')
         value = divu
      case ('divu_minus_S_projection')
         value = divu - s_projection
      case ('divu_minus_S_current')
         value = divu - s_current
      case ('rho_current')
         value = rho_current
      case ('rho_projection')
         value = rho_projection
      case ('rho_current_minus_projection')
         value = rho_current - rho_projection
      case ('mass_flux_divergence_recomputed')
         value = div_mass
      case ('lowmach_source_history_estimate')
         value = source_history
      case ('lowmach_source_advective_density')
         value = source_advective
      case ('u_dot_grad_rho')
         value = ugrad_rho
      case ('continuity_residual_estimate')
         value = continuity_residual
      case default
         value = 0.0_rk
      end select

   end function lowmach_debug_value