1 Introduction

Nonlinear differential equations have been widely applied to describe physical phenomena in many scientific fields, such as physics, electronics and other engineering and applied sciences. For hundreds of years, scientists have been studying both the exact and numerical solutions of nonlinear problems [1,2,3,4]. Due to the inaccuracy of numerical solutions, especially when we encounter very sensitive problems such as chaos, exact solutions have important applications. Accurate solutions can also help us better understand physical phenomena and models. Therefore, finding the exact solutions is of great significance.

A shallow water wave (or long wave) is considered a nonlinear dynamic system with wavelength much longer than its depth. It is widely used to describe nonlinear phenomena in the atmosphere and ocean. In order to describe and study the related nonlinear problems, the KdV equation [5] has been established. However, in some situations, the modified KdV equation should be applied when we discuss the effect of surface tension. But in some conditions such as internal solitary waves in a two-layer fluid with surface tension where the KdV and mKdV equation are not valid at some thickness ratios, we need to combine the KdV equation and mKdV, namely study the Gardner equation, which takes the surface tension on solitary waves in a two-layer (stratified) fluid [6] into consideration. The one-dimensional variable-coefficient Gardner equation

$$ u_{t}+a(t) u_{x}+ b(t) u^{2} u_{x}+ c(t) u_{xxx}=0, $$
(1)

where \(a(t)\), \(b(t)\), \(c(t)\) are nonzero arbitrary functions, was proposed to describe internal solitary waves that occur in coastal areas with inhomogeneous media and boundary, such as the northwest continental shelf of Australia and the Baltic Sea [7, 8]. In this paper, the trial equation method [9,10,11,12,13,14] and the complete discrimination system for polynomial method [15,16,17,18,19,20] are applied to the generalized \((1+1)\) dimensional Gardner equation with variable coefficients. In order to ensure the existence of the solutions, the concrete examples of specific parameters are given.

In real life applications, most nonlinear differential equations (or systems of differential equations) contain arbitrary functions of dependent variables and their derivatives. Extensive studies have been conducted by using various numerical and analytical methods for the various forms of equations that emerge. However, these approaches may involve approximate solutions [21]. In recent years, many useful methods have been put forward, such as direct method [22], improved tanh–coth method [23], and so on. However, few methods can get all the traveling wave solutions to the nonlinear equations. So Liu proposed the trial equation method and the complete discrimination system for polynomial method. By these two methods, many difficult problems have been solved [24]. According to [10], we can see that, by taking a special traveling wave transformation

$$ u(x,y,\dots,t)=\phi (\xi ),\qquad \xi =\kappa _{1}(t) x+ \kappa _{2}(t) y+ \cdots +\omega (t), $$
(2)

we can actually reduce the nonlinear differential equation with variable coefficients

$$ \varPsi (t,x,y,u,u_{x},u_{y},\dots )=0, $$
(3)

to the nonlinear ordinary equation

