Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/elmergrid/src/egtypes.h
3196 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
center,
285
scale, /* scale the geometry */
286
order, /* reorder the nodes */
287
merge, /* merge meshes */
288
translate, /* translate the mesh */
289
rotate, /* rotate the mesh */
290
clone[3], /* clone the mesh the number of given times */
291
mirror[3], /* mirror the mash around the given axis */
292
cloneinds, /* should the material and bc indexes be altered when cloning */
293
canter,
294
decimals, /* save the mesh with number of decimals */
295
layers, /* create boundary layers */
296
layerbounds[MAXBOUNDARIES],
297
layernumber[MAXBOUNDARIES],
298
layermove, /* map the created layer to the original geometry */
299
metis, /* number of Metis partitions */
300
metis_contig, /* is Metis partitioning contiguous */
301
metis_minconn, /* is Metis partitioning contiguous */
302
metis_seed, /* seed for Metis partitioning routines */
303
metis_volcut, /* minimize edgecut (default) or total communication volume when true */
304
metis_ncuts, /* Number of different partitionings that Metis will compute. */
305
partopt, /* free parameter for optimization */
306
partoptim, /* apply aggressive optimization to node sharing on bulk */
307
partbcoptim, /* apply aggressive optimization to node sharing on bcs */
308
partitions, /* number of simple geometric partitions */
309
partdim[3],
310
partjoin, /* number of parallel dimensions to be joined */
311
inmethod, /* method in which mesh is read in to ElmerGrid */
312
outmethod, /* method in which the mesh is written by ElmerGrid */
313
sidemap[3*MAXBOUNDARIES],
314
sidemappings,
315
bulkmap[3*MAXMAPPINGS],
316
bulkmappings,
317
coordinatemap[3],
318
boundorder,
319
bulkorder,
320
boundbounds,
321
boundbound[3*MAXBOUNDARIES],
322
bulkbounds,
323
bulkbound[3*MAXBOUNDARIES],
324
mirrorbc,
325
layerparents[MAXBOUNDARIES],
326
sidebulk[MAXSIDEBULK],
327
triangles,
328
polar,
329
usenames,
330
isoparam,
331
cylinder,
332
unitemeshes,
333
reduce,
334
multidim,
335
removelowdim,
336
removeunused,
337
removeintbcs,
338
increase,
339
reducemat1,
340
reducemat2,
341
findsides,
342
vtuone,
343
saveboundaries,
344
nodes3d,
345
elements3d,
346
periodic,
347
periodicdim[3],
348
discont,
349
discontbounds[MAXBOUNDARIES],
350
connect,
351
connectbounds[MAXBOUNDARIES],
352
connectboundsset[MAXBOUNDARIES],
353
connectboundsnosets,
354
partorder,
355
parthalo[MAXHALOMODES], /* create halo for the partitioning */
356
partitionindirect, /* should one create indirect connections between nodes */
357
partbw, /* minimize bandwidth for partitions */
358
parthypre, /* renumber for hypre */
359
partdual,
360
partbcz,
361
partbcr,
362
partbcmetis,
363
partbclayers,
364
nofilesin,
365
saveinterval[3],
366
elementsredone,
367
bcoffset,
368
rotatecurve,
369
timeron,
370
nosave,
371
nooverwrite,
372
unitenooverlap,
373
filerenamed;
374
375
Real cscale[3],
376
corder[3],
377
parttol,
378
cmerge,
379
ctranslate[3],
380
crotate[3],
381
clonesize[3],
382
layerratios[MAXBOUNDARIES],
383
layerthickness[MAXBOUNDARIES],
384
layereps,
385
triangleangle,
386
partcorder[3],
387
polarradius,
388
curverad,curveangle,curvezet,
389
relh;
390
391
char filesin[MAXCASES][MAXFILESIZE],
392
filesout[MAXCASES][MAXFILESIZE],
393
infofile[MAXFILESIZE];
394
};
395
396
397