The finite element method (FEM) approximates solutions to physical equations by dividing a structure or region into small connected elements. It is the computational method used in finite element analysis (FEA). This makes continuous fields—such as temperature, stress, or pressure—tractable when the partial differential equations describing them are difficult to solve for a real-world shape. section 9.5
A typical FEA workflow has three stages:
- Preprocess: define the physical model, materials, loads, and constraints. section 9.5
- Solve: mesh the domain, apply equations to its elements, assemble the resulting system, and solve it computationally. section 9.5
- Post-process: visualize results across the domain and interpret what they imply about physical behavior. section 9.5
Temperature across a plate
A FreeFem++ example meshes a square plate, sets its left edge to 22 degrees and its other three edges to 12 degrees, then solves for the temperature field. It plots the field, writes coordinates and temperatures to a file, and reports the calculated temperature at the plate’s center. The same decomposition principle can be applied to a structural question, such as whether a roof can bear solar panels and heavy snow. section 9.5
Listing 9.7 FreeFem++ FEM program simulating plate temperatures
real L = 1.0, H = 1.0;
int N = 50;
border a(t=0, L){ x=t; y=0; label=1; }
border b(t=0, H){ x=L; y=t; label=2; }
border c(t=L, 0){ x=t; y=H; label=3; }
border d(t=H, 0){ x=0; y=t; label=4; }
mesh Th = buildmesh(a(N) + b(N) + c(N) + d(N)); #1
plot(Th, wait=1);
fespace Vh(Th, P1); #2
Vh u, v; #3
func Thot = 22.0;
func Tcold = 12.0;
problem heat(u, v) =
int2d(Th)(
dx(u)*dx(v) + dy(u)*dy(v) #4
)
+ on(4, u = Thot)
+ on(1, u = Tcold)
+ on(2, u = Tcold)
+ on(3, u = Tcold);
heat; #5
plot(u, fill=true, iso=true, value=0.5);
ofstream f("heat_data.txt"); #6
for (int i = 0; i < Th.nv; i++) {
f << Th(i).x << " " << Th(i).y << " " << u(Th(i).x, Th(i).y) << endl;
}
real ucenter = u(0.5, 0.5); #7
cout << "Temperature at the center (0.5, 0.5): " << ucenter <<
" degrees." << endl;
The FreeFem++ listing shows the boundary definitions, mesh, finite-element space, temperature conditions, solve, plot, and exported values in one working example. section 9.5
Computational cost matters when FEM is used in a digital twin. A high-fidelity analysis of a complex asset may take hours or days, too long to respond immediately to live sensor data. Reduced basis FEA addresses this bottleneck by reducing model complexity; it enables faster physics-based simulations for structural condition monitoring. section 9.5.2
