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

The derived class from the hydro base class to solve the incompressible NSE in 2D. More...

#include "lib/hydro.h"

Inheritance diagram for hydro_d2:
hydro

Public Member Functions

 hydro_d2 (const grid &mesh, const parser &solParam, parallel &mpiParam)
 Constructor of the hydro_d2 class derived from the base hydro class. More...
 
void solvePDE ()
 The core publicly accessible function of the hydro class to solve the Navier-Stokes equations. More...
 
real testPeriodic ()
 Function to test whether periodic BC is being implemented properly. More...
 
- Public Member Functions inherited from hydro
 hydro (const grid &mesh, const parser &solParam, parallel &mpiParam)
 Constructor of the base hydro class. More...
 

Additional Inherited Members

- Public Attributes inherited from hydro
vfield V
 The vector field that stores the velocity field.
 
sfield P
 The scalar field that stores the pressure field.
 
forcevForcing
 Instance of force class to handle velocity field forcing.
 
- Protected Member Functions inherited from hydro
void checkPeriodic ()
 Function to enable/disable periodic data transfer as per the problem. More...
 
void setCoefficients ()
 Function to set the coefficients used for solving the implicit equations of U, V and W. More...
 
void initVBC ()
 Function to initialize the boundary conditions for velocity. More...
 
void imposeUBCs ()
 Function to impose the boundary conditions for the X-component of velocity. More...
 
void imposeVBCs ()
 Function to impose the boundary conditions for the Y-component of velocity. More...
 
void imposeWBCs ()
 Function to impose the boundary conditions for the Z-component of velocity. More...
 
void initVForcing ()
 Function to initialize the forcing terms for velocity. More...
 
virtual void solveVy ()
 Function to solve the implicit equation for y-velocity. More...
 
- Protected Attributes inherited from hydro
int timeStepCount
 Integer value for the number of time-steps elapsed - it is incremented by 1 in each time-step.
 
int maxIterations
 Maximum number of iterations for the iterative solvers hydro::solveVx, hydro::solveVy and hydro::solveVz.
 
real time
 
real dt
 
real hx
 
real hy
 
real hz
 
real hx2
 
real hz2
 
real hz2hx2
 
real hx2hy2
 
real hy2hz2
 
real hx2hy2hz2
 
const gridmesh
 
const parserinputParams
 
const real inverseRe
 
probesdataProbe
 Instance of the probe class to collect data from probes in the domain.
 
boundaryuLft
 Instances of the boundary class to impose boundary conditions on all the 6 walls for the 3 components of the velocity field.
 
boundaryuRgt
 
boundaryuFrn
 
boundaryuBak
 
boundaryuTop
 
boundaryuBot
 
boundaryvLft
 
boundaryvRgt
 
boundaryvFrn
 
boundaryvBak
 
boundaryvTop
 
boundaryvBot
 
boundarywLft
 
boundarywRgt
 
boundarywFrn
 
boundarywBak
 
boundarywTop
 
boundarywBot
 
parallelmpiData
 Instance of the parallel class that holds the MPI-related data like rank, xRank, etc.
 
plainsf Pp
 Plain scalar field into which the pressure correction is calculated and written by the Poisson solver.
 
plainsf mgRHS
 Plain scalar field into which the RHS for pressure Poisson equation is written and passed to the Poisson solver.
 
plainvf nseRHS
 Plain vector field into which the RHS of the Navier-Stokes equation is written and stored.
 
plainvf velocityLaplacian
 Plain vector field into which the RHS of the implicit equation for velocities are calculated during iterative solving.
 
plainvf pressureGradient
 Plain vector field which stores the pressure gradient term.
 
plainvf guessedVelocity
 Plain vector field which serves as a temporary array during iterative solution procedure for velocity terms.
 

Detailed Description

The derived class from the hydro base class to solve the incompressible NSE in 2D.

Certain paramters to be used in the implicit calculation of velocity are defined separately from within the class. Since the class is instantiated when solving the NSE in 2D, the y-direction component of the grid is supressed. Consequently, the boundary conditions are imposed only on 4 sides of the domain.

Constructor & Destructor Documentation

◆ hydro_d2()

hydro_d2::hydro_d2 ( const grid mesh,
const parser solParam,
parallel mpiParam 
)

Constructor of the hydro_d2 class derived from the base hydro class.

     The constructor passes its arguments to the base hydro class and then initializes all the scalar and
     vector fields necessary for solving the NS equations.
     The various coefficients for solving the equations are also set by a call to the \ref setCoefficients function.
     Based on the problem type specified by the user in the parameters file, and stored by the \ref parser class as
     \ref parser#probType "probType", the appropriate boundary conditions are specified.
Parameters
meshis a const reference to the global data contained in the grid class
solParamis a const reference to the user-set parameters contained in the parser class

Member Function Documentation

◆ solvePDE()

void hydro_d2::solvePDE ( )
virtual

The core publicly accessible function of the hydro class to solve the Navier-Stokes equations.

     The NSE are integrated in time from within this function by calling \ref hydro#timeAdvance in a loop.
     The function keeps track of the non-dimensional time with \ref time and number of iterations with \ref iterCount.
     Both these values are continuously incremented from within the loop, and finally, when \ref time has reached the
     user-ser value in \ref parser#tMax "tMax", the time-integration loop is broken and the program exits.

Reimplemented from hydro.

◆ testPeriodic()

real hydro_d2::testPeriodic ( )
virtual

Function to test whether periodic BC is being implemented properly.

     The function populates the arrays with predetermined values at all locations.
     It then calls imposeUBCs, imposeVBCs and imposeWBCs functions and checks if the correct values of the functions are imposed at boundaries

Reimplemented from hydro.


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