       Re: boundary conditions

• To: mathgroup at smc.vnet.net
• Subject: [mg121601] Re: boundary conditions
• From: Oliver Ruebenkoenig <ruebenko at wolfram.com>
• Date: Thu, 22 Sep 2011 07:23:46 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <201109210935.FAA13289@smc.vnet.net>

```
The message means following:

In the PDE you have m, but not a derivative of m. Now, the order of the
boundary condition must be less than the lowest order of m appearing in
the PDE. The same applies for initial conditions. Just specifying
Neumann type boundary conditions leave the system in a floating state.

While to following code returns the interpolation functions, the boundary
and initial conditions are more certainly not what you would like to
model:

Clear[v]
alpham[v_] = (0.1 (-40 - v))/(Exp[(-40 - v)/10] - 1);
betam[v_] = 4*Exp[(-65 - v)/18];
alphah[v_] = 0.07*Exp[(-65 - v)/20];
betah[v_] = 1/(Exp[(-35 - v)/10] + 1);
alphan[v_] = 0.01 (-55 - v)/(Exp[(-55 - v)/10] - 1);
betan[v_] = 0.125 Exp[(-65 - v)/80];
eqv = Derivative[1, 0][v][t,
x] == (0.0238/(2*35400)) Derivative[0, 2][v][t, x] -
120 (v[t, x] - 50)*h[t, x]*m[t, x]^(3) -
36 (v[t, x] + 77)*n[t, x]^(4) - 0.3 (v[t, x] + 54.387) + 200;
eqm = Derivative[1, 0][m][t, x] ==
alpham[v[t, x]]*(1 - m[t, x]) - betam[v[t, x]]*m[t, x];
eqh = Derivative[1, 0][h][t, x] ==
alphah[v[t, x]]*(1 - h[t, x]) - betah[v[t, x]]*h[t, x];
eqn = Derivative[1, 0][n][t, x] ==
alphan[v[t, x]]*(1 - n[t, x]) - betan[v[t, x]]*n[t, x];
iniconds = {v[0, x] == 0,
m[0, x] == 0,
h[0, x] == 0,
n[0, x] == 0};
bconds = {Derivative[0, 1][v][t, 0] == 0, m[t, 0] == 0, h[t, 0] == 0,
n[t, 0] == 0, Derivative[0, 1][v][t, 5] == 0, m[t, 5] == 0,
h[t, 5] == 0, n[t, 5] == 0};

NDSolve[Join[{eqv, eqm, eqh, eqn}, iniconds, bconds], {v[t, x],
m[t, x], h[t, x], n[t, x]}, {t, 0, 5}, {x, 0, 5},
Method -> {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid",
MinPoints -> 1000}}, PrecisionGoal -> 2]

I agree, that NDSolve can produce quite cryptic message - but I find this
one a particularly clear one....

Oliver

On Wed, 21 Sep 2011, DrMajorBob wrote:

> I didn't solve the problem, but I did make a few changes that may be
> useful:
>
> Clear[v]
> alpham[v_] = (0.1 (-40 - v))/(Exp[(-40 - v)/10] - 1);
> betam[v_] = 4*Exp[(-65 - v)/18];
> alphah[v_] = 0.07*Exp[(-65 - v)/20];
> betah[v_] = 1/(Exp[(-35 - v)/10] + 1);
> alphan[v_] = 0.01 (-55 - v)/(Exp[(-55 - v)/10] - 1);
> betan[v_] = 0.125 Exp[(-65 - v)/80];
> eqv = Derivative[1, 0][v][t,
>     x] == (0.0238/(2*35400)) Derivative[0, 2][v][t, x] -
>     120 (v[t, x] - 50)*h[t, x]*m[t, x]^(3) -
>     36 (v[t, x] + 77)*n[t, x]^(4) - 0.3 (v[t, x] + 54.387) + 200;
> eqm = Derivative[1, 0][m][t, x] ==
>    alpham[v[t, x]]*(1 - m[t, x]) - betam[v[t, x]]*m[t, x];
> eqh = Derivative[1, 0][h][t, x] ==
>    alphah[v[t, x]]*(1 - h[t, x]) - betah[v[t, x]]*h[t, x];
> eqn = Derivative[1, 0][n][t, x] ==
>    alphan[v[t, x]]*(1 - n[t, x]) - betan[v[t, x]]*n[t, x];
> iniconds = {Derivative[1, 0][v][0, x] == 0,
>    Derivative[1, 0][m][0, x] == Derivative[1, 0][h][0, x] == 0,
>    Derivative[1, 0][n][0, x] == 0};
> bconds = {Derivative[0, 1][v][t, 0] == 0,
>    Derivative[0, 1][m][t, 0] == 0, Derivative[0, 1][h][t, 0] == 0,
>    Derivative[0, 1][n][t, 0] == 0, Derivative[0, 1][v][t, 5] == 0,
>    Derivative[0, 1][m][t, 5] == 0, Derivative[0, 1][h][t, 5] == 0,
>    Derivative[0, 1][n][t, 5] == 0};
>
> NDSolve[Join[{eqv, eqm, eqh, eqn}, iniconds, bconds], {v[t, x],
>   m[t, x], h[t, x], n[t, x]}, {t, 0, 5}, {x, 0, 5},
>  Method -> {"MethodOfLines",
>    "SpatialDiscretization" -> {"TensorProductGrid",
>      MinPoints -> 1000}}, PrecisionGoal -> 2]
>
> SetDelayed wasn't needed and, in defining alpham and alphan, it makes no
> difference what the value is at a single point -- v==-40 or -55. "Which"
> is also NOT differentiable, so your definitions could cause problems
> (potentially). If you meant v <= -40 or something like that, try using
> UnitStep or HeavisideTheta, rather than Which.
>
> Reversing the order of the variables in NDSolve -- {t, 0, 5}, {x, 0, 5}
> rather than the other way around -- caused the error message to mention m
> rather than something unrecognizable, like TemporaryVariable\$3339. The
> conditions, but it seems to match the condition that WORKS (not the one
> that doesn't) in the ONLY help example for the error message. Obviously,
> more examples are needed.
>
> Beyond that, sorry, I don't understand the problem well enough to help.
>
> Bobby
>
> On Tue, 20 Sep 2011 01:56:26 -0500, tahereh tekieh <golesang80 at gmail.com>
> wrote:
>
>> I had attached the nb file but anyway i write it here as well.
>>
>> alpham[v_] :=   Which [v == -40, 1, True, (0.1 (-40 - v))/(Exp[(-40 -
>> v)/10]
>> - 1) ];
>>
>> betam[v_] := 4*Exp[(-65 - v)/18];
>>
>> alphah[v_] := 0.07*Exp[(-65 - v)/20];
>>
>> betah[v_] := 1/(Exp[(-35 - v)/10] + 1);
>>
>> alphan[v_] :=   Which [v == -55, 1, True, 0.01 (-55 - v)/(Exp[(-55 -
>> v)/10]
>> - 1)] ;
>>
>> betan[v_] := 0.125 Exp[(-65 - v)/80];
>>
>> eqv = Derivative[1, 0][v][t, x] == (0.0238/(2*35400)) Derivative[0,
>> 2][v][t,
>> x] - 120 (v[t, x] - 50)*h[t, x]*m[t, x]^(3) -
>>     36 (v[t, x] + 77)*n[t, x]^(4) - 0.3 (v[t, x] + 54.387) + 200;
>>
>> eqm = Derivative[1, 0][m][t, x] == alpham[v[t, x]]*(1 - m[t, x]) -
>> betam[v[t, x]]*  m[t, x];
>>
>> eqh = Derivative[1, 0][h][t, x] ==  alphah[v[t, x]]*(1 - h[t, x]) -
>> betah[v[t, x]]*  h[t, x];
>>
>> eqn = Derivative[1, 0][n][t, x] == alphan[v[t, x]]*(1 - n[t, x]) -
>> betan[v[t, x]]*  n[t, x];
>>
>> iniconds = {Derivative[1, 0][v][0, x] == Derivative[1, 0][m][0, x] ==
>> Derivative[1, 0][h][0, x] == Derivative[1, 0][n][0, x] == 0};
>>
>> bconds = {Derivative[0, 1][v][t, 0] == Derivative[0, 1][m][t, 0]
>> ==Derivative[0, 1][h][t, 0] == Derivative[0, 1][n][t, 0] == 0,
>>    Derivative[0, 1][v][t, 5] == Derivative[0, 1][m][t, 5] ==Derivative[0,
>> 1][h][t, 5] == Derivative[0, 1][n][t, 5] == 0};
>>
>> here's the last statement which the error occures:
>>
>> solution =NDSolve[Join[{eqv, eqm, eqh, eqn}, iniconds, bconds], {v[t,
>> x],m[t, x], h[t, x], n[t, x]}, {x, 0, 5}, {t, 0, 5},
>>   Method -> {"MethodOfLines", "SpatialDiscretization" ->
>> {"TensorProductGrid",MinPoints -> 1000}}, PrecisionGoal -> 2];
>>
>> and this is the error:
>> NDSolve::bdord: Boundary condition (TemporaryVariable\$2704^(1,0))[0,t]
>> should have derivatives of order lower than the differential order of the
>> partial differential equation. >>
>>
>> On Mon, Sep 19, 2011 at 3:56 PM, DrMajorBob <btreat1 at austin.rr.com>
>> wrote:
>>
>>> Show us the statements in which the error occurs.
>>>
>>>
>>> Bobby
>>>
>>>
>>> On Mon, 19 Sep 2011 03:32:26 -0500, tahereh tekieh
>>> <golesang80 at gmail.com>
>>> wrote:
>>>
>>>  Dear Bobby,
>>>>  Thanks for the clue, I have attached my notebook file, the problem is
>>>> with
>>>> this legal expression I'll receive an bdord error. I have no idea how
>>>> to
>>>> impose my boundary condition the way it is. I am looking to hearing
>>>> from
>>>> you.
>>>> regards
>>>>
>>>> On Sun, Sep 18, 2011 at 10:29 PM, DrMajorBob <btreat1 at austin.rr.com>
>>>> wrote:
>>>>
>>>>  Neither one is a legal expression, so I suppose there is no
>>>> difference.
>>>>>
>>>>>
>>>>> Derivative[0, 1][v][t, 0]
>>>>>
>>>>> Bobby
>>>>>
>>>>> On Sun, 18 Sep 2011 07:19:50 -0500, goli <golesang80 at gmail.com> wrote:
>>>>>
>>>>>  what is the difference between these boundary conditions? do they
>>>>>
>>>>>> represent the same thing?
>>>>>> Derivative[0,1]v[t,0]==0
>>>>>> v(0,1)[t,0]==0
>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>> DrMajorBob at yahoo.com
>>>>>
>>>>>
>>>
>>> --
>>> DrMajorBob at yahoo.com
>>>
>
>
>

```

• Prev by Date: Re: Problem in "block cutting"
• Next by Date: How to distribute specific tasks to specific subkernels?
• Previous by thread: Re: boundary conditions
• Next by thread: Re: boundary conditions