ExtendableFEM.jl is a high-level, extensible finite element method (FEM) library for Julia, supporting flexible problem descriptions, custom operators, and advanced grid management.
- High-level, extensible API for solving PDE problems by finite element methods
- Flexible
ProblemDescription
interface for assigning unknowns and operators - Supports custom kernel functions for bilinear, linear, and nonlinear forms
- Automatic assembly and Newton's method for NonlinearOperators
- Builds upon ExtendableGrids.jl and low level structures from ExtendableFEMBase.jl
The following minimal example demonstrates how to set up and solve a Poisson problem:
using ExtendableFEM
using ExtendableGrids
# Build a uniform-refined 2D unit square grid with triangles
xgrid = uniform_refine(grid_unitsquare(Triangle2D), 4)
# Create a new PDE description
PD = ProblemDescription()
# Define and assign the unknown
u = Unknown("u"; name = "potential")
assign_unknown!(PD, u)
# Assign Laplace operator (diffusion term)
assign_operator!(PD, BilinearOperator([grad(u)]; factor = 1e-3))
# Assign right-hand side data
function f!(fval, qpinfo)
x = qpinfo.x # global coordinates of quadrature point
fval[1] = x[1] * x[2]
end
assign_operator!(PD, LinearOperator(f!, [id(u)]))
# Assign Dirichlet boundary data (u = 0)
assign_operator!(PD, HomogeneousBoundaryData(u; regions = 1:4))
# Discretize: choose finite element space
FEType = H1Pk{1,2,3} # cubic H1-conforming element with 1 component in 2D
FES = FESpace{FEType}(xgrid)
# Solve the problem
sol = solve!(PD, [FES])
# Plot the solution
using PyPlot
plot(id(u), sol; Plotter = PyPlot)
If you use ExtendableFEM.jl in your research, please cite this Zenodo record.
ExtendableFEM.jl is licensed under the MIT License. See LICENSE for details.