cuIBM
A GPU-based Immersed Boundary Method code
Public Member Functions | Public Attributes | List of all members
bodies< memoryType > Class Template Reference

Contains information about bodies in the flow. More...

#include <bodies.h>

Public Member Functions

void initialise (parameterDB &db, domain &D)
 Sets initial position and velocity of each body. More...
 
void calculateCellIndices (domain &D)
 Stores index of each cell that contains a boundary point. More...
 
void calculateBoundingBoxes (parameterDB &db, domain &D)
 Calculates indices of the bounding box of each body in the flow. More...
 
void update (parameterDB &db, domain &D, real Time)
 Updates position, velocity and neighbors of each body. More...
 
void writeToFile (std::string &caseFolder, int timeStep)
 
void writeToFile (real *bx, real *by, std::string &caseFolder, int timeStep)
 Writes body coordinates into a file called bodies. More...
 
template<>
void writeToFile (std::string &caseFolder, int timeStep)
 Writes body coordinates into a file (using data from the device). More...
 

Public Attributes

int numBodies
 number of bodies More...
 
int totalPoints
 total number of boundary points (all bodies) More...
 
bool bodiesMove
 tells whether the body is moving or not More...
 
cusp::array1d< int, memoryType > numPoints
 number of points for each body More...
 
cusp::array1d< int, memoryType > offsets
 array index of the first point of each body More...
 
cusp::array1d< int, memoryType > I
 x-index of the cell in which a body point is located More...
 
cusp::array1d< int, memoryType > J
 y-index of the cell in which a body point is located More...
 
cusp::array1d< int, memoryType > startI
 starting cell index of the bounding box of a body More...
 
cusp::array1d< int, memoryType > startJ
 starting cell index of the bounding box of a body More...
 
cusp::array1d< int, memoryType > numCellsX
 number of cells in the x-direction in the bounding box of a body More...
 
cusp::array1d< int, memoryType > numCellsY
 number of cells in the y-direction in the bounding box of a body More...
 
cusp::array1d< real, memoryType > xmin
 lowest x-coordinate for the bounding box of a body More...
 
cusp::array1d< real, memoryType > xmax
 highest x-coordinate for the bounding box of a body More...
 
cusp::array1d< real, memoryType > ymin
 lowest y-coordinate for the bounding box of a body More...
 
cusp::array1d< real, memoryType > ymax
 highest y-coordinate for the bounding box of a body More...
 
cusp::array1d< real, memoryType > forceX
 force acting on a body in the x-direction More...
 
cusp::array1d< real, memoryType > forceY
 force acting on a body in the y-direction More...
 
cusp::array1d< real, memoryType > X
 reference x-coordinates of the boundary points More...
 
cusp::array1d< real, memoryType > Y
 reference y-coordinates of the boundary points More...
 
cusp::array1d< real, memoryType > ds
 vector containing the lengths of all the boundary segments More...
 
cusp::array1d< real, memoryType > ones
 vector of size totalPoints with all elements 1 More...
 
cusp::array1d< real, memoryType > x
 actual x-coordinate of the boundary points More...
 
cusp::array1d< real, memoryType > y
 actual y-coordinate of the boundary points More...
 
cusp::array1d< real, memoryType > uB
 x-velocity of the boundary points More...
 
cusp::array1d< real, memoryType > vB
 y-velocity of the boundary points More...
 

Detailed Description

template<typename memoryType>
class bodies< memoryType >

Contains information about bodies in the flow.

Definition at line 19 of file bodies.h.

Member Function Documentation

template<typename memoryType >
void bodies< memoryType >::calculateBoundingBoxes ( parameterDB db,
domain D 
)

Calculates indices of the bounding box of each body in the flow.

First the bounding box is scaled by a coefficient stored in the database. Then, indices of the x-coordinate and y-coordinate of the bottom left cell of the bounding box are stored. Finally, the number of cells in the x- and y- directions are calculated.

Parameters
dbdatabase that contains all the simulation parameters
Dinformation about the computational grid

Definition at line 164 of file bodies.cu.

References domain::x, and domain::y.

template<typename memoryType >
void bodies< memoryType >::calculateCellIndices ( domain D)

Stores index of each cell that contains a boundary point.

It calculates the index of the x-coordinate and the index of the y-coordinate of the bottom-left node of each cell that contains a boundary point. This information is useful when transferring data between the boundary points and the computational grid.

Parameters
Dinformation about the computational grid

Definition at line 108 of file bodies.cu.

References domain::x, and domain::y.

template<typename memoryType >
void bodies< memoryType >::initialise ( parameterDB db,
domain D 
)

Sets initial position and velocity of each body.

Parameters
dbdatabase that contains all the simulation parameters
Dinformation about the computational grid

Definition at line 17 of file bodies.cu.

References kernels::forceX(), and kernels::forceY().

template<typename memoryType >
void bodies< memoryType >::update ( parameterDB db,
domain D,
real  Time 
)

Updates position, velocity and neighbors of each body.

This is done using the formulae:

$ x_{i,m} = X^c_m + (X_{i,m} - X^0_m) \cos\theta - (Y_{i,m} - Y^0_m) \sin\theta $

and

$ y_{i,m} = Y^c_m + (X_{i,m} - X^0_m) \sin\theta + (Y_{i,m} - Y^0_m) \cos\theta $

