- Firedrake: https://github.com/firedrakeproject/firedrake
- tqdm: https://pypi.org/project/tqdm
- meshio: https://pypi.org/project/meshio/
-
Activate the firedrake environment
source </path/to/firedrake/bin/activate>
-
Clone the repo to the source directory of firedrake (or other path)
cd $(dirname $(dirname $(which python)))/src git clone https://github.com/lrtfm/fdutils.git
-
Install
cd $(dirname $(dirname $(which python)))/src/fdutils make develop
NOTE: If you use firedrake before firedrake pr#2662 (merged in 21/02/2023), please checkout branch
v20230219
beforemake
:git checkout v20230219
-
PointCloud
: A class to help evaluate functions on points.This class is used to evaluate functions for many times on a group of points. It works in case that you give different points on different mpi ranks. This is an alternative solution before
VertexOnlyMesh
in Firedrake supporting this feature.Example code on interpolating function
f1
on meshm1
to functionf2
on meshm2
import firedrake as fd from fdutils import PointCloud from fdutils.tools import get_nodes_coords import matplotlib.pyplot as plt m1 = fd.RectangleMesh(10, 10, 1, 1) V1 = fd.FunctionSpace(m1, 'CG', 2) x, y = fd.SpatialCoordinate(m1) f1 = fd.Function(V1).interpolate(x**2 + y**2) m2 = fd.RectangleMesh(20, 20, 1, 1) V2 = fd.FunctionSpace(m2, 'CG', 3) f2 = fd.Function(V2) points = get_nodes_coords(f2) pc = PointCloud(m1, points, tolerance=1e-12) f2.dat.data_with_halos[:] = pc.evaluate(f1) fig, ax = plt.subplots(1, 2, figsize=[8, 4], subplot_kw=dict(projection='3d')) fd.trisurf(f1, axes=ax[0]) fd.trisurf(f2, axes=ax[1])
-
PointArray
: Another class to help evaluate functions on points.This is a wrapper for at method of function to present the same interface as
PointCloud
. -
PointVOM
: A wrapper forVortexOnlyMesh
to provide the same interface withPointCloud
.
fdutils.tools.errornorm
- Class
fdutils.ptqdm
fdutils.meshutils