1 Introduction

Beams resting on elastic foundations have broad applications in civil, hydraulic, bridge, biomechanical, and many other engineering fields. The analysis of beams on an elastic foundation mostly adopts the Winkler foundation model, where the force between the foundation and beam is assumed to be proportional to the deflection of the beam. Initially proposed by Winkler, the general approach typically uses beams to simulate the response of train rails supported by spring and dashpot elements that represent the combined effect of various track components and the ground. Similar applications in engineering include railroad tracks [1,2,3] and continuously supported columns and beams [4, 5]. On the other hand, microbeams interacting with elastic foundations are widely used in the core structure of sensors, brakes, and micro-electro-mechanical systems (MEMS) [6,7,8,9] with inescapable nonlinear factors such as surface effect and frictions [10]. The actual elastic foundation is a complex discrete system with multiphase and random characteristics. Its mechanical properties [11, 12] are not determined by a single parameter but are closely related to the nature of other coexisting properties. The stress–strain relationship of the foundation under external loading is usually characterized by nonlinearity, irreversibility, and evolutionary, exhibiting obvious anisotropy and nonuniformity that render the linear model inadequate in certain occasions.

In engineering analysis, models of elastic foundations can be categorized into linear and nonlinear models. Nonlinear foundation problems pose challenges due to difficult-to-solve nonlinear differential equations and large parameters representing strong nonlinearities that are tough to analyze in most practical problems. Recently, to solve nonlinear differential equations arising from vibrations and wave propagation in elastic structures and solids with nonlinear characteristics, the extended Galerkin method (EGM) and extended Rayleigh–Ritz method (ERRM) have been suggested and validated for certain typical problems [13]. In the process, it is found that the traditional methods for solving typical linear problems in solid mechanics can also be used to solve nonlinear problems effectively. Specifically, the Galerkin method, widely used as an approximate method to analyze linear problems in static and dynamic deformations, can also be used for nonlinear problems, an approach that has recently been demonstrated in several papers [14,15,16]. For nonlinear vibrations, the time factor is considered through the weighted integration over one period with the periodic solutions by introducing the extended Galerkin method [13]. The Rayleigh–Ritz method, which is equivalent to the Galerkin method in most cases, has also been generalized to solve a number of nonlinear vibration problems and has yielded good approximate results [17, 18]. In summary, the Galerkin method can be employed to investigate some nonlinear static problems commonly encountered and studied in engineering applications, offering an alternative solution technique. This study demonstrates the procedure and techniques for addressing similar problems by solving the resulting nonlinear algebraic equations, which are no longer a challenge with powerful symbolic mathematical software tools.

2 Bending of Elastic Beams on a Nonlinear Winkler Foundation

In Fig. 1, the displacement in a beam on a Winker foundation is determined solely by the resistance force at each point, treating the foundation as a composition of many non-interacting independent springs and disregarding shear stress of the foundation for simplicity. As a result, the deformation of the foundation will only occur at the contact point, without extending further, which is obviously inconsistent with the actual situation. However, because of the simplicity of the foundation model, the small number of model parameters, and the accumulation of relatively rich experiences in estimating foundation modulus \(K\) in actual engineering calculation, as long as the value of \(K\) is properly selected, this model remains widely used in engineering design. Initially, the distributed resistance force on the beam with a linear foundation is given as

$$\begin{array}{c}R=Kw\end{array}$$
(1)

where \(R, K,\text{ and }w\) are the resistance force, stiffness coefficient of the foundation, and deflection of the beam, respectively.

Fig. 1
figure 1

A simply-supported beam on a winkler foundation

The deflection of the beam is an important variable to evaluate the performance and deformation of the structure and directly affects the stress state of the structure. Because the traditional linear Winkler foundation model cannot take into account the nonlinear effect of the foundation, there are some inevitable and noticeable errors in the structural deflection analysis. In order to evaluate the deflection response of the structure more accurately, the nonlinear Winkler foundation model has been introduced in practical problems. The nonlinear beam model was shown by Chen et al. [19] according to the equilibrium equation of the element, and a fourth-order differential equation can be obtained for the deflection of the beam as

