# FEM3D_PROJECT Project Data onto a 3D Finite Element Mesh

FEM3D_PROJECT is a MATLAB program which projects a finite element function.

Let us suppose we have a region R and a "tet mesh" (tetrahedral mesh) of R, that is, a set of nodes N1 and tetrahedrons T1 whose union is R. Let P1(I)(X,Y,Z) be the finite element basis function associated with node N1(I). Now let us suppose that we have a finite element function V1, that is a scalar- or vector-valued function V1(X,Y,Z) defined over R, with the formula

V1(X,Y,Z) = sum ( 1 <= I <= NODE_NUM1 ) V1(I) * P1(I)(X,Y,Z)

Now suppose we have a second tet mesh of R comprising a set of nodes N2 and tetrahedrons T2. Can we determine an appropriate set of finite element coefficients V2(I) which best approximate V1 in the finite element space defined by N2 and T2? The finite element coefficient vector V2 is defined by the following relationship:

Integral Sum ( 1 <= I <= NODE_NUM2 ) V2(I) P2(I)(X,Y,Z) P2(J)(X,Y,Z) dx dy dz = Integral V1(X,Y,Z) P2(J)(X,Y,Z) dx dy dz
Thus, in particular, the function V1(X,Y,Z), which is defined on the first finite element space, must be evaluated in a computation that uses the second finite element space.

This procedure can be used to determine the least squares approximant to data (actually, to the piecewise linear interpolant of that data) or to determine the finite element coefficients appropriate when recomputing a finite element solution from a fine mesh to a coarse mesh.

The sample data is given as three tables, each stored in a file:

• the SAMPLE_NODES file contains the 3D coordinates of sample points. Every sample point is presumed to lie within the area covered by the finite element mesh.
• the SAMPLE_ELEMENTS file contains the indices of nodes that form the elements. The elements are presumed to be 4-node tetrahedrons that form a Delaunay tetrahedralization of the sample nodes.
• the SAMPLE_VALUES file contains the value of some vector quantity V at each sample point. The dimensionality of the V data is arbitrary.

The finite element mesh is given as two tables, each stored in a file:

• the FEM_NODES file contains the 3D coordinates of nodes.
• the FEM_ELEMENTS file contains the indices of nodes that form the elements. The elements are presumed to be 4-node tetrahedrons.

The program produces a new table FEM_VALUES, of the same dimensionality as SAMPLE_VALUES. The vector FEM_VALUES can be used in conjunction with the finite element mesh data to produce a finite element function that is an approximant to the SAMPLE_VALUES data.

### Usage:

fem3d_project ( 'sample_prefix', 'fem_prefix' )
where 'sample_prefix' is the common prefix for the SAMPLE files:
• 'sample_prefix'_nodes.txt, the node coordinates (input);
• 'sample_prefix'_elements.txt, the 4 nodes that make up each element (input);
• 'sample_prefix'_values.txt, the data values (input);
and 'fem_prefix' is the common prefix for the FEM files:
• 'fem_prefix'_nodes.txt, the node coordinates (input);
• 'fem_prefix'_elements.txt, the 4 nodes that make up each element (input);
• 'fem_prefix'_values.txt, the data values (output).

The file fem_prefix_values.txt is created by the program, and contains the projections of the sample data values onto the finite element space, that is, these may be regarded as coefficients of finite element functions representing the projections of the sample data. Note that we may also regard this operation as the refinement or coarsening of a finite element function, in that we are transferring information from the ``sample'' space to the ``fem'' space.

### Languages:

FEM3D_PROJECT is available in a C++ version and a FORTRAN90 version and a MATLAB version.

### Related Data and Programs:

FEM1D_PROJECT, a MATLAB program which projects data into a finite element space, including the least squares approximation of data, or the projection of a finite element solution from one mesh to another.

FEM2D_PROJECT, a MATLAB program which projects a function F(X,Y,Z), given as a data, into a given finite element space of piecewise linear triangular elements.

FEM3D, a data directory which contains examples of 3D FEM files, three text files that describe a 3D finite element geometry;

FEM3D_PACK, a MATLAB library which contains utilities for 3D finite element calculations.

FEM3D_SAMPLE, a MATLAB program which evaluates a finite element function defined on 3D tetrahedral mesh.

### Reference:

1. Hans Rudolf Schwarz,
Finite Element Methods,
ISBN: 0126330107,
LC: TA347.F5.S3313.
2. Gilbert Strang, George Fix,
An Analysis of the Finite Element Method,
Cambridge, 1973,
ISBN: 096140888X,
LC: TA335.S77.
3. Olgierd Zienkiewicz,
The Finite Element Method,
Sixth Edition,
Butterworth-Heinemann, 2005,
ISBN: 0750663200,
LC: TA640.2.Z54.

### Examples and Tests:

LINEAR starts with sample data for the vector function f(x)=[ 1, 2x, 3y, 4z ], on an 8x8x8 grid of equally spaced nodes from [0.0,8.0]x[0.0,8.0], and projects this onto a piecewise linear finite element meshes defined on equally spaced grids of dimension 4x4x4, 2x2x2 and 1x1x1.

You can go up one level to the MATLAB source codes.

Last revised on 24 August 2009.