Cooling of a Cube
Example from the PscFunctions package
Using PscFunctions routines it is possible to obtain a line of new solutions of initial boundary value problems for the heat equation
.
Solution of the problem of temperature distribution in unlimited in all directions three-dimensional solid with a given initial temperature may be found with the help of 3D Poisson integral. If the initial temperature function is represented as
then the 3D integral disintegrates into the product of three integrals.
As an example we shall solve a problem about cooling of the unit cube with constant initial temperature
and zero boundary temperature.
Let's consider a unit function on segment [0,1]. For this function we execute odd periodic extension with period 2 to entire axis. This can be made with the help of
FPeriodic
routine of the
PSCFunctions
package. Using obtained function
F(x)
it is possible to construct the function
. This function should be substituted in the Poisson formula that will give a solution of the problem. At the beginning we generate the function
F(x).
> | restart; with(PscFunctions): f:=x->1: Ff:=FPeriodic(f,0..1,style='odd',checkcont=false): F:=x->subs(t=x,Ff(t)): print('F(x)'=F(x)); plot(F(x),x=-2..3,thickness=2,color=BLACK); |
Function
Mod(t,a)
used in the previous formulas
gives the remainder on division of the first argument by the second
.
In the following code with the help of
SCuboid
routine of our package we create the equation of a surface of the cube.
> | Cube:=SCuboid(1,1,1): xc:=(u,v)->Cube[1](u,v):yc:=(u,v)->Cube[2](u,v):zc:=(u,v)->Cube[3](u,v): pc:=plot3d([xc(u,v),yc(u,v),zc(u,v)],u=0..4,v=-1..2,scaling=CONSTRAINED,grid=[9,7],axes=BOXED,labels=["X","Y","Z"],style=WIREFRAME,color=BLACK): plot3d([xc(u,v),yc(u,v),zc(u,v)],u=0..4,v=-1..2,scaling=CONSTRAINED,grid=[17,13],axes=BOXED,labels=["X","Y","Z"]); `Equation of the Cube`; X=xc(u,v); Y=yc(u,v); Z=zc(u,v); |
Then we shall construct a temperature function
.
Temperature distribution we represent in three orthogonal sections passing through the centre of the cube. For this purpose with the help of
DRectDomain
routine of our package we generate the equation of section area of the cube, i.e. the equation of the plane region of the quadrate. Functions (
x1(u,v),y1(u,v),z1(u,v)
), (
x2(u,v),y2(u,v),z2(u,v)
), (
x3(u,v), y3(u,v)
z3(u,v)
) represent parametric equations of these sections. For each of these sections we create the function of color, which corresponds to temperature of the points of the section.
> | v:=(x,t)->evalf[4](1/sqrt(Pi)*Int(F(x+2*sqrt(t)*tau)*exp(-tau^2),tau=-10..10, method=_d01ajc)): L:=1: NN:=10: h:=L/NN: U1:=(x,t)->FPolyline([seq([h*i,v(h*i,t)],i=0..NN)])(x): U:=(x,y,z,t)->U1(x,t)*U1(y,t)*U1(z,t): # temperature distribution in the cube tr:=DRectDomain(x->0,x->1,0..1): # equation of the square x1:=(u,v)->1/2: y1:=(u,v)->tr[1](u,v): z1:=(u,v)->tr[2](u,v): x2:=(u,v)->tr[1](u,v): y2:=(u,v)->1/2: z2:=(u,v)->tr[2](u,v): x3:=(u,v)->tr[1](u,v): y3:=(u,v)->tr[2](u,v): z3:=(u,v)->1/2: t0:=0.01: # point of time clr:=(i,u,v)->U(x||i(u,v),y||i(u,v),z||i(u,v),t0): scAll:=plot3d([[x1(u,v),y1(u,v),z1(u,v)],\ [x2(u,v),y2(u,v),z2(u,v)],\ [x3(u,v),y3(u,v),z3(u,v)]],u=0..1,v=0..1,\ scaling=CONSTRAINED,grid=[11,11],axes=BOXED,labels=["X","Y","Z"],\ color=[[clr(1,u,v),0,0],[clr(2,u,v),0,0],[clr(3,u,v),0,0]]): plots[display](scAll,pc); |