walberla::field::AccuracyEvaluationLinePlot< 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::AccuracyEvaluationLinePlot< Field_T, SolutionFunction_T, Filter_T >

Class for plotting simulation (and solution) values along a line through the domain.

Accuracy Evaluation Line Plot

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). Simulation and solution values are evaluated along a line perpendicular to the x-axis. The data is saved to a file that can be used for plotting graphs.

Do not create objects of class AccuracyEvaluationLinePlot directly, better use one of the various 'makeAccuracyEvaluationLinePlot' 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
  • y-axis: true = plot along y axis, false = plot along z axis
  • line point: a point that specifies the position of the line - this point is always relative to the entire domain with [<0,0,0>,<1,1,1>], i.e., all coordinates of this point (x, y, and z) must be in [0;1]
  • normalization factor: an optional factor the simulation values and the solution values are multiplied with
  • domain normalization: By default, the data points in the file are relative to the simulation space as given by the domain bounding box (blocks->getDomain()). However, you can overwrite the size of the domain via the domain normalization parameter. If you do so, the data points in the file will correspond to this 'normalized' domain. This essentially scales the axis in the plot to a desired range.
  • required and incompatible selectors

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

If you want to use a flag field as evaluation filter, fitting 'makeAccuracyEvaluationLinePlot' 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 'makeAccuracyEvaluationLinePlot' 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:

{
y [boolean]; // plot along y- or z-axis?
point [Vector3: <real,real,real>]; // line point
normalization [floating point value]; // normalization factor
domain [AABB: [<real,real,real>,<real,real,real>]]; // domain normalization
}

Example:

{
y true;
point <0.5,0.5,0.5>; // = line through the middle of the domain
normalization 1;
domain [<-1,-1,-1>,<1,1,1>];
}

Note that the shared pointer returned by all 'makeAccuracyEvaluationLinePlot' functions can be dereferenced and called with a string (=filename) in order to generate a plot straight away or it can be passed to a 'makeAccuracyEvaluationLinePlotter' function (see Accuracy Evaluation Line Plotter) in order to generate a series of plots.

#include <AccuracyEvaluationLinePlot.h>

Public Member Functions

 AccuracyEvaluationLinePlot (const weak_ptr< StructuredBlockStorage > &blocks, const ConstBlockDataID &fieldId, const SolutionFunction_T &solution, const Filter_T &filter, const bool yAxis=true, const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 
 AccuracyEvaluationLinePlot (const weak_ptr< StructuredBlockStorage > &blocks, const ConstBlockDataID &fieldId, const SolutionFunction_T &solution, const bool yAxis=true, const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
 
void setLinePoint (const Vector3< real_t > &p)
 
void setNormalizationFactor (const real_t f)
 
void setDomainNormalization (const math::AABB &d)
 
void operator() (const std::string &filename)
 

Private Attributes

weak_ptr< StructuredBlockStorageblocks_
 
ConstBlockDataID fieldId_
 
SolutionFunction_T solution_
 
Filter_T filter_
 
bool yAxis_
 
Vector3< real_trelLinePoint_
 
real_t normalizationFactor_
 
math::AABB domainNormalization_
 
Set< SUID > requiredSelectors_
 
Set< SUID > incompatibleSelectors_
 

Constructor & Destructor Documentation

◆ AccuracyEvaluationLinePlot() [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::AccuracyEvaluationLinePlot< Field_T, SolutionFunction_T, Filter_T >::AccuracyEvaluationLinePlot ( const weak_ptr< StructuredBlockStorage > &  blocks,
const ConstBlockDataID fieldId,
const SolutionFunction_T &  solution,
const Filter_T &  filter,
const bool  yAxis = true,
const Set< SUID > &  requiredSelectors = Set<SUID>::emptySet(),
const Set< SUID > &  incompatibleSelectors = Set<SUID>::emptySet() 
)
inline

◆ AccuracyEvaluationLinePlot() [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::AccuracyEvaluationLinePlot< Field_T, SolutionFunction_T, Filter_T >::AccuracyEvaluationLinePlot ( const weak_ptr< StructuredBlockStorage > &  blocks,
const ConstBlockDataID fieldId,
const SolutionFunction_T &  solution,
const bool  yAxis = true,
const Set< SUID > &  requiredSelectors = Set<SUID>::emptySet(),
const Set< SUID > &  incompatibleSelectors = Set<SUID>::emptySet() 
)
inline

Member Function Documentation

◆ operator()()

template<typename Field_T , typename SolutionFunction_T , typename Filter_T >
void walberla::field::AccuracyEvaluationLinePlot< Field_T, SolutionFunction_T, Filter_T >::operator() ( const std::string &  filename)

◆ setDomainNormalization()

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::AccuracyEvaluationLinePlot< Field_T, SolutionFunction_T, Filter_T >::setDomainNormalization ( const math::AABB d)
inline

◆ setLinePoint()

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::AccuracyEvaluationLinePlot< Field_T, SolutionFunction_T, Filter_T >::setLinePoint ( const Vector3< real_t > &  p)
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::AccuracyEvaluationLinePlot< 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::AccuracyEvaluationLinePlot< Field_T, SolutionFunction_T, Filter_T >::blocks_
private

◆ domainNormalization_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
math::AABB walberla::field::AccuracyEvaluationLinePlot< Field_T, SolutionFunction_T, Filter_T >::domainNormalization_
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::AccuracyEvaluationLinePlot< Field_T, SolutionFunction_T, Filter_T >::fieldId_
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::AccuracyEvaluationLinePlot< 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::AccuracyEvaluationLinePlot< Field_T, SolutionFunction_T, Filter_T >::incompatibleSelectors_
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::AccuracyEvaluationLinePlot< Field_T, SolutionFunction_T, Filter_T >::normalizationFactor_
private

◆ relLinePoint_

template<typename Field_T , typename SolutionFunction_T = std::function< typename Field_T::value_type ( const Vector3< real_t > & ) >, typename Filter_T = DefaultEvaluationFilter>
Vector3< real_t > walberla::field::AccuracyEvaluationLinePlot< Field_T, SolutionFunction_T, Filter_T >::relLinePoint_
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::AccuracyEvaluationLinePlot< 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::AccuracyEvaluationLinePlot< Field_T, SolutionFunction_T, Filter_T >::solution_
private

◆ yAxis_

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

The documentation for this class was generated from the following file:
AccuracyEvaluationLinePlot(const weak_ptr< StructuredBlockStorage > &blocks, const ConstBlockDataID &fieldId, const SolutionFunction_T &solution, const Filter_T &filter, const bool yAxis=true, const Set< SUID > &requiredSelectors=Set< SUID >::emptySet(), const Set< SUID > &incompatibleSelectors=Set< SUID >::emptySet())
Definition: AccuracyEvaluationLinePlot.h:200
GenericAABB< real_t > AABB
Definition: AABBFwd.h:33