MaMiCo 1.2
Loading...
Searching...
No Matches
coupling::solvers::NumericalSolver Class Referenceabstract

is a virtual base class for the interface for a numerical fluid solver for the Couette scenario More...

#include <NumericalSolver.h>

Inheritance diagram for coupling::solvers::NumericalSolver:
Collaboration diagram for coupling::solvers::NumericalSolver:

Public Member Functions

 NumericalSolver (const double channelheight, const double dx, const double dt, const double kinVisc, const int plotEveryTimestep, const std::string filestem, const tarch::la::Vector< 3, unsigned int > processes, const Scenario *scen=nullptr)
 a simple constructor
 
virtual ~NumericalSolver ()
 a simple destructor
 
void setMDBoundary (tarch::la::Vector< 3, double > mdDomainOffset, tarch::la::Vector< 3, double > mdDomainSize, unsigned int overlapStrip)
 flags the domain boundary cells.
 
virtual void setMDBoundaryValues (coupling::datastructures::FlexibleCellContainer< 3 > &md2macroBuffer)=0
 applies the values received from the MD-solver within the conntinuum solver
 
tarch::la::Vector< 3, unsigned int > getNumberProcesses () const
 returns the number of process, regards parallel runs
 
tarch::la::Vector< 3, unsigned int > getAvgNumberLBCells () const
 returns the average number of cells on each process
 
virtual double getDensity (tarch::la::Vector< 3, double > pos) const =0
 returns the density for a given position
 
virtual void setWallVelocity (const tarch::la::Vector< 3, double > wallVelocity)=0
 changes the velocity at the moving wall (z=0)
 
- Public Member Functions inherited from coupling::solvers::AbstractCouetteSolver< 3 >
virtual ~AbstractCouetteSolver ()
 a dummy destructor
 
virtual void advance (double dt)=0
 advances the solver in time
 
virtual tarch::la::Vector< dim, double > getVelocity (tarch::la::Vector< dim, double > pos) const=0
 returns the current velocity at the given position
 
virtual void setWallVelocity (const tarch::la::Vector< dim, double > wallVelocity)=0
 changes the velocity at the moving for, refers to Couette scenario
 

Static Public Member Functions

static int getAvgDomainSize (double channelheight, double dx, tarch::la::Vector< 3, unsigned int > processes, int d)
 

Protected Types

enum  Flag {
  FLUID = 0 , NO_SLIP = 1 , MOVING_WALL = 2 , PERIODIC = 3 ,
  MD_BOUNDARY = 4 , PARALLEL_BOUNDARY = 5
}
 for every cell exists a flag entry, upon this is defined how the cell is handled More...
 
enum  NbFlag {
  LEFT = 0 , RIGHT = 1 , BACK = 2 , FRONT = 3 ,
  BOTTOM = 4 , TOP = 5
}
 The flags are used on parallel boundaries to define in which direction the boundary goes. More...
 

Protected Member Functions

int get (int i) const
 returns i and performs checks in debug mode
 
int get (int x, int y, int z) const
 returns linearized index and performs checks in debug mode
 
int getParBuf (int x, int y, int lengthx, int lengthy) const
 returns index in 2D parallel buffer with buffer dimensions lengthx+2,lengthy+2. Performs checks in debug mode
 
void plot () const
 
void plot (std::string filename) const
 create vtk plot if required
 
bool skipRank () const
 returns true, if this rank is not of relevance for the LB simulation
 

Protected Attributes

const double _channelheight
 the height and width of the channel in z and y direction
 
const double _dx
 mesh size, dx=dy=dz
 
const double _dt
 time step
 
const double _kinVisc
 kinematic viscosity of the fluid
 
tarch::la::Vector< 3, unsigned int > _processes
 domain decomposition on MPI rank basis; total number is given by multipling all entries
 
const int _plotEveryTimestep
 number of time steps between vtk plots
 
const std::string _filestem
 file stem for vtk plot
 
const int _domainSizeX {getDomainSize(_channelheight, _dx, _processes, 0)}
 domain size in x-direction
 
const int _domainSizeY {getDomainSize(_channelheight, _dx, _processes, 1)}
 domain size in y-direction
 
const int _domainSizeZ {getDomainSize(_channelheight, _dx, _processes, 2)}
 domain size in z-direction
 
