3
$\begingroup$

I cannot figure out why the following piece of code

PDEs = {Derivative[1, 0][w][t, x] == w[t, x]/v[t, x], 
       Derivative[1, 0][v][t, x] == 0};

    IC = {w[0, x] == 0, v[0, x] == 1};

    BC = {w[t, 1] == 0, v[t, 1] == 1};


    AbsoluteTiming[
     evolution = 
       NDSolve[{PDEs, IC, BC}, {w, v}, {t, 0, 1}, {x, 0, 1}, 
        Method -> {"MethodOfLines", 
          "SpatialDiscretization" -> {"FiniteElement", 
            "MeshOptions" -> MaxCellMeasure -> 0.01}}];]

results in

NDSolve::femcnsd: The PDE coefficient w[x]/v[x] does not evaluate to a numeric scalar at the coordinate {0.5}; it evaluated to Indeterminate instead.

instead of the profound result $w(t,x)=v(t,x)-1=0$.

Can anyone help?

PS: Replace w[t, x]/v[t, x] with w[t, x]*v[t, x] in the code, i.e.

 PDEs = {Derivative[1, 0][w][t, x] == w[t, x]*v[t, x], 
           Derivative[1, 0][v][t, x] == 0};

        IC = {w[0, x] == 0, v[0, x] == 1};

        BC = {w[t, 1] == 0, v[t, 1] == 1};

and it works just fine. It seems that my code understands * but not /.

$\endgroup$
4
$\begingroup$

In some rare cases of coupled DEs, NDSolve can not automatically figure out the ordering of the equations. This works:

PDEs = {Derivative[1, 0][w][t, x] == w[t, x]/v[t, x], 
   Derivative[1, 0][v][t, x] == 0};
IC = {w[0, x] == 0, v[0, x] == 1};
BC = {w[t, 1] == 0, v[t, 1] == 1};
AbsoluteTiming[
 evolution = NDSolveValue[{PDEs, IC, BC}, {w, v}, {t, 0, 1}, {x, 0, 1},
    "DependentVariables" -> {w, v},
    Method -> {"MethodOfLines", 
      "SpatialDiscretization" -> {"FiniteElement", 
        "MeshOptions" -> MaxCellMeasure -> 0.01}}];]

Check the result:

Plot3D[#[t, x], {t, 0, 1}, {x, 0, 1}] & /@ evolution

enter image description here

You can find more information on this issue in the documentation here.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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