Question: Searching for a procedure in PDE

I have the following two PDEs:

PDE := diff(u(x, t), t) = diff(u(x, t), x, x)+sin(x+t)-cos(x+t);

IBC:= D[1](u)(0,t)=-sin(t),
D[1](u)(1,t)=-sin(1+t),
u(x,0)=cos(x);

pds := pdsolve( PDE, [IBC], numeric, time = t, range = 0 .. 1,
spacestep = 1/32, timestep = 1/32,
errorest=true
)

 

PDE2 := diff(v(x, t), t) = diff(v(x, t), x, x);
IBC2:= D[1](v)(0,t)=0,
D[1](v)(1,t)=-0.000065*v(1, t)^4,
v(x,0)=1;

pds1 := pdsolve( PDE2, [IBC2], numeric, time = t, range = 0 .. 1,
spacestep = 1/32, timestep = 1/32,
errorest=true
);

 

Now, what I want to do with these two PDEs is the following:

 

For each h=timestep=spacestep  = 1/16 , 1/32 , 1/64 , 1/128 , 1/256

Calculate the error norm ||E||_h = sqrt(sum_{j=0}^{1/h} h* |u(j*h,tval)-v(j*h,tval)|^2)

where tval is some chosen point between 0 and 1 (this value is fixed for each spacestep chosen).

 

And then plot the graph of log ||E||_h vs. log h above.

 

What I don't know is how to extract each time the spacestep and its PDE's two solutions, does someone have a suggested script to use here?

 

 

Please Wait...