# troble in code for wave equation by lassonen method

 Register Blogs Members List Search Today's Posts Mark Forums Read

 January 3, 2014, 08:32 troble in code for wave equation by lassonen method #1 New Member   nargess Join Date: Oct 2013 Posts: 7 Rep Power: 11 Hi every body I have written a code in FORTRAN 95 to compute the solution of wave equation dT/dt=a* d^2T/dx^2 by laasonen method, but there is a problem: the problem is a wall 1ft thick and infinite in other directions. it's initially in constant temperature 100 F and suddenly temperature of two sides is increased and maintained at 300 F. I wrote the following code to find the solution using the Laasonen method.. but there is a problem that my answers contains numbers more than 300 F near the wall. can sb help me about that: program lassonen implicit none integer,parameter::mmax=100,mmin=-100 integer::i,j,n,m,k real,parameter::alpha=0.1 real::diff,a,b,c,delta_t,delta_x,total_t,x,P,L real,dimension(mmin:mmax)::G,H,D real,dimension(mmin:mmax)::T,U open(unit=3,file="1.3.txt") !------------------------------------------------------------ !-----------------------------getting the input-------------- !------------------------------------------------------------ write(*,*)'enter delta_x:' read(*,*)delta_x write(*,*)'enter delta_t:' read(*,*)delta_t write(*,*)'enter total length:' read(*,*)x !length of the plate write(*,*)'enter total time:' read(*,*)total_t diff=(alpha*delta_t/(delta_x**2))!diffusion number !------------------------------------------------------------- !------------------------defining matrix k elements----------- !------------------------------------------------------------- a=diff b=-(1+2*diff) c=diff P=x/delta_x L=(total_t/delta_t)+1 m=P+1 !------------------------------------------------------------ !-----------------------initial condition-------------------- !------------------------------------------------------------ do k=2,m-1 T(k)=100 end do !------------------------------------------------------------ !-----------------------boundary condition------------------- !------------------------------------------------------------ !do n=1,L T(1)=300 T(m)=300 !end do !------------------------------------------------------------- !-------------------------D deffinition----------------------- !------------------------------------------------------------- do n=2,L D(2)=-T(2)-a*T(1) do i=3,m-2 D(i)=-T(i) end do D(m-1)=-T(m-1)-c*T(m) !------------------------------------------------------------- !------------------------H & G deffinition-------------------- H(1)=0 G(1)=300 do i=2,m-1 H(i)=c/(b-a*H(i-1)) G(i)=(D(i)-a*G(i-1))/(b-a*H(i-1)) !write(*,*)i, H(i), G(i) end do do j=m-1,2,-1 T(j)=-H(j)*T(j+1)+G(j) write(*,*) j, T(j) end do - do i=1,m write(3,*) i, T(i) end do end do end program lassonen I really gave up. I have no idea to fix this. please help me.

 January 3, 2014, 15:57 #2 Senior Member   Filippo Maria Denaro Join Date: Jul 2010 Posts: 6,192 Rep Power: 66 You have a linear parabolic equation, that's not a wave equation! As you are solving by an implicit method, I suppose something is wrong in your BC at level n+1, if I have gotten your case you must reach a steady state at T=300°.

 Tags fortran code, laasonen implicit method, wave equation