Algorithm Search⌘K

Algorithmadvanced

Generalized-alpha method

Also called Chung-Hulbert method.

A second order implicit method for structural dynamics with set damping of high frequencies and little damping of low ones; it contains HHT-alpha.

Time
Θ(n b^2 + m n b) worst
Space
Θ(n b) extra
Where
b = the half bandwidth of the effective matrix; m = the number of time steps; n = the number of unknowns
Properties
deterministicimplicitone stepunconditionally stable linear
Origin
Jintai Chung, Gregory M. Hulbert, 1993

The generalized-alpha method is an implicit one-step integrator for the equations of structural dynamics Md¨+Cd˙+Kd=F(t)M\ddot d + C\dot d + K d = F(t). It keeps the displacement and velocity updates of the Newmark-beta method, but it enforces the equation of motion at two shifted points inside the step, one for the inertia term and one for the internal and external forces. One parameter ρ∞∈[0,1]\rho_\infty \in [0, 1] sets the spectral radius of the step as ω dt→∞\omega\,dt \to \infty. So the user picks how strongly the unresolved high modes of the mesh are damped, while the method stays second order and unconditionally stable for linear problems and damps the well resolved low modes very little. Newmark can damp the high modes only with γ>12\gamma > \tfrac12, which drops it to first order.

In plain words

When a computer follows a vibrating structure in time, the mesh has many fast vibrations that are not real physics. They come only from the size of the elements. A good time stepper should remove these fast wiggles and leave the slow motion, which is the answer the engineer wants, almost untouched. The Newmark method can either keep everything, or remove the wiggles at the cost of a larger error on the slow motion. The generalized-alpha method moves the points inside the step where the forces are balanced. With one dial the user picks how much of a fast wiggle is left after each step, from all of it to none, and the slow motion keeps full accuracy.

The problem

Input. Matrices MM (symmetric positive definite), CC and KK of size n×nn \times n, a load F(t)F(t), initial values d0d_0 and v0v_0, a time step dtdt, a number of steps mm and ρ∞∈[0,1]\rho_\infty \in [0, 1]. On finite element pages hh is the mesh size and dtdt is the time step.

Output. Approximations dk≈d(tk)d_k \approx d(t_k) and vk≈d˙(tk)v_k \approx \dot d(t_k) for tk=k dtt_k = k\,dt, k=0,…,mk = 0, \ldots, m, and an auxiliary acceleration aka_k, such that the Newmark updates

dk+1=dk+dt vk+dt2((12−β)ak+βak+1),vk+1=vk+dt((1−γ)ak+γak+1)d_{k+1} = d_k + dt\,v_k + dt^2\big((\tfrac12 - \beta) a_k + \beta a_{k+1}\big), \qquad v_{k+1} = v_k + dt\big((1 - \gamma) a_k + \gamma a_{k+1}\big)

hold, together with the balance at the shifted points

Mak+1−αm+Cvk+1−αf+Kdk+1−αf=F(tk+1−αf),xk+1−α=(1−α)xk+1+αxk.M a_{k+1-\alpha_m} + C v_{k+1-\alpha_f} + K d_{k+1-\alpha_f} = F(t_{k+1-\alpha_f}), \qquad x_{k+1-\alpha} = (1 - \alpha) x_{k+1} + \alpha x_k.

The parameters come from ρ∞\rho_\infty:

αm=2ρ∞−1ρ∞+1,αf=ρ∞ρ∞+1,γ=12−αm+αf,β=14(1−αm+αf)2.\alpha_m = \frac{2\rho_\infty - 1}{\rho_\infty + 1}, \qquad \alpha_f = \frac{\rho_\infty}{\rho_\infty + 1}, \qquad \gamma = \tfrac12 - \alpha_m + \alpha_f, \qquad \beta = \tfrac14(1 - \alpha_m + \alpha_f)^2.

The algorithm

  1. GENERALIZED-ALPHA(M, C, K, F, d_0, v_0, dt, m, alpha_m, alpha_f, beta, gamma)
  2. 1a_0 <- solve M a = F(0) - C v_0 - K d_0
  3. 2for k <- 0 to m - 1 do
  4. 3dp <- d_k + dt v_k + (dt^2 / 2)(1 - 2 beta) a_k
  5. 4vp <- v_k + (1 - gamma) dt a_k
  6. 5r <- F(t_k + (1 - alpha_f) dt) - alpha_m M a_k - C((1 - alpha_f) vp + alpha_f v_k) - K((1 - alpha_f) dp + alpha_f d_k)
  7. 6a_{k+1} <- solve ((1 - alpha_m) M + (1 - alpha_f)(gamma dt C + beta dt^2 K)) a = r
  8. 7d_{k+1} <- dp + beta dt^2 a_{k+1}
  9. 8v_{k+1} <- vp + gamma dt a_{k+1}
  10. 9return (d_k, v_k, a_k) for k = 0 .. m

Lines L3, L4, L7 and L8 are the Newmark predictor and corrector. Lines L5 and L6 are the balance at the shifted points, written as one linear system for ak+1a_{k+1} after the Newmark updates are put in. The effective matrix of line L6 is the same for all steps when dtdt is fixed, so a code factors it once. For a nonlinear internal force, line L6 becomes a Newton iteration with the effective tangent (1−αm)M+(1−αf)(γ dt C+β dt2KT)(1 - \alpha_m) M + (1 - \alpha_f)(\gamma\,dt\,C + \beta\,dt^2 K_T).

Members.

method αm\alpha_m αf\alpha_f when
Newmark-beta 00 00 no shift
HHT-alpha (Hilber, Hughes and Taylor 1977) 00 α∈[0,13]\alpha \in [0, \tfrac13] shift of the force terms only, ρ∞=(1−α)/(1+α)\rho_\infty = (1 - \alpha)/(1 + \alpha)
WBZ-alpha (Wood, Bossak and Zienkiewicz 1980) (ρ∞−1)/(ρ∞+1)(\rho_\infty - 1)/(\rho_\infty + 1) 00 shift of the inertia term only
Chung-Hulbert as above as above both shifts, best ratio of high to low frequency damping

In each case γ=12−αm+αf\gamma = \tfrac12 - \alpha_m + \alpha_f and β=14(1−αm+αf)2\beta = \tfrac14(1 - \alpha_m + \alpha_f)^2. The original HHT paper writes the parameter with the opposite sign, αHHT=−αf∈[−13,0]\alpha_{\rm HHT} = -\alpha_f \in [-\tfrac13, 0].

Example

