0
$\begingroup$

Coding a finite difference algorithm in 1D does not require a complex mesh. In higher dimensions, you would need a mesh and its connectivity graph to compute the differential operators. Finite elements can be seen as a generalization of finite differences.

So my question is:

How is a finite difference code implemented? Are finite difference methods implemented with finite element algorithms on a Cartesian mesh using a product of P1 basis functions?

$\endgroup$
4
  • 2
    $\begingroup$ I wouldn't consider finite elements to be a generalization of finite differences, the formulation of the weak problem is quite unique and not at all how finite differences operates. High order finite volume methods might be a more apt comparison to high order finite differences. There is the K-Exact method which generalizes high order finite volume methods to arbitrary order and unstructured meshes, though it still suffers from the fundamental problem of wide stencil methods that you have to figure out what to do at the boundaries. $\endgroup$ May 10 at 16:08
  • 1
    $\begingroup$ and it is possible to treat low order finite volume methods as equivalent to a piecewise constant discontinuous Galerkin method in certain situations. $\endgroup$ May 10 at 16:11
  • $\begingroup$ If it is a Cartesian mesh, the basis functions are tensor products of P1 basis functions (e.g. nodal basis), and if the continuity is enforced (e.g. if it is not a DG method), then yes, FEM and FDM will give you exactly the same matrix, the same right hand side and the same solution for all linear problems $\endgroup$ May 12 at 2:29
  • 1
    $\begingroup$ Implementing a FDM via FEM assembly seems a bit overkill as the primary advantage of FDM is that the operators and connectivity are known ahead of time so that the discretization can be chosen to have advantageous structure. $\endgroup$
    – whpowell96
    May 12 at 17:31

1 Answer 1

4
$\begingroup$

Finite differences are implemented by fitting a (multivariate) interpolating polynomial through a set of points and taking the derivatives of said interpolating polynomial. Contrary to popular belief (mainly due to the tensor product FDM being what you find in introductory books) this works also on an unstructured set of points, it's just harder to decide which points the polynomial should choose to interpolate in a specific region (so essentially that induces something like a mesh). See the following: "The finite difference method at arbitrary irregular grids and its application in applied Mechanics" by Liszka and Orkisz. Here is also a paper using FDM on an FEM mesh "A simple finite difference approach using unstructured meshes from FEM mesh generators" by Fernandez and Kulas, or also "THE FINITE DIFFERENCE ELEMENT METHOD (FDEM) WITH EXAMPLES AND ERROR ESTIMATES" by Adolph and Schönauer.

Using (multivariate) polynomials relates to a (multivariate) Taylor expansion, but you could also use some other functions to extend your data over space (e.g. Gaussians, piecewise linear functions, splines) as long as you can define a derivative in a meaningful sense. So from that point of view you can interpret FDM, FEM, and FVM as closely related.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.