Kamel
2010-04-21 18:25:04 UTC
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);
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;
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);
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;