tem_reduction_spatial_open Subroutine

public subroutine tem_reduction_spatial_open(me, varSys, varPos)

Prepare the reduction data type

Todo

HK: what is going on here? This stuff reads, as if we have a reduction per variable? However above, we read a set of reduction objects from the configuration, thus it seems to be independent of the number of variables? Somehow there is a missing link between the reduction and the variable it should act on? How is this supposed to work? Please clarify, document or change the code! MH: Ok, the current way it is intended to work is the following you define a tracking object with a given set of variables and define a number of reduction operations. The reduction operations work on the variables starting from the first up to the number of defined reductions example: tracking = { variable = {'density', 'velocity'}, reduction = 'average', ... } Here the number of reductions is smaller than the number of variables which results in that only the density is taken an average.

Arguments

Type IntentOptional Attributes Name
type(tem_reduction_spatial_type), intent(inout) :: me(:)

The reduction type to work on. All definitions should be present in here

type(tem_varSys_type), intent(in) :: varSys

global variable system defined in solver

integer, intent(in) :: varPos(:)

Called by

proc~~tem_reduction_spatial_open~~CalledByGraph proc~tem_reduction_spatial_open tem_reduction_spatial_open proc~hvs_ascii_dump_elem_data hvs_ascii_dump_elem_data proc~hvs_ascii_dump_elem_data->proc~tem_reduction_spatial_open proc~hvs_ascii_dump_point_data hvs_ascii_dump_point_data proc~hvs_ascii_dump_point_data->proc~tem_reduction_spatial_open proc~tem_convergence_check_element tem_convergence_check_element proc~tem_convergence_check_element->proc~tem_reduction_spatial_open proc~tem_convergence_check_point tem_convergence_check_point proc~tem_convergence_check_point->proc~tem_reduction_spatial_open proc~hvs_output_write hvs_output_write proc~hvs_output_write->proc~hvs_ascii_dump_elem_data proc~hvs_output_write->proc~hvs_ascii_dump_point_data proc~tem_convergence_check tem_convergence_check proc~tem_convergence_check->proc~tem_convergence_check_element proc~tem_convergence_check->proc~tem_convergence_check_point proc~tem_tracker tem_tracker proc~tem_tracker->proc~hvs_output_write

Source Code

  subroutine tem_reduction_spatial_open(me, varSys, varPos)
    ! ---------------------------------------------------------------------------
    !> The reduction type to work on. All definitions should be
    !! present in here
    type( tem_reduction_spatial_type ), intent(inout)    :: me(:)
    !> global variable system defined in solver
    type( tem_varSys_type ), intent(in)          :: varSys
    integer, intent(in)                          :: varPos(:)
    ! ---------------------------------------------------------------------------
    integer :: iReduce
    ! ---------------------------------------------------------------------------

    do iReduce = 1, size( me )
      ! Reset the number of treated elements.
      ! Must be counted up during _append
      me( iReduce )%nElems = 0

      ! Take the components of the connected variable system
      me( iReduce )%nComponents = varSys%method%val(varPos(iReduce))%nComponents
      if( .not. allocated( me( iReduce )%val ))                                &
        & allocate( me( iReduce )%val( me(iReduce)%nComponents ))

      select case( trim(me( iReduce )%reduceType) )
        case('max')
          me( iReduce )%val(:) = -huge(1._rk)
        case('min')
          me( iReduce )%val(:) = huge(1._rk)
        case default ! ('sum', 'average', 'l2norm', 'none', ...
          me( iReduce )%val(:) = 0._rk
      end select
    end do

  end subroutine tem_reduction_spatial_open