$$ \psi \bigl(t,x,y,k_{1},k_{2},\omega u, u', u'', \dots \bigr)=0. $$
(4)

Then, by taking the following trial equation:

$$ \bigl(u'\bigr)^{2}=F(u), $$
(5)

and substituting Eq. (5) into Eq. (4), an ordinary equation system is obtained, and the trial function \(F(u)\) could be a polynomial, rational function, or some other irrational function. Upon getting the trial equation, we can obtain the integral form of the original equation as

$$ \pm (\xi -\xi _{0})= \int \frac{d\phi }{\sqrt{G(\phi )}}, $$
(6)

where \(\xi _{0}\) is an integral constant. Then we can obtain the classification of all traveling wave solutions to Eq. (6). For example, Yang applied Liu’s methods to the Gerdjikov–Ivanov model, and the classification of the single traveling wave solutions was obtained [24].

2 The classification of traveling wave solutions to \((1+1)\) dimensional Gardner equation with variable coefficients

To find the classification of traveling wave solutions to \((1+1)\) dimensional Gardner equation with variable coefficients, we set

$$ u(x,t)=\phi (\xi ),\qquad \xi =\kappa (t) x+\omega (t), $$
(7)

where \(\kappa (t)\), \(\omega (t)\) represent nonzero arbitrary functions. Substituting Eq. (7) into Eq. (1) yields

$$ \bigl(\kappa '(t) x+\omega '(t)\bigr)\phi '+a(t)\kappa (t)\phi \phi '+b(t) \kappa (t)\phi ^{2}\phi '+c(t) \kappa ^{3}(t)\phi '''=0. $$
(8)

Now we assume that \((\phi ')^{2}\) is equal to a polynomial function, namely

$$ \bigl(\phi '\bigr)^{2}=a_{n}\phi ^{n}+a_{n-1}\phi ^{n-1}+\cdots +a_{1}\phi +a_{0}, $$
(9)

and, via the balance principle, we get \(n=4\), so

$$ \bigl(\phi '\bigr)^{2}=a_{4}\phi ^{4}+a_{3}\phi ^{3}+a_{2}\phi ^{2}+a_{1}\phi +a _{0}. $$
(10)

Then taking derivatives on both sides of Eq. (10), we have

$$ \phi '''=6a_{4} \phi ^{2}\phi '+3a_{3}\phi \phi '+a_{2}\phi '. $$
(11)

Substituting (11) into (8), we get

$$\begin{aligned} &\frac{d\kappa (t)}{dt}x+\frac{d\omega (t)}{dt}+a_{2}c(t)\kappa ^{3}(t)=0, \end{aligned}$$
(12)
$$\begin{aligned} &a(t)\kappa (t)+3a_{3}c(t)\kappa ^{3}(t)=0, \end{aligned}$$
(13)
$$\begin{aligned} &b(t)\kappa (t)+6a_{4}c(t)\kappa ^{3}(t)=0. \end{aligned}$$
(14)

Actually, this system of equations is not solvable. So we must impose some restrictions on it. Setting \(a_{3} = 2b_{1}a_{4}\), where \(b_{1}\) is a constant, we have

$$\begin{aligned} &a(t)=b_{1}b(t), \end{aligned}$$
(15)
$$\begin{aligned} &\frac{d\kappa (t)}{dt}x=0, \end{aligned}$$
(16)
$$\begin{aligned} &\frac{d\omega (t)}{dt}=-\frac{b(t)\kappa (t)}{6a_{4}}. \end{aligned}$$
(17)

So we get \(\kappa (t)=const\), and by setting \(\kappa (t)=\kappa \), we obtain

$$ \omega (t)=- \int \frac{\kappa b(t)}{6a_{4}}\,dt. $$
(18)

Let

$$ \varPhi =(a_{4})^{\frac{1}{4}} \biggl(\phi + \frac{b_{1}}{2}\biggr),\qquad \xi _{1}=(a _{4})^{\frac{1}{4}} \xi, $$
(19)

then Eq. (10) is deformed into

$$ \varPhi ^{2}_{\xi _{1}}=\varPhi ^{4}+p \varPhi ^{2}+q \varPhi +r, $$
(20)

where

$$\begin{aligned} &p=\frac{a_{2}-\frac{3}{2}{b_{1}}^{2} a_{4}}{\sqrt{a_{4}}}, \end{aligned}$$
(21)
$$\begin{aligned} &q=\frac{a_{1}+a_{4} {b_{1}}^{3}-a_{2} b_{1}}{\sqrt[4]{a_{4}}}, \end{aligned}$$
(22)
$$\begin{aligned} &r=a_{0}-\frac{1}{2}a_{1} b_{1}+ \frac{1}{4}a_{2} {b_{1}}^{2}- \frac{3}{16}a_{4} {b_{1}}^{4}. \end{aligned}$$
(23)

So we have

$$ \pm (\xi _{1}-\xi _{0})= \int \frac{d\varPhi }{\sqrt{\varPhi ^{4}+p\varPhi ^{2}+q \varPhi +r}}. $$
(24)

Then the corresponding complete discrimination system is presented as [11]

$$ \begin{aligned} &D_{1}=4,\qquad D_{2}=-p,\qquad D_{3}=-2p^{3}+8pr-9q^{2}, \qquad E_{2}=9q^{2}-32pr, \\ &D_{4}=-p^{3}q^{2}+4p^{4}r+36pq^{2}-32p^{2}r^{2}- \frac{27}{4}q^{4}+64r ^{3}. \end{aligned} $$
(25)

For the purpose of solving Eq. (24), the solutions of the complete discrimination system of the fourth order polynomial in nine cases are discussed separately.

Case 1. \(D_{4}=0\), \(D_{3}=0\), \(D_{2}=0\). In this case \(G(\varPhi )\) has a root of multiplicity 4, i.e., \(p=0\), \(q=0\), \(r=0\), and then Eq. (20) is presented by

$$ G(\varPhi )=\varPhi ^{4}. $$
(26)

Therefore, by using Eq. (24), we have

$$ \varPhi =-(\xi _{1}-\xi _{0})^{-1}, $$
(27)

where \(\xi _{0}\) is an integral constant. The solutions of Eq. (10) can be shown to be

$$ \phi (\xi )=\mp a_{4}^{-\frac{1}{4}}\bigl(a_{4}^{\frac{1}{4}} \xi -\xi _{0}\bigr)^{-1}-\frac{b _{1}}{2}. $$
(28)

For example, when \(a_{4}=1\), \(\kappa =-6\), \(b_{1}=1\), \(b(t)=t+1\), we get \(\omega (t)=\frac{1}{2} t^{2}+t+c\), and setting \(c=0\), we can get the solution of Eq. (1) as

$$ u(x,t)=-\biggl(-6x+\frac{1}{2}t^{2}+t-\xi _{0}\biggr)^{-1}-\frac{1}{2}. $$
(29)

Case 2. \(D_{4}=0\), \(D_{3}=0\), \(D_{2}<0\). This time \(G(\varPhi )\) has a pair of conjugate complex roots of multiplicity 2, i.e.,

$$ G(\varPhi )=\bigl((\varPhi -l)^{2}+m^{2} \bigr)^{2}, $$
(30)

where \(m>0\). By using Eq. (24), we can obtain

$$ \varPhi =m\tan {m(\xi _{1}-\xi _{0})}+l, $$
(31)

which is a rational solution. So the solutions of Eq. (10) can be shown to be

$$ \phi (\xi )=\pm a_{4}^{-\frac{1}{4}}m\tan \bigl(m \bigl(a_{4}^{\frac{1}{4}} \xi -\xi _{0}\bigr)\bigr)- \frac{b_{1}}{2}. $$
(32)

For instance, when \(a_{4}=1\), \(\kappa =-6\), \(b_{1}=1\), \(b(t)=t+1\), \(p=2\), we have \(\omega (t)=\frac{1}{2} t^{2}+t+c\), and setting \(c=0\), we obtain the solution of Eq. (1) as

$$ u(x,t)=\tan \biggl(-6x+\frac{1}{2} t^{2}+t-\xi _{0}\biggr)-\frac{1}{2}. $$
(33)

Case 3. \(D_{4}=0\), \(D_{3}=0\), \(D_{2}>0\), \(E_{2}=0\). Now \(G(\varPhi )\) has a real root of multiplicity 3 and a real root of multiplicity 1. Thus we have

$$ G(\varPhi )=(\varPhi -l)^{3}(\varPhi -m). $$
(34)

When \(\varPhi >l\), \(\varPhi >m\) or \(\varPhi < l\), \(\varPhi < m\), the solution of Eq. (24) is

$$ \varPhi =\frac{4(l-m)}{(m-l)^{2}(\xi _{1}-\xi _{0})^{2}-4}+l, $$
(35)

where the expression (35) is a rational solution. So we can obtain the solutions of Eq. (10) as

$$ \phi (\xi )=\pm \frac{4 a_{4}^{-\frac{1}{4}}(l-m)}{(m-l)^{2}(a_{4} ^{\frac{1}{4}}\xi -\xi _{0})^{2}-4}+l-\frac{b_{1}}{2}. $$
(36)

For example, when \(a_{4}=1\), \(\kappa =-6\), \(b_{1}=1\), \(b(t)=t+1\), we get \(\omega (t)=\frac{1}{2} t^{2}+t+c\), and setting \(l=1\), \(m=-3\), \(c=0\), the solution of Eq. (1) is given by

$$ u(x,t)=\frac{4}{4(-6x+\frac{1}{2}t^{2}+t-\xi _{0})^{2}-1}+\frac{1}{2}. $$
(37)

Case 4. \(D_{4}=0\), \(D_{3}=0\), \(D_{2}>0\), \(E_{2}>0\). Here \(G(\varPhi )\) has two real roots of multiplicity 2, namely

$$ G(\varPhi )=(\varPhi -l)^{2}(\varPhi -m)^{2}, $$
(38)

where \(l>m\). When \(\varPhi >l\) or \(\varPhi < m\), we can obtain the solution as

$$ \varPhi =\frac{m-l}{e^{(l-m)(\xi _{1}-\xi _{0})}-1}+m=\frac{m-l}{2}\biggl[\coth \frac{(l-m)(\xi _{1}-\xi _{0})}{2}-1\biggr]+m. $$
(39)

Then we can get the solution of Eq. (10) as

$$ \phi (\xi )=\frac{(m-l) a_{4}^{-\frac{1}{4}}}{2}\biggl[\coth \frac{(l-m)(a _{4}^{\frac{1}{4}}\xi -\xi _{0})}{2}-1 \biggr]+m-\frac{b_{1}}{2}, $$
(40)

and, when \(m<\varPhi <l\), we have the solution as

$$ \varPhi =\frac{m-l}{-e^{(l-m)(\xi _{1}-\xi _{0})}-1}+m=\frac{m-l}{2}\biggl[ \tanh \frac{(l-m)(\xi _{1}-\xi _{0})}{2}-1\biggr]+m. $$
(41)

Similarly for

$$ \phi (\xi )=\frac{(m-l) a_{4}^{-\frac{1}{4}}}{2}\biggl[\tanh \frac{(l-m)(a _{4}^{\frac{1}{4}}\xi -\xi _{0})}{2}-1 \biggr]+m-\frac{b_{1}}{2}. $$
(42)

For instance, when \(a_{4}=1\), \(\kappa =-6\), \(b_{1}=1\), \(b(t)=t+1\), \(p=-2\), we have \(\omega (t)=\frac{1}{2} t^{2}+t+c\), and setting \(c=0\), and \(\varPhi >1\) or \(\varPhi <-1\), we can get the solution as follows:

$$ u(x,t)=\coth \biggl(-6x+\frac{1}{2}t^{2}+t-\xi _{0}\biggr)-\frac{1}{2}. $$
(43)

Case 5. \(D_{4}>0\) and \(D_{2}>0\), \(D_{3}>0\). This time \(G(\varPhi )\) has four distinct real roots, namely

$$ G(\varPhi )=(\varPhi -\alpha _{1}) (\varPhi -\alpha _{2}) (\varPhi -\alpha _{3}) ( \varPhi -\alpha _{4}), $$
(44)

where \(\alpha _{1}\), \(\alpha _{2}\), \(\alpha _{3}\), \(\alpha _{4}\) are real numbers, and \(\alpha _{1}>\alpha _{2}>\alpha _{3}>\alpha _{4}\). If \(\varPhi >\alpha _{1}\) or \(\varPhi <\alpha _{4}\), then we take the following transformation:

$$ \varPhi =\frac{\alpha _{2}(\alpha _{1}-\alpha _{4})\sin ^{2}\theta -\alpha _{1}(\alpha _{2}-\alpha _{4})}{(\alpha _{1}-\alpha _{4})\sin ^{2}\theta -( \alpha _{2}-\alpha _{4})}; $$
(45)

if \(\alpha _{3}<\varPhi <\alpha _{2}\), we similarly use

$$ \varPhi =\frac{\alpha _{4}(\alpha _{2}-\alpha _{3})\sin ^{2}\theta -\alpha _{3}(\alpha _{2}-\alpha _{4})}{(\alpha _{2}-\alpha _{3})\sin ^{2}\theta -( \alpha _{2}-\alpha _{4})}. $$
(46)

Substituting (45) or (46) into Eq. (24), we get

$$\begin{aligned} \xi _{1}-\xi _{0} &= \int \frac{d\varPhi }{\sqrt{(\varPhi -\alpha _{1})(\varPhi - \alpha _{2})(\varPhi -\alpha _{3})(\varPhi -\alpha _{4})}} \\ &=\frac{2}{\sqrt{(\alpha _{1}-\alpha _{3})(\alpha _{2}-\alpha _{4})}} \int \frac{d\theta }{\sqrt{1-m^{2}\sin ^{2}\theta }}, \end{aligned}$$
(47)

where \(m^{2}=\frac{(\alpha _{1}-\alpha _{4})(\alpha _{2}-\alpha _{3})}{( \alpha _{1}-\alpha _{3})(\alpha _{2}-\alpha _{4})}\). By using Eq. (47) and the definition of Jacobi elliptic sine function [25], we have

$$ \sin \theta =\operatorname {sn}\biggl(\frac{\sqrt{(\alpha _{1}-\alpha _{3})(\alpha _{2}- \alpha _{4})}}{2}(\xi _{1}-\xi _{0}),m\biggr). $$
(48)

Combining Eq. (48) with the expressions (45) and (46), we obtain the solution of Eq. (24) with corresponding conditions

$$ \varPhi =\frac{\alpha _{2}(\alpha _{1}-\alpha _{4})\operatorname {sn}^{2}(\frac{\sqrt{( \alpha _{1}-\alpha _{3})(\alpha _{2}-\alpha _{4})}}{2}(\xi _{1}-\xi _{0}),m)- \alpha _{1}(\alpha _{2}-\alpha _{4})}{(\alpha _{1}-\alpha _{4})\operatorname {sn}^{2}(\frac{\sqrt{( \alpha _{1}-\alpha _{3})(\alpha _{2}-\alpha _{4})}}{2}(\xi _{1}-\xi _{0}),m)-( \alpha _{2}-\alpha _{4})}, $$
(49)

thus we have the solution of Eq. (10) as

$$ \phi (\xi )=\frac{\alpha _{2}(\alpha _{1}-\alpha _{4})a_{4}^{- \frac{1}{4}}\operatorname {sn}^{2}(\frac{\sqrt{(\alpha _{1}-\alpha _{3})(\alpha _{2}- \alpha _{4})}}{2}(a_{4}^{\frac{1}{4}}\xi -\xi _{0}),m)-\alpha _{1}(\alpha _{2}-\alpha _{4})}{(\alpha _{1}-\alpha _{4})\operatorname {sn}^{2}(\frac{\sqrt{( \alpha _{1}-\alpha _{3})(\alpha _{2}-\alpha _{4})}}{2}(a_{4}^{\frac{1}{4}} \xi -\xi _{0}),m)-(\alpha _{2}-\alpha _{4})}-\frac{b_{1}}{2}, $$
(50)

and

$$ \varPhi =\frac{\alpha _{4}(\alpha _{2}-\alpha _{3})\operatorname {sn}^{2}(\frac{\sqrt{( \alpha _{1}-\alpha _{3})(\alpha _{2}-\alpha _{4})}}{2}(\xi _{1}-\xi _{0}),m)- \alpha _{3}(\alpha _{2}-\alpha _{4})}{(\alpha _{2}-\alpha _{3})\operatorname {sn}^{2}(\frac{\sqrt{( \alpha _{1}-\alpha _{3})(\alpha _{2}-\alpha _{4})}}{2}(\xi _{1}-\xi _{0}),m)-( \alpha _{2}-\alpha _{4})}. $$
(51)

Moreover, we have

$$ \phi (\xi )=\frac{\alpha _{4}(\alpha _{2}-\alpha _{3})a_{4}^{- \frac{1}{4}}\operatorname {sn}^{2}(\frac{\sqrt{(\alpha _{1}-\alpha _{3})(\alpha _{2}- \alpha _{4})}}{2}(a_{4}^{\frac{1}{4}}\xi -\xi _{0}),m)-\alpha _{3}(\alpha _{2}-\alpha _{4})}{(\alpha _{2}-\alpha _{3})\operatorname {sn}^{2}(\frac{\sqrt{( \alpha _{1}-\alpha _{3})(\alpha _{2}-\alpha _{4})}}{2}(a_{4}^{\frac{1}{4}} \xi -\xi _{0}),m)-(\alpha _{2}-\alpha _{4})}-\frac{b_{1}}{2}, $$
(52)

where \(m^{2}=\frac{(\alpha _{1}-\alpha _{4})(\alpha _{2}-\alpha _{3})}{( \alpha _{1}-\alpha _{3})(\alpha _{2}-\alpha _{4})}\). Expressions (49)–(52) involve elliptic functions and are double periodic solutions. For example, when \(a_{4}=1\), \(\kappa =-6\), \(b_{1}=1\), \(b(t)=t+1\), we can get \(\omega (t)=\frac{1}{2} t^{2}+t+c\). Setting \(c=0\), if \(p=-5\), \(q=0\), \(r=4\), we have \(\alpha _{1}=2\), \(\alpha _{2}=1\), \(\alpha _{3}=-1\), \(\alpha _{4}=-2\). When \(\varPhi >\alpha _{1}\) or \(\varPhi <\alpha _{4}\), we get the solution

$$ u(x,t)=\frac{4\operatorname {sn}^{2}(\frac{3}{2}(-6x+\frac{1}{2}t^{2}+t-\xi _{0}),\frac{2 \sqrt{2}}{3})-6}{4\operatorname {sn}^{2}(\frac{3}{2}(-6x+\frac{1}{2}t^{2}+t-\xi _{0}),\frac{2 \sqrt{2}}{3})-3}-\frac{1}{2}. $$
(53)

Case 6. \(D_{4}=0\) and \(D_{2}D_{3}<0\). Now \(G(\varPhi )\) has a real root of multiplicity 2 and a pair of conjugate complex roots, i.e.,

$$ G(\varPhi )=(\varPhi -\beta )^{2}\bigl[(\varPhi -l)^{2}+m^{2}\bigr], $$
(54)

where β, l and m are real numbers. By using Eq. (24), we can get

$$\begin{aligned} \pm (\xi _{1}-\xi _{0})&= \int \frac{d\varPhi }{(\varPhi -\beta )\sqrt{( \varPhi -l)^{2}+m^{2}}} \\ &=\frac{1}{\sqrt{(\beta -l)^{2}+m^{2}}}\ln \biggl\vert \frac{ \epsilon \varPhi +\eta -\sqrt{(\varPhi -l)^{2}+m^{2}}}{\varPhi -\beta } \biggr\vert , \end{aligned}$$
(55)

where

$$ \begin{aligned} &\epsilon =\frac{\beta -2l}{\sqrt{(\beta -l)^{2}+m^{2}}}, \\ &\eta =\sqrt{(\beta -l)^{2}+m^{2}}-\frac{\beta (\beta -2l)}{\sqrt{( \beta -l)^{2}+m^{2}}}. \end{aligned} $$
(56)

Correspondingly we have the solution of Eq. (24) as

$$ \varPhi =\frac{(e^{\pm \sqrt{(\beta -l)^{2}+m^{2}}(\xi _{1}-\xi _{0})}- \epsilon )+\sqrt{(\beta -l)^{2}+m^{2}}(2-\epsilon )}{(e^{\pm \sqrt{( \beta -l)^{2}+m^{2}}(\xi _{1}-\xi _{0})}-\epsilon )^{2}-1}, $$
(57)

hence the solution of Eq. (10) is

$$ \phi (\xi )=\frac{(e^{\pm \sqrt{(\beta -l)^{2}+m^{2}}(a_{4}^{ \frac{1}{4}}\xi -\xi _{0})}-\epsilon )+\sqrt{(\beta -l)^{2}+m^{2}}(2- \epsilon )}{a_{4}^{\frac{1}{4}}[(e^{\pm \sqrt{(\beta -l)^{2}+m^{2}}(a _{4}^{\frac{1}{4}}\xi -\xi _{0})}-\epsilon )^{2}-1]}-\frac{b_{1}}{2}, $$
(58)

which is a solitary wave solution. When \(a_{4}=1\), \(\kappa =-6\), \(b_{1}=1\), \(b(t)=t+1\), \(\beta =1\), \(l=-1\), \(m=2\), we have \(\omega (t)= \frac{1}{2} t^{2}+t+c\), and by setting \(c=0\), we can get the solution of Eq. (1) as

$$ u(x,t)=\frac{e^{\pm 2\sqrt{2}(-6x+\frac{1}{2}t^{2}+t-\xi _{0})}+\frac{13 \sqrt{2}}{4}-3}{[(e^{\pm 2\sqrt{2}(-6x+\frac{1}{2}t^{2}+t-\xi _{0})}-\frac{3 \sqrt{2}}{4})^{2}-1]}-\frac{1}{2}. $$
(59)

Case 7. \(D_{4}<0\) and \(D_{2}D_{3}\geq 0\). In this case \(G(\varPhi )\) has two distinct real roots and a pair of conjugate complex roots, thus \(G(\varPhi )\) is given by

$$ G(\varPhi )=(\varPhi -\beta ) (\varPhi -\gamma )\bigl[(\varPhi -l)^{2}+m^{2}\bigr], $$
(60)

where β, γ, l, m are real numbers, \(\beta >\gamma \) and \(m>0\). We now use the following transformation:

$$ \varPhi =\frac{d_{1}\cos \theta +d_{2}}{d_{3}\cos \theta +d_{4}}, $$
(61)

where

$$ \begin{aligned} &d_{1}=\frac{1}{2}(\beta +\gamma )d_{3}-\frac{1}{2}(\beta -\gamma )d _{4}, \\ &d_{2}=\frac{1}{2}(\beta +\gamma )d_{4}- \frac{1}{2}(\beta -\gamma )d _{3}, \\ &d_{3}=\beta -l-\frac{m}{f_{2}}, \\ &d_{4}=\beta -l-mf_{2}, \\ &e_{2}=\frac{m^{2}+(\beta -l)(\gamma -l)}{m(\beta -\gamma )}, \\ &f_{2}=e_{2}\pm \sqrt{e_{2}^{2}+1}. \end{aligned} $$
(62)

By choosing \(f_{2}>0\) and substituting expression (62) into Eq. (24), we have

$$\begin{aligned} \xi _{1}-\xi _{0}&= \int \frac{d\varPhi }{\sqrt{\pm (\varPhi -\beta )(\varPhi - \gamma )((\varPhi -l)^{2}+m^{2})}} \\ &=\frac{2f_{2}m_{2}}{\sqrt{\mp 2mf _{2}(\beta -\gamma )}} \int \frac{d\varPhi }{\sqrt{1-m_{2}^{2}\sin ^{2} \theta }}, \end{aligned}$$
(63)

where \(m_{2}^{2}=\frac{2}{1+f_{2}^{2}}\). By Eq. (63) and the definition of Jacobi elliptic cosine function [25], we have

$$ \cos \theta =\operatorname {cn}\biggl(\frac{\sqrt{\mp 2mf_{2}(\beta -\gamma )}}{2f_{2}m _{2}}(\xi _{1}-\xi _{0}),m_{2}\biggr). $$
(64)

Combining expression (63) with (60) leads to the solutions of Eq. (24) given by

$$ \varPhi =\frac{d_{1}\operatorname {cn}(\frac{\sqrt{\mp 2mf_{2}(\beta -\gamma )}}{2f _{2}m_{2}}(\xi _{1}-\xi _{0}),m_{2})+d_{2}}{d_{3}\operatorname {cn}(\frac{\sqrt{ \mp 2mf_{2}(\beta -\gamma )}}{2f_{2}m_{2}}(\xi _{1}-\xi _{0}),m_{2})+d _{4}}. $$
(65)

Hence we can get the solution of Eq. (10) in the form

$$ \phi (\xi )=\frac{a_{4}^{-\frac{1}{4}}[d_{1}\operatorname {cn}(\frac{\sqrt{\mp 2mf _{2}(\beta -\gamma )}}{2f_{2}m_{2}}(a_{4}^{\frac{1}{4}}\xi -\xi _{0}),m _{2})+d_{2}]}{d_{3}\operatorname {cn}(\frac{\sqrt{\mp 2mf_{2}(\beta -\gamma )}}{2f _{2}m_{2}}(a_{4}^{\frac{1}{4}}\xi -\xi _{0}),m_{2})+d_{4}}- \frac{b_{1}}{2}, $$
(66)

where expression (66) involves an elliptic function and is a double periodic solution. For example, when \(a_{4}=1\), \(\kappa =-6\), \(b_{1}=1\), \(b(t)=t+1\), \(\beta =1\), \(\gamma =-1\), \(l=0\), \(m=2\), we have \(a_{2}=3\), \(b_{2}=c_{2}=0\), \(d_{2}=-3\), \(e_{2}=\frac{3}{4}\), \(f_{2}=2\) or \(-\frac{1}{2}\), \(\omega (t)=\frac{1}{2} t^{2}+t+c\). By setting \(f_{2}=2\), \(c=0\), we can obtain the solution of Eq. (1) as

$$ u(x,t)=-\operatorname {cn}\biggl(\frac{\sqrt{10}}{2}\biggl(-6x+ \frac{1}{2}t^{2}+t-\xi _{0}\biggr),\frac{ \sqrt{10}}{5} \biggr)-\frac{1}{2}. $$
(67)

Case 8. \(D_{4}>0\) and \(D_{2}D_{3}\leq 0\). This time \(G(\varPhi )\) has two pairs of conjugate complex roots, namely

$$ G(\varPhi )=\bigl((\varPhi -\alpha _{1})^{2}+l_{1}^{2} \bigr) \bigl((\varPhi -\alpha _{2})^{2}+l _{2}^{2} \bigr), $$
(68)

where \(\alpha _{1}\), \(\alpha _{2}\), \(l_{1}\) and \(l_{2}\) are real numbers, \(l_{1}\geq l_{2}>0\). We use the transformation

$$ \varPhi =\frac{d_{1}\tan \theta +d_{2}}{d_{3}\tan \theta +d_{4}}, $$
(69)

where

$$ \begin{aligned} &d_{1}=\alpha _{1}d_{3}+l_{1}d_{4}, \\ &d_{2}=\alpha _{1}d_{4}-l_{1}d_{3}, \\ &d_{3}=-l_{1}-\frac{l_{2}}{f_{2}}, \\ &d_{4}=\alpha _{1}-\alpha _{2}, \\ &e_{2}=\frac{(\alpha _{1}-\alpha _{2})^{2}+l_{1}^{2}+l_{2}^{2}}{2l_{1}l _{2}}, \\ &f_{2}=e_{2}+\sqrt{e_{2}^{2}-1}, \end{aligned} $$
(70)

and get

$$\begin{aligned} \xi _{1}-\xi _{0}&= \int \frac{d\varPhi }{\sqrt{((\varPhi -\alpha _{1})^{2}+l _{1}^{2})((\varPhi -\alpha _{2})^{2}+l_{2}^{2})}} \\ &=\frac{d_{3}^{2}+d_{4} ^{2}}{l_{2} \sqrt{(d_{3}^{2}+d_{4}^{2})(f_{2}^{2}d_{3}^{2}+d_{4} ^{2})}} \int \frac{d\theta }{\sqrt{1-m_{2}^{2}\sin ^{2}\theta }}, \end{aligned}$$
(71)

where \(m_{2}^{2}=\frac{f_{2}^{2}-1}{f_{2}^{2}}\). By Eq. (71) and the definition of Jacobi elliptic functions, we can obtain

$$\begin{aligned} &\sin \theta =\operatorname {sn}\biggl(\frac{l_{2}\sqrt{(d_{3}^{2}+d_{4}^{2})(f_{2}^{2}d _{3}^{2}+d_{4}^{2})}}{d_{3}^{2}+d_{4}^{2}}(\xi _{1}- \xi _{0}),m_{2}\biggr), \end{aligned}$$
(72)
$$\begin{aligned} &\cos \theta =\operatorname {cn}\biggl(\frac{l_{2}\sqrt{(d_{3}^{2}+d_{4}^{2})(f_{2}^{2}d _{3}^{2}+d_{4}^{2})}}{d_{3}^{2}+d_{4}^{2}}(\xi _{1}-\xi _{0}),m_{2}\biggr). \end{aligned}$$
(73)

Combining expressions (72) and (73) with (69) yields

$$ \varPhi =\frac{d_{1}\operatorname {sn}(\eta (\xi _{1}-\xi _{0}),m_{2})+d_{2}\operatorname {cn}(\eta ( \xi _{1}-\xi _{0}),m_{2})}{d_{3}\operatorname {sn}(\eta (\xi _{1}-\xi _{0}),m_{2})+d _{4}\operatorname {cn}(\eta (\xi _{1}-\xi _{0}),m_{2})} $$
(74)

and

$$ \phi (\xi )=\frac{a_{4}^{-\frac{1}{4}}(d_{1}\operatorname {sn}(\eta (a_{4}^{ \frac{1}{4}}\xi -\xi _{0}),m_{2})+d_{2}\operatorname {cn}(\eta (a_{4}^{\frac{1}{4}} \xi -\xi _{0}),m_{2}))}{d_{3}\operatorname {sn}(\eta (a_{4}^{\frac{1}{4}}\xi -\xi _{0}),m_{2})+d_{4}\operatorname {cn}(\eta (a_{4}^{\frac{1}{4}}\xi -\xi _{0}),m_{2})}-\frac{b _{1}}{2}, $$
(75)

where

$$ \eta =\frac{l_{2}\sqrt{(d_{3}^{2}+d_{4}^{2})(f_{2}^{2}d_{3}^{2}+d _{4}^{2})}}{d_{3}^{2}+d_{4}^{2}}. $$
(76)

Expression (75) involves elliptic functions and is a double periodic solution. When \(a_{4}=1\), \(\kappa =-6\), \(b_{1}=1\), \(b(t)=t+1\), \(\alpha _{1}=\frac{\sqrt{7}}{2}\), \(\alpha _{2}=-\frac{\sqrt{7}}{2}\), \(l_{1}=3\), \(l_{2}=2\), we have \(\omega (t)=\frac{1}{2} t^{2}+t+c\), \(a_{2}=\frac{7\sqrt{7}}{6}\), \(b_{2}=\frac{29}{2}\), \(c_{2}=- \frac{11}{3}\), \(d_{2}=\sqrt{7}\), \(e_{2}=\frac{5}{3}\), \(f_{2}=3\) and \(\eta =\frac{24\sqrt{23}}{23}\). Setting \(c=0\), we obtain

$$\begin{aligned} u(x,t)={}&\frac{\frac{7\sqrt{7}}{6}\operatorname {sn}(\frac{24\sqrt{23}}{23}(-6x+ \frac{1}{2}t^{2}+t-\xi _{0}),\frac{2\sqrt{2}}{3})+\frac{29}{2}\operatorname {cn}(\frac{24 \sqrt{23}}{23}(-6x+\frac{1}{2}t^{2}+t-\xi _{0}),\frac{2\sqrt{2}}{3})}{- \frac{11}{3}\operatorname {sn}(\frac{24\sqrt{23}}{23}(-6x+\frac{1}{2}t^{2}+t-\xi _{0}),\frac{2\sqrt{2}}{3})+\sqrt{7}\operatorname {cn}(\frac{24\sqrt{23}}{23}(-6x+ \frac{1}{2}t^{2}+t-\xi _{0}),\frac{2\sqrt{2}}{3})} \\ &{}-\frac{1}{2}. \end{aligned}$$
(77)

Case 9. \(D_{4}=0\), \(D_{3}>0\) and \(D_{2}>0\). In this case \(G(\varPhi )\) has two single real roots and a real root with multiplicity 2. We obtain

$$ G(\varPhi )=(\varPhi -\alpha _{1})^{2}(\varPhi -\alpha _{2}) (\varPhi -\alpha _{3}), $$
(78)

where \(\alpha _{1}\), \(\alpha _{2}\) and \(\alpha _{3}\) are real numbers, and \(\alpha _{2}>\alpha _{3}\), \(\alpha _{1}=-\frac{\alpha _{2}+\alpha _{3}}{2}\). Denote \(h=(\alpha _{1}-\alpha _{2})(\alpha _{1}-\alpha _{3})\). When \(\varPhi >\alpha _{2}\), \(\alpha _{2}>\alpha _{1}>\alpha _{3}\), we get the solution of Eq. (24) as

$$ \varPhi =\frac{2h}{\pm (\alpha _{2}-\alpha _{3})\sin [\sqrt{-h}(\xi _{1}- \xi _{0})]-(2\alpha _{1}-\alpha _{2}-\alpha _{3})}, $$
(79)

thus

$$ \phi (\xi )=\frac{2a_{4}^{-\frac{1}{4}}h }{\pm (\alpha _{2}-\alpha _{3}) \sin [\sqrt{-h}(a_{4}^{\frac{1}{4}}\xi -\xi _{0})]-(2\alpha _{1}- \alpha _{2}-\alpha _{3})}-\frac{b_{1}}{2}. $$
(80)

When \(\alpha _{1}>\alpha _{2}\) or \(\alpha _{1}<\alpha _{3}\),

$$ \varPhi =\frac{2h}{(\alpha _{2}-\alpha _{3})\cosh [\sqrt{h}(\xi _{1}-\xi _{0})]-(2\alpha _{1}-\alpha _{2}-\alpha _{3})}, $$
(81)

and then we have

$$ \phi (\xi )=\frac{2a_{4}^{-\frac{1}{4}}h }{(\alpha _{2}-\alpha _{3}) \cosh [\sqrt{h}(a_{4}^{\frac{1}{4}}\xi -\xi _{0})]-(2\alpha _{1}- \alpha _{2}-\alpha _{3})}-\frac{b_{1}}{2}. $$
(82)

For instance, if \(a_{4}=1\), \(\kappa =-6\), \(b_{1}=1\), \(b(t)=t+1\), \(p=-9\), \(q=-4\), \(r=12\), then \(\omega (t)=\frac{1}{2} t^{2}+t+c\). Setting \(c=0\), the solution can be obtained as

$$ u(x,t)= \frac{15}{\cosh [\sqrt{15}(-6x+\frac{1}{2}t^{2}+t-\xi _{0})]+4}- \frac{1}{2}. $$
(83)

3 Numerical simulations for modified Gardner equation

In this section, numerical simulations of modified Gardner equation are given. According to the solutions obtained above, each solution is chosen to carry out a typical numerical simulation, using Eqs. (29), (33), (37), (43), (53), (59), (67), (77) and (83). The 3D and the corresponding 2D graphs of are drawn to present the nature of them. In addition, we only focus on the positive one if there is a plus–minus sign in the selected solutions.

  • Case 1. For \(a_{4}=1\), see Fig. 1.

    Figure 1
    figure 1

    (a) The 3D graph of a rational function solution \(u(x, t)\) appearing in Eq. (29), when \(\kappa =-6\), \(\omega =\frac{1}{2}t^{2}+t\) and \(\xi _{0}=1\); (b) the corresponding 2D graph for \(u(x, t)\), when t = 1

  • Case 2. For \(a_{4}=1\), see Fig. 2.

    Figure 2
    figure 2

    (a) The 3D graph of a triangle function periodic solution \(u(x, t)\) in Eq. (33), when \(\kappa =-6\), \(\omega =\frac{1}{2}t^{2}+t\) and \(\xi _{0}=1\); (b) the corresponding 2D graph for \(u(x, t)\), when t = 1

  • Case 3. For \(a_{4}=1\), see Fig. 3.

    Figure 3
    figure 3

    (a) The 3D graph of a rational function solution \(u(x, t)\) illustrating Eq. (37), when \(\kappa =-6\), \(\omega =\frac{1}{2}t^{2}+t\) and \(\xi _{0}=1\); (b) the corresponding 2D graph for \(u(x, t)\), when t = 1

  • Case 4. For \(a_{4}=1\), see Fig. 4.

    Figure 4
    figure 4

    (a) The 3D graph of a hyperbolic cotangent function solution \(u(x, t)\) demonstrating Eq. (43), when \(\kappa =-6\), \(\omega = \frac{1}{2}t^{2}+t\) and \(\xi _{0}=1\); (b) the corresponding 2D graph for \(u(x, t)\), when t = 1

  • Case 5. For \(a_{4}=1\), see Fig. 5.

    Figure 5
    figure 5

    (a) The 3D graph of Jacobi elliptic function solution \(u(x, t)\) appearing in Eq. (53), when \(\kappa =-6\), \(\omega = \frac{1}{2}t^{2}+t\) and \(\xi _{0}=1\); (b) the corresponding 2D graph for \(u(x, t)\), when t = 1

  • Case 6. For \(a_{4}=1\), see Fig. 6.

    Figure 6
    figure 6

    (a) The 3D graph of a solitary wave solution \(u(x, t)\) reflected in Eq. (59), when \(\kappa =-6\), \(\omega =\frac{1}{2}t^{2}+t\) and \(\xi _{0}=1\); (b) the corresponding 2D graph for \(u(x, t)\), when t = 1

  • Case 7. For \(a_{4}=1\), see Fig. 7.

    Figure 7
    figure 7

    (a) The 3D graph of Jacobi elliptic function solution \(u(x, t)\) illustrating Eq. (67), when \(\kappa =-6\), \(\omega = \frac{1}{2}t^{2}+t\) and \(\xi _{0}=1\); (b) the corresponding 2D graph for \(u(x, t)\), when t = 1

  • Case 8. For \(a_{4}=1\), see Fig. 8.

    Figure 8
    figure 8

    (a) The 3D graph of Jacobi elliptic function solution \(u(x, t)\) demonstrating Eq. (77), when \(\kappa =-6\), \(\omega = \frac{1}{2}t^{2}+t\) and \(\xi _{0}=1\); (b) the corresponding 2D graph for \(u(x, t)\), when t = 1

  • Case 9. For \(a_{4}=1\), see Fig. 9.

    Figure 9
    figure 9

    (a) The 3D graph of a solitary wave solution \(u(x, t)\) appearing in Eq. (83), when \(\kappa =-6\), \(\omega =\frac{1}{2}t^{2}+t\) and \(\xi _{0}=1\); (b) the corresponding 2D graph for \(u(x, t)\), when t = 1

4 Conclusion

In this paper, we consider the generalized \((1+1)\) dimensional Gardner equation with variable coefficients. By taking a special traveling wave transformation, the original equation can be changed into the integral form. Then by applying the trial equation method and a complete discrimination system for polynomial method, the classification of the exact solutions is obtained. Moreover, the solitary wave solutions and six kinds of double periodic solutions with Jacobi elliptic functions are given, which are very difficult to get by other methods. In addition, some solutions with the specific parameters are also presented in the paper, thus the existence of the solutions is proved. Our results may be helpful to better understand the two-layer fluid with surface tension, and the problem with specific boundary and initial conditions will be studied in a future work. Moreover, we can also conclude that the trial equation method and the discrimination system for polynomial method are powerful in solving differential equations with variable coefficients arising in mathematical physics.