I am trying to solve the following multi-field problem in MMA 12, however, this probelm cannot be solved, i.e., error:

DirichletCondition [...] needs to be linear.

I attached the code here:


PDE1 = (s[t, x])^2 D[u[t, x], x, x] == D[u[t, x], t];
PDE2 = 2 \[Epsilon] D[s[t, x], x, x] + 0.5 (1 - s[t, x])/\[Epsilon] - 
    s[t, x] \[CapitalEpsilon]1 (D[u[t, x], x])^2/\[ScriptCapitalG] == 
   D[s[t, x], t]/10;

lr = 25;
ll = -25;
\[CapitalEpsilon]1 = 1;
\[ScriptCapitalG] = 1;
u0 = 10;
\[Epsilon] = 0.125;

\[CapitalOmega] = Line[{{ll}, {lr}}];

tmax = 1;
bcs1 = {u[t, ll] == -u0 t, u[t, lr] == u0 t};
bcs2 = {s[t, ll] == 1, s[t, lr] == 1};
bcs3 = {Derivative[0, 1][s][t, ll] == 0, 
   Derivative[0, 1][s][t, lr] == 0};
ic = {s[0, x] == 1, u[0, x] == 0};
{uu1, vv1} = 
 NDSolveValue[{PDE1, PDE2, bcs1, bcs2, bcs3, ic}, {u, 
   s}, {x} \[Element] \[CapitalOmega], {t, 0, tmax}, 
  Method -> {"FiniteElement", 
    "MeshOptions" -> {MaxCellMeasure -> 0.001}}]

{Plot3D[uu1[t, x], {x} \[Element] \[CapitalOmega], {t, 0, tmax}, 
  Mesh -> None, ColorFunction -> Hue, AxesLabel -> Automatic], 
 Plot3D[vv1[t, x], {x} \[Element] \[CapitalOmega], {t, 0, tmax}, 
  Mesh -> None, ColorFunction -> Hue, PlotRange -> All, 
  AxesLabel -> Automatic]}
{Plot[uu1[tmax, x], {x} \[Element] \[CapitalOmega]], 
 Plot[vv1[tmax, x], {x} \[Element] \[CapitalOmega], PlotRange -> All]}

In this benchmark test, input parameters and BCs are fixed.

If I remove bcs3, then error:

FindRoot::sszero: The step size in the search has become less than the tolerance prescribed by the PrecisionGoal option, but the function value is still greater than the tolerance prescribed by the AccuracyGoal option.

FindRoot::nosol: Linear equation encountered that has no solution.

Many thanks in advance!

  • $\begingroup$ You need an IC on $u(t, x)$. Also, your bc1 is different from the one in the original. And, you have a scale of 1000 in your 2nd PDE. $\endgroup$
    – LouisB
    Aug 26, 2019 at 8:37
  • $\begingroup$ Since you call this a benchmark, where's the reference solution? $\endgroup$
    – xzczd
    Aug 26, 2019 at 10:20
  • $\begingroup$ @LouisB u[0, x] == 0 is enough? $\endgroup$
    Aug 26, 2019 at 14:39
  • $\begingroup$ @xzczd I have modified the equation and added new code. $\endgroup$
    Aug 26, 2019 at 23:23

1 Answer 1


Because you have not specified enough initial conditions NDSolve will try to solve this as a stationary problem. For this it parses Derivative[0, 1][s][t, ll] as a nonlinear DirichletCondition. To fix this you should specify a initial condition for u.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.