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