One step by hand. Take d¨+d=0\ddot d + d = 0, d0=1d_0 = 1, v0=0v_0 = 0, dt=12dt = \tfrac12 and ρ∞=12\rho_\infty = \tfrac12. Then αm=0\alpha_m = 0, αf=13\alpha_f = \tfrac13, γ=56\gamma = \tfrac56 and β=49\beta = \tfrac49. Line L1 gives a0=−1a_0 = -1. Line L3 gives d~=1+18(1−89)(−1)=7172\tilde d = 1 + \tfrac18(1 - \tfrac89)(-1) = \tfrac{71}{72} and line L4 gives v~=−112\tilde v = -\tfrac1{12}. Line L6 solves (1+23⋅49⋅14) a1=−23⋅7172−13(1 + \tfrac23 \cdot \tfrac49 \cdot \tfrac14)\,a_1 = -\tfrac23 \cdot \tfrac{71}{72} - \tfrac13, that is 2927a1=−107108\tfrac{29}{27} a_1 = -\tfrac{107}{108}, so a1=−107116a_1 = -\tfrac{107}{116}. Then d1=7172−19⋅107116=205232=0.88362d_1 = \tfrac{71}{72} - \tfrac19 \cdot \tfrac{107}{116} = \tfrac{205}{232} = 0.88362 and v1=−112−512⋅107116=−217464=−0.46767v_1 = -\tfrac1{12} - \tfrac5{12} \cdot \tfrac{107}{116} = -\tfrac{217}{464} = -0.46767. The exact values are 0.877580.87758 and −0.47943-0.47943. Note that a1+d1=−9232a_1 + d_1 = -\tfrac{9}{232} is not zero: the auxiliary aka_k does not satisfy the equation of motion at tkt_k. It approximates the acceleration at the earlier time tk−(αf−αm) dtt_k - (\alpha_f - \alpha_m)\,dt.

Damping at the same ρ∞\rho_\infty. Fix ρ∞=911=0.818\rho_\infty = \tfrac{9}{11} = 0.818 for all four methods: Newmark with γ=0.6\gamma = 0.6 and β=0.3025\beta = 0.3025, HHT with α=0.1\alpha = 0.1, WBZ, and Chung-Hulbert. The table gives the algorithmic damping ratio ξˉ=−ln⁡∣λ∣/arg⁡λ\bar\xi = -\ln|\lambda| / \arg\lambda of the principal eigenvalue λ\lambda of one step, for an undamped oscillator. The values are measurements from the reference code.

method ξˉ\bar\xi at ω dt=0.1\omega\,dt = 0.1 at 0.30.3 at 11 period error at 0.30.3 order
Newmark, γ=0.6\gamma = 0.6 4.99×10−34.99 \times 10^{-3} 1.48×10−21.48 \times 10^{-2} 4.31×10−24.31 \times 10^{-2} 0.77 % 1
WBZ-alpha 1.5×10−51.5 \times 10^{-5} 3.87×10−43.87 \times 10^{-4} 9.27×10−39.27 \times 10^{-3} 0.97 % 2
HHT-alpha 1.0×10−51.0 \times 10^{-5} 2.62×10−42.62 \times 10^{-4} 6.75×10−36.75 \times 10^{-3} 0.93 % 2
Chung-Hulbert 5.0×10−75.0 \times 10^{-7} 1.33×10−51.33 \times 10^{-5} 4.18×10−44.18 \times 10^{-4} 0.78 % 2

All four remove the same fraction of a very high mode per step. At ω dt=0.1\omega\,dt = 0.1, a mode resolved with about 60 steps per period, Newmark damps 10 000 times more than Chung-Hulbert. For the second order methods ξˉ\bar\xi falls like (ω dt)3(\omega\,dt)^3.

Correctness

The full arguments are in the correctness proof.

  • Second order (theorem). The auxiliary acceleration aka_k approximates d¨(tk−δ dt)\ddot d(t_k - \delta\,dt) with δ=αf−αm\delta = \alpha_f - \alpha_m. With this shift the exact solution satisfies the balance of lines L5 and L6 up to O(dt2)O(dt^2) and the displacement update up to O(dt3)O(dt^3). The velocity update has the defect (12+δ−γ) dt2 d...(\tfrac12 + \delta - \gamma)\,dt^2\,\dddot d, so the step has a local error of O(dt3)O(dt^3) exactly when γ=12−αm+αf\gamma = \tfrac12 - \alpha_m + \alpha_f.
  • High frequency limit (theorem). As ω dt→∞\omega\,dt \to \infty the step matrix of a mode converges to a matrix with eigenvalues −αf/(1−αf)-\alpha_f/(1 - \alpha_f) and a pair with sum 2−(γ+12)/β2 - (\gamma + \tfrac12)/\beta and product 1−(γ−12)/β1 - (\gamma - \tfrac12)/\beta. With the Chung-Hulbert parameters all three are equal to −ρ∞-\rho_\infty, so the spectral radius tends to ρ∞\rho_\infty.
  • Stability (theorem, cited). For a linear problem with C=0C = 0, the method is unconditionally stable when αm≤αf≤12\alpha_m \le \alpha_f \le \tfrac12 and β≥14+12(αf−αm)\beta \ge \tfrac14 + \tfrac12(\alpha_f - \alpha_m) (Chung and Hulbert 1993). The Chung-Hulbert parameters satisfy both conditions for every ρ∞∈[0,1]\rho_\infty \in [0, 1].
  • The case ρ∞=1\rho_\infty = 1 (theorem). Then αm=αf=12\alpha_m = \alpha_f = \tfrac12, β=14\beta = \tfrac14 and γ=12\gamma = \tfrac12, and for a load that is zero or linear in tt the steps are those of the trapezoidal rule, which conserves the energy of a linear undamped system.
Proof: Second order, high frequency limit and the trapezoidal case of the generalized-alpha methodpartial

Setting. MM is symmetric positive definite, β>0\beta > 0, αm<1\alpha_m < 1, αf<1\alpha_f < 1, and L=(1−αm)M+(1−αf)(γ dt C+β dt2K)L = (1 - \alpha_m) M + (1 - \alpha_f)(\gamma\,dt\,C + \beta\,dt^2 K) is invertible. Lines L3 to L8 give, for every k≥0k \ge 0,

(U1)dk+1=dk+dt vk+dt2((12−β)ak+βak+1),(U2)vk+1=vk+dt((1−γ)ak+γak+1),\text{(U1)}\quad d_{k+1} = d_k + dt\,v_k + dt^2\big((\tfrac12 - \beta) a_k + \beta a_{k+1}\big), \qquad \text{(U2)}\quad v_{k+1} = v_k + dt\big((1 - \gamma) a_k + \gamma a_{k+1}\big),
(B)M((1−αm)ak+1+αmak)+C((1−αf)vk+1+αfvk)+K((1−αf)dk+1+αfdk)=F(tk+(1−αf) dt).\text{(B)}\quad M\big((1 - \alpha_m) a_{k+1} + \alpha_m a_k\big) + C\big((1 - \alpha_f) v_{k+1} + \alpha_f v_k\big) + K\big((1 - \alpha_f) d_{k+1} + \alpha_f d_k\big) = F(t_k + (1 - \alpha_f)\,dt).

Indeed lines L7 and L8 give dk+1=d~+β dt2ak+1d_{k+1} = \tilde d + \beta\,dt^2 a_{k+1} and vk+1=v~+γ dt ak+1v_{k+1} = \tilde v + \gamma\,dt\,a_{k+1}, which are (U1) and (U2). Put them into (B): the terms in ak+1a_{k+1} are Lak+1L a_{k+1} and the other terms are those of the right side rr of line L5, so (B) is the system of line L6. Write δ=αf−αm\delta = \alpha_f - \alpha_m. The status is partial because the unconditional stability (Theorem 4) and the global convergence are cited, not proved.

