Changeset 1816 for trunk/LMDZ.MARS/libf/phymars/massflowrateCO2.F
- Timestamp:
- Nov 2, 2017, 4:40:47 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/massflowrateCO2.F
r1720 r1816 1 2 3 1 c======================================================================= 4 2 subroutine massflowrateCO2(P,T,Sat,Radius,Matm,Ic) 5 3 c 6 c Determination of the mass transfer rate 4 c Determination of the mass transfer rate for CO2 condensation & 5 c sublimation 7 6 c 8 7 c newton-raphson method 9 10 8 c CLASSICAL (no SF etc.) 11 12 c AUTOMATIC SETTING OF RANGES FOR NEWTON-RAPHSON FOR THE PAPER 13 14 c MASS FLUX Ic 15 9 c 10 c inputs: Pressure (P), Temperature (T), saturation ratio (Sat), 11 c particle radius (Radius), molecular mass of the atm (Matm) 12 c output: MASS FLUX Ic 13 c 14 c Authors: C. Listowski (2014) then J. Audouard (2016-2017) 16 15 c======================================================================= 17 16 USE comcstfi_h … … 20 19 21 20 include "microphys.h" 22 c include "microphysCO2.h"23 21 24 22 … … 26 24 c arguments: INPUT 27 25 c ---------- 28 29 26 REAL T,Matm 30 27 REAL*8 SAT … … 33 30 c arguments: OUTPUT 34 31 c ---------- 35 36 32 DOUBLE PRECISION Ic 37 38 33 c Local Variables 39 34 c ---------- 40 41 35 DOUBLE PRECISION Tcm 42 36 DOUBLE PRECISION T_inf, T_sup, T_dT … … 45 39 DOUBLE PRECISION rtsafe 46 40 DOUBLE PRECISION left, fval, dfval 47 48 41 c function for newton-raphson iterative method 49 42 c -------------------------- 50 51 43 EXTERNAL classical 52 53 44 54 Tcm = 80!dble(T) ! initialize pourquoi 0 et pas t(i) 55 45 Tcm = 110!dble(T) ! initialize pourquoi 0 et pas t(i) 56 46 T_inf = 0d0 57 47 T_sup = 800d0 58 59 T_dT = 0.01 ! precision - mettre petit et limiter nb iteration? 48 T_dT = 0.001 ! precision - mettre petit et limiter nb iteration? 60 49 61 50 666 CONTINUE 62 51 63 c print*, 'Radius ', Radius64 c print*, 'SAT = ', Sat65 52 call coefffunc(P,T,Sat,Radius,Matm,kmix,Lsub,C0,C1,C2) 66 53 67 if (isnan(C0) .eqv. .true.) C0=0d0 68 69 54 if (isnan(C0) .eqv. .true.) C0=0d0 70 55 c FIND SURFACE TEMPERATURE (Tc) : iteration sur t 71 72 56 cond = 4.*pi*Radius*kmix 73 74 57 Tcm = rtsafe(classical,T_inf,T_sup,T_dT,Radius,C0,C1,C2) 75 76 77 if (Tcm.LE.0d0) then ! unsignificant cases where S<<<Seq and Ncores <<1e-10 78 79 Tcm = 0d0 80 58 if (Tcm.LE.0d0 .or. isnan(Tcm)) then ! unsignificant cases where S<<<Seq and Ncores <<1e-10 59 Tcm = T 81 60 endif 82 83 84 61 c THEN COMPUTE MASS FLUX Ic from FINAL Tsurface (Tc) 85 86 62 Ic = (Tcm-T) 87 88 Ic = cond*Ic/(-Lsub) 63 Ic = cond*Ic/Lsub 89 64 c regarder de combien varie la solution Ic entre Tcm et Tcm+T_dT 90 65 91 66 RETURN 92 67 … … 95 70 96 71 c**************************************************************** 97 98 72 FUNCTION rtsafe(funcd,x1,x2,xacc,Radius,C0,C1,C2) 99 *100 73 * 101 74 * Newton Raphsen routine (Numerical Recipe) … … 114 87 EXTERNAL funcd 115 88 116 PARAMETER (MAXIT= 50000) !Maximum allowed number of iterations. Using a combination of Newton-Raphson and bisection,89 PARAMETER (MAXIT=10000) !Maximum allowed number of iterations. Using a combination of Newton-Raphson and bisection, 117 90 !find the root of a function bracketed between x1 and x2. The root, returned as the function value rtsafe, 118 91 !will be refined until its accuracy is known within !!±xacc. funcd is a user-supplied subroutine which … … 128 101 129 102 if ((fl.gt.0..and.fh.gt.0.).or.(fl.lt.0..and.fh.lt.0.) ) then 130 131 132 103 x1=0d0 133 x2=500d0 134 104 x2=1200d0 135 105 call funcd(x1,fl,df,C0,C1,C2) 136 106 call funcd(x2,fh,df,C0,C1,C2) 137 138 write(*,*) 'root must be bracketed in rtsafe' 107 c write(*,*) 'root must be bracketed in rtsafe' 139 108 endif 140 109 141 110 142 111 if (fl.eq.0.) then 143 144 112 rtsafe=x1 145 113 return 146 147 114 else if (fh.eq.0.) then 148 149 115 rtsafe=x2 150 116 return 151 152 else if (fl.lt.0.) then !Orient the search so that f(xl) < 0. 153 117 else if (fl.lt.0.) then !Orient the search so that f(xl) < 0. 154 118 xl=x1 155 119 xh=x2 156 157 120 else 158 159 121 xh=x1 160 122 xl=x2 161 162 123 endif 163 164 124 rtsafe = .5*(x1+x2) !Initialize the guess for root, 165 125 dxold = abs(x2-x1) !the stepsize before last, 166 126 dx = dxold ! and the last step. 167 168 169 127 call funcd(rtsafe,f,df,C0,C1,C2) 170 171 128 DO 11 j=1,MAXIT !Loop over allowed iterations. 172 173 174 !print*, 'iteration:', j175 !print*, rtsafe176 177 129 178 130 if (((rtsafe-xh)*df-f)*((rtsafe-xl)*df-f).gt.0. ! Bisect if Newton out of range … … 182 134 dx=0.5*(xh-xl) 183 135 rtsafe=xl+dx 184 185 136 if (xl.eq.rtsafe) return !Change in root is negligible. Newton step acceptable. Take it. 186 187 137 else 188 189 138 dxold=dx 190 139 dx=f/df 191 140 temp=rtsafe 192 193 141 rtsafe=rtsafe-dx 194 195 142 if(temp.eq.rtsafe) return 196 197 143 endif 198 144 199 200 145 if(abs(dx).lt.xacc) return !Convergence criterion. The one new function evaluation per iteration. Maintain the bracket on the root. 201 202 146 call funcd(rtsafe,f,df,C0,C1,C2) 203 204 147 if(f.lt.0.) then 205 148 xl=rtsafe … … 207 150 xh=rtsafe 208 151 endif 209 210 211 152 11 ENDDO 212 153 213 write(*,*) 'rtsafe exceeding maximum iterations'214 154 rtsafe=0d0 155 write(*,*) 'rtsafe exceeding maximum iterations,Tcm=',rtsafe 215 156 return 216 157 … … 219 160 220 161 c******************************************************************************** 221 222 162 subroutine classical(x,f,df,C0,C1,C2) 223 224 163 c Function to give as input to RTSAFE (NEWTON-RAPHOEN) 225 226 227 164 c******************************************************************************** 228 165 … … 231 168 DOUBLE PRECISION x 232 169 DOUBLE PRECISION C0,C1,C2 233 234 170 DOUBLE PRECISION f 235 171 DOUBLE PRECISION df 236 237 238 239 172 240 173 f = x + C0*exp(C1*x) - C2 ! start f … … 242 175 243 176 return 244 245 177 END 246 178 … … 250 182 251 183 c******************************************************************************** 252 c defini la fonction eq 6 papier 2014 184 c defini la fonction eq 6 papier 2014 (Listowski et al., 2014) 253 185 use tracer_mod, only: rho_ice_co2 254 186 USE comcstfi_h 255 187 256 188 implicit none 257 258 189 include "microphys.h" 259 c include "microphysCO2.h"260 261 190 262 191 c arguments: INPUT … … 270 199 c local: 271 200 c ------ 272 273 274 201 DOUBLE PRECISION Cpatm,Cpn2,Cpco2 275 202 DOUBLE PRECISION psat, xinf, pco2 … … 298 225 299 226 c Equilibirum pressure over a flat surface 300 301 227 psat = 1.382 * 1.00e12 * exp(-3182.48/dble(T)) ! (Pa) 302 303 228 c Compute transport coefficient 304 305 229 pco2 = psat * dble(S) 306 307 230 c Latent heat of sublimation if CO2 co2 (J.kg-1) 308 231 c version Azreg_Ainou (J/kg) : 309 310 232 l0=595594. 311 233 l1=903.111 … … 313 235 l3=0.0528288 314 236 l4=-0.000103183 315 316 237 Lsub = l0 + l1 * dble(T) + l2 * dble(T)**2 + l3 * 317 238 & dble(T)**3 + l4 * dble(T)**4 ! J/kg 318 319 239 c atmospheric density 320 321 240 rhoatm = dble(P*Matm)/(rgp*dble(T)) ! g.m-3 322 241 rhoatm = rhoatm * 1.00e-3 !kg.m-3 323 324 242 call KthMixNEW(kmix,T,pco2/dble(P),rhoatm) ! compute thermal cond of mixture co2/N2 325 243 call Diffcoeff(P, T, Dv) … … 328 246 329 247 c ----- FS correction for Diff 330 331 248 vthco2 = sqrt(8d0*kbz*dble(T)/(dble(pi) * mco2/nav)) ! units OK: m.s-1 332 333 249 knudsen = 3*Dv / (vthco2 * rc) 334 335 250 lambda = (1.333+0.71/knudsen) / (1.+1./knudsen) ! pas adaptée, Dahneke 1983? en fait si (Monschick&Black) 336 337 251 Dv = Dv / (1. + lambda * knudsen) 338 339 252 c ----- FS correction for Kth 340 341 253 vthatm = sqrt(8d0*kbz*dble(T)/(pi * 1.00e-3*dble(Matm)/nav)) ! Matm/nav = mass of "air molecule" in G , *1e-3 --> kg 342 343 254 Cpatm = Cpco2 * pco2/dble(P) + Cpn2 * (1d0 - pco2/dble(P)) !J.kg-1.K-1 344 345 255 lpmt = 3 * kmix / (rhoatm * vthatm * (Cpatm - 0.5*rgp/ 346 256 & (dble(Matm)*1.00e-3))) ! mean free path related to heat transfer 347 348 257 knudsen = lpmt / rc 349 350 258 lambda = (1.333+0.71/knudsen) / (1.+1./knudsen) ! pas adaptée, Dahneke 1983? en fait si (Monschick&Black) 351 352 259 kmix = kmix / (1. + lambda * knudsen) 353 354 260 c --------------------- ASSIGN coeff values for FUNCTION 355 356 261 xinf = dble(S) * psat / dble(P) 357 358 262 Ak = exp(2d0*sigco2*mco2/(rgp* dble(rho_ice_co2*T* rc) )) 359 360 263 C0 = mco2*Dv*psat*Lsub/(rgp*dble(T)*kmix)*Ak*exp(-Lsub*mco2/ 361 264 & (rgp*dble(T))) 362 363 265 C1 = Lsub*mco2/(rgp*dble(T)**2) 364 365 266 C2 = dble(T) + dble(P)*mco2*Dv*Lsub*xinf/(kmix*rgp*dble(T)) 366 367 267 RETURN 368 268 END … … 370 270 371 271 c====================================================================== 372 373 272 subroutine Diffcoeff(P, T, Diff) 374 375 273 c Compute diffusion coefficient CO2/N2 376 274 c cited in Ilona's lecture - from Reid et al. 1987 377 275 c====================================================================== 378 379 380 276 IMPLICIT NONE 381 277 382 278 include "microphys.h" 383 c include "microphysCO2.h"384 279 385 280 c arguments … … 425 320 c====================================================================== 426 321 427 428 322 implicit none 429 323 430 324 include "microphys.h" 431 c include "microphysCO2.h"432 433 325 c arguments 434 326 c ----------- … … 457 349 DOUBLE PRECISION kco2, kn2 458 350 459 460 351 x1 = x 461 352 x2 = 1d0 - x 462 353 463 464 354 M1 = mco2 465 355 M2 = mn2 466 356 467 468 357 Tc1 = 304.1282 !(Scalabrin et al. 2006) 469 358 Tc2 = 126.192 ! (Lemmon & Jacobsen 2003) … … 471 360 Pc1 = 73.773 ! (bars) 472 361 Pc2 = 33.958 ! (bars) 473 474 362 475 363 Gamma1 = 210.*(Tc1*M1**(3.)/Pc1**(4.))**(1./6.) 476 364 Gamma2 = 210.*(Tc2*M2**(3.)/Pc2**(4.))**(1./6.) 477 365 478 479 366 c Translational conductivities 480 481 482 367 483 368 lambda_trans1 = ( exp(0.0464 * T/Tc1) - exp(-0.2412 * T/Tc1) ) … … 487 372 & /Gamma2 488 373 489 490 374 c Coefficient of Mason and Saxena 491 492 493 375 epsilon = 1. 494 495 376 496 377 A11 = 1. … … 498 379 A22 = 1. 499 380 500 501 381 A12 = epsilon * (1. + sqrt(lambda_trans1/lambda_trans2)* 502 382 & (M1/M2)**(1./4.))**(2.) / sqrt(8*(1.+ M1/M2)) … … 505 385 & (M2/M1)**(1./4.))**(2.) / sqrt(8*(1.+ M2/M1)) 506 386 507 508 387 c INDIVIDUAL COND. 509 388 … … 511 390 call KthN2LemJac(kn2,T,rho) 512 391 513 514 392 c MIXTURE COND. 515 516 393 Kthmix = kco2*x1 /(x1*A11 + x2*A12) + kn2*x2 /(x1*A21 + x2*A22) 517 394 Kthmix = Kthmix*1e-3 ! from mW.m-1.K-1 to W.m-1.K-1 518 519 395 RETURN 520 396 521 397 END 522 398 523 524 c====================================================================== 525 399 c====================================================================== 526 400 subroutine KthN2LemJac(kthn2,T,rho) 527 528 401 c Compute thermal cond of N2 (Lemmon and Jacobsen, 2003) 529 402 cWITH viscosity … … 565 438 566 439 DOUBLE PRECISION k1, k2 567 568 440 569 441 N1 = 1.511d0 … … 612 484 gamma9 = 1. 613 485 614 615 616 617 c---------------------------------------------------------------------- 618 486 c---------------------------------------------------------------------- 619 487 call viscoN2(T,visco) !! v given in microPa.s 620 621 488 622 489 Tc = 126.192d0 623 490 rhoc = 11.1839 * 1000 * mn2 !!!from mol.dm-3 to kg.m-3 … … 626 493 delta = rho/rhoc 627 494 628 629 630 k1 = N1 * visco + N2 * tau**t2 + N3 * tau**t3 !!! mW m-1 K-1 631 632 495 k1 = N1 * visco + N2 * tau**t2 + N3 * tau**t3 !!! mW m-1 K-1 633 496 c--------- residual thermal conductivity 634 635 636 497 637 498 k2 = N4 * tau**t4 * delta**d4 * exp(-gamma4*delta**l4) … … 642 503 & + N9 * tau**t9 * delta**d9 * exp(-gamma9*delta**l9) 643 504 644 645 505 kthn2 = k1 + k2 646 647 506 648 507 RETURN … … 744 603 DOUBLE PRECISION h1,h2,h3,h4,h5,h6,h7,h8,h9,h10 745 604 DOUBLE PRECISION n1,n2,n3,n4,n5,n6,n7,n8,n9,n10 746 747 748 605 749 606 Tc = 304.1282 !(K) … … 763 620 g10 = 5.5 764 621 765 766 622 h1 = 1. 767 623 h2 = 5. … … 786 642 n10 = 0.00433043347 787 643 788 789 790 644 Tr = T/Tc 791 645 rhor = rho/rhoc 792 793 794 646 795 647 k1 = n1*Tr**(g1)*rhor**(h1) + n2*Tr**(g2)*rhor**(h2) … … 802 654 803 655 k2 = exp(-5.*rhor**(2.)) * k2 804 805 656 806 657 kthco2 = (k1 + k2) * Lambdac ! mW 807 658 808 809 659 RETURN 810 660
Note: See TracChangeset
for help on using the changeset viewer.