Parameters
dbdatabase that contains all the simulation parameters
Dinformation about the computational grid
Timethe time

Definition at line 223 of file bodies.cu.

template<typename memoryType>
void bodies< memoryType >::writeToFile ( std::string &  caseFolder,
int  timeStep 
)
template<typename memoryType >
void bodies< memoryType >::writeToFile ( real bx,
real by,
std::string &  caseFolder,
int  timeStep 
)

Writes body coordinates into a file called bodies.

Parameters
bxx-coordinate of all points of all bodies
byy-coordinate of all points of all bodies
caseFolderdirectory of the simulation
timeSteptime-step of the simulation

Definition at line 308 of file bodies.cu.

template<>
void bodies< device_memory >::writeToFile ( std::string &  caseFolder,
int  timeStep 
)

Writes body coordinates into a file (using data from the device).

Parameters
caseFolderdirectory of the simulation
timeSteptime-step of the simulation

Definition at line 289 of file bodies.cu.

Member Data Documentation

template<typename memoryType>
bool bodies< memoryType >::bodiesMove

tells whether the body is moving or not

Definition at line 25 of file bodies.h.

template<typename memoryType>
cusp::array1d<real, memoryType> bodies< memoryType >::ds

vector containing the lengths of all the boundary segments

Definition at line 50 of file bodies.h.

template<typename memoryType>
cusp::array1d<real, memoryType> bodies< memoryType >::forceX

force acting on a body in the x-direction

Definition at line 46 of file bodies.h.

template<typename memoryType>
cusp::array1d<real, memoryType> bodies< memoryType >::forceY

force acting on a body in the y-direction

Definition at line 46 of file bodies.h.

template<typename memoryType>
cusp::array1d<int, memoryType> bodies< memoryType >::I

x-index of the cell in which a body point is located

Definition at line 28 of file bodies.h.

template<typename memoryType>
cusp::array1d<int, memoryType> bodies< memoryType >::J

y-index of the cell in which a body point is located

Definition at line 28 of file bodies.h.

template<typename memoryType>
int bodies< memoryType >::numBodies

number of bodies

Definition at line 22 of file bodies.h.

template<typename memoryType>
cusp::array1d<int, memoryType> bodies< memoryType >::numCellsX

number of cells in the x-direction in the bounding box of a body

Definition at line 34 of file bodies.h.

template<typename memoryType>
cusp::array1d<int, memoryType> bodies< memoryType >::numCellsY

number of cells in the y-direction in the bounding box of a body

Definition at line 34 of file bodies.h.

template<typename memoryType>
cusp::array1d<int, memoryType> bodies< memoryType >::numPoints

number of points for each body

Definition at line 28 of file bodies.h.

template<typename memoryType>
cusp::array1d<int, memoryType> bodies< memoryType >::offsets

array index of the first point of each body

Definition at line 28 of file bodies.h.

template<typename memoryType>
cusp::array1d<real, memoryType> bodies< memoryType >::ones

vector of size totalPoints with all elements 1

Definition at line 50 of file bodies.h.

template<typename memoryType>
cusp::array1d<int, memoryType> bodies< memoryType >::startI

starting cell index of the bounding box of a body

Definition at line 34 of file bodies.h.

template<typename memoryType>
cusp::array1d<int, memoryType> bodies< memoryType >::startJ

starting cell index of the bounding box of a body

Definition at line 34 of file bodies.h.

template<typename memoryType>
int bodies< memoryType >::totalPoints

total number of boundary points (all bodies)

Definition at line 22 of file bodies.h.

template<typename memoryType>
cusp::array1d<real, memoryType> bodies< memoryType >::uB

x-velocity of the boundary points

Definition at line 50 of file bodies.h.

template<typename memoryType>
cusp::array1d<real, memoryType> bodies< memoryType >::vB

y-velocity of the boundary points

Definition at line 50 of file bodies.h.

template<typename memoryType>
cusp::array1d<real, memoryType> bodies< memoryType >::X

reference x-coordinates of the boundary points

Definition at line 50 of file bodies.h.

template<typename memoryType>
cusp::array1d<real, memoryType> bodies< memoryType >::x

actual x-coordinate of the boundary points

Definition at line 50 of file bodies.h.

template<typename memoryType>
cusp::array1d<real, memoryType> bodies< memoryType >::xmax

highest x-coordinate for the bounding box of a body

Definition at line 40 of file bodies.h.

template<typename memoryType>
cusp::array1d<real, memoryType> bodies< memoryType >::xmin

lowest x-coordinate for the bounding box of a body

Definition at line 40 of file bodies.h.

template<typename memoryType>
cusp::array1d<real, memoryType> bodies< memoryType >::Y

reference y-coordinates of the boundary points

Definition at line 50 of file bodies.h.

template<typename memoryType>
cusp::array1d<real, memoryType> bodies< memoryType >::y

actual y-coordinate of the boundary points

Definition at line 50 of file bodies.h.

template<typename memoryType>
cusp::array1d<real, memoryType> bodies< memoryType >::ymax

highest y-coordinate for the bounding box of a body

Definition at line 40 of file bodies.h.

template<typename memoryType>
cusp::array1d<real, memoryType> bodies< memoryType >::ymin

lowest y-coordinate for the bounding box of a body

Definition at line 40 of file bodies.h.


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