$$\begin{array}{c}EI\frac{{\text{d}}^{4}w}{\text{d}{x}^{4}}=-R\end{array}$$
(2)

where \(EI\) is bending stiffness.

For a nonlinear foundation, the distributed resistance force \(R\) can be better expressed as [20]

$$\begin{array}{c}R={k}_{1}w+{k}_{2}{w}^{2}+{k}_{3}{w}^{3}+\dots +{k}_{n}{w}^{n}\end{array}$$
(3)

From an earlier study by Long [21], the simple bending of a nonlinear beam on a nonlinear foundation is demonstrated with

$$\begin{array}{c}EI\frac{{\text{d}}^{4}w}{\text{d}{x}^{4}}+\alpha w+\beta {w}^{3}=f\end{array}$$
(4)

where \(\alpha \) and \(\beta \) are the coefficients related to the properties of the foundation, and \(f\) is the distributed load on the beam. For convenience, the dimensionless variable \(\xi \) and parameter \(\varphi \) are introduced as [21]

$$\begin{array}{c}\xi =\frac{x}{l},\varphi =\frac{EI}{{l}^{4}}w\end{array}$$
(5)

where \(x\) is the length coordinate and \(l\) is the length of the beam, respectively. By substituting the dimensionless variable \(\xi \) and the parameter \(\varphi \) into Eq. (4), it can be rewritten as

$$ \begin{array}{*{20}c} {\frac{{{\text{d}}^{4} \upvarphi }}{{\text{d}\xi^{4} }} + \frac{{\alpha l^{4} }}{EI}\varphi + \beta \left( {\frac{{l^{4} }}{EI}} \right)^{3} \varphi^{3} = f} \\ \end{array} $$
(6)

Furthermore, it is assumed that [21]

$$\begin{array}{c}\frac{{l}^{4}}{EI}=\frac{1}{\alpha } ,\beta {\left(\frac{{l}^{4}}{EI}\right)}^{3}=\varepsilon \end{array}$$
(7)

then Eq. (6) can be reformulated as

$$\begin{array}{c}\frac{{\text{d}}^{4}\varphi }{\text{d}{\xi }^{4}}+\varphi +\varepsilon {\varphi }^{3}=f\end{array}$$
(8)

Equation (8) is the nonlinear differential equation for the deflection of the beam on a nonlinear foundation which will be solved by the Galerkin method for an approximate solution. Of course, that equation can be extended with the inclusion of the inertial term for the dynamic analysis as well. Furthermore, the equation can be modified to include many other nonlinear factors such as the variable stiffness through material grading and changes in cross-section. The problem to be solved in this study with Eq. (8) is from a beam with uniform stiffness and cross-section for simplicity.

3 Solving the Nonlinear Bending Problem with the Galerkin Method

The Galerkin method is a popular and powerful approximate technique which provides approximate solutions to linear differential equations, as widely known from textbooks. Recently, it has been demonstrated that nonlinear equations can also be solved using the Galerkin method [13,14,15,16, 22, 23]. In order to realize the process of solving nonlinear differential equations by the Galerkin method, this paper demonstrates the basic assumptions and associated procedures and techniques involved in this approximate method to the nonlinear equations.

In Fig. 1, the left and right ends of the beam are simply-supported, so the boundary conditions are symmetric. The external load on the beam is a uniform one, so the deflection curve of the beam is also symmetric. The boundary conditions of the beam are

$$\begin{array}{c}\varphi =0,\frac{{\text{d}}^{2}\varphi }{\text{d}{\xi }^{2}}=0 \,\text{at}\, \xi =\text{0,1}\end{array}$$
(9)

Assuming that the solution of the nonlinear differential equation (Eq. (8)) is a trigonometric series with the boundary conditions satisfied, the deflection of the beam will be expressed as

$$ \begin{array}{*{20}c} {\varphi \left( \xi \right) = \mathop \sum \limits_{n = 1}^{N} A_{n} \sin \left( {2n - 1} \right)\xi \pi ,n = 1,2,3, \ldots , N} \\ \end{array} $$
(10)

