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

Vector field class to store and operate on vector fields. More...

#include "lib/vfield.h"

Public Member Functions

 vfield (const grid &gridData, std::string fieldName)
 Constructor of the vfield class. More...
 
void computeDiff (plainvf &H)
 Function to compute the diffusion term. More...
 
void computeTStp (real &dt_out)
 Operator is used to calculate time step #dt_out using CFL Condition. More...
 
void computeNLin (const vfield &V, plainvf &H)
 Function to compute the convective derivative of the vector field. More...
 
void divergence (plainsf &divV, const sfield &P)
 Operator to compute the divergence of the vector field. More...
 
void syncData ()
 Function to synchronise data across all processors when performing parallel computations. More...
 
vfieldoperator+= (plainvf &a)
 Overloaded operator to add a given plain vector field. More...
 
vfieldoperator-= (plainvf &a)
 Overloaded operator to subtract a given plain vector field. More...
 
vfieldoperator+= (vfield &a)
 Overloaded operator to add a given vector field. More...
 
vfieldoperator-= (vfield &a)
 Overloaded operator to subtract a given vector field. More...
 
vfieldoperator*= (real a)
 Overloaded operator to multiply a scalar value to the vector field. More...
 
void operator= (plainvf &a)
 Overloaded operator to assign a plain vector field to the vector field. More...
 
void operator= (vfield &a)
 Overloaded operator to assign another vector field to the vector field. More...
 
void operator= (real a)
 Overloaded operator to assign a scalar value to the vector field. More...
 

Public Attributes

field Vx
 
field Vy
 
field Vz
 
derivative derVx
 derVx, derVy and derVz are three instances of the derivative class used to compute derivatives. More...
 
derivative derVy
 
derivative derVz
 
std::string fieldName
 This string is used to identify the vector field, and is useful in file-writing.
 
blitz::Array< real, 3 > interTempX
 
blitz::Array< real, 3 > interTempY
 
blitz::Array< real, 3 > interTempZ
 

Detailed Description

Vector field class to store and operate on vector fields.

The class stores vector fields in the form of three instances of the field class defined in field.h. The vector field is stored in such a way that the components are face-centered, with:

The vector field is also equipped with a divergence operator, which returns a scalar field (sfield). However, this operation returns only cell-centered scalar field as output as most scalar fields are stored at cell centers. Moreover, the \( (\mathbf{u}.\nabla)\mathbf{v} \) operator is also provided as the function computeNLin

Constructor & Destructor Documentation

◆ vfield()

vfield::vfield ( const grid gridData,
std::string  fieldName 
)

Constructor of the vfield class.

     Three instances of field class are initialized.
     Each instance corresponds to a component of the vector field.
     The fields are initialized with appropriate grid to place the components on the cell faces.
     The name of the vector field as given by the user is also assigned.
Parameters
gridDatais a const reference to the global data in the grid class
fieldNameis a string value used to name and identify the vector field

Member Function Documentation

◆ computeDiff()

void vfield::computeDiff ( plainvf H)

Function to compute the diffusion term.

     The diffusion term (grad-squared) is caulculated here.
     The second derivatives of each component field are calculated along x, y and z.
     These terms are added to the corresponding components of the given plain
     vector field (plainvf), which is usually the RHS of the PDE being solved.
Parameters
His a reference to the plainvf into which the output is written

◆ computeNLin()

void vfield::computeNLin ( const vfield V,
plainvf H 
)

Function to compute the convective derivative of the vector field.

     The function calculates \f$ (\mathbf{u}.\nabla)\mathbf{v} \f$ on the vector field, \f$\mathbf{v}\f$.
     To do so, the function needs the vector field (vfield) of velocity, \f$\mathbf{u}\f$.
     This value is used in three separate calls to the \ref sfield#computeNLin "computeNLin" function of sfield
     to compute the derivatives for the three components of the vector field.
     It is assumed that the velocity is specified at face-centers, as required by the \ref sfield#computeNLin
     "computeNLin" function of sfield.