Theorem 1 (consistency and the second order condition). Let dd be a smooth solution of Md¨+Cd˙+Kd=FM\ddot d + C\dot d + K d = F, with v=d˙v = \dot d and a=d¨a = \ddot d. Insert the shifted exact values Dk=d(tk)D_k = d(t_k), Vk=v(tk)V_k = v(t_k), Ak=a(tk−δ dt)A_k = a(t_k - \delta\,dt) into (U1), (U2) and (B). Then the defect of (U1) is O(dt3)O(dt^3), the defect of (B) is O(dt2)O(dt^2), and the defect of (U2) is

(12+δ−γ) dt2 a˙(tk)+O(dt3).(\tfrac12 + \delta - \gamma)\,dt^2\,\dot a(t_k) + O(dt^3).

Proof. Write aa, a˙\dot a for the values at tkt_k. Then Ak=a−δ dt a˙+O(dt2)A_k = a - \delta\,dt\,\dot a + O(dt^2) and Ak+1=a+(1−δ) dt a˙+O(dt2)A_{k+1} = a + (1 - \delta)\,dt\,\dot a + O(dt^2).

(U1): d(tk+dt)−d−dt v=12dt2a+O(dt3)d(t_k + dt) - d - dt\,v = \tfrac12 dt^2 a + O(dt^3), and dt2((12−β)Ak+βAk+1)=12dt2a+O(dt3)dt^2((\tfrac12 - \beta)A_k + \beta A_{k+1}) = \tfrac12 dt^2 a + O(dt^3).

(U2): v(tk+dt)−v=dt a+12dt2a˙+O(dt3)v(t_k + dt) - v = dt\,a + \tfrac12 dt^2 \dot a + O(dt^3), and dt((1−γ)Ak+γAk+1)=dt a+dt2a˙ (−(1−γ)δ+γ(1−δ))+O(dt3)=dt a+(γ−δ) dt2a˙+O(dt3)dt((1 - \gamma) A_k + \gamma A_{k+1}) = dt\,a + dt^2\dot a\,\big(-(1 - \gamma)\delta + \gamma(1 - \delta)\big) + O(dt^3) = dt\,a + (\gamma - \delta)\,dt^2\dot a + O(dt^3). The difference is (12−γ+δ) dt2a˙+O(dt3)(\tfrac12 - \gamma + \delta)\,dt^2 \dot a + O(dt^3).

(B): put s=tk+(1−αf) dts = t_k + (1 - \alpha_f)\,dt. A weighted mean (1−α)g(t+dt)+αg(t)(1 - \alpha) g(t + dt) + \alpha g(t) of a smooth gg equals g(t+(1−α) dt)+O(dt2)g(t + (1 - \alpha)\,dt) + O(dt^2). So (1−αm)Ak+1+αmAk=a(tk−δ dt+(1−αm) dt)+O(dt2)=a(s)+O(dt2)(1 - \alpha_m)A_{k+1} + \alpha_m A_k = a(t_k - \delta\,dt + (1 - \alpha_m)\,dt) + O(dt^2) = a(s) + O(dt^2), because −δ+1−αm=1−αf-\delta + 1 - \alpha_m = 1 - \alpha_f. In the same way the vv and dd terms equal v(s)+O(dt2)v(s) + O(dt^2) and d(s)+O(dt2)d(s) + O(dt^2). The exact equation at ss gives a defect O(dt2)O(dt^2). □\square

Why this is the order condition. Subtract the scheme from the shifted exact values. In one step from exact data, the defect O(dt2)O(dt^2) of (B) changes ak+1a_{k+1} by L−1O(dt2)L^{-1} O(dt^2), and L−1ML^{-1}M stays bounded as dt→0dt \to 0 because L→(1−αm)ML \to (1 - \alpha_m) M. Through (U1) and (U2) this changes dk+1d_{k+1} by O(dt4)O(dt^4) and vk+1v_{k+1} by O(dt3)O(dt^3). The defect of (U1) changes dk+1d_{k+1} by O(dt3)O(dt^3). So the local error of one step in (d,v)(d, v) is O(dt3)O(dt^3), that is O(dt2)O(dt^2) per unit time, exactly when γ=12+δ=12−αm+αf\gamma = \tfrac12 + \delta = \tfrac12 - \alpha_m + \alpha_f. For other γ\gamma the velocity has the local error (12+δ−γ) dt2a˙(\tfrac12 + \delta - \gamma)\,dt^2\dot a and the method is first order. With the uniform stability of Theorem 4, a local error O(dt3)O(dt^3) gives a global error O(dt2)O(dt^2) on a fixed interval (Chung and Hulbert 1993). The shifted value A0=a(−δ dt)A_0 = a(-\delta\,dt) differs from the a0a_0 of line L1 by O(dt)O(dt). This start error enters d1d_1 through dt2a0dt^2 a_0 and v1v_1 through dt a0dt\,a_0, so it adds O(dt2)O(dt^2) to the global error.

The same computation shows the role of the load time: if the load is taken at tk+1t_{k+1} in place of ss, the defect of (B) becomes F(tk+1)−F(s)+O(dt2)=O(dt)F(t_{k+1}) - F(s) + O(dt^2) = O(dt), which changes vk+1v_{k+1} by O(dt2)O(dt^2) per step, and the method is first order. The reference test test_load_at_the_shifted_time measures orders 2 and 1 for the two choices.

Theorem 2 (high frequency limit). For the mode d¨+ω2d=0\ddot d + \omega^2 d = 0 put Ω=ω dt\Omega = \omega\,dt and xk=(dk,dt vk,dt2ak)x_k = (d_k, dt\,v_k, dt^2 a_k), so that xk+1=A(Ω)xkx_{k+1} = A(\Omega) x_k. As Ω→∞\Omega \to \infty, A(Ω)A(\Omega) converges to a matrix A∞A_\infty with the eigenvalues

λ1=−αf1−αf,λ2+λ3=2−γ+12β,λ2λ3=1−γ−12β.\lambda_1 = -\frac{\alpha_f}{1 - \alpha_f}, \qquad \lambda_2 + \lambda_3 = 2 - \frac{\gamma + \tfrac12}{\beta}, \qquad \lambda_2\lambda_3 = 1 - \frac{\gamma - \tfrac12}{\beta}.

Proof. Write D,V,AD, V, A for the three components of xkx_k and D′,V′,A′D', V', A' for those of xk+1x_{k+1}. Multiply (B) by dt2dt^2 and use dt2a=−Ω2ddt^2 a = -\Omega^2 d for the stiffness term:

(1−αm)A′+αmA+Ω2((1−αf)D′+αfD)=0,D′=D+V+(12−β)A+βA′.(1 - \alpha_m) A' + \alpha_m A + \Omega^2\big((1 - \alpha_f) D' + \alpha_f D\big) = 0, \qquad D' = D + V + (\tfrac12 - \beta)A + \beta A'.