where \({A}_{n}\) are amplitudes to be determined.

With the solution assumption of Eq. (10), applying the Galerkin method to Eq. (8) will yield

$$ \begin{array}{*{20}c} {\mathop \int \limits_{0}^{1} \left\{ {\mathop \sum \limits_{n = 1}^{N} A_{n} \left( {2n - 1} \right)^{4} \pi^{4} \sin \left( {2n - 1} \right)\xi \pi + \mathop \sum \limits_{n = 1}^{N} A_{n} \sin \left( {2n - 1} \right)\xi \pi } \right.} \\ {\left. { + \varepsilon \left[ {\mathop \sum \limits_{n = 1}^{N} A_{n} \sin \left( {2n - 1} \right)\xi \pi } \right]^{3} - f} \right\}\sin \left( {2n - 1} \right)\xi \pi \text{d}\xi = 0} \\ \end{array} $$
(11)

By evaluating the above integration with different integers \(n\), a set of N nonlinear algebraic equations can be obtained for the coefficients \({A}_{n}\left(n=1, 2, 3, \cdots , N\right)\). With the selected parameter \(N\), the system of nonlinear algebraic equations of unknown amplitudes \({A}_{n}\) can be solved simultaneously. Alternatively, another method is to solve for the coefficients by an iterative method for a continuous approximation. In this study, both methods have been shown as parts of the solution procedure with the extended Galerkin methods before [13,14,15,16, 22, 23]. To demonstrate the solution procedure of the resulting system of nonlinear algebraic equations later, Eq. (12) will be rewritten as

$$ \begin{array}{*{20}l} {\mathop \int \limits_{0}^{1} \left[ {R_{N} \left( \xi \right) + \varphi \left( \xi \right) + \varepsilon \varphi^{3} \left( \xi \right) - f} \right]\sin \left( {2n - 1} \right)\xi \pi \text{d}\xi = 0} \\ {R_{N} \left( \xi \right) = \mathop \sum \limits_{n = 1}^{N} A_{n} (2n - 1)^{4} \pi^{4} \sin \left( {2n - 1} \right)\xi \pi } \\ \end{array} $$
(12)

where \({R}_{N}\left(\xi \right)\) is used for the simplification of the expressions later on.

With \(N\)=1 and \({\varphi }_{1}\left(\xi \right)={A}_{1}\text{sin}\xi \pi \), Eq. (12) for the first-order approximate solution is

$$\begin{array}{c}{\int }_{0}^{1}\left[{A}_{1}{\pi }^{4}\text{sin}\xi \pi +{A}_{1}\text{sin}\xi \pi +\varepsilon {\left({A}_{1}\text{sin}\xi \pi \right)}^{3}-f\right]\text{sin}\xi \pi \text{d} \xi =0\end{array}$$
(13)

From the integration of Eq. (13), the nonlinear equation with the coefficient \({A}_{1}\) will be

$$\begin{array}{c}-\frac{2f}{\pi }+{A}_{1}\left(\frac{1}{2}+\frac{{\pi }^{4}}{2}+\frac{3}{8}{\varepsilon A}_{1}^{2}\right)=0\end{array}$$
(14)

For the above equation, we obtain a solution of \({A}_{1}\) with the parameters \(\varepsilon \) and \(f\). After setting the parameters, the above equation can be easily solved using symbolic mathematical software tools such as MATLAB® or Mathematica®. Next, we will set the parameters \(\varepsilon =100\) and the transverse uniform load \(f=1\), the amplitude is obtained from Eq. (14) as

$$\begin{array}{c}{A}_{1}=0.012936580920766917\end{array}$$

and the first-order approximate solution of the deflection of the beam is

$$\begin{array}{c}{\varphi }_{1}\left(\xi \right)=0.012936580920766917\text{sin}\xi \pi \end{array}$$
(15)

