14 Public :: fmt_weighted_densities
23 Subroutine fmt_weighted_densities(rhop,n0,n1,n2,n3,nv1,nv2,phi_dn0,phi_dn1,phi_dn2,phi_dn3,phi_dnv1,phi_dnv2,user)
28 Use mod_dft
, Only: zp,dzp,fa
33 #include <finclude/petscsys.h> 37 petscscalar :: rhop(ncomp,user%gxs:user%gxe)
38 REAL,
dimension(user%gxs:user%gxe),
Intent(OUT) :: n0,n1,n2,n3,nv1,nv2
39 REAL,
dimension(user%gxs:user%gxe),
Intent(OUT) :: phi_dn0,phi_dn1,phi_dn2,phi_dn3,phi_dnv1,phi_dnv2
46 INTEGER,
parameter :: nmax = 800
47 REAL,
dimension(NMAX) :: x_int,n2_int,n3_int,nv2_int
48 REAL,
dimension(NMAX) :: y2_n2, y2_n3,y2_nv2
49 REAL :: int_n2,int_n3,int_nv2,xhi,xlo
50 REAL :: zms,zms2,zms3,logzms
51 REAL :: nn0,nn1,nn2,nn3,nnv1,nnv2
52 REAL :: rhopjk, rhopjp1k
62 fa2 = maxval(fa(1:ncomp) + 5) / 2
69 Do i=user%xs-fa2,user%xe+fa2
78 rhopjk = rhop(k,j) * parame(k,1)
79 rhopjp1k = rhop(k,j+1) * parame(k,1)
81 If( ( zp(i)-zp(j+1) ) < d2 .and. ( zp(i) - zp(j) ) >= d2 )
Then 84 write(*,*)
'Surface Tension Code: n /=1 in FMT_Weighted_Densities' 89 dz = zp(j+1) - (zp(i) - d2)
92 n2_int(n) = rhopjk + (rhopjp1k-rhopjk) / (dzp) * (dzp-dz)
94 nv2_int(n) = rhopjk*zz +(rhopjp1k*(zp(j+1)-zp(i))-rhopjk*zz)/(dzp)*(dzp-dz)
97 Else If (zp(j) > (zp(i)-d2) .and. zp(j) <= (zp(i)+d2))
Then 100 x_int(n) = x_int(n-1) + dz
104 n3_int(n) = rhopjk * (d2**2 - zz**2)
105 nv2_int(n) = rhopjk * zz
107 If (zp(j) < (zp(i)+d2) .and. zp(j+1) >= (zp(i)+d2) )
Then 109 dz = zp(i) + d2 - zp(j)
113 x_int(n) = x_int(n-1) + dz
118 n2_int(n) = rhopjk + (rhopjp1k-rhopjk) / (dzp) * dz
120 nv2_int(n) = rhopjk*zz + (rhopjp1k*(zp(j+1)-zp(i)) - rhopjk*zz) / (dzp) * dz
134 write(*,*)
'Increase NMAX in FMT_Weighted_Densities (also in AD Routine!!)' 138 call spline ( x_int, n2_int, n, 1.e30, 1.e30, y2_n2 )
139 call spline ( x_int, n3_int, n, 1.e30, 1.e30, y2_n3 )
140 call spline ( x_int, nv2_int, n, 1.e30, 1.e30, y2_nv2 )
142 call splint_integral ( x_int, n2_int, y2_n2, n, xlo, xhi, int_n2 )
143 call splint_integral ( x_int, n3_int, y2_n3, n, xlo, xhi, int_n3 )
144 call splint_integral ( x_int, nv2_int, y2_nv2, n, xlo, xhi, int_nv2 )
147 n2(i) = n2(i) + pi * dhs(k) * int_n2
148 n1(i) = n1(i) + 0.5 * int_n2
149 n0(i) = n0(i) + int_n2/dhs(k)
150 n3(i) = n3(i) + pi * int_n3
151 nv2(i) = nv2(i) -2.0 * pi * int_nv2
152 nv1(i) = nv1(i) -int_nv2 / dhs(k)
172 Do i=user%xs-maxval((fa(1:ncomp)+1)/2),user%xe+maxval((fa(1:ncomp)+1)/2)
185 if(isnan(logzms))
Then 186 write(*,*)
'Surface Tension Code: zms < 0, log(zms) undefined FMT_Weighted_Densities' 191 phi_dn2(i) = nn1/zms + 3.0*(nn2*nn2-nnv2*nnv2) * (nn3+zms2*logzms) / (36.0*pi*nn3*nn3*zms2)
193 phi_dn3(i) = nn0/zms + (nn1*nn2-nnv1*nnv2)/zms2 - (nn2**3-3.0*nn2*nnv2*nnv2) * (nn3*(nn3**2-5.0*nn3+2.0)+2.0*zms3*logzms) &
194 / (36.0*pi*nn3**3*zms3)
196 phi_dnv1(i) = -nnv2/zms
198 phi_dnv2(i) = -nnv1/zms - 6.0*nn2*nnv2*(nn3+zms2*logzms)/(36.0*pi*nn3**2*zms2)
202 End Subroutine fmt_weighted_densities
210 Subroutine fmt_dfdrho(i,fa,user,phi_dn0,phi_dn1,phi_dn2,phi_dn3,phi_dnv1,phi_dnv2,dF_drho_FMT)
214 Use mod_dft
, Only: zp,dzp
221 INTEGER,
INTENT(IN) :: i
222 INTEGER,
INTENT(IN) :: fa(ncomp)
224 REAL,
dimension(user%gxs:user%gxe),
INTENT(IN) :: phi_dn0,phi_dn1,phi_dn2,phi_dn3,phi_dnv1,phi_dnv2
225 REAL,
dimension(user%xs:user%xe,ncomp),
INTENT(OUT) :: df_drho_fmt
231 REAL :: dz,d2,zz, zz_jp1
232 INTEGER,
parameter :: nmax = 800
233 REAL,
dimension(NMAX) :: x_int,y_int,y0_int,y1_int,y2_int,y3_int,yv1_int,yv2_int,y2
234 REAL :: xhi,xlo,integral,int0,int1,int2,int3,intv1,intv2
245 fa2 = ( fa(k) + 5 ) / 2
250 If( ( zp(i)-zp(j+1) ) < d2 .and. ( zp(i) - zp(j) ) >= d2 )
Then 253 write(*,*)
'Surface Tension Code: error in FMT_dFdrho, n should be 1 here!' 256 dz = zp(j+1) - (zp(i) - d2)
258 zz_jp1 = zp(j+1) - zp(i)
259 at_j = phi_dn0(j)/dhs(k) + 0.5*phi_dn1(j) + pi*dhs(k)*phi_dn2(j) &
260 + pi*phi_dn3(j)*(d2**2 - zz**2) + phi_dnv1(j)*zz/dhs(k) + 2.0*pi*phi_dnv2(j)*zz
262 at_jp1 = phi_dn0(j+1)/dhs(k) + 0.5*phi_dn1(j+1) + pi*dhs(k)*phi_dn2(j+1) &
263 + pi*phi_dn3(j+1)*(d2**2 - zz_jp1**2) + phi_dnv1(j+1)*zz_jp1/dhs(k) + 2.0*pi*phi_dnv2(j+1)*zz_jp1
265 y_int(n) = at_j + (at_jp1-at_j)/dzp * (dzp-dz)
274 Else If (zp(j) > (zp(i)-d2) .and. zp(j) <= (zp(i)+d2))
Then 278 x_int(n) = x_int(n-1) + dz
281 y_int(n) = phi_dn0(j)/dhs(k) + 0.5*phi_dn1(j) + pi*dhs(k)*phi_dn2(j) &
282 + pi*phi_dn3(j)*(d2**2 - zz**2) + phi_dnv1(j)*zz/dhs(k) + 2.0*pi*phi_dnv2(j)*zz
295 If (zp(j) < (zp(i)+d2) .and. zp(j+1) > (zp(i)+d2) )
Then 299 zz_jp1 = zp(j+1) - zp(i)
300 dz = zp(i) + d2 - zp(j)
301 x_int(n) = x_int(n-1) + dz
302 at_j = phi_dn0(j)/dhs(k) + 0.5*phi_dn1(j) + pi*dhs(k)*phi_dn2(j) &
303 + pi*phi_dn3(j)*(d2**2 - zz**2) + phi_dnv1(j)*zz/dhs(k) + 2.0*pi*phi_dnv2(j)*zz
304 at_jp1 = phi_dn0(j+1)/dhs(k) + 0.5*phi_dn1(j+1) + pi*dhs(k)*phi_dn2(j+1) &
305 + pi*phi_dn3(j+1)*(d2**2 - zz_jp1**2) + phi_dnv1(j+1)*zz_jp1/dhs(k) + 2.0*pi*phi_dnv2(j+1)*zz_jp1
306 y_int(n) = at_j + (at_jp1-at_j)/dzp * dz
330 write(*,*)
'Surface Tension code: Increase NMAX in FMT_dFdrho (also in AD Routine!!)' 334 call spline(x_int,y_int,n,1.e30,1.e30,y2)
335 call splint_integral(x_int,y_int,y2,n,xlo,xhi,integral)
352 df_drho_fmt(i,k) = integral*parame(k,1)
357 End Subroutine fmt_dfdrho
360 End Module mod_dft_fmt
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains constant...
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...
In this module, the application context is defined.
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...