tem_reduction_spatial_module Module

This module applies reductions to a set of quantities

This module takes a set of input quantities and reduces them according to the chosen reduceType. You can choose between the following reduceTypes:

  • average: Average of all occurring values
  • sum: Sum of all occurring values
  • max: Maximum of all occurring values
  • min: Minimum of all occurring values
  • l2norm: L2 norm of all values, i.e. L_2(x) = sqrt( sum( x_i^2 ))
  • linfnorm: L_inf norm of all values, i.e. L_inf(x) = max( | x_i | )
 reduction = {
               'norm' -- 'average' or 'sum'
             }

The table of reductions has to correspond to the number of entries in the tracking variable table. For each variable, specify a reduction as

 tracking = {
   variable = {'pressure', 'velMag', 'density'},
   reduction = { 'average', 'max', l2norm' }
 }

Usage of this module


The tracking module handles the reductions. In the solver, the reduction must then be inkoved in the compute loop

Embedding in Treelm


Reductions are usually defined in tracking objects. Thus, the tracking module handles the loading and closing of the reductions. The following steps need to be performed within the tracking module

  • Treelm: Load the configuration from the lua file with tem_load_spatial_reduction
  • Treelm: Initialize the reductions with tem_init_reduction
  • Solver:
    • Open the reduction in the current time step tem_reduction_spatial_open
    • invoke the append reduceType to the array on which the reduction will be applied with tem_append_reduction This can be performed for a number of chunks
    • Close the reduction with tem_reduction_spatial_close


Interfaces

public interface tem_reduction_spatial_dump

public interface tem_reduction_spatial_out

  • private subroutine tem_reduction_spatial_out_vector(me, conf)

    Allows the output of array of reduction to lua out

    Arguments

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

    reduction to write into the lua file

    type(aot_out_type), intent(inout) :: conf

    aotus type handling the output to the file in lua format

  • private subroutine tem_reduction_spatial_out_single(me, conf)

    Allows the output of the single reduction to lua out.

    The data is written into the file, the lunit is connected to. It is formatted as a Lua table.

    Arguments

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

    reduction to write into the lua file

    type(aot_out_type), intent(inout) :: conf

    aotus type handling the output to the file in lua format


Derived Types

type, public ::  tem_reduction_spatial_type

This data type is providing the input for the reduction routines It must be filled by the solver, before the reduction is called It exists on each process

Components

Type Visibility Attributes Name Initial
integer, public :: nComponents

amount of components of the quantity to reduce

real(kind=rk), public, allocatable :: val(:)

the result from the reduction operation size: nComponents

integer, public :: nElems

how many elements have been included into the reduction (so far)

real(kind=rk), public :: Vloc

local part of total volume of intersected elements

character(len=labelLen), public :: reduceType = ''

Which operation to perform on the list of elements

Components

Type Visibility Attributes Name Initial
character(len=labelLen), public, allocatable :: reduceType(:)

Which operation to perform on the list of elements

logical, public :: active = .false.

Subroutines

public subroutine tem_load_reduction_spatial(conf, redSpatial_config, parent, key)

read configuration file

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: conf

handle for lua file

type(tem_reduction_spatial_config_type), intent(out) :: redSpatial_config

the reduction file to fill

integer, intent(in), optional :: parent

handle for reduce table

character(len=*), intent(in), optional :: key

which key to open

public subroutine tem_reduction_spatial_init(me, redSpatial_config, varSys, varPos)

Initialize reduction objects according to the variable systems

Arguments

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

array of reductions to initialize

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

global variable system defined in solver

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

position of variable to reduce in the global varSys

public subroutine tem_reduction_spatial_open(me, varSys, varPos)

Prepare the reduction data type

Read more…

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(:)

public subroutine tem_reduction_spatial_append(me, chunk, nElems, varSys, varPos, tree, treeID, nDofs)

Local chunk-wise reduction

Read more…

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

real(kind=rk), intent(in) :: chunk(:)

chunk of results to reduce

integer, intent(in) :: nElems

number of elements the chunk has

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

global variable system defined in solver

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

position of variable to reduce in the global varSys

type(treelmesh_type), intent(in) :: tree

the global tree

integer(kind=long_k), intent(in), optional :: treeID(nElems)

The list of treeIDs of the current chunk

integer, intent(in), optional :: nDofs

Number of degrees of freedom.

public subroutine tem_reduction_spatial_close(me, proc)

Perform the global reduction

Read more…

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_comm_env_type), intent(in) :: proc

communicator for processes participating in this reduction

public subroutine tem_reduction_spatial_toChunk(me, chunk, nChunkElems)

Transfer reduction results to array chunk

Arguments

Type IntentOptional Attributes Name
type(tem_reduction_spatial_type), intent(in) :: me(:)
real(kind=rk), intent(inout) :: chunk(:)
integer, intent(out) :: nChunkElems

Number of element after spatial reduction = 1

private subroutine tem_load_reduction_single(conf, reduceType, handle, key, pos, iError)

Read a single entry of reductions from the lua file

Arguments

Type IntentOptional Attributes Name
type(flu_State), intent(inout) :: conf

handle for lua file

character(len=labelLen), intent(out) :: reduceType

reduction type to be filled

integer, intent(in), optional :: handle

handle for reduce table

character(len=*), intent(in), optional :: key

which key to open

integer, intent(in), optional :: pos

position to load from in config file

integer, intent(out) :: iError

error from aotus

private subroutine tem_reduction_spatial_dump_vector(me, outUnit)

Dumps array of reduction to given unit

Arguments

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

reduction to write into the lua file

integer, intent(in) :: outUnit

unit to write to

private subroutine tem_reduction_spatial_dump_single(me, outUnit)

Dump single reduction to given unit

Arguments

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

reduction to write into the lua file

integer, intent(in) :: outUnit

unit to write to

private subroutine tem_reduction_spatial_out_vector(me, conf)

Allows the output of array of reduction to lua out

Arguments

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

reduction to write into the lua file

type(aot_out_type), intent(inout) :: conf

aotus type handling the output to the file in lua format

private subroutine tem_reduction_spatial_out_single(me, conf)

Allows the output of the single reduction to lua out.

Read more…

Arguments

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

reduction to write into the lua file

type(aot_out_type), intent(inout) :: conf

aotus type handling the output to the file in lua format