Re: NDSolve initial value problem
- To: mathgroup at smc.vnet.net
- Subject: [mg99232] Re: NDSolve initial value problem
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Thu, 30 Apr 2009 06:24:27 -0400 (EDT)
- References: <gt90l4$l1t$1@smc.vnet.net>
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