Skip to main content
Jump to: navigation, search

Difference between revisions of "FEniCS"

(Created page with "== Attributes and Installation == [http://fenicsproject.org/index.html FEniCS] is a series of tools used in important problems with mesh generation and manipulation. Follow t...")
 
Line 1: Line 1:
== Attributes and Installation ==
+
== Introduction and Installation ==  
[http://fenicsproject.org/index.html FEniCS] is a series of tools used in important problems with mesh generation and manipulation.
+
Follow the instructions on the [http://fenicsproject.org/download/ download] page to install FEniCS. There are several dependencies for the full use of FEniCS which are installed for you using the install script or the Docker images.
+
  
== File formats ==
+
[http://fenicsproject.org/ FEniCS] is a package of powerful tools used for mesh generation and solving problems. Dolfin is a core component of FEniCS and serves as an interface and solver. The package is available for download [http://fenicsproject.org/download/ here].
FEniCS uses Dolfin for an interface to mesh generation and manipulation, with a native Dolfin.xml format for meshes. It can convert between this format, the .mesh format, and .gmsh format. For visualization, Dolfin can export from its own XML format to .pvd VTK format, .dx OpenDX format, .m format, and .msh/.res format for GiD. Using Paraview, it is possible to visualize the Dolfin export using VTK format.  
+
There are several ways to install FEniCS- Docker images, Ubuntu packages, and from the source code itself. If installing from source, you will need Python 2.7, git, a c and c++ compiler, a fortran compiler, and OpenGL development files. If compiling from source (not using the install script), then there are several dependencies and optional packages to install (on Linux): eigen3, swig, and boost are all required. Info on this process is available [http://fenicsproject.org/download/installation_from_source.html here]. Finally, there is an option to install from an install script provided at the bottom of the download page. If problems arise when trying to install the mshr package (running Linux Fedora 22), just edit the hashdist profile (the fenics.yaml file) and take out that package. Finally, before running any Dolfin commands, several environment variables need to be declared. The fenics.custom file will add the variables to your running instance with the command:
 +
<code>source fenics.custom</code>
  
== Ease of Use ==
+
on the command line. ** NOTE: only tested on Linux Fedora 22 **
There is extensive user support for FEniCS and Dolfin, and a robust community to help. However, the installation process on Linux is not quick or easy if needed packages are not pre-installed. CMake can run into issues. There are also tons of packages and dependencies for compiling all of FEniCS.
+
 
 +
Running Dolfin commands involves creating a script or program in python/c++ that calls on the Dolfin libraries and running it. From the command line, a user can run python commands:
 +
<syntaxhighlight lang="python">
 +
>>> from dolfin import *
 +
>>> mesh = UnitSquareMesh(10,10)
 +
...
 +
>>> plot(mesh)
 +
>>> interactive()
 +
</syntaxhighlight>
 +
 
 +
==File type specifications ==  
 +
 
 +
Dolfin uses the native Dolfin XML mesh format. It specifies vertices and then either triangles or tetrahedrons. An example of the formatting is shown here:
 +
 +
<syntaxhighlight lang="xml">
 +
<?xml version="1.0?>
 +
<dolfin xmlns:dolfin="http://fenicsproject.org">
 +
    <mesh celltype="triangle" dim="2">
 +
        <vertices size="###">
 +
            <vertex index="0" x="##" y="##" z="##" />
 +
            <vertex index="1" x="##" y="##" z="##" />
 +
            <vertex index="2" x="##" y="##" z="##" />
 +
...
 +
            <vertex index="###" x="##" y="##" z="##" />
 +
        </vertices>
 +
        <cells size="###">
 +
            <triangle index="0" v0="#" v1="#" v2="#">
 +
            <triangle index="1" v0="#" v1="#" v2="#">
 +
            <triangle index="2" v0="#" v1="#" v2="#">
 +
...
 +
            <triangle index="###" v0="#" v1="#" v2="#">
 +
        </cells>
 +
    </mesh>
 +
</dolfin>
 +
</syntaxhighlight>
 +
Or use celltype ="tetrahedron" dim="3" for three dimensional meshes.
 +
 
 +
== Attributes ==
 +
 
 +
Meshes have vertices and each is defined by triangles or quadrilaterals. Faces are defined by the vertices being specified in counter-clockwise order. Objects are usually defined as meshes, with some basic one, two, and three dimensional square meshes being available to generate. For example:
 +
 
 +
mesh = UnitSquareMesh(10,10)
 +
 
 +
Creates a new 10 by 10 unit square mesh. There are also vectors and matrices with which to do physical problems and computations.
 +
 
 +
==Inputs/Outputs==
 +
 
 +
Dolfin works with it's own native Dolfin XML format, but can convert both .mesh and .gmsh formats using its own converter. It would not be theoretically difficult to make a XML conversion tool between ICE's native format and Dolfin's XML format.
 +
 
 +
Dolfin is a able to visualize meshes using VTK, but it can also export to several mesh formats, shown here:
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Extention
 +
! Format/Visualization Software
 +
|-
 +
| .pvd || VTK format, Paraview and MayaVi
 +
|-
 +
| .dx || Open DX format
 +
|-
 +
| .m || GNUOctave and MATLAB format
 +
|-
 +
| .tec || TecPlot format *
 +
|-
 +
| .msh/.res || GiD format
 +
|}
 +
 
 +
* Indicates that the format may no longer be supported
 +
 
 +
It is thus possible to export an ICE native mesh to Dolfin for computation and then export a VTK file back to ICE for visualization using Paraview.
 +
 
 +
== Editor Features ==
 +
 
 +
Dolfin and FEniCS do not provide a simple GUI or graphical interface, as the FEniCS project is not intended as a pure mesh editor. Rather, the tools serve as a collection of libraries and an interface for performing meshing functions and solving physical systems. From [http://fenicsproject.org/about/features.html#features ]
 +
 
 +
* Automated solution of variational problems
 +
* Automated error control and adaptivity
 +
* An extensive library of finite elements
 +
* High performance linear algebra
 +
* Computational meshes
 +
* Postprocessing using VTK
 +
* Python and C++ support
 +
 
 +
== Ease of Use ==
 +
 
 +
FEniCS is quick and easy to use from the command line with Python, and can be powerful with extensive and well-documented libraries. However difficulties can arise when installing from source or using the default Hashdist installation profile. Look into [http://fenicsproject.org/download/installation_using_hashdist.html#installation-using-hashdist installing FEniCS using Hashdist] for more information.
 +
- Only tested on Linux Fedora 22.

Revision as of 11:51, 27 May 2016

Introduction and Installation

FEniCS is a package of powerful tools used for mesh generation and solving problems. Dolfin is a core component of FEniCS and serves as an interface and solver. The package is available for download here. There are several ways to install FEniCS- Docker images, Ubuntu packages, and from the source code itself. If installing from source, you will need Python 2.7, git, a c and c++ compiler, a fortran compiler, and OpenGL development files. If compiling from source (not using the install script), then there are several dependencies and optional packages to install (on Linux): eigen3, swig, and boost are all required. Info on this process is available here. Finally, there is an option to install from an install script provided at the bottom of the download page. If problems arise when trying to install the mshr package (running Linux Fedora 22), just edit the hashdist profile (the fenics.yaml file) and take out that package. Finally, before running any Dolfin commands, several environment variables need to be declared. The fenics.custom file will add the variables to your running instance with the command: source fenics.custom

on the command line. ** NOTE: only tested on Linux Fedora 22 **

Running Dolfin commands involves creating a script or program in python/c++ that calls on the Dolfin libraries and running it. From the command line, a user can run python commands:

>>> from dolfin import *
>>> mesh = UnitSquareMesh(10,10)
...
>>> plot(mesh)
>>> interactive()

File type specifications

Dolfin uses the native Dolfin XML mesh format. It specifies vertices and then either triangles or tetrahedrons. An example of the formatting is shown here:

<?xml version="1.0?>
<dolfin xmlns:dolfin="http://fenicsproject.org">
    <mesh celltype="triangle" dim="2">
        <vertices size="###">
            <vertex index="0" x="##" y="##" z="##" />
            <vertex index="1" x="##" y="##" z="##" />
            <vertex index="2" x="##" y="##" z="##" />
...
            <vertex index="###" x="##" y="##" z="##" />
        </vertices>
        <cells size="###">
            <triangle index="0" v0="#" v1="#" v2="#">
            <triangle index="1" v0="#" v1="#" v2="#">
            <triangle index="2" v0="#" v1="#" v2="#">
...
            <triangle index="###" v0="#" v1="#" v2="#">
        </cells>
    </mesh>
</dolfin>

Or use celltype ="tetrahedron" dim="3" for three dimensional meshes.

Attributes

Meshes have vertices and each is defined by triangles or quadrilaterals. Faces are defined by the vertices being specified in counter-clockwise order. Objects are usually defined as meshes, with some basic one, two, and three dimensional square meshes being available to generate. For example:

mesh = UnitSquareMesh(10,10)

Creates a new 10 by 10 unit square mesh. There are also vectors and matrices with which to do physical problems and computations.

Inputs/Outputs

Dolfin works with it's own native Dolfin XML format, but can convert both .mesh and .gmsh formats using its own converter. It would not be theoretically difficult to make a XML conversion tool between ICE's native format and Dolfin's XML format.

Dolfin is a able to visualize meshes using VTK, but it can also export to several mesh formats, shown here:

Extention Format/Visualization Software
.pvd VTK format, Paraview and MayaVi
.dx Open DX format
.m GNUOctave and MATLAB format
.tec TecPlot format *
.msh/.res GiD format
  • Indicates that the format may no longer be supported

It is thus possible to export an ICE native mesh to Dolfin for computation and then export a VTK file back to ICE for visualization using Paraview.

Editor Features

Dolfin and FEniCS do not provide a simple GUI or graphical interface, as the FEniCS project is not intended as a pure mesh editor. Rather, the tools serve as a collection of libraries and an interface for performing meshing functions and solving physical systems. From [1]

  • Automated solution of variational problems
  • Automated error control and adaptivity
  • An extensive library of finite elements
  • High performance linear algebra
  • Computational meshes
  • Postprocessing using VTK
  • Python and C++ support

Ease of Use

FEniCS is quick and easy to use from the command line with Python, and can be powerful with extensive and well-documented libraries. However difficulties can arise when installing from source or using the default Hashdist installation profile. Look into installing FEniCS using Hashdist for more information. - Only tested on Linux Fedora 22.

Back to the top