const int _avgDomainSizeX {getAvgDomainSize(_channelheight, _dx, _processes, 0)}
 avg. domain size in MPI-parallel simulation in x-direction
 
const int _avgDomainSizeY {getAvgDomainSize(_channelheight, _dx, _processes, 1)}
 avg. domain size in MPI-parallel simulation in y-direction
 
const int _avgDomainSizeZ {getAvgDomainSize(_channelheight, _dx, _processes, 2)}
 avg. domain size in MPI-parallel simulation in z-direction
 
const tarch::la::Vector< 3, unsigned int > _coords {getProcessCoordinates()}
 coordinates of this process (=1,1,1, unless parallel run of the solver )
 
int _counter {0}
 time step counter
 
double * _vel {NULL}
 velocity field
 
double * _density {NULL}
 density field
 
Flag_flag {NULL}
 flag field
 
double * _sendBufferX {NULL}
 buffer to send data from left/right to right/left neighbour
 
double * _recvBufferX {NULL}
 buffer to receive data from from left/right neighbour
 
double * _sendBufferY {NULL}
 buffer to send data from front/back to front/back neighbour
 
double * _recvBufferY {NULL}
 buffer to receive data from from front/back neighbour
 
double * _sendBufferZ {NULL}
 buffer to send data from top/buttom to top/buttom neighbour
 
double * _recvBufferZ {NULL}
 buffer to receive data from from top/buttom neighbour
 
const int _xO {_domainSizeX + 2}
 offset for y-direction (lexicographic grid ordering)
 
const int _yO {(_domainSizeX + 2) * (_domainSizeY + 2)}
 offset for z-direction
 
tarch::la::Vector< 6, int > _parallelNeighbours {(-1)}
 neighbour ranks
 
tarch::la::Vector< 3, int > _offset {(-1)}
 offset of the md domain
 
tarch::la::Vector< 3, int > _globalNumberCouplingCells {(-1)}
 the total number of coupling cells of the coupled simulation
 
const Scenario_scen
 

Private Member Functions

tarch::la::Vector< 3, unsigned int > getProcessCoordinates () const
 determines the process coordinates
 
void determineParallelNeighbours ()
 determines the neighbour relation between the processes
 
void setParallelBoundaryFlags ()
 sets parallel boundary flags according to Couette scenario
 
int getDomainSize (double channelheight, double dx, tarch::la::Vector< 3, unsigned int > processes, int d) const
 determines the local domain size on this rank where channelheight is the domain length in direction d.
 

Detailed Description

is a virtual base class for the interface for a numerical fluid solver for the Couette scenario

The setup is, a 3d solver. A channel flow for the Couette scenario, where the moving wall is located at the lower wall (z=0)

Author
Philipp Neumann & Helene Wittenberg

Member Enumeration Documentation

◆ Flag

for every cell exists a flag entry, upon this is defined how the cell is handled

Enumerator
FLUID 

a normal fluid cell

NO_SLIP 

a cell on the no slip (non-moving) wall

MOVING_WALL 

a cell on the moving wall

PERIODIC 

a cell on a periodic boundary

MD_BOUNDARY 

a cell on the boundary to md

PARALLEL_BOUNDARY 

a cell on a inner boundary of a splitted domain in a parallel run

◆ NbFlag

The flags are used on parallel boundaries to define in which direction the boundary goes.

Enumerator
LEFT 

a parallel boundary to the left

RIGHT 

a parallel boundary to the right

BACK 

a parallel boundary to the back

FRONT 

a parallel boundary to the front

BOTTOM 

a parallel boundary to the bottom

TOP 

a parallel boundary to the top

Constructor & Destructor Documentation

◆ NumericalSolver()

coupling::solvers::NumericalSolver::NumericalSolver ( const double channelheight,
const double dx,
const double dt,
const double kinVisc,
const int plotEveryTimestep,
const std::string filestem,
const tarch::la::Vector< 3, unsigned int > processes,
const Scenario * scen = nullptr )
inline

a simple constructor

Parameters
channelheightthe width and height of the channel in y and z direction
dxthe spacial step size, and equidistant grid is applied
dtthe time step
kinViscthe kinematic viscosity of the fluid
plotEveryTimestepthe time step interval for plotting data; 4 means, every 4th time step is plotted
filestemthe name of the plotted file
processesdefines on how many processes the solver will run; 1,1,1 - sequential run - 1,2,2 = 1*2*2 = 4 processes

