Example B2: Numerical Continuation on a Frictional Oscillator

The scope as well as the approach of this example are very similar to Example b1, with a key difference: this example involves a hysteretic nonlinearity. This poses a very important difference in how the nonlinear force and its harmonics are computed.

The general setup for the problem is similar:

\[\ddot{x} + 2\zeta_0\omega_0\dot{x} + \omega_0^2 x + f_{nl} = F\cos\Omega t.\]

The nonlinearity $f_{nl}$ is a hysteretically saturated linear spring with low amplitude stiffness $k_t$ and saturation limit ("slip" force) $f_s$.

The steps that will be followed in this file are exactly the same as in Example b1:

  1. First we define a "harmonic residue" function for the Duffing oscillator in a way that returns the residue, its Jacobian with respect to the vector of harmonics (see Example a), and also with respect to the excitation frequency.
  2. Next we define the parameters for the problem and setup the necessary variables for the Harmonic Balance (and AFT).
  3. Then we conduct the actual continuation after setting up parameters for this.
  4. Finally the results are plotted in terms of the different harmonics present.

Preamble: Load Packages

using GLMakie
using LaTeXStrings
using LinearAlgebra
using NonlinearSolve
using ForwardDiff
using DSP

using juliajim.HARMONIC
using juliajim.CONTINUATION

Define Residue Function

The structure of the residue function is identical to that in Example 1. A key differerence is in the computation of the nonlinear force.

Unlike in the previous case, the restoring force of a hysteretic element can not be estimated at any instant of time independent of its history. In other words, the restoring force of a hysteretic element can be different based on its loading history. For steady state calculations, we start by assuming initially that the hysteretic element acts as a linear spring (see ft=kt*ut below) and then "march forward" in time. At each instant the incremental form of the friction law is used to check if saturation is violated and the restoring force is corrected appropriately. The force "shakes down" after repeating this for 2 or more cycles of the period. We use this steady-state force for the Fourier transforms involve in Harmonic Balance.

function RESFUN!(Uw, Fl, pars, h, Nt; R=nothing, dRdU=nothing, dRdw=nothing)
    (; z0, w0, kt, fs, F) = pars;

    Om = Uw[end];
    Nhc = sum((h.==0)+2(h.!=0));

    # Linear Portion
    E, dEdw = HARMONICSTIFFNESS(1.0, 2z0*w0, w0^2, Om, h);

    # AFT For nonlinear force
    ut  = AFT(Uw[1:end-1], h, Nt, :f2t);

    # Construct Residue
    if !(R === nothing && dRdU === nothing)
        ft = kt*ut;
        if !(dRdU === nothing)
            cst = AFT(eltype(Uw).(I(Nhc)), h, Nt, :f2t);
            dfdat = kt.*cst;
        end

        for _ in 1:2
            for (ti, tim1) in zip(1:Nt, circshift(1:Nt,1))
                fsp = kt*(ut[ti]-ut[tim1]) + ft[tim1];  # stick prediction
                ft[ti] = clamp(fsp, -fs, fs);
                if !(dRdU === nothing)
                    if (abs(fsp)<fs)
                        dfdat[ti, :] = kt.*(cst[ti,:]-cst[tim1,:]) + dfdat[tim1,:];
                    else
                        dfdat[ti, :] .= 0.0;
                    end
                end
            end
        end
        if !(R === nothing)
            Fnl = AFT(ft, h, Nt, :t2f);
            R[:] = E*Uw[1:end-1] + Fnl - Fl*F;
        end
        if !(dRdU === nothing)
            Jnl    = AFT(dfdat, h, Nt, :t2f);
            dRdU[:, :] = E + Jnl;
        end
    end
    if !(dRdw === nothing)
        dRdw[:] = dEdw*Uw[1:end-1];
    end
    return nothing;
end
RESFUN! (generic function with 1 method)

Setup

Now we setup the specific problem by assigning numerical values to the parameters. Odd harmonics are chosen for the Harmonic Balance since we already have some intuition on the nonlinearity (it, being an "odd function" nonlinearity). As before, this is followed by setting up a NonlinearFunction object that will be used for the continuation.

pars = (z0 = 0.5e-2, w0 = 2., kt = 5.0, fs=1.0, F = 0.1);

# h = (0:5); # Also possible
h = 1:2:5;
Om = 0.1;

Nhc = sum((h.==0)+2(h.!=0));
Nt = 2^9;

Fl = zeros(Nhc);
_,_,zinds,rinds,iinds = HINDS(1, h)
Fl[rinds[1]] = 1.0;

