# Basic data types, constants, structures

FEAT2 provides a set of data types, constants and basic structures. The following list contains an overview about these data types, constants and the most important high-level structures which are necessary for the discretisation.

## Data types (fsystem.f90)

Fortran 90 defines a set of standard data types:

Name data type
integer Standard integer type
real Standard float type
complex Standard complex type
character A character value
logical A boolean value, only .true. or .false.

The module fsystem.f90 declares a set of additional data types which are frequently used throughout the whole FEAT2 library and in the applications. The following table contains a brief overview about these types:

Name data type
integer(I8) 8-bit integer
integer(I16) 16-bit integer
integer(I32) 32-bit integer
integer(I64) 64-bit integer
real(SP) Single precision, corresponds to float in C/C++
real(DP) Double precision, corresponds to double in C/C++
real(QP) Quad precision, corresponds to long double in C/C++
complex(SP) Single precision complex, corresponds to float complex in C/C++
complex(DP) Double precision complex, corresponds to double complex in C/C++
complex(QP) Quad precision complex, corresponds to long double complex in C/C++

## Constants (fsystem.f90)

The module fsystem.f90 defines a set of constants for all relevant data types that describe the set of possible values:

Name Description
SYS_EPSREAL_SP Minimal difference to unity for real values
SYS_EPSREAL_DP
SYS_EPSREAL_QP
SYS_MINREAL_SP Minimal positive values for real variables
SYS_MINREAL_DP
SYS_MINREAL_QP
SYS_MAXREAL_SP Maximal values for real variables
SYS_MAXREAL_DP
SYS_MAXREAL_QP
SYS_MAXINT Maximal values for integer variables
SYS_MAXI8
SYS_MAXI16
SYS_MAXI32
SYS_MAXI64

Of mathematical importance are furthermore the following constants:

Name Description
SYS_PI Mathematical constant Pi; double precision
SYS_INFINITY_SP Internal constant for infinity
SYS_INFINITY_DP
SYS_INFINITY_QP

For string handling, fsystem.f90 defines a set of default string length constants:

Declaration Description
character(LEN=SYS_STRLEN) Declares a string with standard string length
character(LEN=SYS_NAMELEN) Declares a string used for identifiers, names, etc.

## Mesh and domain

1. t_triangulation (triangulation.f90)

• Encapsules a mesh in 1D, 2D and/or 3D
• Simple meshes can be created using the routines in meshgeneration.f90, e.g.
• meshgen_rectangular2DQuadMesh: Creates a regular 2D mesh with quadrilaterals.
• Extended meshes can be imported from .TRI files.

2. t_boundary (boundary.f90)

• Encapsules analytical descriptions of complex boundaries
• Currently used only in 2D
• Used to adapt a mesh to the boundary during refinement
• Cal be imported from .PRM files

3. t_meshregion (meshregion.f90)

• Encapsules parts of a mesh, e.g., a set of cells or vertices
• Used to collect boundary vertices during the generation of boundary conditions

4. t_boudaryRegion (boundary.f90)

• Encapsules parts of a domain, e.g., boundary segments
• Used to in the definition of boundary conditions to mark parts of the boundary

## Discretisation

1. t_scalarDiscretisation (spatialdiscretisation.f90)

• Encapsules a finite element space $V_h$ over a mesh, e.g., $Q_1$
• Contains links to a mesh, transformation formula and (possibly) a description of the boundary

2. t_blockDiscretisation (spatialdiscretisation.f90)

• Encapsules tensor products of finite element spaces, e.g., $X_h = V_h \times V_h$ with $V_h$ a finite element space like $Q_1$
• Contains links to an underlying mesh and (possibly) a description of the boundary
• Realised as a list of t_scalarDiscretisation structures, one for each FE space.
• Access to the subspaces is possible via (t_blockDiscretisation)%RspatialDiscr(:)

All equations are realised based on t_blockDiscretisation. A Poisson equation for example is described by a t_blockDiscretisation structure with only one block, which results in a 1x1 block matrix in the linear system of equations.

## Matrices/Vectors

Corresponding to t_scalarDiscretisation and t_blockDiscretisation, there exist "scalar" and "block" versions of matrices and vectors:

1. t_vectorScalar (linearsystemscalar.f90)

• Encapsules the degrees of freedom (DOFs) of a finite element space $V_h$
• Contains links to a t_scalarDiscretisation structure describing the finite element space $V_h$
• Linear algebra on such vectors is provided by the routines in linearsystemscalar.f90

2. t_matrixScalar (linearsystemscalar.f90)

• Describes a discrete operator $A_h : V_h \to W_h$ for $V_h$ and $W_h$ finite element spaces
• Contains links to the finite element trial space V_h and to the finite element test space $W_h$

3. t_vectorBlock (linearsystemblock.f90)

• Encapsules the degrees of freedom (DOFs) of a tensor product space X_h, e.g., $X_h = V_h \times V_h$
• Realised as a list of t_vectorScalar structures, i.e., as a list of "scalar" vectors. Every scalar subvector is a "block" in the block vector.
• Access to the blocks is possible via (t_vectorBlock)%RvectorBlock(:)
• Linear algebra on such vectors is provided by the routines in linearsystemblock.f90

4. t_matrixBlock (linearsystemblock.f90)

• Describes an operator $A_h : X_h \to Y_h$ between finite element tensor product spaces $X_h$ and $Y_h$
• Contains links to the underlying trial space $X_h$ and test space $Y_h$
• The block matrix is realised as 2D array of "scalar matrices" t_matrixScalar, one submatrix for every combination of the finite element spaces in $X_h$ and $Y_h$.
• Access to the submatrices is possible via (t_matrixBlock)%RmatrixBlock(:,:)

## Cubature

Cubature formulas are defined as constants CUB_xxxx declared in cubature.f90. For every type of cell (triangle, quad, hex,...), there exist a set of cubature formulas. To simplify working with them, a special cubature structure is provided to the assembly routines:

1. t_scalarCubatureInfo (spatialdiscretisation.f90)

• Encapsules all cubature formulas to be used during an assembly. (-> Triangle-Formulas for triangles, Quad-formulas for quads,...)
• Provides the use of "automatic" cubature formulas which automatically adapt themself depending on the cell type.
Example: A t_scalarCubatureInfo is typically set up with the cubature formula CUB_GEN_AUTO_G3 (see cubature.f90) which means:
• Use 3x3 Gauss formula for quads in 2D
• Use 3-point Gauss formula for triangles in 2D
• Use 3x3x3 gauss formula for hexas in 3D
• ...
• Currently, there is no "block" variant available. In "block assembly" routines (which assemble a complete matrix), the same cubature formula is used for all blocks.

## Boundary conditions

1. t_discreteBC (discretebc.f90)
• Encapsules a discrete version of the boundary conditions of the system
• Typically used for Dirichlet boundary conditions

## Linear solver

1. t_linsolNode (linearsolver.f90)

• Encapsules a linear solver
• The solver can be simple (Gauss elimination) or very complex (multigrid with smoothers, etc.)

## Postprocessing

1. t_ucdExport (ucd.f90)

• Provides an export structure for writing .VTK files which can be postprocessed with "Paraview"
• Created based on a mesh. Finite element solution vectors can be attached. At the end, a postprocessing file can be written.