Member Function Documentation

◆ get() [1/2]

int coupling::solvers::NumericalSolver::get ( int i) const
inlineprotected

returns i and performs checks in debug mode

Returns
i

◆ get() [2/2]

int coupling::solvers::NumericalSolver::get ( int x,
int y,
int z ) const
inlineprotected

returns linearized index and performs checks in debug mode

Returns
the linearized index

◆ getAvgDomainSize()

static int coupling::solvers::NumericalSolver::getAvgDomainSize ( double channelheight,
double dx,
tarch::la::Vector< 3, unsigned int > processes,
int d )
inlinestatic

determines the "avg" domain size which is the domain size on each MPI process, except for potentially the last one (the last one may include additional cells)

◆ getAvgNumberLBCells()

tarch::la::Vector< 3, unsigned int > coupling::solvers::NumericalSolver::getAvgNumberLBCells ( ) const
inline

returns the average number of cells on each process

Returns
the average number of cells

◆ getDensity()

virtual double coupling::solvers::NumericalSolver::getDensity ( tarch::la::Vector< 3, double > pos) const
pure virtual

returns the density for a given position

Parameters
posposition for which the density will be returned
Returns
the density

Implemented in coupling::solvers::FiniteDifferenceSolver, and coupling::solvers::LBCouetteSolver.

◆ getDomainSize()

int coupling::solvers::NumericalSolver::getDomainSize ( double channelheight,
double dx,
tarch::la::Vector< 3, unsigned int > processes,
int d ) const
inlineprivate

determines the local domain size on this rank where channelheight is the domain length in direction d.

Returns
the size of the domain

◆ getNumberProcesses()

tarch::la::Vector< 3, unsigned int > coupling::solvers::NumericalSolver::getNumberProcesses ( ) const
inline

returns the number of process, regards parallel runs

Returns
the number of processes

◆ getParBuf()

int coupling::solvers::NumericalSolver::getParBuf ( int x,
int y,
int lengthx,
int lengthy ) const
inlineprotected

returns index in 2D parallel buffer with buffer dimensions lengthx+2,lengthy+2. Performs checks in debug mode

Returns
the index in the buffer

◆ getProcessCoordinates()

tarch::la::Vector< 3, unsigned int > coupling::solvers::NumericalSolver::getProcessCoordinates ( ) const
inlineprivate

determines the process coordinates

Returns
the coordinates of the current process

◆ setMDBoundary()

void coupling::solvers::NumericalSolver::setMDBoundary ( tarch::la::Vector< 3, double > mdDomainOffset,
tarch::la::Vector< 3, double > mdDomainSize,
unsigned int overlapStrip )
inline

flags the domain boundary cells.

Parameters
mdDomainOffsetlower/left/front corner of the MD domain
mdDomainSizetotal 3d size of the md domain
overlapStripthe number of cells in the overlap layer; The overlap of md and macro cells
recvIndicethe coupling cell indices that will be received
sizethe number of cells that will be received

◆ setMDBoundaryValues()

virtual void coupling::solvers::NumericalSolver::setMDBoundaryValues ( coupling::datastructures::FlexibleCellContainer< 3 > & md2macroBuffer)
pure virtual

applies the values received from the MD-solver within the conntinuum solver

Parameters
md2macroBufferholds the data from the md solver coupling cells

Implemented in coupling::solvers::FiniteDifferenceSolver, and coupling::solvers::LBCouetteSolver.

◆ setWallVelocity()

virtual void coupling::solvers::NumericalSolver::setWallVelocity ( const tarch::la::Vector< 3, double > wallVelocity)
pure virtual

changes the velocity at the moving wall (z=0)

Parameters
wallVelocitynew wall velocity to apply

Implemented in coupling::solvers::FiniteDifferenceSolver, and coupling::solvers::LBCouetteSolver.

◆ skipRank()

bool coupling::solvers::NumericalSolver::skipRank ( ) const
inlineprotected

returns true, if this rank is not of relevance for the LB simulation

Returns
a bool, which indicates if the rank shall not do anything (true) or not (false)

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