“FEniCS is a popular open-source computing platform for
solving partial differential equations (PDEs) with the finite
element method (FEM).”
– https://fenicsproject.org
FeniCSX
Introduction
This workflow targets projects that use the open-source
finite element partial differential equation solver, FeniCSX.
It contains the latest FeniCSX
packages and additional
support tools.
Installation
Manifest specification for the FeniCSX
is,
(define fenicsx-base-packages
(list "python"
"python-ipython"
"cmake"
"gcc-toolchain"
"fenicsx-basix"
"python-fenicsx-ufl"
"python-fenicsx-basix"
"fenicsx-ffcx"
"python-fenicsx-ffcx"))
(define fenicsx-real-mode
(list "fenicsx-dolfinx"
"python-fenicsx-dolfinx"))
(define fenicsx-complex-mode
(list "fenicsx-dolfinx-complex"
"python-fenicsx-dolfinx-complex"))
(specifications->manifest
(if (getenv "FENICSX_COMPLEXMODE")
(append fenicsx-base-packages fenicsx-complex-mode)
(append fenicsx-base-packages fenicsx-real-mode)))
Unfortunately, the latest build of the project is not currently available from the official Guix channel.To make use of this configuration additional package definitions must be imported by subscribing to the distroconfig channel(this repository).
(cons* (channel
(name 'distroconfig)
(url "https://gitlab.com/aarongile/distroconfig.git")
(branch "main")
(introduction
(make-channel-introduction
"39f6f48698b0f3e6020c2292879f9bd86a01bd39"
(openpgp-fingerprint
"A3C4 F513 81D0 FBBB EA61 31CF CF81 957B 3875 3EBD"))))
%default-guix-channels)
Once the channel is configured run pull to fetch channel packages.
guix pull
After which FeniCSX
packages can be accessed by
using guix package install
. For example, to install
python-fenicsx-dolfinx
run,
guix package install python-fenicsx-dolfinx
Running Simulations
To use FeniCSX
spawn a guix shell
environment containing python-fenicsx-dolfinx
package and run your simulation file, for example sim.py
, as usual.
python ./sim.py
Alternatively, a user can clone the distroconfig repository using,
git clone https://gitlab.com/aarongile/distroconfig
The repository contains a preconfigured LitDoc
workflow, fenicsx.org(this file)
,
and the Guix
package definitions located under the root guix
directory
--load-path=${LITDOC_ORGDIR}/../../../guix
To start a simulation shell run,
guix ld fenicsx
The command sets up a real-mode version of FeniCSX
development environment. To work with the complex-mode variant
of FeniCSX
run instead,
env FENICSX_COMPLEXMODE=1 guix ld fenicsx
There are also shortcut commands, fenicsx_real
and fenicsx_complex
useful for starting real-mode and complex-mode simulations respectively.
fenicsx_complex(){
env FENICSX_COMPLEXMODE=1 guix ld run fenicsx $@
}
fenicsx_real(){
guix ld run fenicsx $@
}
Build Notes
If you're interested to build FeniCSX
packages from source,
the build notes page might contains useful information.