{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

prob6-4-code - c find pprime coeffs db = 1/apb dc=1/apc app...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
program main cccccccccccccccccccccccccc c prob 6.4 patankar cccccccccccccccccccccccccc real cb,cc,p1,p2,p3,deltax real ab,ac real ub,uc real p2prime real db,dc real alphap,alphau real uresid, cresid integer iter integer itermax c... initial guesses ub=15 uc=15 p2=120 c... problem parameters cb =0.25 cc=0.2 ab=5 ac=4 p1=200 p3=38 deltax=2 c... under-relaxation, convergence tolerance, max iters alphap=0.8 alphau=0.8 tol=1.e-6 itermax=30 do iter=1,itermax print *,' ' print *,'*** iter = ', iter, '***' c... find momentum coeffs and under-relax apb =cb*abs(ub)*deltax apc =cc*abs(uc)*deltax apb=apb/alphau apc = apc/alphau bb= (1-alphau)*apb*ub bc =(1-alphau)*apc*uc print *,'momentum coeffs: apb, apc=', apb,apc c... find momentum residuals and normalize with ap*up uresid= (abs(apb*ub -(p1-p2)-bb)+ + abs(apc*uc -(p2-p3)-bc))/(abs(apb*ub)+abs(apc*uc)) c... solve momentum equations ub = ((p1-p2)+bb)/apb uc = ((p2-p3)+bc)/apc
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
print *,'momentum solution: ub, uc=', ub,uc
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: c... find pprime coeffs db = 1./apb dc=1./apc app = (ab*db+ac*dc) b = (ab*ub - ac*uc) c... find continuity residual and normalize with mean flow rate cresid = abs(b)/((abs(ab*ub)+abs(ac*uc))/2.) print *,'pprime coeffs: app, b=', app,b c... check convergence resid =cresid + uresid print *,'residual = ', resid if( resid.lt.tol) go to 100 c... solve pprime equation p2prime = b/app c...correct velocities; correct pressure using under-relaxtion ubprime=-db*p2prime ucprime =dc*p2prime ub = ub + ubprime uc = uc + ucprime p2=p2+ alphap*p2prime print *,'p2prime, ubprime, ucprime=', p2prime, ubprime,ucprime print *,'Corrected ub,uc,p2=',ub,uc,p2 c...check whether continuity satisfied b = ab*ub - ac*uc print *,'continuity source after correction=', b c... check whether momentum is satisfied resb = cb*abs(ub)*ub*deltax + (p2-p1) resc = cc*abs(uc)*uc*deltax + (p3-p2) print *, 'velocity residuals after correction: resb,resc=', + resb,resc end do 100 continue stop end...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

prob6-4-code - c find pprime coeffs db = 1/apb dc=1/apc app...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online