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:
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
Dumps array of reduction to given unit
| Type | Intent | Optional | 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 |
Dump single reduction to given unit
| Type | Intent | Optional | 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 |
Allows the output of array of reduction to lua out
| Type | Intent | Optional | 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 |
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.
| Type | Intent | Optional | 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 |
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
| 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 |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=labelLen), | public, | allocatable | :: | reduceType(:) |
Which operation to perform on the list of elements |
||
| logical, | public | :: | active | = | .false. |
read configuration file
| Type | Intent | Optional | 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 |
Initialize reduction objects according to the variable systems
| Type | Intent | Optional | 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 |
Prepare the reduction data type
| Type | Intent | Optional | 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(:) |
Local chunk-wise reduction
| Type | Intent | Optional | 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. |
Perform the global reduction
| Type | Intent | Optional | 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 |
Transfer reduction results to array chunk
| Type | Intent | Optional | 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 |
Read a single entry of reductions from the lua file
| Type | Intent | Optional | 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 |
Dumps array of reduction to given unit
| Type | Intent | Optional | 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 |
Dump single reduction to given unit
| Type | Intent | Optional | 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 |
Allows the output of array of reduction to lua out
| Type | Intent | Optional | 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 |
Allows the output of the single reduction to lua out.
| Type | Intent | Optional | 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 |