nicolepitre / fenics-examples

A collection of examples that demonstrate how FEniCS is used to solve PDEs on regular and irregular geometries. Written in Python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fenics-examples

A collection of FEniCS examples that show simple ways to use FEniCS to solve PDEs. Written in Python.

This repository contains examples of Python code for FEniCS. It also contains geometry files written in the Gmsh scripting language. All files with the .geo extension can be displayed in Gmsh. The corresponding mesh files (.msh extension) are contained in the folder called meshes. The XML versions of the meshes are contained in the folder called xml-meshes. Any file with the .py extension should be run inside of FEniCS, including the dolfin-convert script.

The following tips and notes might be useful when learning FEniCS and Gmsh.

FEniCS Notes

Gmsh Notes

Once you are comfortable with FEniCS and Gmsh, you can create your own demos by following the steps below.

Steps to create a FEniCS Demo for a particular geometry

  1. Create a geometry file in the Gmsh script language.
  2. Use Gmsh to generate a finite element mesh from the geometry file.
  3. Convert the mesh into XML format using the dolfin-convert script. The script also produces an XML file called filename_facet_regions.xml if you have labelled any physical lines/surfaces in the geometry file. The syntax for running dolfin-convert inside FEniCS is dolfin-convert filename.msh filename.xml.
  4. Write a Python demo script using the FEniCS DOLFIN module.
  5. Add the XML mesh file into the Python demo script.
  6. Open FEniCS in a virtual environment such as Docker and run the demo.
  7. View the solution in VisIt.

About

A collection of examples that demonstrate how FEniCS is used to solve PDEs on regular and irregular geometries. Written in Python.


Languages

Language:Python 64.7%Language:Jupyter Notebook 25.0%Language:GLSL 10.4%