cuIBM
A GPU-based Immersed Boundary Method code
TairaColoniusSolver.cu
Go to the documentation of this file.
1 
7 #include <sys/stat.h>
8 
9 #include "TairaColoniusSolver.h"
10 
11 
15 template <typename memoryType>
17 {
20 } // TairaColoniusSolver
21 
22 
30 template <typename memoryType>
32 {
35 
36  int numUV = (nx-1)*ny + nx*(ny-1),
37  numP = nx*ny;
38 
40 
42  int totalPoints = NSWithBody<memoryType>::B.totalPoints;
43 
44  NavierStokesSolver<memoryType>::initialiseArrays(numUV, numP+2*totalPoints);
45  if(totalPoints > 0)
46  {
47  // for each Lagragian point, 24 velocity nodes around it
48  // are influenced by the delta function at the point
49  // A 4x3 grid of u-nodes, and a 3x4 grid of v-nodes
50  // which gives 12*2 velocity nodes influence by a boundary point in 2D
51  E.resize(2*totalPoints, numUV, 24*totalPoints);
52  }
54 } // initialise
55 
56 
60 template <typename memoryType>
62 {
63  NavierStokesSolver<memoryType>::logger.startTimer("output");
64 
66 
68  real dt = db["simulation"]["dt"].get<real>();
69  int numBodies = NSWithBody<memoryType>::B.numBodies;
70 
71  // calculate forces using the T&C method
72  calculateForce();
73 
74  // print to file
76  for(int l=0; l<numBodies; l++)
77  {
79  }
81 
82  // print forces calculated using the CV approach
83  //NSWithBody<memoryType>::calculateForce();
84  //NSWithBody<memoryType>::forceFile << NSWithBody<memoryType>::forceX << '\t' << NSWithBody<memoryType>::forceY << std::endl;
85 
86  NavierStokesSolver<memoryType>::logger.stopTimer("output");
87 } // writeData
88 
89 
97 template <typename memoryType>
99 {
100  if (NSWithBody<memoryType>::B.bodiesMove)
101  {
103  updateQT();
105 
106  NavierStokesSolver<memoryType>::logger.startTimer("preconditioner2");
108  NavierStokesSolver<memoryType>::logger.stopTimer("preconditioner2");
109  }
110 } // updateSolverState
111 
112 
113 // include inline files
117 
118 
119 // specialization of the class TairaColoniusSolver
__global__ void updateQT(int *QTRows, int *QTCols, real *QTVals, int QTSize, int *tags, real *coeffs)
Update the divergence operator at forcing nodes.
Definition: generateQT.cu:87
void initialiseBodies()
Stores the parameters of the simulation and initializes the location and motion of each immersed bodi...
Definition: NSWithBody.cu:16
virtual void updateSolverState()
Updates the location of the bodies and re-generates appropriate matrices.
double real
Is a float or a double depending on the machine precision.
Definition: types.h:116
virtual void writeCommon()
Writes flow variables and position of body points into files.
Definition: NSWithBody.cu:136
real forceX
force acting on each body in the x-direction
Definition: NSWithBody.h:26
real forceY
force acting on each body in the y-direction
Definition: NSWithBody.h:26
virtual void writeData()
Calculates and writes forces acting on each immersed body at current time.
void initialiseCommon()
Initializes parameters common to all Navier-Stokes solvers.
std::map< std::string, componentParameter > parameterDB
Map from a string to a componentParameter.
Definition: parameterDB.h:64
TairaColoniusSolver(parameterDB *pDB=NULL, domain *dInfo=NULL)
Constructor. Copies the database and information about the computational grid.
Stores information about the computational grid.
Definition: domain.h:16
void initialiseArrays(int numQ, int numLambda)
Initializes all arrays required to solve the Navier-Stokes equations.
virtual void initialise()
Initializes the solvers.
Declaration of the class TairaColoniusSolver.
Solves the Navier-Stokes equations using the Immersed boundary method from Taira and Colonius (2007)...
virtual void generateC()
void updateBodies()
Updates location and motion of each immersed body at current time.
Definition: NSWithBody.cu:45
void assembleMatrices()
Assembles matrices of the intermediate flux solver and the Poisson solver.
Generic Navier-Stokes solver in the presence of immersed boundaries.
Definition: NSWithBody.h:21
Solves the Navier-Stokes equations in a rectangular domain.
Implementation of the methods of the class TairaColoniusSolver to calculate forces acting on each imm...