FENICS_TO_FEM
Write FENICS Mesh and Solution Data Files


FENICS_TO_FEM illustrate how a mesh or scalar function computed by the FENICS program can be written to FEM files, which can then be used to create images, or as input to meshing programs or other analysis tools.

Three examples of this process are given. All three solve the same problem in FENICS, but then write out information in different ways.

The file fenics_to_fem.py writes three files:

The node and element files can be used, for example, with the MATLAB program fem2d_mesh_display or the C++ program fem2d_mesh_display_opengl in order to display the mesh. The node, element, and value files can be used to display a surface plot of U(X,Y), using the MATLAB program fem2d_scalar_display.

The file fenics_to_txyv.py writes three files:

The node and element files can be used, for example, with the MATLAB program fem2d_mesh_display or the C++ program fem2d_mesh_display_opengl in order to display the mesh. The node, element, and value files can be used to display a surface plot of U(X,Y), using the MATLAB program fem2d_scalar_display.

The file fenics_to_txyz.py writes two files:

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Related Data and Programs:

DOLFIN-CONVERT, a Python program which can convert a mesh file from a given format to an XML format suitable for use by DOLFIN or FENICS, by Anders Logg.

DOLFIN_XML, a data directory which contains examples of XML files that describe 3D finite element meshes as used by DOLFIN and FENICS.

FEM_TO_XML, a C program which reads FEM files defining a 1D, 2D or 3D mesh, namely a file of node coordinates and a file of elements defined by node indices, and creates a corresponding XML file for input to DOLFIN or FENICS.

FEM2D_MESH_DISPLAY, a MATLAB program which reads the FEM model of a 2D mesh, consisting of polygonal elements of any uniform order, and displays an image of the elements and nodes, with optional numbering.

FEM2D_MESH_DISPLAY_OPENGL, a C++ program which reads the FEM model of a 2D mesh, consisting of polygonal elements of any uniform order, and displays an image of the elements and nodes using OpenGL.

FEM2D_SCALAR_DISPLAY, a MATLAB program which reads information about nodes, elements and nodal values for a 2D finite element method (FEM) and creates a surface plot of U(X,Y), using the MATLAB graphics system.

FEM2D_SCALAR_DISPLAY_BRIEF, a MATLAB program which reads information about nodes, elements and nodal values for a 2D finite element method (FEM) and creates a surface plot of U(X,Y), using the MATLAB graphics system, in 5 lines of code.

FEM2D_SCALAR_DISPLAY_GPL, a MATLAB program which reads information about nodes, elements and nodal values for a 2D finite element method (FEM) and creates a GPL file describing a surface plot of U(X,Y), which can be displayed by gnuplot.

FENICS, examples which illustrate the use of FENICS, a collection of free software with an extensive list of features for automated, efficient solution of partial differential equations (PDE's).

FENICS_GLACIER, a FENICS input file that sets up the 2D steady Stokes equations to model the movement of a glacier, by William Mitchell.

GMSH, examples which illustrate the use of the gmsh program, a 3D mesh generator for the finite element method (FEM).

PARAVIEW, examples which illustrate the use of the paraview interactive visualization program.

VISIT, examples which illustrate the use of the visit interactive graphics program.

VTK, a data directory which contains examples of legacy VTK files, a file format used by the Visual Toolkit, and which can be displayed by programs such as paraview and visit;

XML, a data directory which contains examples of XML files, a standard, general datafile format.

XML_TO_FEM, a Python program which reads an XML file created by FENICS or DOLFIN, describing a mesh in 1D, 2D, or 3D, and creates corresponding FEM files, namely, a file of node coordinates, and a file of element connectivities.

Examples and Tests:

FENICS_TO_FEM solves an equation, and writes out three files in FEM format, namely, the node coordinates, the element node connectivity, and the solution values.

FENICS_TO_TXYV solves an equation, and writes out three files, namely, the element node connectivity, the node coordinates, and the solution values.

FENICS_TO_TXYZ solves an equation, and writes out two files: the the element node connectivity, and the node coordinates, with the solution value added as a "Z" coordinate.

You can go up one level to the Examples directory.


Last revised on 03 November 2014.