Changeset 3233 for trunk/LMDZ.GENERIC/libf
- Timestamp:
- Feb 23, 2024, 10:22:20 AM (10 months ago)
- Location:
- trunk/LMDZ.GENERIC/libf/phystd
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90
r3044 r3233 14 14 int_dtaui,int_dtauv, & 15 15 tau_col,cloudfrac,totcloudfrac, & 16 clearsky, firstcall,lastcall)16 clearsky,p_var,frac_var,firstcall,lastcall) 17 17 18 18 use mod_phys_lmdz_para, only : is_master … … 40 40 diagdtau,kastprof,strictboundcorrk,specOLR, & 41 41 CLFvarying,tplanckmin,tplanckmax,global1d, & 42 generic_condensation, aerovenus 42 generic_condensation, aerovenus, nvarlayer, varspec 43 43 use optcv_mod, only: optcv 44 44 use optci_mod, only: optci … … 46 46 use sfluxv_mod, only: sfluxv 47 47 use recombin_corrk_mod, only: corrk_recombin, call_recombin 48 use pindex_mod, only: pindex 48 49 use generic_cloud_common_h, only: Psat_generic, epsi_generic 49 50 use generic_tracer_index_mod, only: generic_tracer_index … … 90 91 REAL,INTENT(IN) :: muvar(ngrid,nlayer+1) 91 92 REAL,INTENT(IN) :: cloudfrac(ngrid,nlayer) ! Fraction of clouds (%). 93 REAL,INTENT(IN) :: frac_var(nvarlayer,ngasmx)! Variable molar fraction. 94 REAL,INTENT(IN) :: p_var(nvarlayer) ! Pressure for frac_var interpolation (Pa) 92 95 logical,intent(in) :: clearsky 93 96 logical,intent(in) :: firstcall ! Signals first call to physics. … … 227 230 228 231 REAL :: maxvalue,minvalue 232 233 real :: frac_vari(L_LEVELS) 234 real :: fracvari(ngasmx,L_LEVELS) 229 235 230 236 !=============================================================== … … 1101 1107 endif 1102 1108 enddo 1109 1110 !----------------------------------------------------------------------- 1111 ! Variation of molar fraction for CIAs 1112 !----------------------------------------------------------------------- 1113 1114 if (varspec) then 1115 do k=1,ngasmx 1116 call pindex(p_var,frac_var(:,k),plevrad(:),nvarlayer,L_LEVELS,frac_vari) 1117 fracvari(k,:) = frac_vari 1118 enddo 1119 endif 1103 1120 1104 1121 !======================================================================= … … 1133 1150 call optcv(dtauv,tauv,taucumv,plevrad, & 1134 1151 qxvaer,qsvaer,gvaer,wbarv,cosbv,tauray,tauaero, & 1135 tmid,pmid,taugsurf,qvar,muvarrad )1152 tmid,pmid,taugsurf,qvar,muvarrad,fracvari) 1136 1153 1137 1154 call sfluxv(dtauv,tauv,taucumv,albv,dwnv,wbarv,cosbv, & … … 1176 1193 call optci(plevrad,tlevrad,dtaui,taucumi, & 1177 1194 qxiaer,qsiaer,giaer,cosbi,wbari,tauaero,tmid,pmid, & 1178 taugsurfi,qvar,muvarrad )1195 taugsurfi,qvar,muvarrad,fracvari) 1179 1196 1180 1197 call sfluxi(plevrad,tlevrad,dtaui,taucumi,ubari,albi, & -
trunk/LMDZ.GENERIC/libf/phystd/callkeys_mod.F90
r3204 r3233 27 27 logical,save :: testradtimes 28 28 logical,save :: rayleigh 29 !$OMP THREADPRIVATE(newtonian,force_cpp,cpp_mugaz_mode,testradtimes,rayleigh) 29 logical,save :: varspec 30 character(64),save :: varspec_data 31 integer,save :: nvarlayer 32 !$OMP THREADPRIVATE(newtonian,force_cpp,cpp_mugaz_mode,testradtimes,rayleigh,varspec,varspec_data,nvarlayer) 30 33 logical,save :: stelbbody 31 34 logical,save :: nearco2cond -
trunk/LMDZ.GENERIC/libf/phystd/dyn1d/kcm1d.F90
r3105 r3233 8 8 use comsaison_h, only: mu0, fract, dist_star 9 9 use planete_mod 10 use callkeys_mod, only: pceil, tstrat, tracer, global1d 10 use callkeys_mod, only: pceil, tstrat, tracer, global1d, & 11 varspec, varspec_data, nvarlayer 11 12 use inifis_mod, only: inifis 12 13 use aerosol_mod, only: iniaerosol … … 20 21 use geometry_mod, only: init_geometry 21 22 use dimphy, only : init_dimphy 23 use gases_h, only: ngasmx 22 24 23 25 implicit none … … 87 89 real int_dtauv(1,llm,L_NSPECTV) 88 90 real Eatmtot 91 92 ! For fixed variable molar mass 93 real, dimension(:),allocatable,save :: p_var 94 real, dimension(:),allocatable,save :: mu_var 95 real, dimension(:,:),allocatable,save :: frac_var 89 96 90 97 integer ierr … … 116 123 ALLOCATE(fract(1)) 117 124 ALLOCATE(glat(1)) 125 126 ! Initialize fixed variable mu 127 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 128 129 if(varspec) then 130 IF (.NOT.ALLOCATED(p_var)) ALLOCATE(p_var(nvarlayer)) 131 IF (.NOT.ALLOCATED(mu_var)) ALLOCATE(mu_var(nvarlayer)) 132 IF (.NOT.ALLOCATED(frac_var)) ALLOCATE(frac_var(nvarlayer,ngasmx)) 133 p_var = 0.0 134 mu_var = 0.0 135 frac_var = 0.0 136 dt_file=TRIM(varspec_data) 137 open(34,file=dt_file,form='formatted',status='old',iostat=ios) 138 if (ios.ne.0) then ! file not found 139 write(*,*) 'Error from varspec' 140 write(*,*) 'Data file ',trim(varspec_data),' not found.' 141 write(*,*) 'Check that the data is in your run repository.' 142 call abort_physic !a verifier 143 else 144 do k=1,nvarlayer 145 read(34,*) p_var(k), mu_var(k),frac_var(k,1:ngasmx) 146 !The order of columns in frac_var must correspond to order of molecules gases.def 147 !The format of your file must be: 148 ! pressure(k) molar_mass(k), molar_fraction_of_gas_1(k), molar_fraction_of_gas_2(k),..., molar_fraction_of_gas_ngasmx(k) 149 enddo 150 endif 151 close(34) 152 endif 118 153 119 154 ! Load parameters from "run.def" … … 386 421 int_dtaui,int_dtauv, & 387 422 tau_col,cloudfrac,totcloudfrac, & 388 .false., firstcall,lastcall)423 .false.,p_var,frac_var,firstcall,lastcall) 389 424 390 425 !write(*,*) 'BASE 3' … … 438 473 int_dtaui,int_dtauv, & 439 474 tau_col,cloudfrac,totcloudfrac, & 440 .false., firstcall,lastcall)475 .false.,p_var,frac_var,firstcall,lastcall) 441 476 442 477 -
trunk/LMDZ.GENERIC/libf/phystd/inifis_mod.F90
r3204 r3233 1061 1061 call getin_p("kmixmin",kmixmin) 1062 1062 if (is_master) write(*,*)trim(rname)//": kmixmin = ",kmixmin 1063 1064 varspec=.false. !default value 1065 call getin_p("varspec",varspec) 1066 if (varspec) then 1067 call getin_p("varspec_data",varspec_data) 1068 call getin_p("nvarlayer",nvarlayer) 1069 endif 1063 1070 1064 1071 if (is_master) write(*,*)'Predefined Cp from dynamics is ',cpp,'J kg^-1 K^-1' -
trunk/LMDZ.GENERIC/libf/phystd/optci.F90
r2972 r3233 7 7 subroutine optci(PLEV,TLEV,DTAUI,TAUCUMI, & 8 8 QXIAER,QSIAER,GIAER,COSBI,WBARI,TAUAERO, & 9 TMID,PMID,TAUGSURF,QVAR,MUVAR )9 TMID,PMID,TAUGSURF,QVAR,MUVAR,FRACVAR) 10 10 11 11 use radinc_h, only: L_LEVELS, L_NLAYRAD, L_NSPECTI, L_NGAUSS, & … … 15 15 igas_CH4, igas_CO2 16 16 use comcstfi_mod, only: g, r, mugaz 17 use callkeys_mod, only: kastprof,continuum,graybody 17 use callkeys_mod, only: kastprof,continuum,graybody,varspec 18 18 use recombin_corrk_mod, only: corrk_recombin, gasi_recomb 19 19 use tpindex_mod, only: tpindex … … 78 78 real*8,intent(in) :: QVAR(L_LEVELS) 79 79 real*8,intent(in) :: MUVAR(L_LEVELS) 80 real*8,intent(in) :: FRACVAR(ngasmx,L_LEVELS) 80 81 real*8 WRATIO(L_LEVELS) 81 82 real*8 KCOEF(4) … … 193 194 if(gfrac(igas).eq.-1)then ! variable 194 195 p_cont = dble(PMID(k)*scalep*QVAR(k)) ! qvar = mol/mol 196 elseif(varspec) then 197 p_cont = dble(PMID(k)*scalep*FRACVAR(igas,k)*(1.-QVAR(k))) 195 198 else 196 199 p_cont = dble(PMID(k)*scalep*gfrac(igas)*(1.-QVAR(k))) … … 213 216 ! then cross-interactions with other gases 214 217 do jgas=1,ngasmx 215 p_cross = dble(PMID(k)*scalep*gfrac(jgas)*(1.-QVAR(k))) 218 if(varspec) then 219 p_cross = dble(PMID(k)*scalep*FRACVAR(jgas,k)*(1.-QVAR(k))) 220 else 221 p_cross = dble(PMID(k)*scalep*gfrac(jgas)*(1.-QVAR(k))) 222 endif 216 223 dtempc = 0.0d0 217 224 if(jgas.eq.igas_N2)then … … 240 247 ! then cross-interactions with other gases 241 248 do jgas=1,ngasmx 242 p_cross = dble(PMID(k)*scalep*gfrac(jgas)*(1.-QVAR(k))) 249 if(varspec) then 250 p_cross = dble(PMID(k)*scalep*FRACVAR(jgas,k)*(1.-QVAR(k))) 251 else 252 p_cross = dble(PMID(k)*scalep*gfrac(jgas)*(1.-QVAR(k))) 253 endif 243 254 dtempc = 0.0d0 244 255 if(jgas.eq.igas_H2)then -
trunk/LMDZ.GENERIC/libf/phystd/optcv.F90
r2972 r3233 7 7 SUBROUTINE OPTCV(DTAUV,TAUV,TAUCUMV,PLEV, & 8 8 QXVAER,QSVAER,GVAER,WBARV,COSBV, & 9 TAURAY,TAUAERO,TMID,PMID,TAUGSURF,QVAR,MUVAR )9 TAURAY,TAUAERO,TMID,PMID,TAUGSURF,QVAR,MUVAR,FRACVAR) 10 10 11 11 use radinc_h, only: L_NLAYRAD, L_NLEVRAD, L_LEVELS, L_NSPECTV, L_NGAUSS, L_REFVAR, NAERKIND … … 14 14 igas_CH4, igas_CO2 15 15 use comcstfi_mod, only: g, r, mugaz 16 use callkeys_mod, only: kastprof,continuum,graybody,callgasvis 16 use callkeys_mod, only: kastprof,continuum,graybody,callgasvis,varspec 17 17 use recombin_corrk_mod, only: corrk_recombin, gasv_recomb 18 18 use tpindex_mod, only: tpindex … … 84 84 real*8,intent(in) :: QVAR(L_LEVELS) 85 85 real*8,intent(in) :: MUVAR(L_LEVELS) 86 real*8,intent(in) :: FRACVAR(ngasmx,L_LEVELS) 86 87 real*8 :: WRATIO(L_LEVELS) 87 88 real*8 KCOEF(4) … … 198 199 if(gfrac(igas).eq.-1)then ! variable 199 200 p_cont = dble(PMID(k)*scalep*QVAR(k)) ! qvar = mol/mol 201 elseif(varspec) then 202 p_cont = dble(PMID(k)*scalep*FRACVAR(igas,k)*(1.-QVAR(k))) 200 203 else 201 204 p_cont = dble(PMID(k)*scalep*gfrac(igas)*(1.-QVAR(k))) … … 219 222 ! then cross-interactions with other gases 220 223 do jgas=1,ngasmx 221 p_cross = dble(PMID(k)*scalep*gfrac(jgas)*(1.-QVAR(k))) 224 if(varspec) then 225 p_cross = dble(PMID(k)*scalep*FRACVAR(jgas,k)*(1.-QVAR(k))) 226 else 227 p_cross = dble(PMID(k)*scalep*gfrac(jgas)*(1.-QVAR(k))) 228 endif 222 229 dtempc = 0.0 223 230 if(jgas.eq.igas_N2)then … … 248 255 ! then cross-interactions with other gases 249 256 do jgas=1,ngasmx 250 p_cross = dble(PMID(k)*scalep*gfrac(jgas)*(1.-QVAR(k))) 257 if(varspec) then 258 p_cross = dble(PMID(k)*scalep*FRACVAR(jgas,k)*(1.-QVAR(k))) 259 else 260 p_cross = dble(PMID(k)*scalep*gfrac(jgas)*(1.-QVAR(k))) 261 endif 251 262 dtempc = 0.0d0 252 263 if(jgas.eq.igas_H2)then -
trunk/LMDZ.GENERIC/libf/phystd/physiq_mod.F90
r3232 r3233 21 21 use generic_cloud_common_h, only : epsi_generic, Psat_generic 22 22 use thermcell_mod, only: init_thermcell_mod 23 use gases_h, only: gnom, gfrac 23 use gases_h, only: gnom, gfrac, ngasmx 24 24 use radcommon_h, only: sigma, glat, grav, BWNV, WNOI, DWNI, DWNV, WNOV 25 25 use suaer_corrk_mod, only: suaer_corrk … … 69 69 startphy_file, testradtimes, tlocked, & 70 70 tracer, UseTurbDiff, water, watercond, & 71 waterrain, generic_rain, global1d, moistadjustment, szangle 71 waterrain, generic_rain, global1d, szangle, & 72 moistadjustment, varspec, varspec_data, nvarlayer 72 73 use generic_tracer_index_mod, only: generic_tracer_index 73 74 use nonoro_gwd_ran_mod, only: nonoro_gwd_ran … … 76 77 use phys_state_var_mod 77 78 use callcorrk_mod, only: callcorrk 79 use pindex_mod, only: pindex 78 80 use vdifc_mod, only: vdifc 79 81 use turbdiff_mod, only: turbdiff … … 450 452 451 453 real muvar(ngrid,nlayer+1) ! For Runaway Greenhouse 1D study. By RW 454 455 ! For fixed variable molar mass 456 real, dimension(:),allocatable,save :: p_var 457 real, dimension(:),allocatable,save :: mu_var 458 real, dimension(:,:),allocatable,save :: frac_var 459 !$OMP THREADPRIVATE(p_var,mu_var,frac_var) 460 real :: mu_vari(nlayer) 461 real :: muvari(ngrid,nlayer) 462 integer ios,k 463 character*100 dt_file 452 464 453 465 real,save,allocatable :: reffcol(:,:) … … 506 518 zdtsw(:,:) = 0.0 507 519 zdtlw(:,:) = 0.0 520 521 ! Initialize fixed variable mu 522 ! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 523 524 if(varspec) then 525 IF (.NOT.ALLOCATED(p_var)) ALLOCATE(p_var(nvarlayer)) 526 IF (.NOT.ALLOCATED(mu_var)) ALLOCATE(mu_var(nvarlayer)) 527 IF (.NOT.ALLOCATED(frac_var)) ALLOCATE(frac_var(nvarlayer,ngasmx)) 528 p_var = 0.0 529 mu_var = 0.0 530 frac_var = 0.0 531 muvari = 0.0 532 dt_file=TRIM(varspec_data) 533 open(33,file=dt_file,form='formatted',status='old',iostat=ios) 534 if (ios.ne.0) then ! file not found 535 write(*,*) 'Error from varspec' 536 write(*,*) 'Data file ',trim(varspec_data),' not found.' 537 write(*,*) 'Check that the data is in your run repository.' 538 call abort_physic !a verifier 539 else 540 do k=1,nvarlayer 541 read(33,*) p_var(k), mu_var(k),frac_var(k,1:ngasmx) 542 !The order of columns in frac_var must correspond to order of molecules gases.def 543 !The format of your file must be: 544 ! pressure(k) molar_mass(k), molar_fraction_of_gas_1(k), molar_fraction_of_gas_2(k),..., molar_fraction_of_gas_ngasmx(k) 545 enddo 546 endif 547 close(33) 548 endif 508 549 509 550 ! Initialize tracer names, indexes and properties. … … 952 993 endif 953 994 if(water) then 995 ! take into account water effect on mean molecular weight 954 996 muvar(1:ngrid,1:nlayer)=mugaz/(1.e0+(1.e0/epsi-1.e0)*pq(1:ngrid,1:nlayer,igcm_h2o_vap)) 955 997 muvar(1:ngrid,nlayer+1)=mugaz/(1.e0+(1.e0/epsi-1.e0)*pq(1:ngrid,nlayer,igcm_h2o_vap)) 956 ! take into account water effect on mean molecular weight957 998 elseif(generic_condensation) then 999 ! take into account generic condensable specie (GCS) effect on mean molecular weight 958 1000 do iq=1,nq 959 1001 … … 969 1011 endif 970 1012 end do ! do iq=1,nq loop on tracers 971 ! take into account generic condensable specie (GCS) effect on mean molecular weight 1013 elseif(varspec) then 1014 !take into account fixed variable mean molecular weight 1015 do ig=1,ngrid 1016 call pindex(p_var,mu_var,pplay(ig,:),nvarlayer,nlayer,mu_vari) 1017 muvari(ig,:) = mu_vari 1018 enddo 1019 1020 muvar(1:ngrid,1:nlayer) = muvari(1:ngrid,1:nlayer) 1021 muvar(1:ngrid,nlayer+1) = muvari(1:ngrid,nlayer) 972 1022 973 1023 else … … 995 1045 int_dtaui,int_dtauv, & 996 1046 tau_col,cloudfrac,totcloudfrac, & 997 clearsky, firstcall,lastcall)1047 clearsky,p_var,frac_var,firstcall,lastcall) 998 1048 999 1049 !GG (feb2021): Option to "artificially" decrease the raditive time scale in … … 1026 1076 int_dtaui1,int_dtauv1, & 1027 1077 tau_col1,cloudfrac,totcloudfrac, & 1028 clearsky, firstcall,lastcall)1078 clearsky,p_var,frac_var,firstcall,lastcall) 1029 1079 clearsky = .false. ! just in case. 1030 1080
Note: See TracChangeset
for help on using the changeset viewer.