Put the second relation into the first and divide by Ω2\Omega^2. As Ω→∞\Omega \to \infty the coefficients converge, and the limit is (1−αf)βA′=−D−(1−αf)V−(1−αf)(12−β)A(1 - \alpha_f)\beta A' = -D - (1 - \alpha_f)V - (1 - \alpha_f)(\tfrac12 - \beta)A. The coefficient of A′A' before the limit is (1−αm)/Ω2+(1−αf)β(1 - \alpha_m)/\Omega^2 + (1 - \alpha_f)\beta, which stays away from 0, so the entries of A(Ω)A(\Omega) converge. In the limit, D′=D+V+(12−β)A+βA′=D−D/(1−αf)=λ1DD' = D + V + (\tfrac12 - \beta)A + \beta A' = D - D/(1 - \alpha_f) = \lambda_1 D. So the first row of A∞A_\infty is (λ1,0,0)(\lambda_1, 0, 0), λ1\lambda_1 is an eigenvalue, and the other two are those of the block for (V,A)(V, A). From A′=−1βV−1β(12−β)A+(⋅)DA' = -\tfrac1\beta V - \tfrac{1}{\beta}(\tfrac12 - \beta)A + (\cdot)D and V′=V+(1−γ)A+γA′V' = V + (1 - \gamma)A + \gamma A' this block is

B=(1−γ/β1−γ/(2β)−1/β1−1/(2β)),B = \begin{pmatrix} 1 - \gamma/\beta & 1 - \gamma/(2\beta) \\ -1/\beta & 1 - 1/(2\beta) \end{pmatrix},

with trace 2−(γ+12)/β2 - (\gamma + \tfrac12)/\beta and determinant 1+12β−γβ=1−(γ−12)/β1 + \tfrac{1}{2\beta} - \tfrac{\gamma}{\beta} = 1 - (\gamma - \tfrac12)/\beta. □\square

Corollary 3 (the Chung-Hulbert parameters). Let γ=12+δ\gamma = \tfrac12 + \delta and β=14(1+δ)2\beta = \tfrac14(1 + \delta)^2. Then λ2=λ3=(δ−1)/(δ+1)\lambda_2 = \lambda_3 = (\delta - 1)/(\delta + 1). With αm=(2ρ∞−1)/(ρ∞+1)\alpha_m = (2\rho_\infty - 1)/(\rho_\infty + 1) and αf=ρ∞/(ρ∞+1)\alpha_f = \rho_\infty/(\rho_\infty + 1), all three eigenvalues of A∞A_\infty equal −ρ∞-\rho_\infty, so the spectral radius of A(Ω)A(\Omega) tends to ρ∞\rho_\infty.

Proof. The trace is 2−(1+δ)/β=2−4/(1+δ)2 - (1 + \delta)/\beta = 2 - 4/(1 + \delta) and the determinant is 1−δ/β=1−4δ/(1+δ)2=((1−δ)/(1+δ))21 - \delta/\beta = 1 - 4\delta/(1 + \delta)^2 = \big((1 - \delta)/(1 + \delta)\big)^2. A pair with sum 2μ2\mu and product μ2\mu^2, μ=1−2/(1+δ)=(δ−1)/(δ+1)\mu = 1 - 2/(1 + \delta) = (\delta - 1)/(\delta + 1), is the double root μ\mu. Now δ=αf−αm=(1−ρ∞)/(1+ρ∞)\delta = \alpha_f - \alpha_m = (1 - \rho_\infty)/(1 + \rho_\infty), so μ=((1−ρ∞)−(1+ρ∞))/((1−ρ∞)+(1+ρ∞))=−ρ∞\mu = \big((1 - \rho_\infty) - (1 + \rho_\infty)\big)/\big((1 - \rho_\infty) + (1 + \rho_\infty)\big) = -\rho_\infty, and λ1=−αf/(1−αf)=−ρ∞\lambda_1 = -\alpha_f/(1 - \alpha_f) = -\rho_\infty. The eigenvalues of a matrix depend continuously on its entries, so the spectral radius of A(Ω)A(\Omega) converges to that of A∞A_\infty. □\square

The parameter β\beta of the corollary is the one that makes the two roots of BB equal. For a larger β\beta the pair is complex with modulus 1−δ/β\sqrt{1 - \delta/\beta}, which is larger than ∣μ∣|\mu|, so a larger β\beta damps the highest modes less.

Theorem 4 (unconditional stability, cited). For a linear undamped problem the method is unconditionally stable when αm≤αf≤12\alpha_m \le \alpha_f \le \tfrac12 and β≥14+12(αf−αm)\beta \ge \tfrac14 + \tfrac12(\alpha_f - \alpha_m) (Chung and Hulbert 1993). The Chung-Hulbert parameters satisfy these conditions: αf−αm=(1−ρ∞)/(1+ρ∞)≥0\alpha_f - \alpha_m = (1 - \rho_\infty)/(1 + \rho_\infty) \ge 0, αf=ρ∞/(ρ∞+1)≤12\alpha_f = \rho_\infty/(\rho_\infty + 1) \le \tfrac12, and 14(1+δ)2−14−12δ=14δ2≥0\tfrac14(1 + \delta)^2 - \tfrac14 - \tfrac12\delta = \tfrac14\delta^2 \ge 0. The reference test test_unconditional_stability measures a spectral radius at most 1+10−61 + 10^{-6} for ρ∞∈{0,0.3,0.6,0.9,1}\rho_\infty \in \{0, 0.3, 0.6, 0.9, 1\} and ω dt\omega\,dt from 10−210^{-2} to 10310^3.

Theorem 5 (the case ρ∞=1\rho_\infty = 1). For ρ∞=1\rho_\infty = 1, αm=αf=12\alpha_m = \alpha_f = \tfrac12, γ=12\gamma = \tfrac12 and β=14\beta = \tfrac14. If the load FF is affine in tt (for example zero), the method produces the same (dk,vk,ak)(d_k, v_k, a_k) as the average acceleration Newmark method, and Mak+Cvk+Kdk=F(tk)M a_k + C v_k + K d_k = F(t_k) for every kk.

Proof. By induction on kk. For k=0k = 0 the equation holds by line L1. If it holds at kk, then (B) with αm=αf=12\alpha_m = \alpha_f = \tfrac12 says that the mean of Ma+Cv+KdM a + C v + K d at kk and k+1k + 1 equals F(tk+12dt)F(t_k + \tfrac12 dt), which is the mean of F(tk)F(t_k) and F(tk+1)F(t_{k+1}) because FF is affine. So the equation holds at k+1k + 1. Then (U1), (U2) and the equation at k+1k + 1 are the defining equations of the Newmark step with β=14\beta = \tfrac14, γ=12\gamma = \tfrac12, which has a unique solution. □\square

So for ρ∞=1\rho_\infty = 1 and a linear undamped problem the energy 12v⊤Mv+12d⊤Kd\tfrac12 v^\top M v + \tfrac12 d^\top K d is conserved exactly, by the energy theorem of the Newmark-beta method. The reference test test_rho_one_is_the_trapezoidal_rule checks both facts in exact rational arithmetic.

Complexity

