# troble in code for wave equation by lassonen method

 User Name Remember Me Password
 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: 5 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: 3,494 Rep Power: 40 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

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post houkensjtu Main CFD Forum 0 July 9, 2011 10:45 Ameya J Main CFD Forum 2 April 21, 2011 05:45 dvdromnu OpenFOAM Programming & Development 0 December 14, 2009 03:09 HaKu Main CFD Forum 0 June 29, 2009 15:40 mehdi Main CFD Forum 1 July 29, 2000 19:14

All times are GMT -4. The time now is 20:05.

 Contact Us - CFD Online - Privacy Statement - Top