Saras
Finite   Difference   Solver   for   Fluid   Dynamics   Simulations
Public Member Functions | Public Attributes | List of all members
field Class Reference

Field class to store data and perform finite difference operations on the data. More...

#include "lib/field.h"

Public Member Functions

 field (const grid &gridData, std::string fieldName, const bool xStag, const bool yStag, const bool zStag)
 Constructor of the field class. More...
 
void syncData ()
 Function to synchronise data across all processors when performing parallel computations. More...
 
real fieldMax ()
 Function to extract the maximum value from the field. More...
 
blitz::RectDomain< 3 > shift (int dim, const blitz::RectDomain< 3 > core, int steps)
 Function to shift a blitz RectDomain object by a given number of steps along a specified dimension. More...
 
fieldoperator+= (field &a)
 Overloaded operator to add a given field. More...
 
fieldoperator-= (field &a)
 Overloaded operator to subtract a given field. More...
 
fieldoperator+= (real a)
 Overloaded operator to add a given scalar value. More...
 
fieldoperator-= (real a)
 Overloaded operator to subtract a given scalar value. More...
 
void operator= (field &a)
 Overloaded operator to assign a field to the field. More...
 
void operator= (real a)
 Overloaded operator to assign a scalar value to the field. More...
 

Public Attributes

blitz::Array< real, 3 > F
 The field data is stored in this Blitz array.
 
std::string fieldName
 This string is used to identify the field, and is useful in file-writing.
 
const bool xStag
 xStag, yStag and zStag are the boolean flags which specify whether the field variable is at cell-center, face-center, edge-center and so on. More...
 
const bool yStag
 
const bool zStag
 
blitz::RectDomain< 3 > fCore
 The core slice is a view of the field data excluding the ghost points surrounding it.
 
blitz::RectDomain< 3 > fBulk
 The bulk slice is a view of the field data excluding the walls surrounding it. More...
 
blitz::RectDomain< 3 > fCLft
 fCLft, fCRgt, fCFrt, fCBak, fCBot, fCTop are views of the field data generated by shifting the core slice in all the three independent directions. More...
 
blitz::RectDomain< 3 > fCRgt
 
blitz::RectDomain< 3 > fCFrt
 
blitz::RectDomain< 3 > fCBak
 
blitz::RectDomain< 3 > fCBot
 
blitz::RectDomain< 3 > fCTop
 
blitz::Array< blitz::RectDomain< 3 >, 1 > fWalls
 The wall slices are views of the field data showing only the wall points. More...
 
blitz::Array< blitz::RectDomain< 3 >, 1 > PcIntSlices
 
blitz::Array< blitz::RectDomain< 3 >, 1 > QvIntSlices
 
blitz::Array< blitz::RectDomain< 3 >, 1 > VxIntSlices
 
blitz::Array< blitz::RectDomain< 3 >, 1 > VyIntSlices
 
blitz::Array< blitz::RectDomain< 3 >, 1 > VzIntSlices
 
blitz::Array< blitz::RectDomain< 3 >, 1 > WxIntSlices
 
blitz::Array< blitz::RectDomain< 3 >, 1 > WyIntSlices
 
blitz::Array< blitz::RectDomain< 3 >, 1 > WzIntSlices
 
blitz::TinyVector< int, 3 > fSize
 
blitz::TinyVector< int, 3 > flBound
 
blitz::TinyVector< int, 3 > cuBound
 
mpidatampiHandle
 

Detailed Description

Field class to store data and perform finite difference operations on the data.

The class stores the base data of both scalar and vector fields as blitz arrays. The data is stored with a uniform grid spacing as in the transformed plane. The limits and views of the full, core and bulk domains are also stored in a set of TinyVector and RectDomain objects respectively.

Constructor & Destructor Documentation

◆ field()

field::field ( const grid gridData,
std::string  fieldName,
const bool  xStag,
const bool  yStag,
const bool  zStag 
)

Constructor of the field class.

     The field class decides the limits necessary for a 3D array to store the
     data as per the specified grid indexing (half or full index).
     It initializes and stores necessary RectDomain objects for getting the
     core slice and bulk slice.
     Moreover, various offset slices of both core and bulk, used for performing
     finite difference operations, are also defined in this class.
     The upper and lower bounds of the array are calculated based on the directions
     along which the variable is staggered (or half-indexed).
     Finally, a blitz array to store the data of the field is resized according
     to the limits and initialized to 0.