fun = NonlinearFunction((r,u,p)->RESFUN!([u;p],Fl,pars,h,Nt;R=r),
    jac=(J,u,p)->RESFUN!([u;p],Fl,pars,h,Nt;dRdU=J),
    paramjac=(Jp,u,p)->RESFUN!([u;p],Fl,pars,h,Nt;dRdw=Jp));

Check by solving for a Single point

We do the single point check to ensure that everything works - no errors in the residue, the Jacobian is correct, etc. This should also converge within 3-4 iterations.

E = zeros(Nhc, Nhc);
HARMONICSTIFFNESS!(E, nothing, 1.0, 2pars.z0*pars.w0, pars.w0^2+pars.kt, Om, h);
U0 = E\ (Fl*pars.F);

prob = NonlinearProblem(fun, U0, Om);
sol = solve(prob, show_trace=Val(true));

Algorithm: NewtonRaphson(
    descent = NewtonDescent(),
    autodiff = AutoForwardDiff(),
    vjp_autodiff = AutoFiniteDiff(
        fdtype = Val{:forward}(),
        fdjtype = Val{:forward}(),
        fdhtype = Val{:hcentral}(),
        dir = true
    ),
    jvp_autodiff = AutoForwardDiff(),
    concrete_jac = Val{false}()
)

----    	-------------       	-----------
Iter    	f(u) inf-norm       	Step 2-norm
----    	-------------       	-----------
0       	1.84128022e-17      	0.00000000e+00
1       	1.84128022e-17      	2.22627759e-18
Final   	1.84128022e-17
----------------------

Continuation

Finally we're ready to do the continuation so we setup the system as before: initialize continuation parameters and setup the initial guess. Then we invoke CONTINUATE to compute the solutions and then arrange the harmonics in complex notation for plotting.

Om0 = 0.02pars.w0;
Om1 = 2pars.w0;
dOm = 0.04pars.w0;
cpars = (parm=:riks, nmax=300, Dsc=:auto, minDsc=1e-2);

HARMONICSTIFFNESS!(E, nothing, 1.0, 2pars.z0*pars.w0, pars.w0^2+pars.kt, Om0, h);
U0 = E\ (Fl*pars.F);

sols, its, dss, xis, Dsc = CONTINUATE(U0, fun, [Om0, Om1], dOm; cpars...);

uh = zeros(Complex, maximum(h)+1, length(sols));
uh[h.+1, :] = hcat([[s.up[zinds]; s.up[rinds]+1im*s.up[iinds]] for s in sols]...);
Oms = [s.up[end] for s in sols];

Algorithm: NewtonRaphson(
    descent = NewtonDescent(),
    autodiff = AutoForwardDiff(),
    vjp_autodiff = AutoFiniteDiff(
        fdtype = Val{:forward}(),
        fdjtype = Val{:forward}(),
        fdhtype = Val{:hcentral}(),
        dir = true
    ),
    jvp_autodiff = AutoForwardDiff(),
    concrete_jac = Val{false}()
)

