Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
bvp4c with method of lines

Subject: bvp4c with method of lines

From: Moritz

Date: 3 Sep, 2013 17:20:05

Message: 1 of 5

Hi,

i implemented a BVP-PDE (sedimentation of particles) via the method of lines and solved it with ode23. Works well, little bit slow but I am getting it faster every week.

Matlab provides bvp4c four such problems but i am not sure wheter this would fit my needs, or not. I have only du/dt (u...solution) given at the boundaries. Since the boundary function takes the solution as input i would have to discretize it in time and here i would run into troubles because of the variable step size solver.

Is bvp4c suited for the MOL with some other approach ?

Subject: bvp4c with method of lines

From: Torsten

Date: 4 Sep, 2013 06:51:05

Message: 2 of 5

"Moritz" wrote in message <l055o5$d1q$1@newscl01ah.mathworks.com>...
> Hi,
>
> i implemented a BVP-PDE (sedimentation of particles) via the method of lines and solved it with ode23. Works well, little bit slow but I am getting it faster every week.
>
> Matlab provides bvp4c four such problems but i am not sure wheter this would fit my needs, or not. I have only du/dt (u...solution) given at the boundaries. Since the boundary function takes the solution as input i would have to discretize it in time and here i would run into troubles because of the variable step size solver.
>
> Is bvp4c suited for the MOL with some other approach ?

BVP4c is for stationary problems - I don't think it is suited if you simulate a time-dependent process.
But if you post your model, I can check if there is a ready-to-use MATLAB function to solve your problem.

Best wishes
Torsten.

Subject: bvp4c with method of lines

From: Moritz

Date: 4 Sep, 2013 08:34:10

Message: 3 of 5

"Torsten" wrote in message <l06l8p$edb$1@newscl01ah.mathworks.com>...
> "Moritz" wrote in message <l055o5$d1q$1@newscl01ah.mathworks.com>...
> > Hi,
> >
> > i implemented a BVP-PDE (sedimentation of particles) via the method of lines and solved it with ode23. Works well, little bit slow but I am getting it faster every week.
> >
> > Matlab provides bvp4c four such problems but i am not sure wheter this would fit my needs, or not. I have only du/dt (u...solution) given at the boundaries. Since the boundary function takes the solution as input i would have to discretize it in time and here i would run into troubles because of the variable step size solver.
> >
> > Is bvp4c suited for the MOL with some other approach ?
>
> BVP4c is for stationary problems - I don't think it is suited if you simulate a time-dependent process.
> But if you post your model, I can check if there is a ready-to-use MATLAB function to solve your problem.
>
> Best wishes
> Torsten.

Thanks Thorsten,

that Answer helped me a lot. I don´t think there is such a function. It is a strongly degenerate parabolic-hyperbolic PDE. It needs a flux limiter and numerical flux. But it works only if i discretize it by hand ( i am following a published recipe for this type of PDE)

Greetings

Moritz

Subject: bvp4c with method of lines

From: Torsten

Date: 4 Sep, 2013 10:43:09

Message: 4 of 5

"Moritz" wrote in message <l06ra2$hbm$1@newscl01ah.mathworks.com>...
> "Torsten" wrote in message <l06l8p$edb$1@newscl01ah.mathworks.com>...
> > "Moritz" wrote in message <l055o5$d1q$1@newscl01ah.mathworks.com>...
> > > Hi,
> > >
> > > i implemented a BVP-PDE (sedimentation of particles) via the method of lines and solved it with ode23. Works well, little bit slow but I am getting it faster every week.
> > >
> > > Matlab provides bvp4c four such problems but i am not sure wheter this would fit my needs, or not. I have only du/dt (u...solution) given at the boundaries. Since the boundary function takes the solution as input i would have to discretize it in time and here i would run into troubles because of the variable step size solver.
> > >
> > > Is bvp4c suited for the MOL with some other approach ?
> >
> > BVP4c is for stationary problems - I don't think it is suited if you simulate a time-dependent process.
> > But if you post your model, I can check if there is a ready-to-use MATLAB function to solve your problem.
> >
> > Best wishes
> > Torsten.
>
> Thanks Thorsten,
>
> that Answer helped me a lot. I don´t think there is such a function. It is a strongly degenerate parabolic-hyperbolic PDE. It needs a flux limiter and numerical flux. But it works only if i discretize it by hand ( i am following a published recipe for this type of PDE)
>
> Greetings
>
> Moritz

If you have the NAG toolbox, try
http://www.google.de/url?sa=t&rct=j&q=&esrc=s&frm=1&source=web&cd=1&sqi=2&ved=0CDEQFjAA&url=http%3A%2F%2Fwww.nag.co.uk%2Fnumeric%2Fmb%2Fmanual_21_1%2Fpdf%2Fd03%2Fd03pf.pdf&ei=Og4nUsuQNYimtAbMpoGoAw&usg=AFQjCNGzbvIjmnqKjEOxIqS04Mb8cpSo5w&sig2=W259fWBlQWVz-tky2mM5iQ
for parabolic-hyperbolic PDEs.

Best wishes
Torsten.

Subject: bvp4c with method of lines

From: Moritz

Date: 4 Sep, 2013 11:35:08

Message: 5 of 5

"Torsten" wrote in message <l072rt$86d$1@newscl01ah.mathworks.com>...
> "Moritz" wrote in message <l06ra2$hbm$1@newscl01ah.mathworks.com>...
> > "Torsten" wrote in message <l06l8p$edb$1@newscl01ah.mathworks.com>...
> > > "Moritz" wrote in message <l055o5$d1q$1@newscl01ah.mathworks.com>...
> > > > Hi,
> > > >
> > > > i implemented a BVP-PDE (sedimentation of particles) via the method of lines and solved it with ode23. Works well, little bit slow but I am getting it faster every week.
> > > >
> > > > Matlab provides bvp4c four such problems but i am not sure wheter this would fit my needs, or not. I have only du/dt (u...solution) given at the boundaries. Since the boundary function takes the solution as input i would have to discretize it in time and here i would run into troubles because of the variable step size solver.
> > > >
> > > > Is bvp4c suited for the MOL with some other approach ?
> > >
> > > BVP4c is for stationary problems - I don't think it is suited if you simulate a time-dependent process.
> > > But if you post your model, I can check if there is a ready-to-use MATLAB function to solve your problem.
> > >
> > > Best wishes
> > > Torsten.
> >
> > Thanks Thorsten,
> >
> > that Answer helped me a lot. I don´t think there is such a function. It is a strongly degenerate parabolic-hyperbolic PDE. It needs a flux limiter and numerical flux. But it works only if i discretize it by hand ( i am following a published recipe for this type of PDE)
> >
> > Greetings
> >
> > Moritz
>
> If you have the NAG toolbox, try
> http://www.google.de/url?sa=t&rct=j&q=&esrc=s&frm=1&source=web&cd=1&sqi=2&ved=0CDEQFjAA&url=http%3A%2F%2Fwww.nag.co.uk%2Fnumeric%2Fmb%2Fmanual_21_1%2Fpdf%2Fd03%2Fd03pf.pdf&ei=Og4nUsuQNYimtAbMpoGoAw&usg=AFQjCNGzbvIjmnqKjEOxIqS04Mb8cpSo5w&sig2=W259fWBlQWVz-tky2mM5iQ
> for parabolic-hyperbolic PDEs.
>
> Best wishes
> Torsten.

Well, i did. Great toolbox by the way. But I can only get it to work with this published method. So either a NAG or MATLAB ode solver with the MOL. Since d03pf or d03pl are somehow a black box, I can´t tell why. Operator splitting is also an option but that is for now out of my scope.

Since it is the speed which is of my concern i wrote my functions in c++ (considering to use FORTRAN instead) and i am getting deeper and deeper in numerics and programming. What was not my intention at the beginning. I should be in the lab. But that´s another story.

Offtopic:
If i compare my (exponential) function in c++ and matlab is it fair to do that inside a loop and call it e.g 1e5 times ?
c++ takes 0.5 seconds and MATLAB 7 seconds

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us