冰海烈焰 发表于 2015-6-16 20:17:04

Aspen adsorption 自带例子丁烯脱氢生成丁二烯Fortran语句

      subroutine pUgCtSl(Tg,p,y,ny,cs,nsol,
   :                   Rgas,ngas,Rtot,nreac,Rsol,nrsol,ifail)
C-----------------------------------------------------------
CReaction Rates for Butene dehydrogenation example
Creference: Froment, Bischoff: Chemical Reactor Analysis
Cand Design
CT.B. 06.09.98
C------------------------------------------------------------   
      implicit none
      integer ncomp, nsol, ngas, nreac, nrsol, ifail, itype, i, j,
   :      ncg, ncs, nctot, nr, ny

      parameter (ncg=4, ncs=1, nctot=5, nr=3)

      double precision Tg, p, c(ncg), cs(nsol), stage, Rgas(ngas),
   :               Rtot(nreac), Rsol(nrsol), R, Ea(nr), k0(nr),
   :               kactive(nr), stoichg(ncg, nr), stoichs(ncs, nr),
   :               F, ctot, pp(ncg), K, M_C, effect(nr), y(ny)

      data R   /8.31441d0/
      data K   /0.0018d0/
      data M_C /12.011d0/
      data Ea /29236.0d0, 32860.0d0, 21042.0d0/
      data k0 /5072.22d0, 43300.0d0, 141.89d0/
      data effect /1d0, 1d0, 1d0/
      data ((stoichg(i,j), i=1,1), j=1,nr) /0.0d0, 0.0d0, 1.0d0/
      data ((stoichg(i,j), i=2,2), j=1,nr) /0.0d0, -1.0d0, 0.0d0/
      data ((stoichg(i,j), i=3,3), j=1,nr) /1.0d0, 0.0d0, 0.0d0/
      data ((stoichg(i,j), i=4,4), j=1,nr) /0.0d0, 0.0d0, 0.0d0/
      data ((stoichs(i,j), i=1,1), j=1,nr) /0.0d0, 0.0d0, 0.0d0/


C-------------------------------------------------------------------
C set active rate constants to be k0 or 0, depending on stage number
C-------------------------------------------------------------------

      kactive(1) = k0(1)
      kactive(2) = k0(2)
      kactive(3) = k0(3)

C------------------------------------------------------------------
C Calculate the reaction rates of each reaction
C------------------------------------------------------------------
      do i=1, nr
      rtot(i) = kactive(i)*dexp(-Ea(i)/(R*Tg))*effect(i)
      enddo

      do i=1,ncg
      c(i) = y(i)*p/(R*1.0d-2*Tg)
      enddo

      ctot = 0.0d0

      do i=1, ncg
      ctot = ctot + c(i)
      enddo

      do i=1, ncg
      pp(i) = p*y(i)
      enddo
C------------------------------------------------------------------
C The following are only dummies. To be used until rate eq is known
c Substitute/Replace 1.0d-3 below with the right composition function F
C------------------------------------------------------------------                                 从这开始,我感觉是在定义反应速率,为什么还对反应速率进行比较?
      F= 1.0D-3
      Rtot(1) = rtot(1)*(pp(2)-pp(3)*pp(1)/K)/
   :   ((1.0d0+1.727d0*pp(2)+3.593d0*pp(3)+38.028d0*pp(1))**2.0d0)*
   :   dexp(-42.12d0*cs(1)*M_C)
      if(pp(2) .lt. 1.0d-20) then
         Rtot(2) = 1.0d-20
      else
         Rtot(2) = rtot(2)*pp(2)**0.743d0/
   :            ((1.0d0+1.695d0*dsqrt(pp(3)))**2.0d0)*
   :            dexp(-45.53d0*M_C*cs(1))/M_C
      endif
      if(pp(1) .lt. 1.0d-20) then
         Rtot(3) = 1.0d-20
      else
         Rtot(3) = rtot(2)*pp(1)**0.853d0/
   :            ((1.0d0+1.695d0*dsqrt(pp(3)))**2.0d0)*
   :            dexp(-45.53d0*M_C*cs(1))/M_C
      endif


C------------------------------------------------------------------
C Calculate the reaction rates for each component
C------------------------------------------------------------------
      Rgas(1) = Rtot(1)-Rtot(3)/(4.0d0)
      Rgas(2) = -(Rtot(1)+Rtot(2)/(4.0d0))
      Rgas(3) = Rtot(1)
      Rgas(4) = 1.0d-20
C      if(y(2) .gt. 0.99999d0)then
C      Rsol(1) = 0.0d0
C      else
      Rsol(1) = Rtot(2)+Rtot(3)
C      endif

      return
      end


chenhaijunsjy 发表于 2015-6-16 20:17:04


粗看了下,很适合我这种初学者

冰海烈焰 发表于 2015-6-16 20:17:04

chenhaijunsjy 发表于 2015-6-17 08:54
粗看了下,很适合我这种初学者

能看懂吗?最后一步Rgas(1)、Rgas(2)、Rgas(3)、Rgas(4)是什么?
页: [1]
查看完整版本: Aspen adsorption 自带例子丁烯脱氢生成丁二烯Fortran语句