The first-order solution is compared with the exact solution in the elliptic function by Long [21] in Fig. 2. Obviously, a first-order approximation of only one term is the accurate result of other approximation techniques that require a lot of numerical computation. The advantages of the Galerkin method for the approximate solutions of nonlinear problems are clearly shown here.

Fig. 2
figure 2

The comparison of the first-order approximation with the exact solution

Next, for the second-order approximation with \(N=2\), the approximate solution is assumed as

$$\begin{array}{c}{\varphi }_{2}\left(\xi \right)={A}_{1}\text{sin}\xi \pi +{A}_{2}\text{sin}3\xi \pi \end{array}$$
(16)

and substituting it into Eq. (12) yields

$$\begin{array}{c}{\int }_{0}^{1}\left[{R}_{N}\left(\xi \right)+\varphi \left(\xi \right)+\varepsilon {\varphi }^{3}\left(\xi \right)-f\right]\text{sin}\xi \pi \text{d}\xi =0\\ {\int }_{0}^{1}\left[{R}_{N}\left(\xi \right)+\varphi \left(\xi \right)+\varepsilon {\varphi }^{3}\left(\xi \right)-f\right]\text{sin}3\xi \pi \text{d}\xi =0 \end{array}$$
(17)

Here the deflection \({\varphi }_{2}\left(\xi \right)\) is composed of two terms. A system of nonlinear algebraic equations with coefficients \({A}_{1} \, \text{and} \, {A}_{2}\) is obtained by integrating the Eq. (17) as

$$\begin{array}{l}-\frac{2f}{\pi }+\frac{1}{8}{A}_{1}\left[4\left(1+{\pi }^{4}\right)+3\varepsilon \left({A}_{1}^{2}-{A}_{1}{A}_{2}+2{A}_{2}^{2}\right)\right]=0\\ -\frac{2f}{3\pi }+\frac{1}{8}\left[{\varepsilon A}_{1}\left(6{ A}_{1}{A}_{2}-{A}_{1}^{2}\right)+{A}_{2}\left(4+324{\pi }^{4}+3{\varepsilon A}_{2}^{2}\right)\right]=0 \end{array}$$
(18)

Again, with the same parameters \(\varepsilon =100\, \text{and }f=1\), solving Eq. (18) simultaneously will give the appropriate solutions as

$$\begin{array}{l}{A}_{1}=0.012936587721817345\\ {A}_{2}=0.000053790219344112004 \end{array}$$

By substituting the coefficient \({A}_{1} \,\text{and}\, {A}_{2}\) into Eq. (16), the second-order approximate solution of the deflection of the beam on a nonlinear foundation is obtained as

$$ \begin{aligned} \varphi _{2} \left( \xi \right) = & 0.012936587721817345{\text{sin}}\xi \pi \\ & + 0.0000537902193441120044{\text{sin}}3\xi \pi \\ \end{aligned} $$
(19)

The approximate result of second-order deflection is compared in Fig. 3 with the exact solution in the elliptic function. Clearly, there is no obvious difference between the solutions, implying excellent accuracy of the approximate solutions in this case.

Fig. 3
figure 3

The first-, second-, and third-order approximations in a comparison

Similarly, for the third-order approximation with \(N=3\), the approximate solution is assumed as

$$\begin{array}{c}{\varphi }_{3}\left(\xi \right)={A}_{1}\text{sin}\xi \pi +{A}_{2}\text{sin}3\xi \pi +{A}_{3}\text{sin}5\xi \pi \end{array}$$
(20)

and substituting it into Eq. (12) yields

$$\begin{array}{c}{\int }_{0}^{1}\left[{R}_{N}\left(\xi \right)+\varphi \left(\xi \right)+\varepsilon {\varphi }^{3}\left(\xi \right)-f\right]\text{sin}\xi \pi \text{d}\xi =0\\ {\int }_{0}^{1}\left[{R}_{N}\left(\xi \right)+\varphi \left(\xi \right)+\varepsilon {\varphi }^{3}\left(\xi \right)-f\right]\text{sin}3\xi \pi \text{d}\xi =0\\ {\int }_{0}^{1}\left[{R}_{N}\left(\xi \right)+\varphi \left(\xi \right)+\varepsilon {\varphi }^{3}\left(\xi \right)-f\right]\text{sin}5\xi \pi \text{d}\xi =0\end{array}$$
(21)

