walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T > Class Template Reference

Detailed Description

template<typename Field_T, typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
class walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >

Class for evaluating the accuracy of a simulation.

Accuracy Evaluation

Class for evaluating the accuracy of a simulation by comparing simulation values with values provided by a solution function (can be the analytical solution, if one exists). Comparison is performed by evaluating discrete weighted L1, L2, and Lmax norms of the error (error = difference between simulation and solution values). For each cell that is evaluated, the weight corresponds to the volume fraction of the cell in relation to the entire domain.

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

Template parameters:

  • Field_T: the field storing the simulation values (also works if the field stores data of type Vector3)
  • SolutionFunction_T: type of the solution function - must return Field_T::value_type and must take one parameter of type Vector3<real_t> that corresponds to a position inside the simulation domain (simulation domain = returned by calling getDomain() at the block storage)
  • Filter_T: the type of the evaluation filter (see Evaluation Filter in 'EvaluationFilter.h')

Parameters for setting up and controlling accuracy evaluation:

  • blocks: the block storage
  • fieldId: block data ID of the field
  • solution: the solution callback function - must return the solution when called with a position inside the domain
  • filter: the evaluation filter that indicates which cells are processed
  • plot frequency: the plotting interval - used for saving the data to file. If set to '0', no plotting data is created.
  • log frequency: the logging interval - used for logging the data via the Logging singleton. If set to '0', no logging is performed.
  • filename: the name of the file that stores the data for plotting
  • normalization factor: an optional factor the simulation values and the solution values are multiplied with
  • required and incompatible selectors

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 'makeAccuracyEvaluation' 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 'makeAccuracyEvaluation' functions that take configuration file data as an additional parameter in order to parse the configuration file for setting up and controlling accuracy evaluation. The configuration file block looks like as follows:

{
plotFrequency [unsigned integer]; // the plot frequency
logFrequency [unsigned integer]; // the log frequency
filename [string]; // the name of the file that stores the data for plotting
normalization [floating point value]; // normalization factor
}

Example:

{
plotFrequency 10;
logFrequency 1000;
filename Accuracy.txt;
}

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

#include <AccuracyEvaluation.h>

Public Member Functions

 AccuracyEvaluation (const weak_ptr< StructuredBlockStorage > &blocks, const ConstBlockDataID &fieldId, const SolutionFunction_T &solution, const Filter_T &filter, const uint_t plotFrequency, const uint_t logFrequency, const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 
 AccuracyEvaluation (const weak_ptr< StructuredBlockStorage > &blocks, const ConstBlockDataID &fieldId, const SolutionFunction_T &solution, const uint_t plotFrequency, const uint_t logFrequency, const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 
void setNormalizationFactor (const real_t f)
 
void setFilename (const std::string &filename)
 
real_t L1 () const
 
real_t L2 () const
 
real_t Lmax () const
 
void operator() ()
 

Private Attributes

weak_ptr< StructuredBlockStorageblocks_
 
ConstBlockDataID fieldId_
 
SolutionFunction_T solution_
 
Filter_T filter_
 
uint_t executionCounter_
 
uint_t plotFrequency_
 
uint_t logFrequency_
 
std::string filename_
 
real_t normalizationFactor_
 
real_t L1_
 
real_t L2_
 
real_t Lmax_
 
Set< SUID > requiredSelectors_
 
Set< SUID > incompatibleSelectors_
 

Constructor & Destructor Documentation

◆ AccuracyEvaluation() [1/2]

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::AccuracyEvaluation ( const weak_ptr< StructuredBlockStorage > &  blocks,
const ConstBlockDataID fieldId,
const SolutionFunction_T &  solution,
const Filter_T &  filter,
const uint_t  plotFrequency,
const uint_t  logFrequency,
const Set< SUID > &  requiredSelectors = Set<SUID>::emptySet(),
const Set< SUID > &  incompatibleSelectors = Set<SUID>::emptySet() 
)
inline

◆ AccuracyEvaluation() [2/2]

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::AccuracyEvaluation ( const weak_ptr< StructuredBlockStorage > &  blocks,
const ConstBlockDataID fieldId,
const SolutionFunction_T &  solution,
const uint_t  plotFrequency,
const uint_t  logFrequency,
const Set< SUID > &  requiredSelectors = Set<SUID>::emptySet(),
const Set< SUID > &  incompatibleSelectors = Set<SUID>::emptySet() 
)
inline

Member Function Documentation

◆ L1()

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
real_t walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::L1 ( ) const
inline

◆ L2()

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
real_t walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::L2 ( ) const
inline

◆ Lmax()

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
real_t walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::Lmax ( ) const
inline

◆ operator()()

template<typename Field_T , typename SolutionFunction_T , typename Filter_T >
void walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::operator()

◆ setFilename()

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
void walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::setFilename ( const std::string &  filename)
inline

◆ setNormalizationFactor()

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
void walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::setNormalizationFactor ( const real_t  f)
inline

Member Data Documentation

◆ blocks_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
weak_ptr< StructuredBlockStorage > walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::blocks_
private

◆ executionCounter_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
uint_t walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::executionCounter_
private

◆ fieldId_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
ConstBlockDataID walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::fieldId_
private

◆ filename_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
std::string walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::filename_
private

◆ filter_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
Filter_T walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::filter_
private

◆ incompatibleSelectors_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
Set<SUID> walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::incompatibleSelectors_
private

◆ L1_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
real_t walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::L1_
private

◆ L2_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
real_t walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::L2_
private

◆ Lmax_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
real_t walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::Lmax_
private

◆ logFrequency_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
uint_t walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::logFrequency_
private

◆ normalizationFactor_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
real_t walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::normalizationFactor_
private

◆ plotFrequency_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
uint_t walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::plotFrequency_
private

◆ requiredSelectors_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
Set<SUID> walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::requiredSelectors_
private

◆ solution_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
SolutionFunction_T walberla::field::AccuracyEvaluation< Field_T, SolutionFunction_T, Filter_T >::solution_
private

The documentation for this class was generated from the following file:
AccuracyEvaluation(const weak_ptr< StructuredBlockStorage > &blocks, const ConstBlockDataID &fieldId, const SolutionFunction_T &solution, const Filter_T &filter, const uint_t plotFrequency, const uint_t logFrequency, const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
Definition: AccuracyEvaluation.h:142