2. Physics-informed neural network fundamentals
A physics-informed neural network (PINN) is a supervised learning framework in which the governing partial differential equations (PDEs) of a physical system are embedded directly into the training objective as soft constraints. Instead of learning a mapping purely from labeled data, the network is trained to satisfy the balance laws, constitutive relations, and boundary/initial conditions simultaneously. For transient solid dynamics, this means the network must approximate the displacement field u(x, t) such that the momentum balance, kinematic relations, and material laws are respected throughout the space–time domain.
This section develops the PINN formulation for elastodynamics: how the governing equations enter the loss, how automatic differentiation supplies the required derivatives, and how the training loop is structured for a transient problem.
Governing Equations as Soft Constraints
Consider a solid body occupying domain Ω with boundary Γ, subjected to transient loading. Using the small-strain assumption and an isotropic linear elastic material, the strong form of the momentum balance is:
ρ ∂²u/∂t² = ∇·σ + b in Ω × (0, T]
σ = λ tr(ε) I + 2μ ε
ε = ½(∇u + ∇uᵀ)
Here ρ is density, σ the Cauchy stress, b the body force, λ and μ the Lamé parameters, and ε the infinitesimal strain. Boundary conditions (Dirichlet displacement or Neumann traction) and initial conditions (u(x,0), ∂u/∂t(x,0)) complete the problem.
In a PINN, these equations are not solved by discretization. Instead, a neural network u_θ(x, t) with parameters θ is evaluated at collocation points sampled across the space–time domain. The PDE residual is computed by substituting the network output into the governing equations, and the training objective penalizes any deviation from zero. The equations thus act as soft constraints: they are not enforced exactly but drive the optimization toward physically admissible solutions.
Loss Composition
The total loss aggregates several residual terms, each evaluated over a distinct set of sample points:
| Term | Expression | Sample points |
|---|---|---|
| PDE residual | ‖ρ u_θ,tt − ∇·σ_θ − b‖² | Interior collocation |
| Boundary (Dirichlet) | ‖u_θ − u_D‖² | Γ_D |
| Boundary (Neumann) | ‖σ_θ·n − t_N‖² | Γ_N |
| Initial displacement | ‖u_θ(x,0) − u_0‖² | Ω at t=0 |
| Initial velocity | ‖u_θ,t(x,0) − v_0‖² | Ω at t=0 |
| Data (optional) | ‖u_θ − u_obs‖² | Sensor locations |
The composite loss is a weighted sum:
L(θ) = w_pde · L_pde + w_bc · L_bc + w_ic · L_ic + w_data · L_data
Weight selection is critical. If w_pde dominates, the network may satisfy the PDE but drift from boundary data; if data terms dominate, the solution may fit observations while violating equilibrium. A common practice is to normalize each term by its running magnitude or to use adaptive weighting schemes that balance gradient norms across terms during training.
Automatic Differentiation
PINNs rely on automatic differentiation (AD) to compute the derivatives appearing in the PDE residual. Because the network output is a differentiable function of its inputs, AD can evaluate ∂u/∂t, ∂²u/∂t², and spatial gradients ∇u exactly (to machine precision) without finite differences or mesh-based stencils.
In practice, the collocation inputs (x, t) are declared as differentiable tensors, and the network forward pass is followed by gradient operations with respect to those inputs. For a second-order-in-time problem, two nested time derivatives are required. The spatial gradient of displacement feeds the strain, which feeds the stress, which feeds the divergence in the momentum equation — a chain of AD operations that the framework tracks automatically.
# Pseudocode for PDE residual (PyTorch-style)
x.requires_grad_(True); t.requires_grad_(True)
u = net(x, t)
u_t = grad(u, t, create_graph=True)
u_tt = grad(u_t, t, create_graph=True)
grad_u = grad(u, x, create_graph=True) # per-component
eps = 0.5 * (grad_u + grad_u.transpose())
sigma = lam * trace(eps) * I + 2 * mu * eps
div_sigma = divergence(sigma, x)
residual = rho * u_tt - div_sigma - b
The create_graph=True flag is essential: it preserves the computational graph through the first derivative so that higher-order derivatives and backpropagation through the residual remain possible.
The PINN Training Loop for Transient Dynamics
The training loop for a transient solid dynamics problem proceeds as follows. Collocation points are sampled in the interior of the space–time domain, on the boundaries, and at the initial time. At each iteration, the network evaluates the displacement at all point sets, AD computes the required derivatives, and the weighted loss is assembled. Gradients of the loss with respect to θ are computed by backpropagation and applied with an optimizer such as Adam, often followed by L-BFGS for fine convergence.
For transient problems, two sampling strategies are common. Full space–time collocation samples points across the entire domain Ω × (0,T] at once, treating time as an additional input dimension. Sequential or time-marching training partitions the time axis into windows and trains each window in turn, using the previous window's prediction as the initial condition for the next. The former is simpler but can struggle with long time horizons; the latter improves stability at the cost of error accumulation across windows.
Practical Considerations and Failure Modes
Several issues commonly arise when training PINNs for transient solid dynamics. Spectral bias causes the network to learn low-frequency components first, so sharp wavefronts may be under-resolved; Fourier feature embeddings or adaptive activation functions can mitigate this. Stiffness from high-frequency modes or large material contrasts can destabilize optimization; loss weighting and curriculum on time windows help. Error accumulation in time-marching schemes requires monitoring the residual at window boundaries.
A useful diagnostic is to track each loss component separately. If L_pde decreases while L_ic rises, the network is sacrificing initial-condition fidelity for interior equilibrium — a sign that w_ic should be increased or the sampling density near t=0 raised. If all terms plateau at high values, the optimizer may be trapped; switching to L-BFGS or reducing the learning rate often resolves this.
With the formulation established — governing equations as soft constraints, a weighted composite loss, AD-supplied derivatives, and a structured training loop — the network can approximate transient elastodynamic fields without mesh generation. The next step is to apply this framework to a concrete loading scenario and examine how the choice of collocation, weighting, and time-windowing affects accuracy.