CG  Version 25
Cgins.h
Go to the documentation of this file.
1 #ifndef CGINS_H
2 #define CGINS_H
3 
4 #include "DomainSolver.h"
5 #include "InsParameters.h"
6 
7 // CG equation-domain solver for the Incompressible Navier-Stokes Equations
8 
9 class Cgins : public DomainSolver
10 {
11 public:
12 
13 Cgins(CompositeGrid & cg,
14  GenericGraphicsInterface *ps=NULL,
15  Ogshow *show=NULL,
16  const int & plotOption=1 );
17 
18 virtual ~Cgins();
19 
20 virtual
21 void addForcing(realMappedGridFunction & dvdt, const realMappedGridFunction & u, int iparam[], real rparam[],
22  realMappedGridFunction & dvdtImplicit = Overture::nullRealMappedGridFunction(),
23  realMappedGridFunction *referenceFrameVelocity=NULL );
24 
25 void
27  MappedGrid & c,
28  realMappedGridFunction & f,
29  realMappedGridFunction & gridVelocity,
30  const real & t );
31 
32 virtual int
33 advanceLineSolve(LineSolve & lineSolve,
34  const int grid, const int direction,
35  realCompositeGridFunction & u0,
36  realMappedGridFunction & f,
37  realMappedGridFunction & residual,
38  const bool refactor,
39  const bool computeTheResidual =false );
40 
41 int
42 advanceLineSolveOld(LineSolve & lineSolve,
43  const int grid, const int direction,
44  realCompositeGridFunction & u0,
45  realMappedGridFunction & f,
46  realMappedGridFunction & residual,
47  const bool refactor,
48  const bool computeTheResidual =false );
49 
50 int
51 advanceLineSolveNew(LineSolve & lineSolve,
52  const int grid, const int direction,
53  realCompositeGridFunction & u0,
54  realMappedGridFunction & f,
55  realMappedGridFunction & residual,
56  const bool refactor,
57  const bool computeTheResidual =false );
58 
59 
60 virtual int
61 applyBoundaryConditions(const real & t, realMappedGridFunction & u,
62  realMappedGridFunction & gridVelocity,
63  const int & grid,
64  const int & option =-1,
65  realMappedGridFunction *puOld =NULL,
66  realMappedGridFunction *pGridVelocityOld =NULL,
67  const real & dt =-1. );
68 
69 virtual int
70 applyBoundaryConditionsForImplicitTimeStepping(realMappedGridFunction & u,
71  realMappedGridFunction &uL,
72  realMappedGridFunction & gridVelocity,
73  real t,
74  int scalarSystem,
75  int grid );
76 
77 void
78 applyFourthOrderBoundaryConditions( realMappedGridFunction & u0, real t, int grid,
79  realMappedGridFunction & gridVelocity );
80 
81 int
82 assignLineSolverBoundaryConditions(const int grid, const int direction,
83  realMappedGridFunction & u,
84  realMappedGridFunction & f,
85  const int numberOfTimeDependentComponents,
86  bool isPeriodic[3] );
87 
88 void
89 assignPressureRHS( GridFunction & gf0, realCompositeGridFunction & f );
90 
91 void
92 assignPressureRHS( const int grid, GridFunction & gf0, realCompositeGridFunction & f0 );
93 
94 virtual int
95 buildTimeSteppingDialog(DialogData & dialog );
96 
97 int computeAxisymmetricDivergence(realArray & divergence,
98  Index & I1, Index & I2, Index & I3, MappedGrid & c,
99  const realArray & u0,
100  const realArray & u0x,
101  const realArray & v0y );
102 
103 int
105 
106 // int & debug() const { return parameters.debug;}
107 
108 virtual void
110  const aString & label =nullString );
111 
112 virtual void
113 determineErrors(realCompositeGridFunction & u,
114  realMappedGridFunction **gridVelocity,
115  const real & t,
116  const int options,
117  RealArray & err,
118  const aString & label =nullString );
119 
120 
121 virtual void
122 formMatrixForImplicitSolve(const real & dt0,
123  GridFunction & cgf1,
124  GridFunction & cgf0 );
125 virtual int
126 formImplicitTimeSteppingMatrix(realMappedGridFunction & coeff,
127  const real & dt0,
128  int scalarSystem,
129  realMappedGridFunction & u0,
130  const realMappedGridFunction & gridVelocity,
131  const int & grid,
132  const int & imp );
133 
134 
135 // Return the list of interface data needed by a given interface:
136 virtual int
137 getInterfaceDataOptions( GridFaceDescriptor & info, int & interfaceDataOptions ) const;
138 
139 virtual int
140 getResidual( real t, real dt, GridFunction & cgf, realCompositeGridFunction & residual);
141 
142 virtual int
143 getTimeSteppingOption(const aString & answer,
144  DialogData & dialog );
145 
146 // semi-discrete discretization. Lambda is used to determine the time step by requiring
147 // lambda*dt to be in the stability region of the particular time stepping method we are
148 // using
149 virtual void
150 getTimeSteppingEigenvalue(MappedGrid & mg,
151  realMappedGridFunction & u,
152  realMappedGridFunction & gridVelocity,
153  real & reLambda,
154  real & imLambda,
155  const int & grid);
156 
157 virtual int
158 getUt(const realMappedGridFunction & v,
159  const realMappedGridFunction & gridVelocity,
160  realMappedGridFunction & dvdt,
161  int iparam[], real rparam[],
162  realMappedGridFunction & dvdtImplicit = Overture::nullRealMappedGridFunction(),
163  MappedGrid *pmg2=NULL,
164  const realMappedGridFunction *pGridVelocity2= NULL);
165 
166 void
167 gridAccelerationBC(const int & grid,
168  const real & t0,
169  GridFunction & gf0,
170  realCompositeGridFunction & f0,
171  int side,
172  int axis );
173 
174 virtual void
175 implicitSolve(const real & dt0,
176  GridFunction & cgf1,
177  GridFunction & cgf0);
178 virtual int
180 
181 int
183  realMappedGridFunction & coeff,
184  const real & dt0,
185  const realMappedGridFunction & u0,
186  realMappedGridFunction & fe,
187  realMappedGridFunction & fi,
188  const realMappedGridFunction & gridVelocity,
189  const int & grid);
190 
191 virtual int
193  int interfaceDataOptions,
194  GridFaceDescriptor & info,
195  GridFaceDescriptor & gfd,
196  int gfIndex, real t );
197 int
198 lineSolverBoundaryConditions(const int grid, const int direction,
199  realMappedGridFunction & u,
200  realMappedGridFunction & f,
201  realMappedGridFunction & residual,
202  Index *Iv, Index *Jv, Index *Ixv,
203  const int maxNumberOfSystems, int *uSystem,
204  const int numberOfTimeDependentComponents,
205  IntegerArray & bc, IntegerArray & extra, IntegerArray & offset,
206  bool & boundaryConditionsAreDifferent, bool isPeriodic[3] );
207 
208 int
209 getLineSolverBoundaryConditions(const int grid, const int direction,
210  realMappedGridFunction & u,
211  Index *Ixv,
212  const int maxNumberOfSystems, int *uSystem,
213  const int numberOfTimeDependentComponents,
214  IntegerArray & bc,IntegerArray & numGhost,
215  int & numberOfDifferentLineSolverBoundaryConditions );
216 
217 
218 virtual void
219 outputSolution( realCompositeGridFunction & u, const real & t,
220  const aString & label =nullString,
221  int printOption = 0 );
222 
223 virtual void
224 printTimeStepInfo( const int & step, const real & t, const real & cpuTime );
225 
226 virtual int
227 setup();
228 
229 virtual int
230 setupPde(aString & reactionName,bool restartChosen, IntegerArray & originalBoundaryCondition);
231 
232 virtual void
233 updateDivergenceDamping( CompositeGrid & cg0, const int & geometryHasChanged );
234 
235 virtual int
236 updateForNewTimeStep(GridFunction & gf, const real & dt );
237 
238 virtual int
240 
241 virtual void
242 updatePressureEquation(CompositeGrid & cg0, GridFunction & cgf );
243 
244 virtual int
246 
247 virtual int
248 updateStateVariables(GridFunction & cgf, int stage=-1);
249 
250 virtual void
251 updateTimeIndependentVariables(CompositeGrid & cg0, GridFunction & cgf );
252 
253 virtual int
254 updateToMatchGrid(CompositeGrid & cg);
255 
256 virtual int
257 setSolverParameters(const aString & command = nullString,
258  DialogData *interface =NULL );
259 
260 virtual int
262 
263 virtual void
264 solveForTimeIndependentVariables( GridFunction & cgf, bool updateSolutionDependentEquations=false );
265 
266 virtual int
267 turbulenceModels(realArray & nuT,
268  MappedGrid & mg,
269  const realArray & u,
270  const realArray & uu,
271  const realArray & ut,
272  const realArray & ux,
273  const realArray & uy,
274  const realArray & uz,
275  const realArray & uxx,
276  const realArray & uyy,
277  const realArray & uzz,
278  const Index & I1, const Index & I2, const Index & I3,
280  real nu,
281  const int numberOfDimensions,
282  const int grid, const real t );
283 int
284 turbulenceModelBoundaryConditions(const real & t,
285  realMappedGridFunction & u,
286  Parameters & parameters,
287  int grid,
288  RealArray *pBoundaryData[2][3] );
289 
290 virtual realCompositeGridFunction &
291 getAugmentedSolution( GridFunction & gf0, realCompositeGridFunction & v );
292 
293 virtual void buildImplicitSolvers(CompositeGrid & cg);
294 
295 virtual int
297 
298 virtual int
299 setPlotTitle(const real &t, const real &dt);
300 
301 virtual void
302 saveShowFileComments( Ogshow &show );
303 
304 virtual
305 void writeParameterSummary( FILE *file );
306 
307 virtual
308 int project(GridFunction &cgf);
309 
310 virtual
311 int setOgesBoundaryConditions( GridFunction &cgf, IntegerArray & boundaryConditions, RealArray &boundaryConditionData,
312  const int imp );
313 
314 virtual
316 
317 public: // for now
318 
319 // protected:
320 
321 realCompositeGridFunction divDampingWeight;
322 // realCompositeGridFunction pressureRightHandSide;
323 
324 // InsParameters parameters; // overloads base class Parameters
325 
326 // Oges *poisson;
327 
328 private:
329 
330  // These next variables are for addForcing (optimized TZ evaluation)
331  std::vector<real> tzTimeVector1;
332  std::vector<real> tzTimeVector2;
333  std::vector<realSerialArray*> tzForcingVector;
334 
335 };
336 
337 #endif