----    	-------------       	-----------
Iter    	f(u) inf-norm       	Step 2-norm
----    	-------------       	-----------
0       	2.77555756e-17      	0.00000000e+00
1       	2.62851264e-17      	3.65628091e-18
Final   	2.62851264e-17
----------------------
2. 0.12 with step 0.0800 (2.0000) converged in 1 iterations. 0.137768 Δα.
3. 0.24 with step 0.1244 (1.7959) converged in 1 iterations. 0.099752 Δα.
4. 0.47 with step 0.2261 (1.7378) converged in 1 iterations. 0.094599 Δα.
5. 0.89 with step 0.4214 (1.7035) converged in 1 iterations. 0.101574 Δα.
6. 1.65 with step 0.7666 (1.6412) converged in 2 iterations. 0.184239 Δα.
7. 2.40 with step 0.9177 (1.1450) converged in 3 iterations. 0.435822 Δα.
8. 2.62 with step 0.3430 (0.6168) converged in 2 iterations. 0.489249 Δα.
9. 2.71 with step 0.1218 (0.4000) converged in 2 iterations. 0.451119 Δα.
10. 2.78 with step 0.0915 (0.4000) converged in 2 iterations. 0.446880 Δα.
11. 2.84 with step 0.0685 (0.4000) converged in 2 iterations. 0.441269 Δα.
12. 2.87 with step 0.0514 (0.4000) converged in 2 iterations. 0.434244 Δα.
13. 2.90 with step 0.0385 (0.4000) converged in 2 iterations. 0.423698 Δα.
14. 2.92 with step 0.0285 (0.4000) converged in 3 iterations. 1.537231 Δα.
15. 2.92 with step 0.0022 (0.4000) converged in 2 iterations. 0.313547 Δα.
16. 2.93 with step 0.0039 (0.4000) converged in 2 iterations. 0.295713 Δα.
17. 2.94 with step 0.0073 (0.4000) converged in 3 iterations. 0.372927 Δα.
18. 2.95 with step 0.0120 (0.4000) converged in 3 iterations. 0.438570 Δα.
19. 2.96 with step 0.0117 (0.4000) converged in 2 iterations. 0.485158 Δα.
20. 2.97 with step 0.0108 (0.4000) converged in 2 iterations. 0.839571 Δα.
21. 2.99 with step 0.0116 (0.4000) converged in 2 iterations. 1.483804 Δα.
22. 3.00 with step 0.0127 (0.4000) converged in 2 iterations. 0.433848 Δα.
23. 3.01 with step 0.0129 (0.4000) converged in 2 iterations. 0.275452 Δα.
24. 3.03 with step 0.0157 (0.4000) converged in 2 iterations. 0.238844 Δα.
25. 3.05 with step 0.0208 (0.4000) converged in 3 iterations. 0.263346 Δα.
26. 3.07 with step 0.0218 (0.4000) converged in 3 iterations. 0.353609 Δα.
27. 3.08 with step 0.0120 (0.4000) converged in 3 iterations. 0.464249 Δα.
28. -2.00 with step 0.0045 (0.4000) converged in 42 iterations. 2.417961 Δα.
29. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 4.471880 Δα.
30. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 4.613668 Δα.
31. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 5.304581 Δα.
32. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.776022 Δα.
33. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 4.644540 Δα.
34. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 5.430191 Δα.
35. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.953262 Δα.
36. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 5.232261 Δα.
37. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 2.080139 Δα.
38. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 4.906533 Δα.
39. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 1.347796 Δα.
40. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 1.067595 Δα.
41. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.705421 Δα.
42. -2.00 with step 0.0002 (0.4000) converged in 3 iterations. 3.766286 Δα.
43. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.312581 Δα.
44. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.411154 Δα.
45. -2.00 with step -0.0001 (0.4000) converged in 1 iterations. 0.572577 Δα.
46. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.395653 Δα.
47. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.790667 Δα.
48. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.326786 Δα.
49. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.148902 Δα.
50. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.111838 Δα.
51. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.130768 Δα.
52. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.203256 Δα.
53. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.166120 Δα.
54. -2.00 with step -0.0001 (0.4000) converged in 1 iterations. 0.159470 Δα.
55. -2.00 with step -0.0001 (0.4000) converged in 1 iterations. 0.187803 Δα.
56. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.240183 Δα.
57. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.294580 Δα.
58. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.454496 Δα.
59. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.654184 Δα.
60. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 1.006836 Δα.
61. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 2.246123 Δα.
62. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 4.415086 Δα.
63. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 2.158821 Δα.
64. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.942855 Δα.
65. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 4.832657 Δα.
66. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 4.585458 Δα.
67. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 2.147793 Δα.
68. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 2.336526 Δα.
69. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 5.380945 Δα.
70. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 1.998426 Δα.
71. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 4.740754 Δα.
72. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.946690 Δα.
73. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.433831 Δα.
74. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.338379 Δα.
75. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.474787 Δα.
76. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.626365 Δα.
77. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 1.697790 Δα.
78. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.243972 Δα.
79. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.105498 Δα.
80. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.261065 Δα.
81. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.196582 Δα.
82. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.100101 Δα.
83. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.111139 Δα.
84. -2.00 with step 0.0001 (0.4000) converged in 1 iterations. 0.119528 Δα.
85. -2.00 with step 0.0001 (0.4000) converged in 1 iterations. 0.146306 Δα.
86. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.214394 Δα.
87. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.276280 Δα.
88. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.365109 Δα.
89. -2.00 with step -0.0002 (0.4000) converged in 3 iterations. 3.321224 Δα.
90. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 1.022344 Δα.
91. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 1.545359 Δα.
92. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 4.881348 Δα.
93. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 2.032094 Δα.
94. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 1.788092 Δα.
95. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.577842 Δα.
96. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 4.349757 Δα.
97. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 5.343827 Δα.
98. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.721271 Δα.
99. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 2.009542 Δα.
100. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 2.066165 Δα.
101. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 5.149060 Δα.
102. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 1.468478 Δα.
103. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 1.132138 Δα.
104. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.896517 Δα.
105. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.546222 Δα.
106. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.312756 Δα.
107. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.375582 Δα.
108. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.498043 Δα.
109. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.828429 Δα.
110. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.788689 Δα.
111. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.166540 Δα.
112. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.234480 Δα.
113. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.133025 Δα.
114. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.127805 Δα.
115. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.172725 Δα.
116. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.182412 Δα.
117. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.192430 Δα.
118. -2.00 with step -0.0001 (0.4000) converged in 1 iterations. 0.175126 Δα.
119. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.213653 Δα.
120. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.264585 Δα.
121. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.370867 Δα.
122. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.539973 Δα.
123. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.849681 Δα.
124. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 3.189779 Δα.
125. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 1.841682 Δα.
126. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.747384 Δα.
127. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 4.533805 Δα.
128. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 4.910764 Δα.
129. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 5.355844 Δα.
130. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 1.907327 Δα.
131. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 2.175743 Δα.
132. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 2.085063 Δα.
133. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 5.262616 Δα.
134. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 1.453141 Δα.
135. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 1.024002 Δα.
136. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.455277 Δα.
137. -2.00 with step -0.0002 (0.4000) converged in 3 iterations. 3.313668 Δα.
138. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 2.977039 Δα.
139. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.608250 Δα.
140. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 1.344519 Δα.
141. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.913766 Δα.
142. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.099108 Δα.
143. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.260167 Δα.
144. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.200272 Δα.
145. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.104013 Δα.
146. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.115716 Δα.
147. -2.00 with step 0.0001 (0.4000) converged in 1 iterations. 0.124194 Δα.
148. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.151976 Δα.
149. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 2.945091 Δα.
150. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.241792 Δα.
151. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.382314 Δα.
152. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.600614 Δα.
153. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 1.025990 Δα.
154. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 1.621926 Δα.
155. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 1.849468 Δα.
156. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 2.073964 Δα.
157. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 1.888549 Δα.
158. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.621706 Δα.
159. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 1.328591 Δα.
160. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 5.347036 Δα.
161. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.720205 Δα.
162. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 2.017922 Δα.
163. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 5.256386 Δα.
164. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 5.129042 Δα.
165. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 1.466723 Δα.
166. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 1.130961 Δα.
167. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.895708 Δα.
168. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.546155 Δα.
169. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.314318 Δα.
170. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.378795 Δα.
171. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.502589 Δα.
172. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.838275 Δα.
173. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.780361 Δα.
174. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.168876 Δα.
175. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.238243 Δα.
176. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.136289 Δα.
177. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.130305 Δα.
178. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.175493 Δα.
179. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.185224 Δα.
180. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.195700 Δα.
181. -2.00 with step -0.0001 (0.4000) converged in 1 iterations. 0.178064 Δα.
182. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.216634 Δα.
183. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.267210 Δα.
184. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.372337 Δα.
185. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.541007 Δα.
186. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.897060 Δα.
187. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 3.067538 Δα.
188. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 1.862742 Δα.
189. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.803302 Δα.
190. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 4.525403 Δα.
191. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 4.909727 Δα.
192. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 5.324605 Δα.
193. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 1.905299 Δα.
194. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 2.195092 Δα.
195. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 2.113529 Δα.
196. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 5.244142 Δα.
197. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 1.451138 Δα.
198. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 1.022662 Δα.
199. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.460387 Δα.
200. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.306712 Δα.
201. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.435001 Δα.
202. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.619990 Δα.
203. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 1.373285 Δα.
204. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.922205 Δα.
205. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.100858 Δα.
206. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.262259 Δα.
207. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.202511 Δα.
208. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.105663 Δα.
209. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.117448 Δα.
210. -2.00 with step 0.0001 (0.4000) converged in 1 iterations. 0.125890 Δα.
211. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.153877 Δα.
212. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.177440 Δα.
213. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.243261 Δα.
214. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.383208 Δα.
215. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.605624 Δα.
216. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 3.756059 Δα.
217. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 1.626209 Δα.
218. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 1.854534 Δα.
219. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 2.079789 Δα.
220. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 1.873994 Δα.
221. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.590003 Δα.
222. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 4.341303 Δα.
223. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 5.339982 Δα.
224. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.722620 Δα.
225. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 2.010879 Δα.
226. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 2.053761 Δα.
227. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 5.157388 Δα.
228. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 1.469238 Δα.
229. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 1.132641 Δα.
230. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.896862 Δα.
231. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.546252 Δα.
232. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.312097 Δα.
233. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.374227 Δα.
234. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.496130 Δα.
235. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.824289 Δα.
236. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.792298 Δα.
237. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.165541 Δα.
238. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.232864 Δα.
239. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.131623 Δα.
240. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.126731 Δα.
241. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.171536 Δα.
242. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.181203 Δα.
243. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.191024 Δα.
244. -2.00 with step -0.0001 (0.4000) converged in 1 iterations. 0.173864 Δα.
245. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.212372 Δα.
246. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.263462 Δα.
247. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.370257 Δα.
248. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.539567 Δα.
249. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.830108 Δα.
250. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 3.245590 Δα.
251. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 1.832746 Δα.
252. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.723493 Δα.
253. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 4.537259 Δα.
254. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 4.911042 Δα.
255. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 5.370586 Δα.
256. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 1.908326 Δα.
257. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 2.166496 Δα.
258. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 2.071436 Δα.
259. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 5.271487 Δα.
260. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 1.454104 Δα.
261. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 1.024647 Δα.
262. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.448703 Δα.
263. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 3.318579 Δα.
264. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.476675 Δα.
265. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.607937 Δα.
266. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 1.346402 Δα.
267. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.915801 Δα.
268. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.100059 Δα.
269. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.261735 Δα.
270. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.202249 Δα.
271. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.105549 Δα.
272. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 0.117358 Δα.
273. -2.00 with step 0.0001 (0.4000) converged in 1 iterations. 0.125812 Δα.
274. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.153798 Δα.
275. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.177367 Δα.
276. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 0.243200 Δα.
277. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.383171 Δα.
278. -2.00 with step 0.0002 (0.4000) converged in 2 iterations. 0.604959 Δα.
279. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 3.757210 Δα.
280. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 1.625906 Δα.
281. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 1.854181 Δα.
282. -2.00 with step 0.0000 (0.4000) converged in 2 iterations. 2.079384 Δα.
283. -2.00 with step 0.0000 (0.4000) converged in 1 iterations. 1.870766 Δα.
284. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.590194 Δα.
285. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 4.341233 Δα.
286. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 5.339436 Δα.
287. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.722833 Δα.
288. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 2.011211 Δα.
289. -2.00 with step -0.0000 (0.4000) converged in 2 iterations. 2.049751 Δα.
290. -2.00 with step 0.0001 (0.4000) converged in 2 iterations. 5.160043 Δα.
291. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 1.469472 Δα.
292. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 1.132798 Δα.
293. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.896970 Δα.
294. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.546262 Δα.
295. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.311891 Δα.
296. -2.00 with step -0.0002 (0.4000) converged in 2 iterations. 0.373803 Δα.
297. -2.00 with step -0.0001 (0.4000) converged in 2 iterations. 0.495531 Δα.
298. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.822993 Δα.
299. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 1.793441 Δα.
300. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.165226 Δα.
301. -2.00 with step -0.0000 (0.4000) converged in 1 iterations. 0.232354 Δα.

