cuIBM
A GPU-based Immersed Boundary Method code
bodies.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include "domain.h"
10 #include "parameterDB.h"
11 #include "body.h"
12 
13 
18 template <typename memoryType>
19 class bodies
20 {
21 public:
22  int numBodies,
23  totalPoints;
24 
25  bool bodiesMove;
26 
27  cusp::array1d<int, memoryType>
29  offsets,
30  I,
31  J;
32 
33  cusp::array1d<int, memoryType>
35  startJ,
36  numCellsX,
37  numCellsY;
38 
39  cusp::array1d<real, memoryType>
40  xmin,
41  xmax,
42  ymin,
43  ymax;
44 
45  cusp::array1d<real, memoryType>
47  forceY;
48 
49  cusp::array1d<real, memoryType>
50  X,
51  Y,
52  ds,
53  ones,
54  x,
55  y,
56  uB,
57  vB;
58 
59  // set initial position and velocity of each body
60  void initialise(parameterDB &db, domain &D);
61 
62  // store index of each cell that contains a boundary point
64 
65  // store indices of the bounding box of each body
67 
68  // update position, velocity and neighbors of each body
69  void update(parameterDB &db, domain &D, real Time);
70 
71  // write body coordinates into a file
72  void writeToFile(std::string &caseFolder, int timeStep);
73 
74  // write body coordinates into a file called \a bodies
75  void writeToFile(real *bx, real *by, std::string &caseFolder, int timeStep);
76 }; // bodies
bool bodiesMove
tells whether the body is moving or not
Definition: bodies.h:25
int totalPoints
total number of boundary points (all bodies)
Definition: bodies.h:22
Definition of the class body.
double real
Is a float or a double depending on the machine precision.
Definition: types.h:116
cusp::array1d< int, memoryType > I
x-index of the cell in which a body point is located
Definition: bodies.h:28
cusp::array1d< real, memoryType > y
actual y-coordinate of the boundary points
Definition: bodies.h:50
void calculateBoundingBoxes(parameterDB &db, domain &D)
Calculates indices of the bounding box of each body in the flow.
Definition: bodies.cu:164
cusp::array1d< real, memoryType > x
actual x-coordinate of the boundary points
Definition: bodies.h:50
cusp::array1d< int, memoryType > offsets
array index of the first point of each body
Definition: bodies.h:28
cusp::array1d< real, memoryType > xmin
lowest x-coordinate for the bounding box of a body
Definition: bodies.h:40
cusp::array1d< real, memoryType > vB
y-velocity of the boundary points
Definition: bodies.h:50
std::map< std::string, componentParameter > parameterDB
Map from a string to a componentParameter.
Definition: parameterDB.h:64
cusp::array1d< real, memoryType > uB
x-velocity of the boundary points
Definition: bodies.h:50
Stores information about the computational grid.
Definition: domain.h:16
cusp::array1d< real, memoryType > X
reference x-coordinates of the boundary points
Definition: bodies.h:50
Contains information about bodies in the flow.
Definition: bodies.h:19
cusp::array1d< int, memoryType > J
y-index of the cell in which a body point is located
Definition: bodies.h:28
Declaration of the class property.
cusp::array1d< real, memoryType > forceX
force acting on a body in the x-direction
Definition: bodies.h:46
void calculateCellIndices(domain &D)
Stores index of each cell that contains a boundary point.
Definition: bodies.cu:108
cusp::array1d< real, memoryType > ones
vector of size totalPoints with all elements 1
Definition: bodies.h:50
void writeToFile(std::string &caseFolder, int timeStep)
void initialise(parameterDB &db, domain &D)
Sets initial position and velocity of each body.
Definition: bodies.cu:17
cusp::array1d< int, memoryType > startJ
starting cell index of the bounding box of a body
Definition: bodies.h:34
cusp::array1d< real, memoryType > Y
reference y-coordinates of the boundary points
Definition: bodies.h:50
cusp::array1d< real, memoryType > ymax
highest y-coordinate for the bounding box of a body
Definition: bodies.h:40
cusp::array1d< real, memoryType > forceY
force acting on a body in the y-direction
Definition: bodies.h:46
cusp::array1d< int, memoryType > startI
starting cell index of the bounding box of a body
Definition: bodies.h:34
Definition of the class domain.
cusp::array1d< int, memoryType > numPoints
number of points for each body
Definition: bodies.h:28
void update(parameterDB &db, domain &D, real Time)
Updates position, velocity and neighbors of each body.
Definition: bodies.cu:223
cusp::array1d< real, memoryType > xmax
highest x-coordinate for the bounding box of a body
Definition: bodies.h:40
cusp::array1d< real, memoryType > ds
vector containing the lengths of all the boundary segments
Definition: bodies.h:50
cusp::array1d< int, memoryType > numCellsY
number of cells in the y-direction in the bounding box of a body
Definition: bodies.h:34
cusp::array1d< real, memoryType > ymin
lowest y-coordinate for the bounding box of a body
Definition: bodies.h:40
int numBodies
number of bodies
Definition: bodies.h:22
cusp::array1d< int, memoryType > numCellsX
number of cells in the x-direction in the bounding box of a body
Definition: bodies.h:34