Parameters
Vis a const reference to the vector field (vfield) that specifies the convection velocity
His a reference to the plainvf into which the output is written

◆ computeTStp()

void vfield::computeTStp ( real &  dt_out)

Operator is used to calculate time step #dt_out using CFL Condition.

     When the parameters specify that time-step must be adaptively
     calculated using the Courant Number given in the parameters file,
     this function will provide the \f$ dt \f$ using the maximum values
     of the components of the vfield.
Parameters
dt_outis a reference to the real value into which the calculated value of time-step is written

◆ divergence()

void vfield::divergence ( plainsf divV,
const sfield P 
)

Operator to compute the divergence of the vector field.

     The operator computes the divergence of a face-centered staggered vector field, and stores it into a cell centered
     scalar field as defined by the tensor operation:
     \f$ \nabla . \mathbf{v} = \frac{\partial \mathbf{v}}{\partial x} +
                               \frac{\partial \mathbf{v}}{\partial y} +
                               \frac{\partial \mathbf{v}}{\partial z} \f$.
Parameters
divVis a reference to the scalar field (sfield) into which the computed divergence is written.

◆ operator*=()

vfield & vfield::operator*= ( real  a)

Overloaded operator to multiply a scalar value to the vector field.

     The unary operator *= multiplies a real value to all the fields (Vx, Vy and Vz) stored in vfield and returns
     a pointer to itself.
Parameters
ais a real number to be multiplied to the vector field
Returns
A pointer to itself is returned by the vector field class to which the operator belongs

◆ operator+=() [1/2]

vfield & vfield::operator+= ( plainvf a)

Overloaded operator to add a given plain vector field.

     The unary operator += adds a given plain vector field to the vfield and returns
     a pointer to itself.
Parameters
ais a reference to the plainvf to be added to the member fields
Returns
A pointer to itself is returned by the vector field object to which the operator belongs

◆ operator+=() [2/2]

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

Overloaded operator to add a given vector field.

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

◆ operator-=() [1/2]

vfield & vfield::operator-= ( plainvf a)

Overloaded operator to subtract a given plain vector field.

     The unary operator -= subtracts a given plain vector field from the vfield and returns
     a pointer to itself.
Parameters
ais a reference to the plainvf to be subtracted from the member fields
Returns
A pointer to itself is returned by the vector field object to which the operator belongs

◆ operator-=() [2/2]

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

Overloaded operator to subtract a given vector field.

     The unary operator -= subtracts a given vector field from the vfield and returns
     a pointer to itself.
Parameters
ais a reference to the vfield to be subtracted from the member fields
Returns
A pointer to itself is returned by the vector field object to which the operator belongs

◆ operator=() [1/3]

void vfield::operator= ( plainvf a)

Overloaded operator to assign a plain vector field to the vector field.

     The operator = assigns all the three blitz arrays of a plain vector field (plainvf)
     to the corresponding arrays in the three fields of the vfield.
Parameters
ais a plainvf to be assigned to the vector field

◆ operator=() [2/3]

void vfield::operator= ( real  a)

Overloaded operator to assign a scalar value to the vector field.

     The operator = assigns a real value to all the fields (Vx, Vy and Vz) stored in vfield.
Parameters
ais a real number to be assigned to the vector field

◆ operator=() [3/3]

void vfield::operator= ( vfield a)

Overloaded operator to assign another vector field to the vector field.

     The operator = assigns all the three fields of a given vector field (vfield)
     to the corresponding fields of the vfield.
Parameters
ais a vfield to be assigned to the vector field

◆ syncData()

void vfield::syncData ( )

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

     Each of the individual field components have their own subroutine, \ref sfield#syncData "syncData" to send and
     receive data across its MPI decomposed sub-domains.
     This function calls the \ref sfield#syncData "syncData" function of its components to update the sub-domain boundary pads.

Member Data Documentation

◆ derVx

derivative vfield::derVx

derVx, derVy and derVz are three instances of the derivative class used to compute derivatives.

They correspond to finite-differencing operations along X, Y and Z directions respectively.


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