11 MODULE mod_dft_chain_d
21 SUBROUTINE chain_aux_d(rhop, rhopd, rhobar, rhobard, lambda, lambdad, &
25 USE mod_dft
, ONLY : zp, dzp, fa
32 #include <finclude/petscsys.h> 37 petscscalar :: rhop(ncomp,user%gxs:user%gxe)
38 petscscalar :: rhopd(ncomp,user%gxs:user%gxe)
39 REAL,
INTENT(OUT) :: rhobar(user%gxs:user%gxe,ncomp)
40 REAL,
INTENT(OUT) :: rhobard(user%gxs:user%gxe,ncomp)
41 REAL,
INTENT(OUT) ::
lambda(user%gxs:user%gxe,ncomp)
42 REAL,
INTENT(OUT) :: lambdad(user%gxs:user%gxe,ncomp)
48 REAL :: zz, dz, xlo, xhi, integral_lamb, integral_rb
49 REAL :: integral_lambd, integral_rbd
50 INTEGER,
parameter :: nmax = 800
51 REAL,
DIMENSION(NMAX) :: x_int, lamb_int, rb_int
52 REAL,
DIMENSION(NMAX) :: lamb_intd, rb_intd
53 REAL,
DIMENSION(NMAX) :: y2_lamb, y2_rb
54 REAL,
DIMENSION(NMAX) :: y2_lambd, y2_rbd
55 REAL :: rhopjk, rhopjp1k
56 REAL :: rhopjkd, rhopjp1kd
71 Do i = user%xs-fak,user%xe+fak
82 rhopjp1kd = rhopd(k, j+1)
83 rhopjp1k = rhop(k, j+1)
84 IF (zp(i) - zp(j+1) .LT. dhsk .AND. zp(i) - zp(j) .GE. dhsk) &
95 dz = zp(j+1) - (zp(i)-dhsk)
101 lamb_intd(n) = rhopjkd + (dzp-dz)*(rhopjp1kd-rhopjkd)/dzp
102 lamb_int(n) = rhopjk + (rhopjp1k-rhopjk)/dzp*(dzp-dz)
107 ELSE IF (zp(j) .GT. zp(i) - dhsk .AND. zp(j) .LE. zp(i) + dhsk&
112 x_int(n) = x_int(n-1) + dz
115 lamb_intd(n) = rhopjkd
117 rb_intd(n) = (dhsk**2-zz**2)*rhopjkd
118 rb_int(n) = rhopjk*(dhsk**2-zz**2)
119 IF (zp(j) .LT. zp(i) + dhsk .AND. zp(j+1) .GE. zp(i) + dhsk&
122 dz = zp(i) + dhsk - zp(j)
127 x_int(n) = x_int(n-1) + dz
130 lamb_intd(n) = rhopjkd + dz*(rhopjp1kd-rhopjkd)/dzp
131 lamb_int(n) = rhopjk + (rhopjp1k-rhopjk)/dzp*dz
142 CALL spline_d(x_int, lamb_int, lamb_intd, n, 1.e30, 1.e30, &
144 CALL spline_d(x_int, rb_int, rb_intd, n, 1.e30, 1.e30, y2_rb, &
146 CALL splint_integral_d(x_int, lamb_int, lamb_intd, y2_lamb, &
147 & y2_lambd, n, xlo, xhi, integral_lamb, &
149 CALL splint_integral_d(x_int, rb_int, rb_intd, y2_rb, y2_rbd, n&
150 & , xlo, xhi, integral_rb, integral_rbd)
151 lambdad(i, k) = 0.5*integral_lambd/dhsk
152 lambda(i, k) = 0.5*integral_lamb/dhsk
153 rhobard(i, k) = 0.75*integral_rbd/dhsk**3
154 rhobar(i, k) = 0.75*integral_rb/dhsk**3
155 result1 = epsilon(dz)
156 IF (
lambda(i, k) .LT. result1)
lambda(i, k) = epsilon(dz)
162 END SUBROUTINE chain_aux_d
171 SUBROUTINE chain_dfdrho_d(i, rhop, rhopd, lambda, lambdad, rhobar, &
172 & rhobard, df_drho_chain, df_drho_chaind, user)
175 USE mod_dft
, ONLY : zp, dzp, fa
181 #include <finclude/petscsys.h> 185 INTEGER,
INTENT(IN) :: i
187 petscscalar :: rhop(ncomp,user%gxs:user%gxe)
188 petscscalar :: rhopd(ncomp,user%gxs:user%gxe)
189 REAL,
INTENT(IN) :: rhobar(user%gxs:user%gxe,ncomp)
190 REAL,
INTENT(IN) :: rhobard(user%gxs:user%gxe,ncomp)
191 REAL,
INTENT(IN) ::
lambda(user%gxs:user%gxe,ncomp)
192 REAL,
INTENT(IN) :: lambdad(user%gxs:user%gxe,ncomp)
196 REAL,
INTENT(OUT) :: df_drho_chain(user%xs:user%xe,ncomp)
197 REAL,
INTENT(OUT) :: df_drho_chaind(user%xs:user%xe,ncomp)
204 REAL :: rhopjk, rhopjp1k, logrho, xlo, xhi
205 REAL :: rhopjkd, rhopjp1kd
206 REAL :: ycorr(ncomp), dlny(ncomp, ncomp)
207 REAL :: ycorrd(ncomp), dlnyd(ncomp, ncomp)
208 INTEGER,
parameter :: nmax = 800
209 REAL,
DIMENSION(NMAX) :: x_int, int_1, int_2
210 REAL,
DIMENSION(NMAX) :: int_1d, int_2d
211 REAL,
DIMENSION(NMAX) :: y2_1, y2_2
212 REAL,
DIMENSION(NMAX) :: y2_1d, y2_2d
213 REAL :: dz, zz, integral_1, integral_2
214 REAL :: integral_1d, integral_2d
219 REAL,
DIMENSION(ncomp) :: arg1
220 REAL,
DIMENSION(ncomp) :: arg1d
229 CALL cavity_mix_d(rhobar(i, 1:ncomp), rhobard(i, 1:ncomp), ycorr, &
230 & ycorrd, dlny, dlnyd)
244 rhopjkd = rhopd(k, j)
246 rhopjp1kd = rhopd(k, j+1)
247 rhopjp1k = rhop(k, j+1)
248 IF (zp(i) - zp(j+1) .LT. dhsk .AND. zp(i) - zp(j) .GE. dhsk) &
259 dz = zp(j+1) - (zp(i)-dhsk)
268 int_2d(n) = rhopjkd*
lambda(j, k) + rhopjk*lambdad(j, k) + (&
269 & dzp-dz)*(rhopjp1kd*
lambda(j+1, k)+rhopjp1k*lambdad(j+1, k)&
270 & -rhopjkd*
lambda(j, k)-rhopjk*lambdad(j, k))/dzp
271 int_2(n) = rhopjk*
lambda(j, k) + (rhopjp1k*
lambda(j+1, k)-&
272 & rhopjk*
lambda(j, k))/dzp*(dzp-dz)
274 ELSE IF (zp(j) .GT. zp(i) - dhsk .AND. zp(j) .LE. zp(i) + dhsk) &
279 x_int(n) = x_int(n-1) + dz
282 arg1d(:) = (parame(1:ncomp,1)-1.0)*(rhopd(1:ncomp, j)*dlny(1:ncomp&
283 & , k)+rhop(1:ncomp, j)*dlnyd(1:ncomp, k))
284 arg1(:) = (parame(1:ncomp,1)-1.0)*rhop(1:ncomp, j)*dlny(1:ncomp, k&
286 int_1d(n) = (dhsk**2-zz**2)*0.75*sum(arg1d(:))/dhsk**3
287 int_1(n) = sum(arg1(:))*0.75/dhsk**3*(dhsk**2-zz**2)
288 int_2d(n) = (rhopjkd*
lambda(j, k)-rhopjk*lambdad(j, k))/
lambda&
290 int_2(n) = rhopjk/
lambda(j, k)
291 IF (zp(j) .LT. zp(i) + dhsk .AND. zp(j+1) .GE. zp(i) + dhsk) &
294 dz = zp(i) + dhsk - zp(j)
299 x_int(n) = x_int(n-1) + dz
302 int_2d(n) = rhopjkd*
lambda(j, k) + rhopjk*lambdad(j, k) + dz&
303 & *(rhopjp1kd*
lambda(j+1, k)+rhopjp1k*lambdad(j+1, k)-&
304 & rhopjkd*
lambda(j, k)-rhopjk*lambdad(j, k))/dzp
305 int_2(n) = rhopjk*
lambda(j, k) + (rhopjp1k*
lambda(j+1, k)-&
306 & rhopjk*
lambda(j, k))/dzp*dz
317 CALL spline_d(x_int, int_1, int_1d, n, 1.e30, 1.e30, y2_1, y2_1d)
318 CALL splint_integral_d(x_int, int_1, int_1d, y2_1, y2_1d, n, xlo, &
319 & xhi, integral_1, integral_1d)
320 CALL spline_d(x_int, int_2, int_2d, n, 1.e30, 1.e30, y2_2, y2_2d)
321 CALL splint_integral_d(x_int, int_2, int_2d, y2_2, y2_2d, n, xlo, &
322 & xhi, integral_2, integral_2d)
323 result1 = epsilon(dz)
324 IF (rhop(k, i) .LT. result1)
THEN 328 arg10d = ycorrd(k)*
lambda(i, k) + ycorr(k)*lambdad(i, k)
329 arg10 = ycorr(k)*
lambda(i, k)
330 df_drho_chaind(i, k) = (parame(k,1)-1.0)*rhopd(k, i)/rhop(k, i) - (&
331 & parame(k,1)-1.0)*(arg10d/arg10+0.5*integral_2d/dhsk) - integral_1d
332 df_drho_chain(i, k) = (parame(k,1)-1.0)*log(rhop(k, i)) - (parame(k,1)-1.0&
333 & )*(log(arg10)-1.0+0.5*integral_2/dhsk) - integral_1
338 END SUBROUTINE chain_dfdrho_d
349 SUBROUTINE cavity_mix_d(rhoi, rhoid, ycorr, ycorrd, dlnydr, dlnydrd)
357 REAL,
INTENT(IN) :: rhoi(ncomp)
358 REAL,
INTENT(IN) :: rhoid(ncomp)
359 REAL,
INTENT(OUT) :: ycorr(ncomp)
360 REAL,
INTENT(OUT) :: ycorrd(ncomp)
362 REAL,
INTENT(OUT) :: dlnydr(ncomp, ncomp)
363 REAL,
INTENT(OUT) :: dlnydrd(ncomp, ncomp)
367 REAL :: z0, z1, z2, z3, zms, z1_rk, z2_rk, z3_rk
368 REAL :: z2d, z3d, zmsd
369 REAL,
DIMENSION(ncomp, ncomp) :: dij_ab, gij, gij_rk
370 REAL,
DIMENSION(ncomp, ncomp) :: gijd, gij_rkd
372 REAL,
DIMENSION(ncomp) :: arg1
373 REAL,
DIMENSION(ncomp) :: arg1d
375 arg1(:) = rhoi(1:ncomp)*parame(1:ncomp,1)
376 z0 = pi/6.0*sum(arg1(:))
377 arg1(:) = rhoi(1:ncomp)*parame(1:ncomp,1)*dhs(1:ncomp)
378 z1 = pi/6.0*sum(arg1(:))
379 arg1d(:) = parame(1:ncomp,1)*dhs(1:ncomp)**2*rhoid(1:ncomp)
380 arg1(:) = rhoi(1:ncomp)*parame(1:ncomp,1)*dhs(1:ncomp)**2
381 z2d = pi*sum(arg1d(:))/6.0
382 z2 = pi/6.0*sum(arg1(:))
383 arg1d(:) = parame(1:ncomp,1)*dhs(1:ncomp)**3*rhoid(1:ncomp)
384 arg1(:) = rhoi(1:ncomp)*parame(1:ncomp,1)*dhs(1:ncomp)**3
385 z3d = pi*sum(arg1d(:))/6.0
386 z3 = pi/6.0*sum(arg1(:))
391 dij_ab(i, j) = dhs(i)*dhs(j)/(dhs(i)+dhs(j))
400 z1_rk = pi/6.0*parame(k,1)*dhs(k)
401 z2_rk = pi/6.0*parame(k,1)*dhs(k)*dhs(k)
402 z3_rk = pi/6.0*parame(k,1)*dhs(k)**3
405 gijd(i, j) = ((3.0*dij_ab(i, j)*z2d*zms-3.0*dij_ab(i, j)*z2*zmsd&
406 & )/zms-3.0*dij_ab(i, j)*z2*zmsd/zms)/zms**2 - zmsd/zms**2 + (&
407 & 2.0*2*dij_ab(i, j)**2*z2*z2d*zms**3-2.0*dij_ab(i, j)**2*z2**2*&
408 & 3*zms**2*zmsd)/(zms**3)**2
409 gij(i, j) = 1.0/zms + 3.0*dij_ab(i, j)*z2/zms/zms + 2.0*(dij_ab(&
410 & i, j)*z2)**2/zms**3
413 gij_rkd(i, j) = (-2)*(z3_rk*zmsd/zms)/zms**2 + ((3.0*dij_ab(i, j&
414 & )*(2.0*z3_rk*z2d*zms-2.0*z2*z3_rk*zmsd)/zms-3.0*dij_ab(i, j)*(&
415 & z2_rk+2.0*z2*z3_rk/zms)*zmsd)/zms-3.0*dij_ab(i, j)*(z2_rk+2.0*&
416 & z2*z3_rk/zms)*zmsd/zms)/zms**2 + (dij_ab(i, j)**2*z2d*zms**3-&
417 & dij_ab(i, j)**2*z2*3*zms**2*zmsd)*(4.0*z2_rk+6.0*z2*z3_rk/zms)&
418 & /zms**6 + dij_ab(i, j)**2*z2*(6.0*z3_rk*z2d*zms-6.0*z2*z3_rk*&
420 gij_rk(i, j) = z3_rk/zms/zms + 3.0*dij_ab(i, j)*(z2_rk+2.0*z2*&
421 & z3_rk/zms)/zms/zms + dij_ab(i, j)**2*z2/zms**3*(4.0*z2_rk+6.0*&
424 ycorrd(i) = gijd(i, i)
426 dlnydrd(i, k) = (gij_rkd(i, i)*gij(i, i)-gij_rk(i, i)*gijd(i, i)&
428 dlnydr(i, k) = gij_rk(i, i)/gij(i, i)
431 END SUBROUTINE cavity_mix_d
433 END MODULE mod_dft_chain_d
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains constant...
double lambda
Latent heat of blowing agent, J/kg.
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...
In this module, the application context is defined.
WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW This module contains paramete...