Again, with the same parameters \(\varepsilon =100\, \text{and }f=1\), the completion of the integration in Eq. (21) will result in three nonlinear algebraic equations for the amplitudes, and solving these equations will give the approximate solutions of the third-order deflection of the beam as

$$ \begin{aligned} \varphi _{3} \left( \xi \right) = & 0.012936587725919858{\text{sin}}\xi \pi \\ & + 0.00005379022594213314{\text{sin}}3\xi \pi \\ & + 4.182678079241996 \times 10^{{ - 6}} {\text{sin}}5\xi \pi \\ \end{aligned} $$
(22)

The comparison between the exact and approximate solutions of the third-order deflection is shown in Fig. 3.

From the comparison of approximate results of different orders in Fig. 3, the difference between the first-order approximate solution and the exact solution is not significant, and it is actually very close to the exact solution. The curve of the third-order approximation almost coincides with the exact solution even after enlargement in Fig. 3, which demonstrates the high accuracy of the approximate solution.

The approximate solution closely matches the exact solution in the comparison of the deflection curve shown in Fig. 3. The error between the approximate solutions and the exact solution is found to be \(0.3772\%\) for the first-order, \(0.0401\%\) for the second-order, and \(0.0076\%\) for the third-order after rigorous calculations. The discrepancy is minimal, especially with the third-order approximation.

Clearly, by applying the same procedure, more higher-order solutions of the nonlinear differential equations can be obtained. Generally speaking, the accuracy can be improved with the increase of the number of terms in the solution. The procedure of solution is simple and efficient, but care must be taken with numerical solutions to ensure correct selection from multiple roots. It is always a hesitation if it is required to deal with the highly nonlinear equations, even if they are the algebraic ones, then the iterative procedure is another possible choice. In such cases, linear solutions can serve as a reference point for identifying the correct solutions.

4 The Iterative Solution Procedure for the Nonlinear Algebraic Equations

In the previous section, the third-order approximate solutions of coefficients \({A}_{1},{ A}_{2},\) and \({A}_{3}\) are obtained from the system of nonlinear algebraic equations simultaneously, implying the solution method may require a lot of computing time and efforts for a large number of coefficients. Therefore, as an alternative approach, the iterative method to solve the nonlinear equations should be adopted for the approximate solutions in a more simple and efficient procedure with advantages in the computation.

The basic idea of the iterative method is to set an initial value or a group of initial values, and iteratively update the values according to a certain iterative relationship from the equations until the results converge to fixed or convergent values. For the nonlinear equations (Eq. (21)) with three unknowns, first setting \({A}_{2}=0 \, \text{and} \,{A}_{3}=0\), then substituting the first equation with

$$\begin{array}{c}{\int }_{0}^{1}\left[{A}_{1}{\pi }^{4}\text{sin}\xi \pi +{A}_{1}\text{sin}\xi \pi +\varepsilon {\left({A}_{1}\text{sin}\xi \pi \right)}^{3}-f\right]\text{sin}\xi \pi \text{d} \xi =0\end{array}$$
(23)

For the above equation with parameters \(\varepsilon =100 \) and \(f=1\), after integration, the equation for the coefficient of \({A}_{1}\) is obtained as

$$\begin{array}{c}-\frac{2}{\pi }+\frac{1}{2}{A}_{1}\left(1+75{A}_{1}^{2}+{\pi }^{4}\right)=0\end{array}$$
(24)

The solution of \({A}_{1}\) from the above is

$$\begin{array}{c}{A}_{1}=0.012936580920766917\end{array}$$

This is exactly the first-order solution obtained before. This solution will be used for the approximate solution as the initial value of \({A}_{1}\).

Then, continuing the iterative procedure by letting \({A}_{3}=0\) and \({A}_{1}=0.012936580920766917\) and substituting them into the second equation of Eq. (21), the equation for the coefficient \({A}_{2}\) is obtained as

