walberla::field::StabilityChecker< Field_T, Filter_T > Class Template Reference

Detailed Description

template<typename Field_T, typename Filter_T = DefaultEvaluationFilter>
class walberla::field::StabilityChecker< Field_T, Filter_T >

Class/functor for checking a running simulation for non-finite values in a specific field.

Stability Checker

If non-finite values are detected in the field that is checked, the simulation is aborted. Optionally, information about all cells that contain non-finite vales can be logged via the Logging or saved as VTK output for further investigation.

Do not create objects of class StabilityChecker directly, better use one of the various 'makeStabilityChecker' functions below!

Template parameters:

  • Field_T: the field storing the simulation values (also works if the field stores data of type Vector3)
  • Filter_T: the type of the evaluation filter (see Evaluation Filter in 'EvaluationFilter.h')

For the parameters for setting up and controlling the stability checker see the documentation of the constructor of this class.

You do not have to specify an evaluation filter! If you do not specify any filter, all cells are processed and no cell is excluded.

If you want to use a flag field as evaluation filter, fitting 'makeStabilityChecker' functions already exist. These functions need an additional template parameter FlagField_T and you have to provide the block data ID of the flag field together with a set of flag UIDs that specify which cells need to be processed.

There also exist 'makeStabilityChecker' functions that take configuration file data as an additional parameter in order to parse the configuration file for setting up and controlling the stability checker. The configuration file block looks like as follows:

{
checkFrequency [unsigned integer]; // check frequency [default:0]
streamOutput [boolean]; // output to stream? [default: true]
vtkOutput [boolean]; // output to VTK? [default:true]
vtkBaseFolder [string]; // VTK base folder [default: vtk_out]
vtkExecutionFolder [string]; // VTK execution folder [default:output]
vtkIdentifier [string]; // VTK identifier [default: error_field]
vtkBinary [boolean]; // write VTK data in binary? [default: true]
vtkLittleEndian [boolean]; // VTK binary file format [default: true (= little endian)]
vtkMPIIO [boolean]; // use MPI IO for creating VTK output? [default: true]
vtkForcePVTU [boolean]; // force VTK to generate a PVTU file? [default: false]
}

Example:

{
checkFrequency 100;
streamOutput false;
vtkOutput true;
vtkBaseFolder /home/anonymous/vtk;
}

For documentation of the VTK parameters see VTK via Configuration File.

Note that the shared pointer returned by all 'makeStabilityChecker' functions can be captured by a SharedFunctor for immediate registration at a time loop (see field::makeSharedFunctor).

#include <StabilityChecker.h>

Classes

class  FValueVTKWriter
 For each value of a cell, either '0' or '1' is stored in the VTK file. More...
 
class  GlobalCoordVTKWriter
 For each cell, the corresponding global cell coordinates are stored in the VTK file. More...
 
class  LocalCoordVTKWriter
 For each cell, the corresponding block local cell coordinates are stored in the VTK file. More...
 
class  VTKCellFilter
 This cell filter selects only those cells in which at least one non-finite value (= infinite or NaN) was detected. More...
 

