CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

troble in code for wave equation by lassonen method

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 3, 2014, 07:32
Default troble in code for wave equation by lassonen method
  #1
New Member
 
nargess
Join Date: Oct 2013
Posts: 7
Rep Power: 12
nargess_md is on a distinguished road
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.
nargess_md is offline   Reply With Quote

Old   January 3, 2014, 14:57
Default
  #2
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,768
Rep Power: 71
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
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°.
FMDenaro is offline   Reply With Quote

Reply

Tags
fortran code, laasonen implicit method, wave equation


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help!on simple method code houkensjtu Main CFD Forum 0 July 9, 2011 10:45
Code for Discontinuous Galerkin Method ? Ameya J Main CFD Forum 2 April 21, 2011 05:45
cahn hilliard equation finite volume method dvdromnu OpenFOAM Programming & Development 0 December 14, 2009 02:09
orlandi code for poisson equation with FFT ( paid tutorial) HaKu Main CFD Forum 0 June 29, 2009 15:40
volumetric conservation equation in PHOENICS code mehdi Main CFD Forum 1 July 29, 2000 19:14


All times are GMT -4. The time now is 18:27.