16 INTEGER :: i, j, kk, converg, discret, fa, outpt, irc
17 INTEGER :: ithick, idel, iab1, iab2
18 REAL,
DIMENSION(-NDFT:NDFT) :: zp
19 REAL,
DIMENSION(-NDFT:NDFT) :: rhop, rhop_o
20 REAL,
DIMENSION(-NDFT:NDFT) :: mf_att
21 REAL ,
DIMENSION(2) :: rhob
22 REAL :: end_x, steps, my0
24 REAL :: integrand, dev
25 REAL :: omega, free, phs1, om1, pbulk, surftens
26 REAL :: zges(np), inte2, f01, rm
27 REAL :: tc, pc, rhoc, tsav
28 REAL :: density(np), w(np,nc), lnphi(np,nc)
29 REAL :: cploc, dens_inv, dummy, cpcp
30 REAL :: intgrid(0:5000)
34 CALL set_default_eos_numerical
44 z3t = pi/6.0* parame(1,1) * ( 1.0 &
45 *(1.0-0.12*exp(-3.0*parame(1,3)/t)) )**3
48 write(*,*)
'SPECIFY ONLY ONE COMPONENT IN THE INPUT-FILE:' 49 write(*,*)
' ./input_file/INPUT.INP' 66 tau_cut = 4.0*(rc**(-12)-rc**(-6))
91 IF (eos >= 4) val_init(4) = 1.e-3
105 CALL phase_equilib(end_x,steps,converg)
106 IF (converg == 1)
THEN 109 val_init(3) = t - 10.0
111 write (*,*)
'no VLE found' 114 CALL si_dens (density,w)
115 rhob(1) = dense(1)/z3t
116 rhob(2) = dense(2)/z3t
117 write (*,*)
'densities ',rhob(1),rhob(2)
121 CALL fugacity (lnphi)
123 zges(1) = p / (rgas *t *density(1)) * mm(1)/1000.0
124 zges(2) = p / (rgas *t *density(2)) * mm(1)/1000.0
126 pbulk = zges(1)*rhob(1)
127 write (*,*)
'chem. potentials',lnphi(1,1),lnphi(2,1)
143 irc = nint(rc/dzp) + 1
147 iab2 = ithick + idel/2
148 iab1 = ithick - idel/2
150 zp(i) =
REAL(i) * dzp
154 zp(i) =
REAL(i) * dzp
155 rhop(i) = rhob(1) - (rhob(1) - rhob(2)) *
REAL(I-IAB1) /
REAL(iab2-iab1)
157 do i = iab2, discret+irc
158 zp(i) =
REAL(i) * dzp
171 dummy = dens_inv(cpcp)
194 DO j=-irc,discret+irc
195 zz1 = abs(zp(j)-zp(i))
197 IF (zz1 > rm .AND. zz1 <= rc)
THEN 198 integrand= 0.4*(zz1**(-10)-rc**(-10)) &
199 -(zz1**(-4 )-rc**(-4 )) &
200 +tau_cut/2.0*(zz1**2 -rc**2 )
201 ELSEIF (zz1 <= rm)
THEN 202 integrand= 0.40*(rm**(-10)- rc**(-10)) &
203 - (rm**(-4) - rc**(-4)) &
204 +0.5*(zz1**2- rm**2 ) &
205 +tau_cut/2.0*(zz1**2 -rc**2 )
210 IF (zz1 > 1.0 .AND. zz1 <= rc)
THEN 211 integrand= 0.4*(zz1**(-10)-rc**(-10)) &
212 -(zz1**(-4 )-rc**(-4 )) &
213 +tau_cut/2.0*(zz1**2-rc**2)
214 ELSEIF (zz1 <= 1.0)
THEN 215 integrand= 0.4*(1.0- rc**(-10)) &
217 +tau_cut/2.0*(1.0-rc**2)
222 intgrid(j+irc) = rhop(j)* integrand
223 inte2=inte2+dzp*(intgrid(j+irc)+f01)/2.0
243 mf_att(i) = -2.0*pi*parame(1,3)/t*parame(1,1)**2 *inte2
255 cploc = my0 + mf_att(i)
256 rhop(i) = dens_inv(cploc)
261 dev = dev + (rhop(i)-rhop_o(i))**2
268 IF (dev >= 4.e-8 .AND. kk <= 50) cycle converge_profile
269 IF (kk > 50)
write (*,*)
' no convergence in 50 steps' 270 EXIT converge_profile
271 END DO converge_profile
276 write (68,
'(i3,66(f18.8))') 0,zp(0)-zp(int(discret/2)),rhop(0),t, &
277 val_conv(4)/1.e5,density(1),density(2)
279 IF (
REAL(i)/
REAL(outpt) == real(int(i/outpt))) &
280 write (68,
'(i6,3(f18.10))') i,zp(i)-zp(int(discret/2)),rhop(i)
291 dense(1) = rhop(i)*z3t
292 densta(1) = rhop(i)*z3t
294 CALL fugacity (lnphi)
295 phs1 = dense(1)/z3t*z_ges
296 om1 = lnphi(1,1) - my0 - mf_att(i)/2.0
297 omega = pbulk - phs1 + dense(1)/z3t*om1
298 free = free + omega*dzp
300 surftens = 1.380662* t *free /parame(1,2)**2
302 write (*,*)
'Temp. [K], Pressure [bar] ',t,val_conv(4)/1.e5
303 write (*,*)
'Density [kg/m**3] ',density(1),density(2)
304 write (*,*)
'Dimensionless Density (rho*) ',rhob(1),rhob(2)
305 write (*,*)
'Excess Grand Potential ',free
306 write (*,*)
'Interfacial Tension [mN/m] = ',surftens
308 write (69,
'(7(f18.10))') t,val_conv(4)/1.e5, &
309 density(1),density(2),surftens,free,dev
319 IF (eos < 4 .AND. val_conv(4) > 1.e6)
CALL critical (tc,pc,rhoc)
322 IF (val_conv(4) > 1.e6)
THEN 323 write (*,
'(a,3(f16.4))')
'critical point',tc,pc/1.e5,rhoc
326 IF (val_conv(4) < 1.e6) tc=1000.0
327 IF ((t+2.5) <= tc)
THEN 329 IF ((t+8.0) <= tc) t=t+3.0
330 IF ((t+25.0) <= tc) t=t+15.0
335 z3t = pi/6.0* parame(1,1) * ( 1.0 &
336 *(1.0-0.12*exp(-3.0*parame(1,3)/t)) )**3
337 cycle diagram_condition
339 IF(tc /= 1.e3)
write(69,
'(6(f18.10))')tc,pc/1.e5,rhoc,rhoc,0.,0.
341 EXIT diagram_condition
342 END DO diagram_condition
351 SUBROUTINE tridiag (a,b,c,r,u,n)
358 REAL :: a(n),b(n),c(n),r(n),u(n)
361 INTEGER,
PARAMETER :: nmax = 5000
363 REAL :: bet, gam(nmax)
370 bet = b(j)-a(j)*gam(j)
371 IF (bet == 0.0)
call paus (
'TRIDIAG failed')
372 u(j) = (r(j)-a(j)*u(j-1))/bet
375 u(j) = u(j) - gam(j+1)*u(j+1)
378 END SUBROUTINE tridiag
397 SUBROUTINE spline_para (dzp,intgrid,utri,stepno)
404 REAL,
DIMENSION(5000) :: atri, btri, ctri, rtri, utri
405 REAL,
DIMENSION(0:5000) :: intgrid
416 rtri(j) = 3.0/dzp*(intgrid(j+1)-2.0*intgrid(j)+intgrid(j-1))
419 CALL tridiag (atri,btri,ctri,rtri,utri,(stepno-1))
421 END SUBROUTINE spline_para
428 SUBROUTINE spline_coeff(beta,gamma,delta,dzp,intgrid,utri,stepno)
434 REAL :: dzp, utri(5000)
435 REAL,
DIMENSION(0:5000) :: intgrid, beta, gamma, delta
438 beta(0) = (intgrid(1)-intgrid(0))/dzp - dzp/3.0*utri(1)
440 delta(0) = (utri(1)-0.0)/(3.0*dzp)
443 beta(j) = (intgrid(j+1)-intgrid(j))/dzp - dzp/3.0*(utri(j+1)+2.0*utri(j))
444 delta(j)= (utri(j+1)-utri(j))/(3.0*dzp)
446 gamma(stepno-1)= utri(stepno-1)
447 beta(stepno-1) = (intgrid(stepno)-intgrid(stepno-1))/dzp - dzp/3.0*(0.0+2.0*utri(stepno-1))
448 delta(stepno-1)= (0.0-utri(stepno-1))/(3.0*dzp)
456 END SUBROUTINE spline_coeff
463 SUBROUTINE spline_int(INTEGRAL,dzp,intgrid,utri,stepno)
469 REAL :: dzp, integral, utri(5000)
470 REAL,
DIMENSION(0:5000) :: intgrid, beta, gamma, delta
473 beta(0) = (intgrid(1)-intgrid(0))/dzp - dzp/3.0*utri(1)
475 delta(0) = (utri(1)-0.0)/(3.0*dzp)
478 beta(j) = (intgrid(j+1)-intgrid(j))/dzp - dzp/3.0*(utri(j+1)+2.0*utri(j))
479 delta(j)= (utri(j+1)-utri(j))/(3.0*dzp)
481 gamma(stepno-1)= utri(stepno-1)
482 beta(stepno-1) = (intgrid(stepno)-intgrid(stepno-1))/dzp &
483 - dzp/3.0*(0.0+2.0*utri(stepno-1))
484 delta(stepno-1)= (0.0-utri(stepno-1))/(3.0*dzp)
489 integral = integral + intgrid(j)*dzp +0.5*beta(j)*dzp**2 &
490 +1.0/3.0*gamma(j)*dzp**3 +0.25*delta(j)*dzp**4
493 END SUBROUTINE spline_int
503 REAL FUNCTION dens_inv(CPCP)
510 INTEGER :: l, n, i, ii, j, k, kk
512 REAL :: dl(3), dm(3), dmm(3)
513 REAL :: b(10), c(10), d(10)
515 REAL :: cpcp, cp, df, di, s, hsmy, lnphi(np,nc)
517 common/help/ a,b,c,d,dmm
518 DATA dm / 0.0, 0.0, 10.0 /
519 DATA dl / 0.1, 0.6, 0.95 /
523 dl(1) = 0.1 /parame(1,1)
524 dl(2) = 0.6 /parame(1,1)
525 dl(3) = 0.95 /parame(1,1)
529 IF (cpcp >= 1.e6)
THEN 538 CALL fugacity (lnphi)
544 d(i)=di+(df-di)/(
REAL(n)-1.0)*(
REAL(i)-1.0)
548 CALL fugacity (lnphi)
553 IF (l == 1) c(i)=exp(c(i))
565 b(k)=b(k-1)-c(j)*b(k)
570 a(k,l)=a(k,l)+d(i)*s*b(k)
577 IF (cp >= dmm(1))
THEN 581 IF (l == 1) cp=exp(cp)
587 dens_inv=dens_inv*cp+a(ii,l)
592 END FUNCTION dens_inv
601 SUBROUTINE barker_org(T_st,d_hs)
607 REAL :: gint, summ, xsig, eux, add, xinv
608 REAL :: x6, u0, u0r, d_hs, epst, t_st, rm
615 summ = 1.0 / (2.0 * gint)
617 xsig =
REAL(j) /gint * rm
618 IF ( xsig < 0.5 )
then 623 u0 = 4.0 * x6 * (x6-1.0)
625 IF ( u0r > 20.0 )
THEN 631 add = (1.0-eux) / gint
634 summ = summ - add/2.0
638 END SUBROUTINE barker_org
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains constant...
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW Module DFT_MODULE This module...
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...