CG  Version 25
MovingGrids.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 #ifndef MOVING_GRIDS_H
3 #define MOVING_GRIDS_H
4 
5 #include "Overture.h"
6 
7 //..Forward definitions
8 class GridFunction;
9 class GenericGraphicsInterface;
10 class RigidBodyMotion;
11 class Parameters;
12 class Integrate;
13 class Ogshow;
14 
16 class MatrixMotion;
17 
18 
19 // ========================================================================
20 // This class coordinates the movement of grids for CG
21 // ========================================================================
22 
24 {
25 public:
26 
27 // This enum defines how the grid for a body moves
29 {
35  matrixMotion, // pre-defined matrix (rigid or scaling) motions
36  rigidBody, // rigid motions defined by fluid forces and torques
40 };
41 
42 
43 
45 MovingGrids(const MovingGrids & mg);
46 virtual ~MovingGrids();
47 
48 
49 // correction step:
50 virtual int correctGrids(const real t1,
51  const real t2,
52  GridFunction & cgf1,
53  GridFunction & cgf2 );
54 
55 static int debug0;
56 int debug() const {return debug0;}
57 
58 int detectCollisions(GridFunction & cgf1);
59 
60 virtual int getBoundaryAcceleration( MappedGrid & c, realSerialArray & gtt, int grid, real t0, int option );
61 
63 
64 virtual int getGridVelocity( GridFunction & gf0, const real & tGV );
65 
66 Integrate* getIntegrate() const;
67 
68 const RealArray & getMoveParameters() const;
69 
71 
72 int getNumberOfDeformingBodies() const;
73 
74 DeformingBodyMotion & getDeformingBody(const int bodyNumber);
75 
77 
78 MatrixMotion & getMatrixMotionBody(const int bodyNumber);
79 
80 int getNumberOfRigidBodies() const;
81 
82 RigidBodyMotion & getRigidBody(const int bodyNumber);
83 
84 real getTimeStepForRigidBodies() const;
85 
86 int getUserDefinedBoundaryAcceleration( MappedGrid & mg, realSerialArray & gtt, int grid, real t0, int option,
87  const int side, const int axis );
88 
89 int getUserDefinedGridVelocity( GridFunction & gf0, const real & t0, const int grid );
90 
91 // get from a data base file
92 int get( const GenericDataBase & dir, const aString & name);
93 
94 virtual int gridAccelerationBC(const int & grid,
95  const real & t0,
96  MappedGrid & c,
97  realMappedGridFunction & u ,
98  realMappedGridFunction & f ,
99  realMappedGridFunction & gridVelocity ,
100  realSerialArray & normal,
101  const Index & I1,
102  const Index & I2,
103  const Index & I3,
104  const Index & I1g,
105  const Index & I2g,
106  const Index & I3g );
107 
108 bool gridIsMoving(int grid) const;
109 
110 
111 virtual int moveDeformingBodies(const real & t1,
112  const real & t2,
113  const real & t3,
114  const real & dt0,
115  GridFunction & cgf1,
116  GridFunction & cgf2,
117  GridFunction & cgf3 );
118 
119 virtual int moveGrids(const real & t1,
120  const real & t2,
121  const real & t3,
122  const real & dt0,
123  GridFunction & cgf1,
124  GridFunction & cgf2,
125  GridFunction & cgf3 );
126 
128 
129 aString movingGridOptionName(MovingGridOption option) const;
130 
131 
132 bool isMovingGridProblem() const;
133 
134 // put to a data base file
135 int put( GenericDataBase & dir, const aString & name) const;
136 
137 virtual int rigidBodyMotion(const real & t1,
138  const real & t2,
139  const real & t3,
140  const real & dt0,
141  GridFunction & cgf1,
142  GridFunction & cgf2,
143  GridFunction & cgf3 );
144 
145 virtual int saveToShowFile() const;
146 
147 int setIsMovingGridProblem( bool trueOrFalse=TRUE );
148 
149 // interactive update
150 virtual int update(CompositeGrid & cg, GenericGraphicsInterface & gi );
151 
152 
153 
154 int updateToMatchGrid( CompositeGrid & cg );
155 
156 // general motion
157 int userDefinedMotion(const real & t1,
158  const real & t2,
159  const real & t3,
160  const real & dt0,
161  GridFunction & cgf1,
162  GridFunction & cgf2,
163  GridFunction & cgf3 );
164 
165 // motions that use a MatrixTransform -- shift, rotate, scale
166 int userDefinedTransformMotion(const real & t1,
167  const real & t2,
168  const real & t3,
169  const real & dt0,
170  GridFunction & cgf1,
171  GridFunction & cgf2,
172  GridFunction & cgf3,
173  const int grid );
174 
175 int userDefinedGridAccelerationBC(const int & grid,
176  const real & t0,
177  MappedGrid & c,
178  realMappedGridFunction & u ,
179  realMappedGridFunction & f ,
180  realMappedGridFunction & gridVelocity ,
181  realSerialArray & normal,
182  const Index & I1,
183  const Index & I2,
184  const Index & I3,
185  const Index & I1g,
186  const Index & I2g,
187  const Index & I3g );
188 
189 int updateUserDefinedMotion(CompositeGrid & cg, GenericGraphicsInterface & gi);
190 
191 
192 
193 protected:
194 
195 int initialize();
196 int getRamp(real t, real rampInterval, real & ramp, real & rampSpeed, real & rampAcceleration );
197 
198 
200 
201 IntegerArray gridsToMove;
202 
204 
206 IntegerArray moveOption;
207 IntegerArray movingGrid; // gridIsMoving(grid) is true if a grid is moving
208 RealArray moveParameters; // moveParameters(.,grid) : parameters for the type of movement
209 
210 // Matrix Motion body info
212 MatrixMotion **matrixMotionBody; // array of pointers to one or more matrix motion bodies
213 
214 //..Rigid body information
216 RigidBodyMotion **body; // array of pointers one or more rigid bodies.
217 Integrate *integrate; // used to integrate stresses on bodies.
219 
221 RealArray rigidBodyInfo; // save time sequence of some rigid body info.
223 
226 
229 
232 
233 //..Deforming body information
236 
237 };
238 
239 #endif