Wiki
Clone wikilifev-release / tutorial / Creation_of_the_FESpace
Creation of the FESpace
There are two main classes that provide the tools to create a finite element space:
- the FESpace class, which contains the basic definitions and operations to create and manipulate a finite element space;
- the ETFESpace class, that contains some advanced definitions to perform the assembly of the linear system.
To create a finite element space, we have to:
- include the header files that contain the definitions of the classes FESpace and ETFESpace;
- define a type for the maps used to manage the degrees of freedom;
- define the FESpace and then define the ETFESpace.
First of all, we add the following two header files:
#!C++ // ... // Header for the Finite Element Space #include <lifev/core/fem/FESpace.hpp> // Header for the ET Finite Element Space #include <lifev/eta/fem/ETFESpace.hpp> // ...
#!C++ // ... int main ( Int argc, char** argv ) { // ... typedef MapEpetra map_Type; // ...
As input parameters, it requires the local (possibly partitioned) mesh, the type of the finite element (e.g. P1, P1b, P2 and so on), the dimension of the field (1: scalar, 3: vectorial) and the communicator.
Finally, we can define a pointer to the ETFESpace that depends on i) the type of the mesh, ii) the type of the map, iii) the dimension of the physical space (1, 2 or 3) and iv) the dimension of the field (1: scalar, 3: vectorial). The constructor requires the local (possibly partitioned) mesh, the reference element (obtained from the FESpace), the geometrical mapping from the reference to the current element (obtained from the FESpace) and the communicator.
#!C++ // ... // Defining the classical Finite Element Space (for scalar field) std::shared_ptr< FESpace< mesh_Type, map_Type> > uFESpace ( new FESpace< mesh_Type, map_Type> ( local_mesh, dataFile ( "finite_element/degree", "P1" ), 1, Comm ) ); // Creating the ET Finite Element Space (3 dimensional, scalar field) // based on the classical Finite Element Space previously declared std::shared_ptr< ETFESpace< mesh_Type, map_Type, 3, 1 > > uETFESpace ( new ETFESpace< mesh_Type, map_Type, 3, 1 > ( local_mesh, & ( uFESpace->refFE() ), & ( uFESpace->fe().geoMap() ), Comm) ); // ...
#!C++ // ... if ( Comm->MyPID() == 0 ) { // Total number of Dofs created std::cout << "\nUsing " << uETFESpace->dof().numTotalDof() << " Dofs\n\n"; } // ...
Updated