The cost is that of the Newmark-beta method: in the real-RAM model a linear problem with banded matrices of half bandwidth bb and fixed dtdt needs one factorization, Θ(nb2)\Theta(n b^2), and then Θ(nb)\Theta(n b) per step, so Θ(nb2+mnb)\Theta(n b^2 + m n b) in total and Θ(nb)\Theta(n b) memory. The shifted balance adds two vectors of storage and a few vector operations per step. A nonlinear problem costs one tangent assembly and one factorization per Newton iteration. The reference code uses dense Gaussian elimination and is meant only for small systems.

Properties

  • One parameter for all the damping. ρ∞=1\rho_\infty = 1 gives no damping (the trapezoidal rule), ρ∞=0\rho_\infty = 0 gives asymptotic annihilation: a mode with ω dt→∞\omega\,dt \to \infty is removed in one step, as with an L-stable method.
  • Second order for every ρ∞\rho_\infty, and unconditionally stable for linear problems.
  • Small low frequency damping. Among the second order three-stage schemes of this form, the Chung-Hulbert choice minimizes the low frequency damping for a given ρ∞\rho_\infty (Chung and Hulbert 1993). The measured ratios are in the example.
  • The auxiliary acceleration is not the physical one. aka_k is a time-shifted value, so a code that reports accelerations, for example floor response spectra, must say so or recompute them from the equation of motion.

Variants and improvements

  • HHT-alpha (αm=0\alpha_m = 0) and WBZ-alpha (αf=0\alpha_f = 0): the two one-shift members. HHT-alpha is the usual implicit dynamics option of several commercial finite element codes.
  • First order systems (Jansen, Whiting and Hulbert 2000). The same idea for Mu˙+f(u)=0M\dot u + f(u) = 0, with αm=12(3−ρ∞)/(1+ρ∞)\alpha_m = \tfrac12(3 - \rho_\infty)/(1 + \rho_\infty), αf=1/(1+ρ∞)\alpha_f = 1/(1 + \rho_\infty) and γ=12+αm−αf\gamma = \tfrac12 + \alpha_m - \alpha_f in their convention. It is used for stabilized finite element and variational multiscale flow solvers and in isogeometric fluid codes.
  • Nonlinear and constrained systems. For multibody dynamics with constraints, Arnold and Bruls (2007) analyzed the method as an index-3 DAE integrator.
  • Energy-momentum and energy-decaying schemes. For strongly nonlinear elastodynamics, generalized-alpha can still let the energy grow. Schemes based on discrete gradients bound the energy by construction.

When to use it

Use it as the default implicit integrator for linear and nonlinear structural dynamics with a mesh that has unresolved high modes, for example after a sudden load or with contact, where the trapezoidal rule leaves high frequency noise in the stresses. A value ρ∞\rho_\infty between 0.50.5 and 0.90.9 is common. Use the trapezoidal rule (ρ∞=1\rho_\infty = 1) when you need exact energy for a linear problem. Use the explicit central difference method for short wave and impact problems where the step is small anyway.

Pitfalls

  • Wrong sign conventions. Papers and codes use α\alpha, −α-\alpha, 1−α1 - \alpha for the same shift. A wrong sign gives a method that is first order or unstable. Check with the second order test and with the spectral radius at a large ω dt\omega\,dt.
  • Inconsistent initial acceleration. Line L1 computes a0a_0 from the equation of motion, but strictly a0a_0 should approximate d¨(−δ dt)\ddot d(-\delta\,dt). The difference is O(dt)O(dt) and is damped by the method, so it costs little in practice, but it shows up in the first steps of an error plot.
  • Load at the wrong time. The load must be evaluated at tk+1−αft_{k+1-\alpha_f} (or averaged as (1−αf)Fk+1+αfFk(1 - \alpha_f)F_{k+1} + \alpha_f F_k). Using F(tk+1)F(t_{k+1}) makes the method first order for a time-dependent load.
  • Low frequency damping is not zero. For ρ∞<1\rho_\infty < 1 a long simulation of a resolved mode still loses some amplitude, about ξˉ ω t\bar\xi\,\omega\,t in relative terms. For very long runs, use ρ∞\rho_\infty close to 1.
  • Nonlinear energy growth. The linear stability proof does not cover nonlinear problems. Strongly nonlinear problems with large steps can still blow up.

Implementations

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

generalized_alpha_method.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/generalized-alpha-method/. The authors are listed in prov/1NTWAK.jsonl.

"""Generalized-alpha time stepping (Chung and Hulbert 1993) for M a + C v + K d = F(t).

Matrices are lists of rows and vectors are lists, as in scimat. The step is dt.
The equation of motion is enforced at shifted points inside the step:
    M a_(n+1-am) + C v_(n+1-af) + K d_(n+1-af) = F(t_(n+1-af)),
with x_(n+1-alpha) = (1 - alpha) x_(n+1) + alpha x_n, and the Newmark updates
for d and v. With Fraction data and parameters the steps are exact.
"""

import cmath
import math

import scimat


def chung_hulbert(rho_inf):
    """Return (alpha_m, alpha_f, beta, gamma) for the high frequency limit rho_inf in [0, 1]."""
    if not 0 <= rho_inf <= 1:
        raise ValueError("rho_inf must be in [0, 1]")
    am = (2 * rho_inf - 1) / (rho_inf + 1)
    af = rho_inf / (rho_inf + 1)
    gamma = (1 - 2 * am + 2 * af) / 2
    beta = (1 - am + af) ** 2 / 4
    return am, af, beta, gamma


def hht(alpha):
    """Return the parameters of the HHT-alpha method; alpha in [0, 1/3] (am = 0, af = alpha)."""
    if not 0 <= alpha <= 1 / 3:
        raise ValueError("alpha must be in [0, 1/3]")
    return 0 * alpha, alpha, (1 + alpha) ** 2 / 4, (1 + 2 * alpha) / 2


def wbz(rho_inf):
    """Return the parameters of the WBZ-alpha method (af = 0) for rho_inf in [0, 1]."""
    am = (rho_inf - 1) / (rho_inf + 1)
    return am, 0 * am, (1 - am) ** 2 / 4, (1 - 2 * am) / 2


def step(M, C, K, F, t, d, v, a, dt, am, af, beta, gamma):
    """Advance (d, v, a) at time t by one generalized-alpha step and return the new triple."""
    n = len(d)
    lhs = [[(1 - am) * M[i][j] + (1 - af) * (gamma * dt * C[i][j] + beta * dt * dt * K[i][j]) for j in range(n)] for i in range(n)]
    dp = [d[i] + dt * v[i] + dt * dt / 2 * (1 - 2 * beta) * a[i] for i in range(n)]  # @line L3
    vp = [v[i] + (1 - gamma) * dt * a[i] for i in range(n)]  # @line L4
    dm = [(1 - af) * dp[i] + af * d[i] for i in range(n)]
    vm = [(1 - af) * vp[i] + af * v[i] for i in range(n)]
    rhs = scimat.sub(F(t + (1 - af) * dt), scimat.add(scimat.scale(am, scimat.matvec(M, a)), scimat.add(scimat.matvec(C, vm), scimat.matvec(K, dm))))  # @line L5
    a1 = scimat.solve(lhs, rhs)  # @line L6
    d1 = [dp[i] + beta * dt * dt * a1[i] for i in range(n)]  # @line L7
    v1 = [vp[i] + gamma * dt * a1[i] for i in range(n)]  # @line L8
    return d1, v1, a1