Parameters
gridDatais a const reference to the global data in the grid class
xStagis a const boolean value that is true when F is staggered (half-indexed) along x-direction
yStagis a const boolean value that is true when F is staggered (half-indexed) along y-direction
zStagis a const boolean value that is true when F is staggered (half-indexed) along z-direction

Member Function Documentation

◆ fieldMax()

real field::fieldMax ( )

Function to extract the maximum value from the field.

     The function uses the in-built blitz function to obtain the maximum value in an array.
     Note that this function *takes the maximum of the absolute value* of the field.
     While performing parallel computation, the function performs an <B>MPI_Allreduce()</B> to get
     the global maximum from the entire computational domain.
Returns
The real value of the maximum is returned (it is implicitly assumed that only real values are used)

◆ operator+=() [1/2]

field & field::operator+= ( field a)

Overloaded operator to add a given field.

     The unary operator += adds a given field to the field stored by the class and returns
     a pointer to itself.
Parameters
ais a reference to another to be added to the member field
Returns
A pointer to itself is returned by the field class to which the operator belongs

◆ operator+=() [2/2]

field & field::operator+= ( real  a)

Overloaded operator to add a given scalar value.

     The unary operator += adds a given constant scalar value to the field stored by the class and returns
     a pointer to itself.
Parameters
ais a real number to be added to the field
Returns
A pointer to itself is returned by the field class to which the operator belongs

◆ operator-=() [1/2]

field & field::operator-= ( field a)

Overloaded operator to subtract a given field.

     The unary operator -= subtracts a given field from the field stored by the class and returns
     a pointer to itself.
Parameters
ais a reference to another field to be deducted from the member field
Returns
A pointer to itself is returned by the field class to which the operator belongs

◆ operator-=() [2/2]

field & field::operator-= ( real  a)

Overloaded operator to subtract a given scalar value.

     The unary operator -= subtracts a given constant scalar value from the field stored by the class and returns
     a pointer to itself.
Parameters
ais a real number to be subtracted from the field
Returns
A pointer to itself is returned by the field class to which the operator belongs

◆ operator=() [1/2]

void field::operator= ( field a)

Overloaded operator to assign a field to the field.

     The operator = copies the contents of the input field to itself.
Parameters
ais the field to be assigned to the field

◆ operator=() [2/2]

void field::operator= ( real  a)

Overloaded operator to assign a scalar value to the field.

     The operator = assigns a real value to the entire field.
Parameters
ais a real number to be assigned to the field

◆ shift()

blitz::RectDomain< 3 > field::shift ( int  dim,
const blitz::RectDomain< 3 >  core,
int  steps 
)

Function to shift a blitz RectDomain object by a given number of steps along a specified dimension.

     The RectDomain objects offer a view of the blitz arrays on which the shift function operates.
     These objects are shifted along the dimension specified in the argument, by <B>dim</B>, through a number of steps,
     to offer offset views.
Parameters
dimis the integer input to specify the dimension (direction) of the shift. (x -> 0, y -> 1, z -> 2)
coreis the input RectDomain object which is to be shifted to get the new view
stepsis the integer value by which the input view must be offset along the dimension specified by dim
Returns
A RectDomain object that specifies the new offset view of the data

◆ syncData()

void field::syncData ( )

Function to synchronise data across all processors when performing parallel computations.

     This function calls the \ref mpidata#syncData "syncData" function of mpidata class to
     perform data-transfer and thus update the sub-domain boundary pads.

Member Data Documentation

◆ fBulk

blitz::RectDomain<3> field::fBulk

The bulk slice is a view of the field data excluding the walls surrounding it.

This view is therefore a subset of the core slice.

◆ fCLft

blitz::RectDomain<3> field::fCLft

fCLft, fCRgt, fCFrt, fCBak, fCBot, fCTop are views of the field data generated by shifting the core slice in all the three independent directions.

These views are useful in calculating derivatives, like in divergence calculations.

◆ fWalls

blitz::Array<blitz::RectDomain<3>, 1> field::fWalls

The wall slices are views of the field data showing only the wall points.

Thus, the core slice is a union of both bulk and wall slices.

◆ xStag

const bool field::xStag

xStag, yStag and zStag are the boolean flags which specify whether the field variable is at cell-center, face-center, edge-center and so on.

When the flag is true, the variable is shifted by half the grid-spacing. This means that when all the flags are true, the variable is at the cell-center. And when all the flags are false, the variable is placed at the vertex centers (collocated arrangement).


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