Path: news.mathworks.com!not-for-mail From: <HIDDEN> Newsgroups: comp.soft-sys.matlab Subject: Re: PDEPE boundary conditions ul equals ur Date: Tue, 11 Feb 2014 07:24:08 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 44 Message-ID: <ldcj6o$8e$1@newscl01ah.mathworks.com> References: <ld2jgp$mc3$1@newscl01ah.mathworks.com> <lda5ge$d2i$1@newscl01ah.mathworks.com> <ldac66$hmn$1@newscl01ah.mathworks.com> <ldae5v$n3l$1@newscl01ah.mathworks.com> <ldatuc$68u$1@newscl01ah.mathworks.com> Reply-To: <HIDDEN> NNTP-Posting-Host: rubyext-03-ls.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1392103448 270 172.20.102.179 (11 Feb 2014 07:24:08 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Tue, 11 Feb 2014 07:24:08 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 3799640 Xref: news.mathworks.com comp.soft-sys.matlab:809055 "Tran Trung Luu" wrote in message <ldatuc$68u$1@newscl01ah.mathworks.com>... > "Torsten" wrote in message <ldae5v$n3l$1@newscl01ah.mathworks.com>... > > "Tran Trung Luu" wrote in message <ldac66$hmn$1@newscl01ah.mathworks.com>... > > > > Why do you want to solve the equation numerically ? > > > > If A is constant, the analytical solution is pretty clear. > > > > > > > > Best wishes > > > > Torsten. > > > > > > Thank you Torsten for your message. > > > > > > Yes, you are right. However, for simplicity I did not put it clearly. Actually A is A(t) but this A(t) is numerically defined along all t thus I would not call it a function, I call it a constant. > > > > > > Since the boundary is not set right thus if there is no solution for this with pdepe, I am thinking of writing my own solver to solve this particular problem because I will have more control than pdepe. In that case, I am considering Crank Nilcoson's algorithm. Could you please comment on this or advise me what should be the best way? > > > > > > Thanks a lot and have a nice day, > > > Trung > > > > > > PS: I tried to use the ode45 for t plus finite difference method to do derivative in x. But the results seem to contain a lot of numerical errors so I am not satisfied. > > > > Even if A=A(t), I'd not solve the original PDE. > > Make your initial condition u0(x) periodic over the real line with period (xr-xl). > > Calculate the quantity > > integral_{t'=0}^{t'=t} A(t') dt'. > > If I'm not mistaken, the solution of your problem is then given by > > u(x,t) = u0(x-integral_{t'=0}^{t'=t} A(t') dt') > > > > Best wishes > > Torsten. > > Dear Torsten, > Actually our problem is more complicated than this thus I tried to simplify it just to get the main point of the boundary. > Nevertheless, I implemented your analytical solution and it works perfectly. I compared the solution from pdepe and this analytical one and they are almost identical. Many thanks for this. I should have look more carefully to see if we can get an analytical solution first, even for this particular case. > Regarding the boundary, I would like to see how the boudaries behave when u(x,t) reaching them with the conditions we have. What is clear in the analytical solution you suggested is that u(x,t) will just go out and be missing. This is also confirmed in the pdepe results. > I guess that this is what it is. > Thank you again Torsten, I will look further into details. At the moment, things are good. > > Best wishes, > Trung Your pde just moves the initial function u0 (periodically continued) to the left and to the right on the x-axis with "velocity" A(t). That's why the analytical solution is just a translation of the initial profile on the x-axis. Best wishes Torsten.