Public Member Functions

 StabilityChecker (const weak_ptr< StructuredBlockStorage > &blocks, const ConstBlockDataID &fieldId, const Filter_T &filter, const uint_t checkFrequency, const bool outputToStream=true, const bool outputVTK=true, const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 Constructor for class 'StabilityChecker'. More...
 
 StabilityChecker (const weak_ptr< StructuredBlockStorage > &blocks, const ConstBlockDataID &fieldId, const uint_t checkFrequency, const bool outputToStream=true, const bool outputVTK=true, const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 
void setVTKBaseFolder (const std::string &vtkBaseFolder)
 
void setVTKExecutionFolder (const std::string &vtkExecutionFolder)
 
void setVTKIdentifier (const std::string &vtkIdentifier)
 
void setVTKBinary (const bool vtkBinary)
 
void setVTKLittleEndian (const bool vtkLittleEndian)
 
void setVTKMPIIO (const bool vtkMPIIO)
 
void setVTKForcePVTU (const bool vtkForcePVTU)
 
void operator() ()
 

Private Types

typedef std::map< const IBlock *, std::map< Cell, std::set< cell_idx_t > > > BlockCellsMap
 

Private Member Functions

void checkBlock (const IBlock *const block)
 

Private Attributes

weak_ptr< StructuredBlockStorage > blocks_
 
Filter_T filter_
 
uint_t executionCounter_
 
uint_t checkFrequency_
 
ConstBlockDataID fieldId_
 
BlockCellsMap failedCells_
 
bool outputToStream_
 
bool outputVTK_
 
std::string vtkBaseFolder_
 
std::string vtkExecutionFolder_
 
std::string vtkIdentifier_
 
bool vtkBinary_
 
bool vtkLittleEndian_
 
bool vtkMPIIO_
 
bool vtkForcePVTU_
 
Set< SUID > requiredSelectors_
 
Set< SUID > incompatibleSelectors_
 

Member Typedef Documentation

template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
typedef std::map< const IBlock *, std::map< Cell, std::set< cell_idx_t > > > walberla::field::StabilityChecker< Field_T, Filter_T >::BlockCellsMap
private

Constructor & Destructor Documentation

template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
walberla::field::StabilityChecker< Field_T, Filter_T >::StabilityChecker ( const weak_ptr< StructuredBlockStorage > &  blocks,
const ConstBlockDataID &  fieldId,
const Filter_T &  filter,
const uint_t  checkFrequency,
const bool  outputToStream = true,
const bool  outputVTK = true,
const Set< SUID > &  requiredSelectors = Set<SUID>::emptySet(),
const Set< SUID > &  incompatibleSelectors = Set<SUID>::emptySet() 
)
inline

Constructor for class 'StabilityChecker'.

Parameters
blocksShared pointer to a structured block storage
fieldIdBlock data ID of the field that will be checked
filterThe evaluation filter that indicates which cells are processed
checkFrequencyIf operator()() is called, the stability check is only performed every 'checkFrequency'-th time. Setting 'checkFrequency' to 1 means the stability check is performed each time operator()() is called. Setting 'checkFrequency' to 0 disables the check entirely.
outputToStreamIf true, in case a non-finite value is detected in the field, information about the corresponding cells is logged via WALBERLA_LOG_WARNING.
outputVTKIf true, in case a non-finite value is detected in the field, VTK output is generated and information about the corresponding cells is saved.
requiredSelectorsRequired selectors
incompatibleSelectorsIncompatible selectors
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
walberla::field::StabilityChecker< Field_T, Filter_T >::StabilityChecker ( const weak_ptr< StructuredBlockStorage > &  blocks,
const ConstBlockDataID &  fieldId,
const uint_t  checkFrequency,
const bool  outputToStream = true,
const bool  outputVTK = true,
const Set< SUID > &  requiredSelectors = Set<SUID>::emptySet(),
const Set< SUID > &  incompatibleSelectors = Set<SUID>::emptySet() 
)
inline

Member Function Documentation

template<typename Field_T , typename Filter_T >
void walberla::field::StabilityChecker< Field_T, Filter_T >::checkBlock ( const IBlock *const  block)
private
template<typename Field_T , typename Filter_T >
void walberla::field::StabilityChecker< Field_T, Filter_T >::operator() ( )
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
void walberla::field::StabilityChecker< Field_T, Filter_T >::setVTKBaseFolder ( const std::string &  vtkBaseFolder)
inline
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
void walberla::field::StabilityChecker< Field_T, Filter_T >::setVTKBinary ( const bool  vtkBinary)
inline
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
void walberla::field::StabilityChecker< Field_T, Filter_T >::setVTKExecutionFolder ( const std::string &  vtkExecutionFolder)
inline
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
void walberla::field::StabilityChecker< Field_T, Filter_T >::setVTKForcePVTU ( const bool  vtkForcePVTU)
inline
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
void walberla::field::StabilityChecker< Field_T, Filter_T >::setVTKIdentifier ( const std::string &  vtkIdentifier)
inline
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
void walberla::field::StabilityChecker< Field_T, Filter_T >::setVTKLittleEndian ( const bool  vtkLittleEndian)
inline
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
void walberla::field::StabilityChecker< Field_T, Filter_T >::setVTKMPIIO ( const bool  vtkMPIIO)
inline

Member Data Documentation

template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
weak_ptr< StructuredBlockStorage > walberla::field::StabilityChecker< Field_T, Filter_T >::blocks_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
uint_t walberla::field::StabilityChecker< Field_T, Filter_T >::checkFrequency_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
uint_t walberla::field::StabilityChecker< Field_T, Filter_T >::executionCounter_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
BlockCellsMap walberla::field::StabilityChecker< Field_T, Filter_T >::failedCells_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
ConstBlockDataID walberla::field::StabilityChecker< Field_T, Filter_T >::fieldId_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
Filter_T walberla::field::StabilityChecker< Field_T, Filter_T >::filter_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
Set<SUID> walberla::field::StabilityChecker< Field_T, Filter_T >::incompatibleSelectors_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
bool walberla::field::StabilityChecker< Field_T, Filter_T >::outputToStream_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
bool walberla::field::StabilityChecker< Field_T, Filter_T >::outputVTK_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
Set<SUID> walberla::field::StabilityChecker< Field_T, Filter_T >::requiredSelectors_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
std::string walberla::field::StabilityChecker< Field_T, Filter_T >::vtkBaseFolder_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
bool walberla::field::StabilityChecker< Field_T, Filter_T >::vtkBinary_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
std::string walberla::field::StabilityChecker< Field_T, Filter_T >::vtkExecutionFolder_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
bool walberla::field::StabilityChecker< Field_T, Filter_T >::vtkForcePVTU_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
std::string walberla::field::StabilityChecker< Field_T, Filter_T >::vtkIdentifier_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
bool walberla::field::StabilityChecker< Field_T, Filter_T >::vtkLittleEndian_
private
template<typename Field_T , typename Filter_T = DefaultEvaluationFilter>
bool walberla::field::StabilityChecker< Field_T, Filter_T >::vtkMPIIO_
private

The documentation for this class was generated from the following file: