From: Kamel on
Thank you Torsten,

dui you know how to use the restart the calculation with the solution obtained so far ?

Thank you very much,

Kamel


Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote in message <1541508462.1794.1271918912055.JavaMail.root(a)gallium.mathforum.org>...
> > Hello,
> >
> > I try to impose a boundary condition to resolve a
> > parabolic equation using the pdepe solver. Do you
> > know how to impose a discrete time boundary conition
> > for the right BC like this (series of ramp
> > displacements) :
> >
> > for t<500s, ur = 0.0013*t, 500<t<1000: ur = 0.65,
> > 1000<t<1500: ur = 0.0013*t, 500<t<2000:
> > : ur=0.65+0.65.
> >
> > I tried something like:
> > pr = (ur+0.0013*t)*(t<500)+(ur+0.65)*(500<t<1000)
> > + (ur+0.0013*t)*(1000<t<1500)+
> > (ur+0.65+0.65)*(1500<t<2000);
> >
>
> The boundary condition for u at the right boundary
> point does not change continuously at time t=1000.
> ur(1000-) = 0.65 ; ur(1000+) = 1.3.
> Maybe this is a mistake in your setting.
> If not, you will have to restart pdepe at time t=1000
> with the solution obtained so far and artificially set
> u=1.3 in the routine where the initial values are
> supplied.
>
> Another point is that you have to set
> pr = (ur-0.0013*t)*(t<500)+(ur-0.65)*(500<t<1000)
> + (ur-0.0013*t)*(1000<t<1500)+
> (ur-(0.65+0.65))*(1500<t<2000);
>
> Best wishes
> Torsten.
>
> > but it works only for the two first blocks (up to
> > t=1000).
> >
> > Please, could you help me to find an easy way to get
> > this BC applied ?
> >
> > Thank you very much,
> >
> > Kamel
> > ps: below is the main program
> >
> >
> > function pdex1
> >
> > m = 0;
> > x = linspace(0,1.41,50);
> > t = linspace(0,2000,50);
> >
> > sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t);
> > % Extract the first solution component as u.
> > u = sol(:,:,1);
> > save -ascii relax_10pts.dat u,x,t
> >
> > % A solution profile can also be illuminating.
> > figure
> > %surf(u,x,t)
> > plot(t,u(:,:))
> > %plot(0.4*diff(u))
> > title('Displacement vs time for each z')
> > xlabel('t (s)')
> > ylabel('U (mm)')
> > %
> > ------------------------------------------------------
> > --------
> > function [c,f,s] = pdex1pde(x,t,u,DuDx)
> > c = 1/(0.4*2.7e-3);
> > f = DuDx;
> > s = 0;
> > %
> > ------------------------------------------------------
> > --------
> > function u0 = pdex1ic(x)
> > u0 = 0;
> > %
> > ------------------------------------------------------
> > --------
> > function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
> > pl = ul;
> > ql = 0;
> > pr =
> > ur+0.0013*t)*(t<500)+(ur+0.65)*(500<t<1000)+(ur+0.0013
> > *t)*(1000<t<1500)+(ur+0.65+0.65)*(1500<t<2000);
> > qr = 0;
From: Torsten Hennig on
> Thank you Torsten,
>
> dui you know how to use the restart the calculation
> with the solution obtained so far ?
>
> Thank you very much,
>
> Kamel
>

An ad-hoc solution:

Write the solution vector at t=1000 into a
global variable vector and change the value at
the right boundary point appropriately.
Then call pdepe again with different function handles
for the inital and boundary routines.
In the new routine for the initial values, supply the
values from the globally accessible solution vector
at t = 1000.

Best wishes
Torsten.

>
> Torsten Hennig <Torsten.Hennig(a)umsicht.fhg.de> wrote
> in message
> <1541508462.1794.1271918912055.JavaMail.root(a)gallium.m
> athforum.org>...
> > > Hello,
> > >
> > > I try to impose a boundary condition to resolve a
> > > parabolic equation using the pdepe solver. Do you
> > > know how to impose a discrete time boundary
> conition
> > > for the right BC like this (series of ramp
> > > displacements) :
> > >
> > > for t<500s, ur = 0.0013*t, 500<t<1000: ur = 0.65,
> > > 1000<t<1500: ur = 0.0013*t, 500<t<2000:
> > > : ur=0.65+0.65.
> > >
> > > I tried something like:
> > > pr = (ur+0.0013*t)*(t<500)+(ur+0.65)*(500<t<1000)
>
> > > + (ur+0.0013*t)*(1000<t<1500)+
> > > (ur+0.65+0.65)*(1500<t<2000);
> > >
> >
> > The boundary condition for u at the right boundary
> > point does not change continuously at time t=1000.
> > ur(1000-) = 0.65 ; ur(1000+) = 1.3.
> > Maybe this is a mistake in your setting.
> > If not, you will have to restart pdepe at time
> t=1000
> > with the solution obtained so far and artificially
> set
> > u=1.3 in the routine where the initial values are
> > supplied.
> >
> > Another point is that you have to set
> > pr = (ur-0.0013*t)*(t<500)+(ur-0.65)*(500<t<1000)
> > + (ur-0.0013*t)*(1000<t<1500)+
> > (ur-(0.65+0.65))*(1500<t<2000);
> >
> > Best wishes
> > Torsten.
> >
> > > but it works only for the two first blocks (up to
> > > t=1000).
> > >
> > > Please, could you help me to find an easy way to
> get
> > > this BC applied ?
> > >
> > > Thank you very much,
> > >
> > > Kamel
> > > ps: below is the main program
> > >
> > >
> > > function pdex1
> > >
> > > m = 0;
> > > x = linspace(0,1.41,50);
> > > t = linspace(0,2000,50);
> > >
> > > sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t);
> > > % Extract the first solution component as u.
> > > u = sol(:,:,1);
> > > save -ascii relax_10pts.dat u,x,t
> > >
> > > % A solution profile can also be illuminating.
> > > figure
> > > %surf(u,x,t)
> > > plot(t,u(:,:))
> > > %plot(0.4*diff(u))
> > > title('Displacement vs time for each z')
> > > xlabel('t (s)')
> > > ylabel('U (mm)')
> > > %
> > >
> ------------------------------------------------------
> > > --------
> > > function [c,f,s] = pdex1pde(x,t,u,DuDx)
> > > c = 1/(0.4*2.7e-3);
> > > f = DuDx;
> > > s = 0;
> > > %
> > >
> ------------------------------------------------------
> > > --------
> > > function u0 = pdex1ic(x)
> > > u0 = 0;
> > > %
> > >
> ------------------------------------------------------
> > > --------
> > > function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
> > > pl = ul;
> > > ql = 0;
> > > pr =
> > >
> ur+0.0013*t)*(t<500)+(ur+0.65)*(500<t<1000)+(ur+0.0013
> > > *t)*(1000<t<1500)+(ur+0.65+0.65)*(1500<t<2000);
> > > qr = 0;
From: Torsten Hennig on
> Hello,
>
> I try to impose a boundary condition to resolve a
> parabolic equation using the pdepe solver. Do you
> know how to impose a discrete time boundary conition
> for the right BC like this (series of ramp
> displacements) :
>
> for t<500s, ur = 0.0013*t, 500<t<1000: ur = 0.65,
> 1000<t<1500: ur = 0.0013*t, 500<t<2000:
> : ur=0.65+0.65.
>
> I tried something like:
> pr = (ur+0.0013*t)*(t<500)+(ur+0.65)*(500<t<1000)
> + (ur+0.0013*t)*(1000<t<1500)+
> (ur+0.65+0.65)*(1500<t<2000);
>

The boundary condition for u at the right boundary
point does not change continuously at time t=1000.
ur(1000-) = 0.65 ; ur(1000+) = 1.3.
Maybe this is a mistake in your setting.
If not, you will have to restart pdepe at time t=1000
with the solution obtained so far and artificially set
u=1.3 in the routine where the initial values are
supplied.

Another point is that you have to set
pr = (ur-0.0013*t)*(t<500)+(ur-0.65)*(500<t<1000)
+ (ur-0.0013*t)*(1000<t<1500)+
(ur-(0.65+0.65))*(1500<t<2000);

Best wishes
Torsten.

> but it works only for the two first blocks (up to
> t=1000).
>
> Please, could you help me to find an easy way to get
> this BC applied ?
>
> Thank you very much,
>
> Kamel
> ps: below is the main program
>
>
> function pdex1
>
> m = 0;
> x = linspace(0,1.41,50);
> t = linspace(0,2000,50);
>
> sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t);
> % Extract the first solution component as u.
> u = sol(:,:,1);
> save -ascii relax_10pts.dat u,x,t
>
> % A solution profile can also be illuminating.
> figure
> %surf(u,x,t)
> plot(t,u(:,:))
> %plot(0.4*diff(u))
> title('Displacement vs time for each z')
> xlabel('t (s)')
> ylabel('U (mm)')
> %
> ------------------------------------------------------
> --------
> function [c,f,s] = pdex1pde(x,t,u,DuDx)
> c = 1/(0.4*2.7e-3);
> f = DuDx;
> s = 0;
> %
> ------------------------------------------------------
> --------
> function u0 = pdex1ic(x)
> u0 = 0;
> %
> ------------------------------------------------------
> --------
> function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
> pl = ul;
> ql = 0;
> pr =
> ur+0.0013*t)*(t<500)+(ur+0.65)*(500<t<1000)+(ur+0.0013
> *t)*(1000<t<1500)+(ur+0.65+0.65)*(1500<t<2000);
> qr = 0;
 | 
Pages: 1
Prev: CDF for Comparison
Next: prowler in matlab