Open krober10nd opened 3 years ago
Re inputs: mesh
is a Firedrake.Mesh
, V
is a Firedrake.FunctionSpace
, and c
is a Function(V)
with spatially varying scalar wavespeeds.
Oh man, I'd love to see a simple Python FEM package without C++ (beyond those in numpy/scipy). Anyway, this seems a little too specific with all the input argument. You'd want to pin one single value for each mesh. Looking at the spectral radius is actually a good idea, I'll add that for the Laplacian.
Oh man, I'd love to see a simple Python FEM package without C++ (beyond those in numpy/scipy)
Yea, I think scikit-fem
strives for some of that. I can't tell you how much time I've spent (wasted?) trying to install Firedrake on different machines.
I agree it's a little too specific but the spectral radius in general is useful as it incorporates both the discretization (order and such) and the mesh quality at the same time.
For my application the difference between a minimum dihedral angle bound of 1 degree and 18 degrees means a variation in maximum stable timestep between 0.0001 and 0.0012 seconds. To get that high of a dihedral angle bound, I typically need to iterate with DistMesh 300-500 iterations (depending on the minimum element size).
Here's the result.
import firedrake as fd from firedrake import dot, grad import finat
def estimate_timestep(mesh, V, c, estimate_max_eigenvalue=True): """Estimate the maximum stable timestep based on the spectral radius using optionally the Gershgorin Circle Theorem to estimate the maximum generalized eigenvalue. Otherwise computes the maximum generalized eigenvalue exactly Currently only works with KMV elements. """