APPENDICE A
LA SUBROUTINE REZPENT MODIFICATA
subroutine rezpent c
c
====================================================================== c
c template rezoner for a 4-valve OHC or DOHC engine with a pentroof c combustion chamber that is nearly symmetric between the intake c and exhaust sides, and in which the intake and exhaust valves c alternately share the same physical space. an example is the c GM Quad 4, with either a half-circle or full-circle mesh. c
c rezpent is called by: rezone (every cycle), and also snapb and c snapvfce (cycle 0 only)
c
c rezpent calls the following subroutines and functions: (none) c c ====================================================================== c include 'comkiva.i' c c <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> c do 10 i4=ifirst,nverts zsquish(i4)=0.0 10 continue c +++
c +++ flag all squish region vertices that lie on a logical line of c +++ sight going up from the piston surface, except around the
c +++ subsequent do-loops: c +++ i4min=+1000000 i4max=-1000000 xtest=+1.0e+10 do 80 n=1,nvfaceb(0) cylwall=0.0 i4=i4faceb(n,0) if(i4.lt.0) then cylwall=1.0 i4=iabs(i4) if(x(i4).lt.xtest) then xtest=x(i4) i4save=i4 endif endif limit=1 kp=i4 i4min=min(i4,i4min) i4max=max(i4,i4max) 70 kp=i8tab(kp)
if(fv(kp).eq.flsqsh .and. idface(kp).eq.-1) then zsquish(kp)=1.0 + cylwall i4min=min(kp,i4min) i4max=max(kp,i4max) limit=limit+1 if(limit.gt.nverts) then write(12,910) write( *,910) call exitk(1) endif go to 70 else go to 80
endif 80 continue
zminap=z(i8tab(i4save)) c +++
c +++ openval controls the upward relaxation of the grid that takes c +++ place only while valves are open. when valves are closed this is c +++ not used. this prevents the grid lines from forever migrating c +++ upward. c +++ openval=0.0 do 85 n=1,nvalves if(vliftnow(2*n-1).gt.0.3) openval=1.0 85 continue head=stroke + squish + 0.001 thsectdeg=thsect/pio180 do 90 i4=i4min,i4max im=imtab(i4) ip=i1tab(i4) jm=jmtab(i4)
if(abs(y(i4)).lt.1.0e-6 .and. thsectdeg.lt.181.0) jm=i3tab(i4) jp=i3tab(i4)
if(fv(im).eq.flhead .or. fv(ip).eq.flhead .or.
& fv(jm).eq.flhead .or. fv(jp).eq.flhead) zsquish(i4)=0.0 c if(zsquish(i4).eq.2.0 .and. z(i4).lt.head) zsquish(i4)=0.0 if(zsquish(i4).eq.0.0 .or. zsquish(i4).eq.2.0) go to 90 kp=i8tab(i4)
kpkp=i8tab(kp)
c if(abs(x(i4)).lt.0.9 .and. fv(kp).eq.flhead) zsquish(kp)=3.0 if(idface(kp).ge.1) zsquish(i4)=4.0
if(idface(jm).ge.1 .or. idface(jp).ge.1) zsquish(i4)=5.0 if((idface(im).ge.1 .or. idface(ip).ge.1) .and.
& abs(x(i4)).lt.0.9) zsquish(i4)=6.0 c if((fv(kp ).eq.flhead .and. z(kp ).lt.head) .or.
c & (fv(kpkp).eq.flhead .and. z(kpkp).lt.head)) zsquish(i4)=7.0 90 continue do 92 i4=i4min,i4max if(fv(i4).eq.4.0.and.x(i4).gt.3.85)zsquish(i4)=7.0 c if(fv(i4).eq.4.0.and.x(i4).lt.-3.85)zsquish(i4)=7.0 92 continue c do 93 i4=i4min,i4max c if(fv(i4).eq.4.0.and.y(i4).lt.0.01.and.abs(x(i4)).lt.4.29)then c zsquish(i4)=0.0 c endif c 93 continue iterlim=50 testqrez=0.02 iter=0 100 ind=0 do 110 i4=i4min,i4max if(zsquish(i4).eq.0.0) go to 110 im=imtab(i4) ip=i1tab(i4) jm=jmtab(i4)
if(abs(y(i4)).lt.1.0e-6 .and. thsectdeg.lt.181.0) jm=i3tab(i4) jp=i3tab(i4) km=kmtab(i4) kp=i8tab(i4) if(zsquish(i4).eq.1.0) then algoritmo ideato co=vliftnow(2)/vliftmax(2) xn=(1/(2+4*co))*(co*(2.0*(1.02*x(im)+0.98*x(ip))) &+1.0*x(km)+1.0*x(kp)) zn=(1/(2+4*co))*(co*(z(im)+z(ip)+z(jm)+z(jp)) &+0.95*z(km)+1.05*z(kp))
if(zsquish(kp).eq.4.0 .and. idface(km).eq.0) then xn=0.5*(x(km)+x(kp))
zn=0.5*(z(km)+z(kp)) endif if(wmove(0).gt.0.0) zn=max(zn,zminap) elseif(zsquish(i4).eq.2.0) then xn=x(i4) zn=0.5*(0.95*z(km)+1.05*z(kp)) elseif(zsquish(i4).eq.3.0) then xn=0.5*(x(im)+x(ip)) zn=z(kp)-0.07 elseif(zsquish(i4).eq.4.0) then xn=x(kp) zn=z(kp)-0.03*(1+co*4) elseif(zsquish(i4).eq.5.0) then xn=0.5*(x(jm)+x(jp)) zn=0.5*(z(jm)+z(jp)) elseif(zsquish(i4).eq.6.0) then xn=0.5*(x(im)+x(ip)) zn=0.5*(1.1*z(im)+0.9*z(ip)) elseif(zsquish(i4).eq.7.0) then xn=x(kp) zn=0.5*(0.95*z(km)+1.05*z(kp)) c if(x(i4).gt.0.0)then c if(bcl(i1tab(i4)).eq.2.0)zn=z(i1tab(i4)) c if(bcl(i1tab(i1tab(i4))).eq.2.0)zn=z(i1tab(i1tab(i4))) c endif c if(x(i4).lt.0.0)then c if(bcl(imtab(i4)).eq.2.0)zn=z(imtab(i4)) c if(bcl(imtab(imtab(i4))).eq.2.0)zn=z(imtab(imtab(i4))) c endif elseif(zsquish(i4).eq.8.0) then zn=z(jp) xn=x(jp) c ztest=100.0 c do 150 i4pr=ifirst,nverts
c if(x(i4pr).gt.4.0)then c if(z(i4pr).lt.ztest) then c ztest=z(i4pr) c i4save=i4pr c endif c endif c 150 continue c di=z(kmtab(i4save))-z(i4save) c open(unit=50,file='stronzo.txt') c write(50,*)'' c if(fv(km).eq.3.0)zn=z(kp)-di*0.5 else xn=x(kp) zn=0.5*(z(km)+z(kp)) c if(y(i4).lt.0.01)then c zn=z(jp) c xn=x(jp) c endif endif delx=xn-x(i4) x(i4)=xn if(abs(delx).gt.testqrez) ind=ind+1 delz=zn-z(i4) z(i4)=zn if(abs(delz).gt.testqrez) ind=ind+1 110 continue iter=iter+1
if(ind.gt.0 .and. iter.lt.iterlim) go to 100 cett controllo zsquish
c do 141 i4=ifirst,nverts
c if(zsquish(i4).eq.1.0.and.ncyc.eq.353)then c write(26,960) i4,x(i4),y(i4),z(i4)
c nu=nu+1 c endif
c 141 continue cett fine
c if(ncyc.eq.2802)call visualizzagriglia c if(ncyc.eq.156)call visualizzagriglia return
910 format(' rezpent failed to find top of cylinder') 960 format(1x,'n,',i5,',',e12.5,',',e12.5,','e12.5) end