def generalized_alpha(M, C, K, F, d0, v0, dt, nsteps, rho_inf=None, params=None):
    """Integrate M a + C v + K d = F(t) from (d0, v0) with nsteps steps of size dt.

    Give either rho_inf (Chung-Hulbert parameters) or params = (am, af, beta, gamma).
    Return the lists of displacements, velocities and accelerations.
    """
    if params is None:
        params = chung_hulbert(rho_inf)
    am, af, beta, gamma = params
    d, v = list(d0), list(v0)
    a = scimat.solve(M, scimat.sub(scimat.sub(F(0 * dt), scimat.matvec(C, v)), scimat.matvec(K, d)))  # @line L1
    ds, vs, accs = [d], [v], [a]
    for k in range(nsteps):  # @line L2
        d, v, a = step(M, C, K, F, k * dt, d, v, a, dt, am, af, beta, gamma)
        ds.append(d)
        vs.append(v)
        accs.append(a)
    return ds, vs, accs  # @line L9


def amplification_matrix(omega_dt, params, xi=0.0):
    """Return the 3 by 3 matrix A with (d, dt v, dt^2 a)_(n+1) = A (d, dt v, dt^2 a)_n.

    It is for a + 2 xi omega v + omega^2 d = 0 with dt = 1 and omega = omega_dt.
    """
    am, af, beta, gamma = params
    m, c, k = [[1.0]], [[2 * xi * omega_dt]], [[omega_dt * omega_dt]]
    cols = []
    for x in ((1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0)):
        d1, v1, a1 = step(m, c, k, lambda t: [0.0], 0.0, [x[0]], [x[1]], [x[2]], 1.0, am, af, beta, gamma)
        cols.append((d1[0], v1[0], a1[0]))
    return [[cols[j][i] for j in range(3)] for i in range(3)]


def eigenvalues_3x3(a):
    """Return the three complex eigenvalues of a real 3 by 3 matrix (Durand-Kerner on its cubic)."""
    tr = a[0][0] + a[1][1] + a[2][2]
    minors = (a[0][0] * a[1][1] - a[0][1] * a[1][0]) + (a[0][0] * a[2][2] - a[0][2] * a[2][0]) + (a[1][1] * a[2][2] - a[1][2] * a[2][1])
    det = scimat.det(a)
    # characteristic polynomial: z^3 - tr z^2 + minors z - det
    def p(z):
        return ((z - tr) * z + minors) * z - det

    scale = 1 + abs(tr) + abs(minors) + abs(det)
    roots = [scale * (0.4 + 0.9j) ** k for k in range(3)]
    for _ in range(500):
        new = []
        for i, z in enumerate(roots):
            den = 1
            for j, w in enumerate(roots):
                if j != i:
                    den *= z - w
            new.append(z - p(z) / den if den != 0 else z + 1e-12)
        done = max(abs(x - y) for x, y in zip(new, roots)) < 1e-15 * scale
        roots = new
        if done:
            break
    return roots


def spectral_radius(omega_dt, params, xi=0.0):
    """Return the spectral radius of the step matrix at omega dt."""
    return max(abs(z) for z in eigenvalues_3x3(amplification_matrix(omega_dt, params, xi)))


def principal_root(omega_dt, params):
    """Return the eigenvalue near exp(i omega dt) (positive imaginary part) of the undamped step.

    Return None if the principal roots are real (no oscillation per step).
    """
    roots = eigenvalues_3x3(amplification_matrix(omega_dt, params))
    best = max(roots, key=lambda z: z.imag)
    if best.imag <= 1e-14:
        return None
    return best


def damping_ratio_and_period_error(omega_dt, params):
    """Return (algorithmic damping ratio, relative period error) at omega dt.

    The principal root is exp(omega_dt (-xi_bar + i) * wbar / omega) in polar form;
    xi_bar = -ln|z| / arg z and the period error is omega_dt / arg z - 1.
    """
    z = principal_root(omega_dt, params)
    ang = cmath.phase(z)
    return -math.log(abs(z)) / ang, omega_dt / ang - 1
scimat.py 227 lines
# SPDX-License-Identifier: MIT
# Shared helper of the scientific-computing pages of https://algorithm.tamnd.com/. The authors are listed in prov/.

"""Small dense linear algebra and error norms for the scientific-computing pages.

A matrix is a list of rows and a vector is a list. Entries may be int,
float or fractions.Fraction. The routines that do not take a square root
(solve, inv, det and the arithmetic) keep Fraction entries exact.
cholesky, cholesky_solve and norm2 take square roots and return floats.

API (fixed; other pages copy this file byte for byte):
    zeros(m, n=None)        m by n zero matrix (n = m if not given)
    eye(n)                  n by n identity
    add(A, B), sub(A, B)    entrywise sum and difference (vectors or matrices)
    scale(c, A)             c times A (vector or matrix)
    matmul(A, B)            matrix product
    matvec(A, x)            matrix times vector
    transpose(A)            transpose
    dot(x, y)               inner product of two vectors
    norm2(x)                Euclidean norm of a vector, as a float
    outer(x, y)             outer product x y^T
    solve(A, b)             Gaussian elimination with partial pivoting;
                            b is a vector or a matrix of right sides
    inv(A)                  inverse of A
    det(A)                  determinant of A
    cholesky(A)             lower triangular L with A = L L^T (floats)
    cholesky_solve(L, b)    solve L L^T x = b for a vector b
    err_l1(e, dx=1)         sum |e_j| dx
    err_l2(e, dx=1)         sqrt(sum e_j^2 dx), as a float
    err_linf(e, dx=1)       max |e_j| (dx is not used)
    observed_order(errors)  [log2(E_i / E_(i+1)) for successive errors]
"""

import math


def zeros(m, n=None):
    """Return an m by n matrix of zeros (n = m if n is None)."""
    if n is None:
        n = m
    return [[0] * n for _ in range(m)]


def eye(n):
    """Return the n by n identity matrix."""
    out = zeros(n, n)
    for i in range(n):
        out[i][i] = 1
    return out


def _is_matrix(a):
    return len(a) > 0 and isinstance(a[0], list)


def add(a, b):
    """Return a + b for two vectors or two matrices of the same shape."""
    if _is_matrix(a):
        return [[x + y for x, y in zip(ra, rb)] for ra, rb in zip(a, b)]
    return [x + y for x, y in zip(a, b)]


def sub(a, b):
    """Return a - b for two vectors or two matrices of the same shape."""
    if _is_matrix(a):
        return [[x - y for x, y in zip(ra, rb)] for ra, rb in zip(a, b)]
    return [x - y for x, y in zip(a, b)]


def scale(c, a):
    """Return c times a, for a vector or a matrix a."""
    if _is_matrix(a):
        return [[c * x for x in row] for row in a]
    return [c * x for x in a]


def transpose(a):
    """Return the transpose of the matrix a."""
    return [list(col) for col in zip(*a)]


def matmul(a, b):
    """Return the matrix product a b."""
    bt = transpose(b)
    return [[sum(x * y for x, y in zip(row, col)) for col in bt] for row in a]


