;PRO lecture_diffusion_draft ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Task: Solve diffusion-equation by separation of ;variables as described in paper1.tex. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Definition of parameters Lx=10.0 D=0.5; diffusion coefficient x0=5.0 & x1=7.0 A=2.0 & l=1.5 temp0=0.5 & temp1=2.0; Temperature at x=0,Lx for (c) tend=20.0; Until what time to compute? ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ;Setup grid in x and t nx=51; number of grid points in x x=Lx*findgen(nx)/(nx-1) & dx=Lx/(nx-1) nt=10*long(tend)+1; number of time steps tvec=tend*findgen(nt)/(nt-1) fx0=fltarr(nx); initialise fx0 ; ;Define initial conditions rho(x,0)=fx0(x) ;Choose only one and out-comment the others fx0=A*exp(-(x-x0)^2/l); IC a); for a) ;u=where((x ge x0) and (x le x1)) & fx0[u]=A; for b) ;fx0=0.0*x; for c) ; ;Show the intial condition plot,x,fx0,yrange=1.0*[-0.2,1.2*A],linestyle=1,thick=2,$ xtitle='x',ytitle='rho',title='1D Diffusion equation',$ charsize=1.5 ; ;Task: ;Find separable solutions of the Diffusion equations ;which fulfills boundary and initial conditions ;as defined in task 1 a-c ;Rember: Linear PDE => Superposition of solutions ;is also a solution of the PDE. ; @lecture_diffusion_task1a.pro ; b is identical ;@lecture_diffusion_task1c.pro ;@lecture_diffusion_task1d.pro END