Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/elmergrid/src/egtypes.h
5225 views
1
/* femtypes.h */
2
/* Defines the types used in the FEM model. */
3
4
/* Definitions used in allocating space for the structures. */
5
#define DIM 2 /* dimension of the space */
6
#define MAXDOFS 20 /* maximum number of variables, e.g. T,P */
7
#define MAXCELLS 100 /* maximum number of subcells in given direction */
8
#define MAXBOUNDARIES 1000 /* maximum number of boundary groups for BCs, usually one or two except in ElmerGrid format */
9
#define MAXCASES 12 /* maximum number of coexisting cases */
10
#define MAXFILESIZE 600 /* maximum filenamesize for i/o files */
11
#define MAXLINESIZE 600 /* maximum length of line to be read */
12
#define LONGLINESIZE 1201
13
#define MAXNAMESIZE 50 /* maximum size of the variablename */
14
#define MAXPARAMS 30 /* maximum number of parameters */
15
#define MAXNODESD3 64 /* maximum number of 3D nodes */
16
#define MAXNODESD2 27 /* maximum number of 2D nodes */
17
#define MAXNODESD1 9 /* maximum number of 1D nodes */
18
#define MAXMAPPINGS 20 /* maximum number of geometry mappings */
19
#define MAXCONNECTIONS 500 /* maximum number of connections in nodal or dual graph */
20
#define MAXBCS 4000 /* maximum boundary index in naming, for example */
21
#define MAXBODIES 1000 /* maximum number of bodies in naming */
22
#define MAXPARTITIONS 512 /* maximum number of partitions */
23
#define MAXHALOMODES 10
24
25
#define MAXELEMENTTYPE 827
26
27
struct CRSType {
28
int *rows, *cols;
29
int rowsize,colsize;
30
int created;
31
};
32
33
/* Structure GridType includes the subcell structure of the
34
geometry and the meshing information. The elements may be
35
directly derived from this structures but it takes some
36
time and is not easy to comprehend. Therefore structures
37
CellType and FemType are derived from this data. The special
38
subcell structure is, however, utilized in some mapping
39
subroutines that in general cases would be much more difficult
40
(and expensive) to perform.
41
*/
42
struct GridType {
43
int dimension,
44
triangles,
45
layeredbc,
46
partitions,
47
coordsystem, /* 2D cartesian or axisymmetric? */
48
layered,
49
autoratio, /* set the scale in x and y automatically? */
50
minxelems, /* minimum number of elements */
51
minyelems,
52
minzelems,
53
totxelems, /* total number of elements */
54
totyelems,
55
totzelems,
56
elemorder,
57
elemmidpoints,
58
wantedelems,
59
limitdxverify,
60
wantedelems3d,
61
wantednodes3d,
62
firstmaterial, /* first material to be included in mesh */
63
lastmaterial, /* last material to be included in mesh */
64
nocells, /* number of subcells */
65
xcells, /* number of subcells in x-direction */
66
ycells,
67
zcells,
68
layerbcoffset, /* offset of bcs when doing extrusion */
69
noelements, /* number of elements in the mesh */
70
noknots, /* number of knots in the mesh */
71
nonodes, /* number of nodes in one element */
72
numbering, /* numbering scheme */
73
maxwidth, /* maxwidth of the band matrix */
74
noboundaries, /* number of boundaries for BCs */
75
maxmaterial; /* maximum material index */
76
int xlinear[MAXCELLS+1], /* linearity flag within the subcells */
77
ylinear[MAXCELLS+1],
78
zlinear[MAXCELLS+1],
79
xelems[MAXCELLS+1], /* number of elements within subcells */
80
yelems[MAXCELLS+1],
81
zelems[MAXCELLS+1],
82
zfirstmaterial[MAXCELLS+1],
83
zlastmaterial[MAXCELLS+1],
84
zmaterial[MAXCELLS+1],
85
boundint[MAXBOUNDARIES], /* internal material for boundary */
86
boundext[MAXBOUNDARIES], /* external material for boundary */
87
boundsolid[MAXBOUNDARIES],/* which of these is the solid? */
88
boundtype[MAXBOUNDARIES]; /* type of the boundary */
89
int **zmaterialmap,zmaterialmapexists;
90
Real zhelicity;
91
int zhelicityexists;
92
int structure[MAXCELLS+2][MAXCELLS+2], /* material structure of subcells */
93
numbered[MAXCELLS+2][MAXCELLS+2]; /* numbering order of the subcells */
94
Real dx0, /* global mesh scale in x-direction */
95
dy0,
96
dz0,
97
limitdx,
98
triangleangle,
99
xyratio, /* ratio between dx0 and dy0 */
100
xzratio;
101
Real rotateradius1,rotateradius2,rotateimprove;
102
int rotate,rotateblocks,rotatecurve,rotatecartesian,mappings,
103
reduceordermatmin,reduceordermatmax;
104
Real curverad,curveangle,curvezet,polarradius;
105
Real x[MAXCELLS+1], /* vertical lines in the geometry */
106
y[MAXCELLS+1], /* horizontal lines in the geometry */
107
z[MAXCELLS+1],
108
xexpand[MAXCELLS+1], /* local expand ratio in the subcells */
109
yexpand[MAXCELLS+1],
110
zexpand[MAXCELLS+1],
111
xratios[MAXCELLS+1], /* relative mesh scale ratios in subcells */
112
yratios[MAXCELLS+1],
113
zratios[MAXCELLS+1],
114
dx[MAXCELLS+1], /* local mesh scale in the subcells */
115
dy[MAXCELLS+1],
116
dz[MAXCELLS+1],
117
xdens[MAXCELLS+1], /* local density of the mesh in the subcells */
118
ydens[MAXCELLS+1],
119
zdens[MAXCELLS+1];
120
int mappingtype[MAXMAPPINGS],
121
mappingline[MAXMAPPINGS],
122
mappingpoints[MAXMAPPINGS];
123
Real mappinglimits[2*MAXMAPPINGS],
124
*mappingparams[MAXMAPPINGS];
125
};
126
127
/* The elements are numbered in the program without allocating
128
space for the knot numbers. Only a limited number of information
129
for each subcell is saved to structure CellType. Specific subroutines
130
are then used to calculate element or knot information using this
131
information. Cell is one macroscopic building block that may be
132
divided to M x N elements. It may even consist of one element. */
133
struct CellType {
134
int nonodes, /* number of nodes within an element */
135
dimension, /* 1D or 2D */
136
numbering, /* numbering scheme */
137
xelem, /* number of elements in the subcell */
138
yelem,
139
levelwidth, /* width in knot numbering */
140
left1st, /* first index in the first line */
141
left2nd, /* first index in the second line */
142
leftlast, /* first index in the last line */
143
levelwidthcenter,
144
leftcenter, /* first index for 8 and 9-node elements */
145
left2center,/* first index in the second line of 12- and 16-node elements */
146
elem1st, /* index of the lower left element */
147
elemwidth, /* width in element numbering */
148
xlinear, /* linearity flag */
149
ylinear,
150
material, /* material flag */
151
xind, yind; /* Indexes of the cell */
152
int boundary[8], /* material indices of neighbouring cells */
153
neighbour[8]; /* number of neighbouring cells */
154
Real xwidth, /* size of the subcell */
155
ywidth,
156
xratio, /* ratio of elements in the subcell */
157
yratio,
158
dx1, /* local mesh scale */
159
dy1;
160
Real xcorner[4], /* coordinates of the subcell corners */
161
ycorner[4];
162
};
163
164
165
/* This type includes all the element information needed for a
166
FEM model: the element topology, node coordinates, node indexing
167
and all the degrees of freedom. */
168
struct FemType {
169
int created, /* is the structure created? */
170
noknots, /* number of knots */
171
noelements, /* number of elements */
172
nodepermexist, /* are the nodes permutated at the start */
173
*nodeperm, /* Inverse node permutation to save */
174
coordsystem, /* coordsystem flag */
175
nocells, /* number of subcells */
176
maxnodes, /* maximum number of nodes */
177
dim, /* dimension of space */
178
numbering, /* numbering scheme */
179
variables, /* number of variables */
180
indexwidth, /* maximum difference of node indices */
181
mapgeo, /* mappings for geometry */
182
*nodalgraph[MAXCONNECTIONS],
183
nodalmaxconnections,
184
nodalexists,
185
dualexists,
186
*partitiontable[MAXCONNECTIONS],
187
maxpartitiontable,
188
partitiontableexists,
189
190
nocorners, /* number material corners in the mesh */
191
timesteps, /* number of timesteps */
192
periodicexist, /* does the periodic vector exist? */
193
*periodic, /* periodic ordering vector, if needed */
194
nodeconnectexist, /* does the node connection vector exist? */
195
*nodeconnect, /* connections between nodes, if needed */
196
elemconnectexist, /* does the element connection vector exist? */
197
*elemconnect, /* connections between elements, if needed */
198
partitionexist,/* does the partitioning exist? */
199
nopartitions, /* number of partitions */
200
*elempart, /* which partition owns the element */
201
*nodepart, /* which partition owns the node */
202
*corners, /* corners associated to elements */
203
*elementtypes, /* types of elements if not all the same */
204
*material, /* material for each element */
205
**topology, /* element topology */
206
bodynamesexist,
207
boundarynamesexist;
208
209
int edofs[MAXDOFS]; /* number of dofs in each node */
210
int bandwidth[MAXDOFS]; /* bandwidth accounting fixed points */
211
int alldofs[MAXDOFS]; /* total number of variables */
212
213
Real minsize,maxsize;
214
Real *x, /* in axisymmetric case r */
215
*y, /* in axisymmetric case z */
216
*z, /* in cylindrical case theta */
217
*times;
218
Real *dofs[MAXDOFS]; /* degrees of freedom in the mesh */
219
char dofname[MAXDOFS][MAXNAMESIZE];
220
char *bodyname[MAXBODIES];
221
char *boundaryname[MAXBCS];
222
int noboundaries; /* number of boundaries */
223
224
struct CRSType dualgraph, /* The dual graph of the finite element mesh */
225
nodalgraph2, /* The nodal graph of the finite element mesh */
226
invtopo; /* The inverse of the finite element mesh topology */
227
};
228
229
/* The boundaries between different materials or domains
230
are saved into this structure. It is used for setting
231
the boundary conditions. In physics it is typical that
232
the BCs are more complicated than the equations in the
233
bulk and therefore the structure must be such that it
234
enables the use of a wide variety of BCs. */
235
struct BoundaryType {
236
int created, /* is boundary created? */
237
nosides, /* sides on the boundary */
238
maxsidenodes, /* number of sidenodes on the element */
239
coordsystem, /* coordinate system flag */
240
echain, /* does the chain exist? */
241
ediscont, /* does the discontinuous boundary exist */
242
chainsize; /* size of the chain */
243
int *parent, /* primary parents of the sides */
244
*parent2, /* secondary parents of the sides */
245
*material, /* material of the sides */
246
*side, /* side in the primary parent element */
247
*side2, /* side in the secondary parent element */
248
*chain, /* indices in the chain representation */
249
*types,
250
*discont, /* type of discontinuous and periodic BCs */
251
*normal, /* direction of the normal */
252
*elementtypes, /* side element types if needed */
253
**topology; /* topology if needed */
254
};
255
256
/* Sometimes one point is discontinuous or there is
257
BC for one point only. This structure may then be
258
needed. */
259
#define MAXNOPOINTS 20
260
struct PointType {
261
int nopoints;
262
int parent[MAXNOPOINTS],corner[MAXNOPOINTS];
263
int material[MAXNOPOINTS],type[MAXNOPOINTS];
264
};
265
266
267
/* Physical parameters are read with a general manner.
268
They may be added without constraints. */
269
struct ModelType {
270
int iparameters, /* number of int parameters */
271
rparameters, /* number of Real parameters */
272
iparameter[MAXPARAMS]; /* values of int parameters */
273
Real rparameter[MAXPARAMS]; /* values of Real parameters */
274
char ikeyword[MAXPARAMS][MAXNAMESIZE]; /* names of int */
275
char rkeyword[MAXPARAMS][MAXNAMESIZE]; /* names of Real */
276
};
277
278
279
#define MAXSIDEBULK 10
280
struct ElmergridType {
281
282
int dim,
283
silent,
284
binary, /* save mesh to ElmerSolver in binary format */
285
center,
286
scale, /* scale the geometry */
287
order, /* reorder the nodes */
288
merge, /* merge meshes */
289
translate, /* translate the mesh */
290
rotate, /* rotate the mesh */
291
clone[3], /* clone the mesh the number of given times */
292
mirror[3], /* mirror the mash around the given axis */
293
cloneinds, /* should the material and bc indexes be altered when cloning */
294
canter,
295
decimals, /* save the mesh with number of decimals */
296
layers, /* create boundary layers */
297
layerbounds[MAXBOUNDARIES],
298
layernumber[MAXBOUNDARIES],
299
layermove, /* map the created layer to the original geometry */
300
metis, /* number of Metis partitions */
301
metis_contig, /* is Metis partitioning contiguous */
302
metis_minconn, /* is Metis partitioning contiguous */
303
metis_seed, /* seed for Metis partitioning routines */
304
metis_volcut, /* minimize edgecut (default) or total communication volume when true */
305
metis_ncuts, /* Number of different partitionings that Metis will compute. */
306
partopt, /* free parameter for optimization */
307
partoptim, /* apply aggressive optimization to node sharing on bulk */
308
partbcoptim, /* apply aggressive optimization to node sharing on bcs */
309
partitions, /* number of simple geometric partitions */
310
partdim[3],
311
partjoin, /* number of parallel dimensions to be joined */
312
inmethod, /* method in which mesh is read in to ElmerGrid */
313
outmethod, /* method in which the mesh is written by ElmerGrid */
314
sidemap[3*MAXBOUNDARIES],
315
sidemappings,
316
bulkmap[3*MAXMAPPINGS],
317
bulkmappings,
318
coordinatemap[3],
319
boundorder,
320
bulkorder,
321
boundbounds,
322
boundbound[3*MAXBOUNDARIES],
323
bulkbounds,
324
bulkbound[3*MAXBOUNDARIES],
325
mirrorbc,
326
layerparents[MAXBOUNDARIES],
327
sidebulk[MAXSIDEBULK],
328
triangles,
329
polar,
330
usenames,
331
isoparam,
332
cylinder,
333
unitemeshes,
334
reduce,
335
multidim,
336
removelowdim,
337
removeunused,
338
removeintbcs,
339
increase,
340
reducemat1,
341
reducemat2,
342
findsides,
343
vtuone,
344
saveboundaries,
345
nodes3d,
346
elements3d,
347
periodic,
348
periodicdim[3],
349
discont,
350
discontbounds[MAXBOUNDARIES],
351
connect,
352
connectbounds[MAXBOUNDARIES],
353
connectboundsset[MAXBOUNDARIES],
354
connectboundsnosets,
355
partorder,
356
parthalo[MAXHALOMODES], /* create halo for the partitioning */
357
partitionindirect, /* should one create indirect connections between nodes */
358
partbw, /* minimize bandwidth for partitions */
359
parthypre, /* renumber for hypre */
360
partdual,
361
partbcz,
362
partbcr,
363
partbcmetis,
364
partbclayers,
365
nofilesin,
366
saveinterval[3],
367
elementsredone,
368
bcoffset,
369
rotatecurve,
370
timeron,
371
nosave,
372
nooverwrite,
373
unitenooverlap,
374
filerenamed;
375
376
Real cscale[3],
377
corder[3],
378
parttol,
379
cmerge,
380
ctranslate[3],
381
crotate[3],
382
clonesize[3],
383
layerratios[MAXBOUNDARIES],
384
layerthickness[MAXBOUNDARIES],
385
layereps,
386
triangleangle,
387
partcorder[3],
388
polarradius,
389
curverad,curveangle,curvezet,
390
relh;
391
392
char filesin[MAXCASES][MAXFILESIZE],
393
filesout[MAXCASES][MAXFILESIZE],
394
infofile[MAXFILESIZE];
395
};
396
397
398