def matvec(a, x):
    """Return the product of the matrix a and the vector x."""
    return [sum(aij * xj for aij, xj in zip(row, x)) for row in a]


def dot(x, y):
    """Return the inner product of the vectors x and y."""
    return sum(a * b for a, b in zip(x, y))


def norm2(x):
    """Return the Euclidean norm of the vector x, as a float."""
    return math.sqrt(float(dot(x, x)))


def outer(x, y):
    """Return the outer product x y^T as a matrix."""
    return [[a * b for b in y] for a in x]


def _eliminate(a, rhs):
    """Reduce a to upper triangular form with partial pivoting.

    a is a copy of the square matrix, rhs a list of right side rows (one
    row per row of a) that receives the same row operations. Return the
    number of row swaps. Raise ValueError if a pivot is zero.
    """
    n = len(a)
    swaps = 0
    for k in range(n):
        p = max(range(k, n), key=lambda i: abs(a[i][k]))
        if a[p][k] == 0:
            raise ValueError("matrix is singular")
        if p != k:
            a[k], a[p] = a[p], a[k]
            rhs[k], rhs[p] = rhs[p], rhs[k]
            swaps += 1
        for i in range(k + 1, n):
            f = a[i][k] / a[k][k]
            if f == 0:
                continue
            for j in range(k, n):
                a[i][j] -= f * a[k][j]
            for j in range(len(rhs[i])):
                rhs[i][j] -= f * rhs[k][j]
    return swaps


def solve(a, b):
    """Solve a x = b by Gaussian elimination with partial pivoting.

    b is a vector (the result is a vector) or a matrix with one column per
    right side (the result is a matrix). Fraction entries stay exact.
    Raise ValueError if a is singular.
    """
    n = len(a)
    work = [list(row) for row in a]
    vector = not _is_matrix(b)
    rhs = [[v] for v in b] if vector else [list(row) for row in b]
    _eliminate(work, rhs)
    m = len(rhs[0]) if n else 0
    x = [[0] * m for _ in range(n)]
    for i in range(n - 1, -1, -1):
        for j in range(m):
            s = rhs[i][j]
            for k in range(i + 1, n):
                s -= work[i][k] * x[k][j]
            x[i][j] = s / work[i][i]
    if vector:
        return [row[0] for row in x]
    return x


def inv(a):
    """Return the inverse of the square matrix a."""
    return solve(a, eye(len(a)))


def det(a):
    """Return the determinant of the square matrix a (0 if singular)."""
    work = [list(row) for row in a]
    rhs = [[] for _ in a]
    try:
        swaps = _eliminate(work, rhs)
    except ValueError:
        return 0
    d = -1 if swaps % 2 else 1
    for i in range(len(a)):
        d *= work[i][i]
    return d


def cholesky(a):
    """Return the lower triangular L with a = L L^T, in floats.

    Raise ValueError if a is not symmetric positive definite.
    """
    n = len(a)
    low = [[0.0] * n for _ in range(n)]
    for j in range(n):
        s = float(a[j][j]) - sum(low[j][k] ** 2 for k in range(j))
        if s <= 0.0:
            raise ValueError("matrix is not positive definite")
        low[j][j] = math.sqrt(s)
        for i in range(j + 1, n):
            t = float(a[i][j]) - sum(low[i][k] * low[j][k] for k in range(j))
            low[i][j] = t / low[j][j]
    return low


def cholesky_solve(low, b):
    """Solve L L^T x = b, with L from cholesky, for a vector b."""
    n = len(low)
    y = [0.0] * n
    for i in range(n):
        y[i] = (float(b[i]) - sum(low[i][k] * y[k] for k in range(i))) / low[i][i]
    x = [0.0] * n
    for i in range(n - 1, -1, -1):
        x[i] = (y[i] - sum(low[k][i] * x[k] for k in range(i + 1, n))) / low[i][i]
    return x


def err_l1(e, dx=1):
    """Return the discrete L1 norm sum |e_j| dx."""
    return sum(abs(v) for v in e) * dx


def err_l2(e, dx=1):
    """Return the discrete L2 norm sqrt(sum e_j^2 dx), as a float."""
    return math.sqrt(float(sum(v * v for v in e) * dx))


def err_linf(e, dx=1):
    """Return the max norm max |e_j|. dx is accepted for a uniform call and not used."""
    return max(abs(v) for v in e)


def observed_order(errors):
    """Return [log2(E_i / E_(i+1))] for a list of errors on meshes h, h/2, h/4, ..."""
    return [math.log2(float(errors[i]) / float(errors[i + 1])) for i in range(len(errors) - 1)]
test_generalized_alpha_method.py 153 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/generalized-alpha-method/. The authors are listed in prov/1NTWAK.jsonl.

import math
from fractions import Fraction as Fr

import scimat
from generalized_alpha_method import (
    amplification_matrix,
    chung_hulbert,
    damping_ratio_and_period_error,
    eigenvalues_3x3,
    generalized_alpha,
    hht,
    spectral_radius,
    wbz,
)


def free_sdof(omega, T, ns, params):
    return generalized_alpha([[1.0]], [[0.0]], [[omega * omega]], lambda t: [0.0], [1.0], [0.0], T / ns, ns, params=params)


def errors_free(params, steps, T=2.0):
    out = []
    for ns in steps:
        ds, vs, _ = free_sdof(1.0, T, ns, params)
        out.append(math.hypot(ds[-1][0] - math.cos(T), vs[-1][0] + math.sin(T)))
    return out


def test_parameters_from_rho_inf():
    am, af, beta, gamma = chung_hulbert(Fr(1, 2))
    assert (am, af, beta, gamma) == (Fr(0), Fr(1, 3), Fr(4, 9), Fr(5, 6))
    am, af, beta, gamma = chung_hulbert(Fr(1))
    assert (am, af, beta, gamma) == (Fr(1, 2), Fr(1, 2), Fr(1, 4), Fr(1, 2))


def test_rho_one_is_the_trapezoidal_rule():
    # With rho_inf = 1 the step equals the average acceleration Newmark step, exactly.
    M = [[Fr(2), Fr(0)], [Fr(0), Fr(1)]]
    K = [[Fr(6), Fr(-2)], [Fr(-2), Fr(4)]]
    C = [[Fr(0)] * 2 for _ in range(2)]
    ds, vs, accs = generalized_alpha(M, C, K, lambda t: [Fr(0), Fr(0)], [Fr(1), Fr(0)], [Fr(0), Fr(1)], Fr(1, 2), 6, rho_inf=Fr(1))
    e0 = (scimat.dot(vs[0], scimat.matvec(M, vs[0])) + scimat.dot(ds[0], scimat.matvec(K, ds[0]))) / 2
    for d, v, a in zip(ds, vs, accs):
        # the equation of motion holds at every step and the energy is exact
        assert scimat.add(scimat.matvec(M, a), scimat.matvec(K, d)) == [0, 0]
        assert (scimat.dot(v, scimat.matvec(M, v)) + scimat.dot(d, scimat.matvec(K, d))) / 2 == e0


