I have a nonlinear ordinary differential equation with two parameters c
and R
in the form of:
lhs[u[x]; c, R]=0
, where R>=0
and
lhs = 2/3 u[x]^3 + 4/75 R u[x]^6 u'[x] + 2/3*u[x]^3 u'''[x] -c u[x] + c - 2/3;
subject to far field boundary conditions (BCs): $u\rightarrow1$, as $x\rightarrow\pm\infty$
I want to plot a curve that presents the relation of parameters c
and R
, and plot the function u[x]
corresponding to a value of c
on the curve as below (here all u[x]
shown for c=5
and R=2.49
, 3.32
, 3.97
). There should be multiple solutions because it is a nonlinear equation. The solutions can be classified by the number of bumps in u[x]
(see the insets in the following figures). So, I need to find multiple solutions.
Plan A: I found a relevant numerical approach posted here based on a user-defined function TrackRootPAL
. But I saw only polynomial equations with one parameter in those problems. Here I have two parameters in an ODE with BCs at infinity.
I tried TrackRootPAL
, as expected, it does not work in this simple mechanical application, because I didn't know how to impose the far BCs and introduce the other parameter c
.
tr = TrackRootPAL[lhs, {u[x]}, {R, 0, 20}, 1, {2}];
Plot[Evaluate[u[x] /. tr], {R, 0, 20}]
But, as commented by @Chris this is probably not the right approach to start.
Plan B: The method proposed by @Pragabhava here looks a good direction to find multiple solutions. However, I need help to adapt the code for an ODE with 2 parameters. The two examples appended there are still for polynomial equations with a single parameter.
Plan C:
By searching on the web, I think ParametricNDSolve
may also be an alternative to solve ODE with multiple parameters. But, I need help with applying the BCs again.
eqbc = {lhs == 0, FarBC =...};
Sol = ParametricNDSolve[eqbc, u, {x, -L, L}, {R, c}]
As an MMA beginner, these methods are daunting for me. Please help. Thank you in advance.
As suggested by @PlatoManiac and @Chris, I have tried to solve the boundary value problem for a given parameter.
Test1 (failed):
I noted a related answer using Chebyshev method by @Michael E2. For simplicity, the independent variable has been changed into y[x]
to match that code.
R = 0; c = 2;
ode = 2/3 y[x]^3 + 4/75 R y[x]^6 y'[x] + 2/3*y[x]^3 y'''[x] - c y[x] + c - 2/3;
bcs = {y[0] == 1, y[Infinity] == 1};
LinearSolve::nosol: Linear equation encountered that has no solution.
It failed again and the reason should be due to the nonlinearity of the ODE.
Test2 (partially successful):
Yesterday, I noted another related answer using a user-defined function pdetoae by @xzczd. But this method uses a finite domain size. Here I take [0,40]
as in the insets. The code works but it only gave a similar solution for all the 3 values of R
(see the description above), which is more like the inset in the 1st figure. I need to find all the solutions as shown in the figures above.
L = 40; domain = {0, L};
points = 81; difforder = 4;
grid = Array[# &, points, domain];
ptoafunc = pdetoae[u[x], grid, difforder];
c = 5; R = 249/100(*332/100*)(*397/100*); (*parameters for the three u[x] respectively*)
eq = 2/3 u[x]^3 + 4/75 R u[x]^6 u'[x] + 2/3*u[x]^3 u'''[x] - c u[x] +
c - 2/3 == 0;
bc = {u[0] == 1, u[L] == 1, u'[0] == 0, u'[L] == 0};
del = #[[3 ;; -3]] &;
ae = ptoafunc@eq //del;
aebc = ptoafunc@bc;
Iniu[x_]=Cos[2 \[Pi] x/L];
sol = FindRoot[{ae, aebc}, Table[{u[x], Iniu[x]}, {x, grid}], WorkingPrecision -> 20, MaxIterations -> 200];
solfunc = ListInterpolation[sol[[All, -1]], grid];
solplot = Plot[solfunc[x], {x, 0, L}, PlotStyle -> {Thick, Blue}, PlotRange -> {{0, L}, {0, 4}}, Frame -> True, Axes -> False]
Test 3 (no solution found):
I found a package BVPh which is designed to solve this kind of nonlinear ODE, and I tried BVPh 2.0. In the input file, I assigned R=332/100
and used the following initial guess
U[1,0] = 2 - Cos[2*Pi*(z - zR[1])/zR[1]]
which satisfies the 4 BCs: u[0] = u[L] = 1 and u'[0] = u'[L] = 0.
When I run the file
(* 1. Clear all global variables *)
ClearAll["Global`*"];
(* 2. Read in the package BVPh 2.0 *)
<< "E:\\BVPh2_0\\Package\\BVPh2_0.m"
(* 3. Set the current working directory to "the current directory" *)
SetDirectory[ToFileName[Extract["FileName" /.NotebookInformation[EvaluationNotebook[]], {1}, FrontEnd`FileName]]];
(* 4. Read in your input data in current directory and compute *)
<< input.m
I got no result
In GetConstants: there is no solution.
Btw, how to distinguish different eigenfunctions with an additional BC in the BVPh 2.0?
Noted that I don't need to solve an IVP for any PDE (which is easy actually), I just need to solve the BVP of the nonlinear ODE with an emphasis on the multiplicity of the solutions. Any ideas would be much appreciated!
c
andR
,lhs[c, R]=0
is a differential equation foru[x]
that you can solve withNDSolve
. What condition defines the curve in thec
-R
plane? $\endgroup$