Overture
Version 25
Main Page
Namespaces
Classes
Files
File List
File Members
Overture.v25.d
include
EllipticGridGenerator.h
Go to the documentation of this file.
1
#ifndef ELLIPTIC_GRID_GENERATOR_H
2
#define ELLIPTIC_GRID_GENERATOR_H
3
4
#include "
GenericDataBase.h
"
5
#include "
GenericGraphicsInterface.h
"
6
7
class
doubleMappedGridFunction
;
// forward declarations
8
class
floatMappedGridFunction
;
9
#ifdef OV_USE_DOUBLE
10
typedef
doubleMappedGridFunction
RealMappedGridFunction
;
11
#else
12
typedef
floatMappedGridFunction
RealMappedGridFunction
;
13
#endif
14
15
class
Mapping
;
16
class
MappedGridOperators
;
17
class
GenericGraphicsInterface
;
18
class
DataPointMapping
;
19
//class PlotStuff;
20
class
TridiagonalSolver
;
21
22
class
EllipticGridGenerator
23
{
24
// A class to solve pde using the multigrid method
25
26
public
:
27
28
int
domainDimension
,
rangeDimension
;
29
30
enum
BoundaryConditionTypes
31
{
32
dirichlet
=1,
33
slipOrthogonal
=2,
34
noSlipOrthogonalAndSpecifiedSpacing
=3,
35
noSlipOrthogonal
,
36
freeFloating
37
};
38
39
enum
SmoothingTypes
40
{
41
jacobiSmooth
,
42
redBlackSmooth
,
43
lineSmooth
,
44
line1Smooth
,
45
line2Smooth
,
46
line3Smooth
,
47
zebraSmooth
,
48
numberOfSmoothingTypes
49
};
50
51
52
53
EllipticGridGenerator
();
54
55
EllipticGridGenerator
(
const
EllipticGridGenerator
& oldEllipticGridGenerator);
// The copy constructor
56
57
~EllipticGridGenerator
();
// The destructor
58
59
60
// perform iterations
61
int
generateGrid
();
62
63
void
setup
(
Mapping
&
map
,
Mapping
*projectionMapping=
NULL
);
64
65
66
// return the current solution.
67
const
RealMappedGridFunction
&
solution
()
const
;
68
69
// supply a weight function for adaptation.
70
int
weightFunction
(
RealMappedGridFunction
& weight );
71
72
// supply a starting grid.
73
int
startingGrid
(
const
realArray
& u0,
74
const
realArray
& r0 =
Overture::nullRealDistributedArray
(),
75
const
IntegerArray
& indexBounds=
Overture::nullIntArray
() );
76
77
// Interactively choose parameters and compute elliptic grid.
78
int
update
(
DataPointMapping
& dpm,
79
GenericGraphicsInterface
*gi =
NULL
,
80
GraphicsParameters
& parameters =
Overture::defaultGraphicsParameters
() );
81
82
protected
:
83
84
// void applyBC(realArray &u1, realArray &v1, int i);
85
86
87
int
applyBoundaryConditions
(
const
int
& level,
88
RealMappedGridFunction
& uu );
89
90
int
coarseToFine
(
const
int
& level,
91
const
RealMappedGridFunction
& uCoarse,
92
RealMappedGridFunction
& uFine,
93
const
bool
& isAGridFunction =
FALSE
);
94
95
int
defineBoundaryControlFunction
();
96
97
int
defineSurfaceControlFunction
();
98
99
int
determineBoundarySpacing
(
const
int
& side,
100
const
int
& axis,
101
real
& averageSpacing,
102
real
& minimumSpacing,
103
real
& maximumSpacing );
104
105
// dot product
106
realArray
dot
(
const
realArray
& a,
107
const
realArray
& b,
108
const
Index & I1=
nullIndex
,
109
const
Index & I2=
nullIndex
,
110
const
Index & I3=
nullIndex
);
111
112
int
estimateUnderRelaxationCoefficients
();
113
114
int
fineToCoarse
(
const
int
& level,
115
const
RealMappedGridFunction
& uFine,
116
RealMappedGridFunction
& uCoarse,
117
const
bool
& isAGridFunction =
FALSE
);
118
119
// get coefficients of the elliptic system
120
int
getCoefficients
(
realArray
& coeff,
121
const
Index & J1,
122
const
Index & J2,
123
const
Index & J3,
124
const
realArray
& ur,
125
const
realArray
& us,
126
const
realArray
& ut =
Overture::nullRealDistributedArray
() );
127
128
int
getControlFunctions
(
const
int
& level );
129
130
int
jacobi
(
const
int
& level,
131
RealMappedGridFunction
& uu );
132
133
int
restrictMovement
(
const
int
& level,
134
const
RealMappedGridFunction
& u0,
135
RealMappedGridFunction
& u1,
136
const
Index & I1 =
nullIndex
,
137
const
Index & I2 =
nullIndex
,
138
const
Index & I3 =
nullIndex
);
139
140
141
// For smoothing the weight function:
142
int
smoothJacobi
(
RealMappedGridFunction
&
w
,
const
int
& numberOfSmooths= 4 );
143
144
int
lineSmoother
(
const
int
&
direction
,
145
const
int
& level,
146
RealMappedGridFunction
&
u
);
147
148
int
multigridVcycle
(
const
int
& level );
149
150
int
redBlack
(
const
int
& level,
151
RealMappedGridFunction
& uu );
152
153
void
getResidual
(
realArray
&resid1,
154
const
int
& level);
155
156
void
getResidual
(
realArray
&resid1,
157
const
int
& level,
158
Index Jv[3],
159
realArray
& coeff,
160
const
bool
& computeCoefficients =
TRUE
,
161
const
bool
& includeRightHandSide=
TRUE
,
162
const
bool
& computeControlFunctions=
TRUE
,
163
const
SmoothingTypes
& lineSmoothType =
jacobiSmooth
);
164
165
int
projectBoundaryPoints
(
const
int
& level,
166
RealMappedGridFunction
& uu,
167
const
int
& side,
168
const
int
& axis,
169
const
Index & I1,
170
const
Index & I2,
171
const
Index & I3 );
172
173
// this periodic update knows about the derivativePeriodic case
174
int
periodicUpdate
(
RealMappedGridFunction
& x,
175
const
Range & C=
nullRange
,
176
const
bool
& isAGridFunction =
TRUE
);
177
178
int
plot
(
const
RealMappedGridFunction
& v,
const
aString
& label );
179
180
realArray
signOf
(
const
realArray
& uarray);
181
182
int
smooth
(
const
int
& level,
183
const
SmoothingTypes
& smoothingType,
184
const
int
& numberOfSubIterations =1 );
185
186
int
stretchTheGrid
(
Mapping
& mapToStretch);
187
188
int
updateForNewBoundaryConditions
();
189
190
void
updateRightHandSideWithFASCorrection
(
int
level );
191
192
193
Mapping
*
userMap
;
// Defines mapping from r -> x
194
Mapping
*
projectionMap
;
// Use this mapping when projecting boundaries.
195
Mapping
*
boundaryProjectionMap
[2][3];
// points to Mappings to use to project boundaries.
196
197
IntegerArray
subSurfaceIndex
;
198
realArray
subSurfaceNormal
;
199
200
int
numberOfLevels
;
201
int
maximumNumberOfLevels
;
202
int
maximumNumberOfIterations
;
203
204
SmoothingTypes
smoothingMethod
;
205
206
Mapping
*
map
;
// for unit interval
207
MappedGrid
*
mg
;
208
MappedGridOperators
*
operators
;
209
realMappedGridFunction
*
u
;
210
211
Range
Rx
,
Rr
;
212
213
RealMappedGridFunction
*
source
;
214
RealMappedGridFunction
*
rhs
, *
w
;
//The right hand side and linearized solution
215
216
bool
userWeightFunctionDefined
;
217
RealMappedGridFunction
*
pWeight
;
// weight function for adaption.
218
219
RealArray
dx
;
220
221
real
residualTolerance
;
// convergence criteria for the maximum residual
222
223
//for the smoother
224
real
omega
;
// Optimal omega for underelaxed jacobi
225
RealArray
omegaMax
;
// maximum omega as determined from the control functions.
226
227
// when there is a gridBc=3
228
int
numberOfPeriods
;
// For doing many sheets in the periodic case
229
int
useBlockTridiag
;
230
231
intArray
boundaryCondition
;
232
realArray
boundarySpacing
;
//The specified boundary thickness
233
234
RealMappedGridFunction
*
rBoundary
;
// holds unit square coordinates of boundary values.
235
RealMappedGridFunction
*
xBoundary
;
// holds x values corresponding to rBoundary
236
237
IntegerArray
gridIndex
;
// holds interior points plus boundary where equations are applied.
238
int
numberOfLinesOfAttraction
;
239
IntegerArray
lineAttractionDirection
;
240
RealArray
lineAttractionParameters
;
241
242
int
numberOfPointsOfAttraction
;
243
RealArray
pointAttractionParameters
;
244
245
real
normalCurvatureWeight
;
// for surface control function.
246
real
residualNormalizationFactor
;
// scaling for residual
247
248
bool
useNewStuff
;
249
250
int
debug
;
251
252
TridiagonalSolver
*
tridiagonalSolver
;
253
254
bool
controlFunctions
;
// true if there are control functions.
255
bool
controlFunctionComputed
;
256
bool
applyBoundarySourceControlFunction
;
257
258
// PlotStuff *ps;
259
GenericGraphicsInterface
*
ps
;
260
GraphicsParameters
psp
;
261
262
int
initializeParameters
();
263
real
maximumResidual
,
previousMaximumResidual
;
264
265
int
numberOfCoefficients
;
// number of coefficients int the coeff array
266
char
buff
[80];
267
FILE *
debugFile
;
268
269
aString
smootherNames
[
numberOfSmoothingTypes
];
270
271
real
work
;
272
273
};
274
275
#endif
Generated on Fri Jan 4 2013 10:17:51 for Overture by
1.8.3