Professional Documents
Culture Documents
Numerican Method
Numerican Method
Submission Date:
11.20.2013
Introduction:
In this homework, we will consider a laminar boundary layer over a flat plate which its temperature distribution is knows. We will use Runge- Kutta for system of ordinary differential equations to solve second order ODE and we will consider a different cases for various x locations ,various for various fluids. and finally
Method:
Considering the given problem in the homework, we will notice that in order to solve this second order differential equation we will need two initial conditions. However we only have one initial condition and the other one which is first derivative of temperature is missing. As we learned in classes, in these situation we will use the Shooting Method to solve these kind of problems by shooting (guessing) our missing initial condition and solving the problem accordingly till we get a proper result.
8.00E+06 7.00E+06 6.00E+06 5.00E+06 4.00E+06 Series2 3.00E+06 2.00E+06 1.00E+06 0.00E+00 0.00E+00
Falt plate(y-axies)
2.00E-04
4.00E-04
6.00E-04
8.00E-04
1.00E-03
1.20E-03
Series1
Code:
c-----------------------------------------------------------------------c RK4 SOLVER for a Boundary Value Problem c Course: AE305 c Instructors: I.H. TUNCER & Y. OZYORUK c------------------------------------------------------------------------
program shootingRK4 parameter (neq=2) real y1(neq),Tinf,Twall,etamax,deta,eta,error,eallowed integer n character*40 fname Twall=500. Tinf=300. error=1. eallowed=0.1 n=1 print*,' ' print*,' Enter the EtaMax and the StepSize :>' read(*,*) etamax,deta print*,' Enter the output file name [solution.dat]:' read(*,'(a)') fname if( fname .eq. ' ') fname = 'solution.dat' do while(error .gt. eallowed) eta = 0. y1(1) = Twall y1(2) = n*(Twall-Tinf)/10. open(1,file=fname,form='formatted') write(1,'(3e15.7)') eta,y1(1),y1(2) do while(eta .lt. etamax) call SRK4(eta,y1,deta) eta = eta + deta write(1,'(3e15.7)') eta,y1(1),y1(2) enddo close(1) error=abs(y1(1)-Tinf) print*,error n=n+1 endd stop end subroutine SRK4(x1,y1,dx) parameter (neq=2) real y1(neq),ytmp(neq)
real k1(neq),k2(neq),k3(neq),k4(neq) dx2 = 0.5*dx call ODES(x1,y1,k1) do n = 1,neq ytmp(n) = y1(n) + k1(n)*dx2 enddo call ODES(x1+dx2,ytmp,k2) do n = 1,neq ytmp(n) = y1(n) + k2(n)*dx2 enddo call ODES(x1+dx2,ytmp,k3) do n = 1,neq ytmp(n) = y1(n) + k3(n)*dx enddo call ODES(x1+dx,ytmp,k4)
subroutine ODES(x,y,ode) parameter (neq=2) real y(neq),ode(neq),beta,cf,re,pr,L,vinf,nu,rex,xx real Tinf,Twall nu=5.2e-5 xx=0.2 L=1. vinf=20. Tinf=300. Twall=500. pr=0.72 re=L*vinf/nu rex=re/L*xx cf=0.664*sqrt(rex) beta=(sqrt(re)*cf*pr)/(2**1.5) ode(1) = y(2) ode(2) = Tinf - y(1) - beta*y(2) return end