[Date Index]
[Thread Index]
[Author Index]
Re: Re: NDSolve initial value problem
*To*: mathgroup at smc.vnet.net
*Subject*: [mg99258] Re: [mg99232] Re: NDSolve initial value problem
*From*: Murat Havzalı <gezginorman at gmail.com>
*Date*: Fri, 1 May 2009 05:22:14 -0400 (EDT)
*References*: <gt90l4$l1t$1@smc.vnet.net> <200904301024.GAA02567@smc.vnet.net>
Hi;
First of all, thanks for all the replies.
What I was trying to do is solve the equation with u(x,y)=1
on one boundary and gradient (heat flux du/dy=-1) on
the other boundary. For the dirichlet type the following works
fine (along with your notation suggestions), as well as your suggestion:
n1 = 1;
n2 = 1;
pe = 0.5;
u[y_] = 1 - y^2;
sol = NDSolve[{
pe* u[y] *D[T[x, y], x] == D[T[x, y], {y, 2}],
T[0, y] == UnitStep[-y - 1]*n1 + UnitStep[y - 1]*n2,
T[x, 1] == n2,
T[x, -1] == n1},
T, {x, 0, 1}, {y, -1, 1}, SolveDelayed -> True];
But I could not do it for the flux case and frankly was wondering if there
is a trick for it. I know that the initial condition is not continuous but
it's the way it is. But thanks for suggestions anyway.
Cheers.
-----Original Message-----
From: Sjoerd C. de Vries [mailto:sjoerd.c.devries at gmail.com]
Sent: 30 April 2009 12:24
To: mathgroup at smc.vnet.net
Subject: [mg99258] [mg99232] Re: NDSolve initial value problem
Hi Murat,
First, your definition of u is ok if you stick to the letter y,
otherwise it is better to use y_. I also would change the second
derivative to D[T[x, y], {y, 2}] for better looks.
To solve your problem I'd suggest changing the last condition:
pe = 0.5;
u[y_] = 1 - y^2;
sol =
NDSolve[
{
pe*u[y]*D[T[x, y], x] == D[T[x, y], {y, 2}],
T[0, y] == Piecewise[{{-y, y <= -1}, {0, -1 < y < 1}, {1, 1 <=
y}}],
T[x, 1] == 1,
T[x, -1] == 1
},
T[x, y], {x, 0, 1}, {y, -1, 1},
SolveDelayed -> True
]
g[x_, y_] = (T[x, y] /. sol[[1, 1]])
Animate[Plot[g[x, y], {y, -1, 1}, PlotRange -> {0, 1}], {x, 0, 1}]
Cheers -- Sjoerd
On Apr 29, 9:46 am, Murat Havzal=FD <gezginor... at gmail.com> wrote:
> Dear Mathematica users;
>
> I am trying to solve liquid heat/mass transfer equation with mixed bounda=
ry
> conditions.
>
> My code looks like this:
>
> pe=0.5;
>
> u[y]=1-y^2;
>
> sol=NDSolve[
>
> {
>
> pe*u[y]*D[T[x,y],x]==D[T[x,y],y,y],
>
> T[0,y]==Piecewise[{{-y,y<=-1},{0,-1< y<1},{1,1<=y}}],
>
> T[x,1]==1,
>
> (D[T[x,y],y]/.y->-1)==-1
>
> },
>
> T,{x,0,1},{y,-1,1},SolveDelayed->True];
>
> This returns inconsistent initial boundary conditions error.
>
> I also tried to make the piecewise initial condition, a numerical functio=
n
> namely:
>
> initial[y_?NumericQ]:=Piecewise[{{-y,y<=-1},{0,-1< y<1},{1,1<=y}}]
>
> However this did not work, too. I understand that there is a similar
> question already asked about this subject,
>
> and I tried my best to convert it to my problem but couldn't. I couldn't
> find the code but I also tried to give the
>
> initial piecewise function as a interpolating function, it returned the s=
ame
> response.
>
> Any help would be appreciated.
>
> Thanks.
>
> Murat Havzal
Prev by Date:
**Re: New Wolfram Tutorial Collection documentation is ready**
Next by Date:
**Re: HoldForm in defined function doesn't seem to work**
Previous by thread:
**Re: Plot function, finding numeric optima, intersection points**
Next by thread:
**FindFit and complex data**
| |