def test_high_frequency_limit_is_rho_inf():
    for r in (0.0, 0.3, 0.5, 0.8, 0.95):
        p = chung_hulbert(r)
        rho = spectral_radius(1e6, p)
        assert abs(rho - r) < 2e-3, (r, rho)
        # the three roots meet at -rho_inf
        for z in eigenvalues_3x3(amplification_matrix(1e6, p)):
            assert abs(z + r) < 5e-3


def test_unconditional_stability():
    for r in (0.0, 0.3, 0.6, 0.9, 1.0):
        p = chung_hulbert(r)
        for k in range(-8, 13):
            w = 10 ** (k / 4)
            # near omega dt = infinity and rho_inf = 1 the roots form a near Jordan block, so allow rounding
            assert spectral_radius(w, p) <= 1 + 1e-6, (r, w)


def test_second_order_for_all_rho():
    for r in (0.0, 0.5, 0.9):
        p = scimat.observed_order(errors_free(chung_hulbert(r), [40, 80, 160, 320]))
        assert all(abs(q - 2) < 0.2 for q in p), (r, p)


def test_hht_and_wbz_second_order_and_limit():
    for params, r in ((hht(0.1), 9 / 11), (hht(1 / 3), 0.5), (wbz(0.5), 0.5)):
        p = scimat.observed_order(errors_free(params, [40, 80, 160, 320]))
        assert all(abs(q - 2) < 0.2 for q in p), p
        assert abs(spectral_radius(1e7, params) - r) < 1e-3


def test_less_low_frequency_damping_than_newmark():
    # Same rho_inf = 9/11: Newmark with gamma = 0.6 damps the resolved modes far more.
    newmark = (0.0, 0.0, 1.1 ** 2 / 4, 0.6)
    ch = chung_hulbert(9 / 11)
    for w in (0.1, 0.3, 1.0):
        xn, _ = damping_ratio_and_period_error(w, newmark)
        xc, _ = damping_ratio_and_period_error(w, ch)
        xh, _ = damping_ratio_and_period_error(w, hht(0.1))
        assert 0 <= xc < xh < xn
    p = scimat.observed_order(errors_free(newmark, [80, 160, 320, 640]))
    assert all(abs(q - 1) < 0.2 for q in p)


def test_damping_ratio_is_third_order_in_omega_dt():
    p = chung_hulbert(0.5)
    x = [damping_ratio_and_period_error(w, p)[0] for w in (0.2, 0.1, 0.05)]
    orders = scimat.observed_order(x)
    assert all(abs(q - 3) < 0.3 for q in orders), orders


def test_forced_damped_two_dof():
    # M = I, C = 0.1 K, K = [[2, -1], [-1, 2]], F = (sin t, 0), against a fine reference run.
    K = [[2.0, -1.0], [-1.0, 2.0]]
    C = scimat.scale(0.1, K)
    I2 = scimat.eye(2)

    def F(t):
        return [math.sin(t), 0.0]

    T = 3.0
    ref, _, _ = generalized_alpha(I2, C, K, F, [0.0, 0.0], [0.0, 0.0], T / 5120, 5120, rho_inf=0.6)
    errs = []
    for ns in (40, 80, 160):
        ds, _, _ = generalized_alpha(I2, C, K, F, [0.0, 0.0], [0.0, 0.0], T / ns, ns, rho_inf=0.6)
        errs.append(max(abs(x - y) for x, y in zip(ds[-1], ref[-1])))
    p = scimat.observed_order(errs)
    assert all(abs(q - 2) < 0.25 for q in p), p


def test_load_at_the_shifted_time():
    # a + 0.2 v + d = cos t from rest. The load at t_(n+1-af) gives order 2; the load at t_(n+1) only order 1.
    xi, T = 0.1, 4.0
    wd = math.sqrt(1 - xi * xi)

    def exact(t):
        return 5 * math.sin(t) - 5 / wd * math.exp(-xi * t) * math.sin(wd * t)

    params = chung_hulbert(0.5)
    af = params[1]
    for late, order in ((False, 2), (True, 1)):
        errs = []
        for ns in (50, 100, 200, 400):
            dt = T / ns
            F = (lambda t, dt=dt: [math.cos(t + af * dt)]) if late else (lambda t: [math.cos(t)])
            ds, _, _ = generalized_alpha([[1.0]], [[0.2]], [[1.0]], F, [0.0], [0.0], dt, ns, params=params)
            errs.append(abs(ds[-1][0] - exact(T)))
        p = scimat.observed_order(errs)
        assert abs(p[-1] - order) < 0.1, (late, p)


def test_stiff_mode_is_damped():
    # A stiff spring (omega = 1000) next to a soft one; after 20 large steps the stiff mode is gone.
    M = scimat.eye(2)
    K = [[1.0, 0.0], [0.0, 1e6]]
    Z = scimat.zeros(2)
    ds, _, _ = generalized_alpha(M, Z, K, lambda t: [0.0, 0.0], [1.0, 1.0], [0.0, 0.0], 0.1, 20, rho_inf=0.0)
    assert abs(ds[-1][1]) < 1e-12
    assert abs(ds[-1][0] - math.cos(2.0)) < 1e-2
    ds, _, _ = generalized_alpha(M, Z, K, lambda t: [0.0, 0.0], [1.0, 1.0], [0.0, 0.0], 0.1, 20, rho_inf=1.0)
    assert abs(ds[-1][1]) > 0.5

History

Hilber, Hughes and Taylor in 1977 shifted the stiffness and load terms of the Newmark balance and obtained second order with controllable high frequency damping. Wood, Bossak and Zienkiewicz in 1980 shifted the inertia term instead. Chung and Hulbert in 1993 used both shifts, related all parameters to the single high frequency spectral radius ρ∞\rho_\infty, and showed that this choice gives the least low frequency damping for a given high frequency damping. Jansen, Whiting and Hulbert extended the method to first order systems in 2000, which made it a standard time integrator for stabilized flow solvers.

References

  1. J. Chung and G. M. Hulbert, A time integration algorithm for structural dynamics with improved numerical dissipation. The generalized-alpha method, Journal of Applied Mechanics 60(2) (1993) 371-375, the method, the parameter choice by rho_inf, the second order condition and the stability analysis
  2. H. M. Hilber, T. J. R. Hughes and R. L. Taylor, Improved numerical dissipation for time integration algorithms in structural dynamics, Earthquake Engineering and Structural Dynamics 5(3) (1977) 283-292, the HHT-alpha method
  3. W. L. Wood, M. Bossak and O. C. Zienkiewicz, An alpha modification of Newmark's method, International Journal for Numerical Methods in Engineering 15(10) (1980) 1562-1566, the WBZ-alpha method
  4. K. E. Jansen, C. H. Whiting and G. M. Hulbert, A generalized-alpha method for integrating the filtered Navier-Stokes equations with a stabilized finite element method, Computer Methods in Applied Mechanics and Engineering 190(3-4) (2000) 305-319, the generalized-alpha method for first order systems
  5. Thomas J. R. Hughes, The Finite Element Method, Linear Static and Dynamic Finite Element Analysis, Dover, 2000, Chapter 9 (Newmark and HHT-alpha methods, spectral radius, algorithmic damping and period error)

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of correctness
  • a full proof of time.worst
  • a full proof of space.extra
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a scene preset for the example