$$\begin{array}{c}-0.21223365332830585+3945.5807385115427{A}_{2}+37.5{A}_{2}^{3}=0\end{array}$$
(25)

similarly, solving the above equation gives the coefficient \({A}_{2}\)

$$\begin{array}{c}{A}_{2}=0.000053790219333474836\end{array}$$

Repeating the iterative procedure with \({A}_{1}=0.012936580920766917\) and \({A}_{2}=0.000053790219333474836\) by substituting them into the second equation of Eq. (21), the equation for the coefficient \({A}_{3}\) is obtained as

$$\begin{array}{c}-0.12732429064745573+30440.85349997721{A}_{3}+37.5{A}_{3}^{3}=0\end{array}$$
(26)

and the solution is

$$\begin{array}{c}{A}_{3}=4.182678079231528\times {10}^{-6}\end{array}$$

Now the first round of the iteration process has been completed, and the values of \({A}_{1},{A}_{2},\text{and }{A}_{3}\) from the first iteration can be used for the second iteration, and the iteration is continued until the values of all coefficients converge to fixed values. Other iteration methods can also be used here by simply substituting the corresponding iteration relations. In this paper, the number of iterations is actually very small, and the values of the coefficients after the completion of the iteration are

$$\begin{array}{l}{A}_{1}=0.012936587725898969\\ {A}_{2}=0.000053790225941725126\\ {A}_{3}=4.182678079242707\times {10}^{-6}\end{array}$$

The details of the convergent process in this calculation are shown in Table 1.

Table 1 The values of the coefficients during the iteration process

As shown in Table 1, with the increase of iteration steps, the resulting values will quickly converge. The values of convergent coefficients obtained by the iterative method is very close to the values of coefficients obtained by directly solving the equations simultaneously in the previous section, and the differences in the process are negligible. Of course, the differences depend on the equations and may not always lead to stable and rapid convergence. The choice of the solution technique should be made with the consideration of the equations, algorithm implementation, and available resources. The two methods used in this study yield consistent and mutually verified coefficients. In other words, they are both reliable for solving nonlinear problems.

5 Conclusion and Discussion

With the Galerkin method, the deformation of an elastic beam on a nonlinear Winkler foundation is analyzed by solving the nonlinear algebraic equations through a standard procedure and an iterative procedure. The Galerkin method is fully proven with the accurate results of the deflection in agreement with the exact solution in the elliptic function. As generally known, the greatest challenge in the solution process is finding the solutions of the nonlinear algebraic equations, which are not encountered in linear problems. In many approximate techniques for nonlinear problems, linearization is always the first choice of the solution strategy at the expense of computing time and manipulation of variables and expressions. Furthermore, the convergence is usually slow. By dealing with the nonlinear equations directly, the main challenge is the solution of the system on nonlinear algebraic equations. It is tough, but current sophistication in symbolic computation makes the solution process with a limited number of equations easy and simple. Although an example of a single equation is discussed, the procedure and algorithm can be extended to problems with many equations or higher-order solutions commonly seen in studies and applications. Of course, two approaches, both direct solving and iteration, have been utilized and verified with this example. It is also advisable that both approaches are employed in the analysis for verification purposes.

As is explained, the Galerkin method is used to solve nonlinear problems after knowing that the extended Galerkin method can be used for solving nonlinear vibration problems recently. The same core challenge encountered in the solution process is the solution of the nonlinear algebraic equations, and it is suggested that the trial solutions are sought in the vicinity of the linear solutions. Now it is clear that the solution procedure has been successful for both dynamic and static problems. It is also shown that the Galerkin method is truly a powerful technique applicable to linear, nonlinear, dynamic, and static problems, provided that the solutions of the resulting algebraic equations can be solved systematically and accurately. It is hoped that this conviction is an inspiration to seek simple solution techniques for nonlinear problems arising from many scientific and engineering fields with the Galerkin method, as it is fully demonstrated with the nonlinear Winkler foundation problem.