Plotting

Here again, we visualize the harmonic contents. Unlike the previous example, a very clear non-smooth behavior can be noticed here. It is only near the resonance, when amplitude is large, where the higher harmonics show up. At other frequencies, the higher harmonics are all zero.

his = [1, 3, 5];

fsz = 24;
fig = Figure(fontsize=fsz, size=(1000, 600));

ax1s = [];
ax2s = [];
for i in eachindex(his[his.<=maximum(h)])
    ax = Axis(fig[1, i],
        ylabel=L"$H_%$(his[i])$ Response (m)", yscale=log10);
    scatterlines!(ax, Oms, abs.(uh[his[i].+1, :]));
    push!(ax1s, ax)

    ax = Axis(fig[2, i], xlabel=L"Excitation Frequency $\Omega$",
        ylabel=L"$H_%$(his[i])$ Phase (rad)");
    scatterlines!(ax, Oms, unwrap(angle.(uh[his[i].+1, :])));
    push!(ax2s, ax)
end
linkxaxes!(vcat(ax1s, ax2s)...)

    fig
Example block output

Outro

This is yet another example of using the utility functions in HARMONIC for conducting harmonic balance. Looking at Example b1 and this, it must be clear that a lot of the "setup" that has to be done for any given system is very similar. So it makes sense to have a unified interface which constructs the different residue functions for a given system with its nonlinearity. This is precisely what the MDOFUTILS module sets out to do.


This page was generated using Literate.jl.