Changeset 5283 for LMDZ6/trunk/libf
- Timestamp:
- Oct 28, 2024, 1:47:34 PM (4 days ago)
- Location:
- LMDZ6/trunk/libf
- Files:
-
- 2 deleted
- 20 edited
- 6 moved
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/dyn3d/fluxstokenc.f90
r5282 r5283 15 15 !cc .. Modif. P. Le Van ( 20/12/97 ) ... 16 16 ! 17 USE tracstoke_mod_h 17 18 USE dimensions_mod, ONLY: iim, jjm, llm, ndm 18 19 USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, & … … 22 23 23 24 24 include "tracstoke.h"25 25 26 26 REAL :: time_step,t_wrt, t_ops -
LMDZ6/trunk/libf/dyn3d/gcm.f90
r5282 r5283 28 28 USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, & 29 29 ip1jmi1, ijp1llm, ijmllm, mvar, jcfil, jcfllm 30 USE tracstoke_mod_h 30 31 IMPLICIT NONE 31 32 … … 59 60 ! Declarations: 60 61 ! ------------- 61 include "tracstoke.h"62 62 63 63 REAL zdtvr -
LMDZ6/trunk/libf/dyn3d_common/tracstoke_mod_h.f90
r5282 r5283 1 ! 2 ! $Header$ 3 ! 4 common /tracstoke/istdyn,istphy,unittrac 5 integer istdyn,istphy,unittrac 1 ! Replaces tracstoke.h 2 MODULE tracstoke_mod_h 3 IMPLICIT NONE; PRIVATE 4 PUBLIC istdyn, istphy, unittrac 5 6 INTEGER istdyn, istphy, unittrac 7 END MODULE tracstoke_mod_h -
LMDZ6/trunk/libf/dyn3dmem/fluxstokenc_p.f90
r5272 r5283 6 6 SUBROUTINE fluxstokenc_p(pbaru,pbarv , & 7 7 masse, teta, phi) 8 USE tracstoke_mod_h 8 9 USE parallel_lmdz 9 10 USE control_mod, ONLY : iapp_tracvl,planet_type,iphysiq … … 32 33 33 34 34 include "tracstoke.h"35 35 36 36 ! Arguments: -
LMDZ6/trunk/libf/dyn3dmem/gcm.F90
r5282 r5283 32 32 USE paramet_mod_h, ONLY: iip1, iip2, iip3, jjp1, llmp1, llmp2, llmm1, kftd, ip1jm, ip1jmp1, & 33 33 ip1jmi1, ijp1llm, ijmllm, mvar, jcfil, jcfllm 34 USE tracstoke_mod_h 34 35 IMPLICIT NONE 35 36 … … 63 64 ! Declarations: 64 65 ! ------------- 65 include "tracstoke.h"66 67 68 66 REAL zdtvr 69 67 -
LMDZ6/trunk/libf/dynphy_lonlat/phylmd/iniphysiq_mod.F90
r5282 r5283 38 38 USE bands, ONLY : distrib_phys 39 39 #endif 40 USE tracstoke_mod_h 40 41 USE iniprint_mod_h 41 42 USE comgeom_mod_h … … 56 57 57 58 58 include "tracstoke.h"59 59 60 60 REAL, INTENT (IN) :: prad ! radius of the planet (m) -
LMDZ6/trunk/libf/phylmd/concvl.f90
r5282 r5283 47 47 , RESTT, RALPW, RBETW, RGAMW, RALPS, RBETS, RGAMS & 48 48 , RALPD, RBETD, RGAMD 49 USE conema3_mod_h 49 50 IMPLICIT NONE 50 51 ! ====================================================================== … … 238 239 include "YOETHF.h" 239 240 include "FCTTRE.h" 240 !jyg<241 include "conema3.h"242 !>jyg243 241 244 242 IF (first) THEN -
LMDZ6/trunk/libf/phylmd/conema3.f90
r5274 r5283 21 21 , RESTT, RALPW, RBETW, RGAMW, RALPS, RBETS, RGAMS & 22 22 , RALPD, RBETD, RGAMD 23 USE conema3_mod_h 23 24 IMPLICIT NONE 24 25 ! ====================================================================== … … 65 66 ! ====================================================================== 66 67 67 include "conema3.h"68 68 INTEGER i, l, m, itra 69 69 INTEGER ntra ! if no tracer transport -
LMDZ6/trunk/libf/phylmd/conema3_mod_h.f90
r5282 r5283 1 ! 2 ! $Header$ 3 !-- Modified by : Filiberti M-A 06/2005 4 ! 5 real epmax ! 0.993 6 real coef_epmax_cape ! 0.993 7 !jyg< 8 REAL cvl_comp_threshold ! 0. 9 !>jyg 10 logical ok_adj_ema ! F 11 integer iflag_clw ! 0 12 integer iflag_cvl_sigd 13 real cvl_sig2feed ! 0.97 1 MODULE conema3_mod_h 2 IMPLICIT NONE; PRIVATE 3 PUBLIC epmax, coef_epmax_cape, cvl_comp_threshold, cvl_sig2feed 4 PUBLIC iflag_cvl_sigd, iflag_clw, ok_adj_ema 14 5 15 !jyg< 16 !! common/comconema1/epmax,coef_epmax_cape,ok_adj_ema,iflag_clw,sig1feed,sig2feed 17 !! common/comconema2/iflag_cvl_sigd 18 common/comconema1/epmax,coef_epmax_cape, cvl_comp_threshold, cvl_sig2feed 19 common/comconema2/iflag_cvl_sigd, iflag_clw, ok_adj_ema 20 !>jyg 6 REAL epmax ! 0.993 7 REAL coef_epmax_cape ! 0.993 8 REAL cvl_comp_threshold ! 0. 9 LOGICAL ok_adj_ema ! F 10 INTEGER iflag_clw ! 0 11 INTEGER iflag_cvl_sigd 12 REAL cvl_sig2feed ! 0.97 21 13 22 ! common/comconema/epmax,coef_epmax_cape,ok_adj_ema,iflag_clw 23 !$OMP THREADPRIVATE(/comconema1/) 24 !$OMP THREADPRIVATE(/comconema2/) 25 14 !$OMP THREADPRIVATE(epmax,coef_epmax_cape, cvl_comp_threshold, cvl_sig2feed) 15 !$OMP THREADPRIVATE(iflag_cvl_sigd, iflag_clw, ok_adj_ema) 16 END MODULE conema3_mod_h -
LMDZ6/trunk/libf/phylmd/conf_phys_m.f90
r5282 r5283 24 24 alp_offset) 25 25 26 USE yomcst_mod_h, ONLY: RPI, RCLUM, RHPLA, RKBOL, RNAVO & 26 USE conema3_mod_h 27 USE yomcst_mod_h, ONLY: RPI, RCLUM, RHPLA, RKBOL, RNAVO & 27 28 , RDAY, REA, REPSM, RSIYEA, RSIDAY, ROMEGA & 28 29 , R_ecc, R_peri, R_incl & … … 50 51 USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_STRATAER 51 52 52 INCLUDE "conema3.h"53 53 INCLUDE "nuage.h" 54 54 -
LMDZ6/trunk/libf/phylmd/cv30_routines_mod.f90
r5282 r5283 1 2 ! $Id$ 3 4 5 6 SUBROUTINE cv30_param(nd, delt) 7 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 8 , clmci, eps, epsi, epsim1, ginv, hrd, grav 9 IMPLICIT NONE 10 11 ! ------------------------------------------------------------ 12 ! Set parameters for convectL for iflag_con = 3 13 ! ------------------------------------------------------------ 14 15 16 ! *** PBCRIT IS THE CRITICAL CLOUD DEPTH (MB) BENEATH WHICH THE *** 17 ! *** PRECIPITATION EFFICIENCY IS ASSUMED TO BE ZERO *** 18 ! *** PTCRIT IS THE CLOUD DEPTH (MB) ABOVE WHICH THE PRECIP. *** 19 ! *** EFFICIENCY IS ASSUMED TO BE UNITY *** 20 ! *** SIGD IS THE FRACTIONAL AREA COVERED BY UNSATURATED DNDRAFT *** 21 ! *** SPFAC IS THE FRACTION OF PRECIPITATION FALLING OUTSIDE *** 22 ! *** OF CLOUD *** 23 24 ! [TAU: CHARACTERISTIC TIMESCALE USED TO COMPUTE ALPHA & BETA] 25 ! *** ALPHA AND BETA ARE PARAMETERS THAT CONTROL THE RATE OF *** 26 ! *** APPROACH TO QUASI-EQUILIBRIUM *** 27 ! *** (THEIR STANDARD VALUES ARE 1.0 AND 0.96, RESPECTIVELY) *** 28 ! *** (BETA MUST BE LESS THAN OR EQUAL TO 1) *** 29 30 ! *** DTCRIT IS THE CRITICAL BUOYANCY (K) USED TO ADJUST THE *** 31 ! *** APPROACH TO QUASI-EQUILIBRIUM *** 32 ! *** IT MUST BE LESS THAN 0 *** 33 34 include "cv30param.h" 35 include "conema3.h" 36 37 INTEGER nd 38 REAL delt ! timestep (seconds) 39 40 ! noff: integer limit for convection (nd-noff) 41 ! minorig: First level of convection 42 43 ! -- limit levels for convection: 44 45 noff = 1 46 minorig = 1 47 nl = nd - noff 48 nlp = nl + 1 49 nlm = nl - 1 50 51 ! -- "microphysical" parameters: 52 53 sigd = 0.01 54 spfac = 0.15 55 pbcrit = 150.0 56 ptcrit = 500.0 57 ! IM cf. FH epmax = 0.993 58 59 omtrain = 45.0 ! used also for snow (no disctinction rain/snow) 60 61 ! -- misc: 62 63 dtovsh = -0.2 ! dT for overshoot 64 dpbase = -40. ! definition cloud base (400m above LCL) 65 dttrig = 5. ! (loose) condition for triggering 66 67 ! -- rate of approach to quasi-equilibrium: 68 69 dtcrit = -2.0 70 tau = 8000. 71 beta = 1.0 - delt/tau 72 alpha = 1.5E-3*delt/tau 73 ! increase alpha to compensate W decrease: 74 alpha = alpha*1.5 75 76 ! -- interface cloud parameterization: 77 78 delta = 0.01 ! cld 79 80 ! -- interface with boundary-layer (gust factor): (sb) 81 82 betad = 10.0 ! original value (from convect 4.3) 83 84 RETURN 85 END SUBROUTINE cv30_param 86 87 SUBROUTINE cv30_prelim(len, nd, ndp1, t, q, p, ph, lv, cpn, tv, gz, h, hm, & 88 th) 89 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 90 , clmci, eps, epsi, epsim1, ginv, hrd, grav 91 IMPLICIT NONE 92 93 ! ===================================================================== 94 ! --- CALCULATE ARRAYS OF GEOPOTENTIAL, HEAT CAPACITY & STATIC ENERGY 95 ! "ori": from convect4.3 (vectorized) 96 ! "convect3": to be exactly consistent with convect3 97 ! ===================================================================== 98 99 ! inputs: 100 INTEGER len, nd, ndp1 101 REAL t(len, nd), q(len, nd), p(len, nd), ph(len, ndp1) 102 103 ! outputs: 104 REAL lv(len, nd), cpn(len, nd), tv(len, nd) 105 REAL gz(len, nd), h(len, nd), hm(len, nd) 106 REAL th(len, nd) 107 108 ! local variables: 109 INTEGER k, i 110 REAL rdcp 111 REAL tvx, tvy ! convect3 112 REAL cpx(len, nd) 113 114 include "cv30param.h" 115 116 117 ! ori do 110 k=1,nlp 118 DO k = 1, nl ! convect3 1 MODULE cv30_routines_mod 2 !------------------------------------------------------------ 3 ! Parameters for convectL, iflag_con=30: 4 ! (includes - microphysical parameters, 5 ! - parameters that control the rate of approach 6 ! to quasi-equilibrium) 7 ! - noff & minorig (previously in input of convect1) 8 !------------------------------------------------------------ 9 10 IMPLICIT NONE; PRIVATE 11 PUBLIC sigd, spfac, pbcrit, ptcrit, omtrain, dtovsh, dpbase, dttrig, dtcrit, & 12 tau, beta, alpha, delta, betad, noff, minorig, nl, nlp, nlm, & 13 cv30_param, cv30_prelim, cv30_feed, cv30_undilute1, cv30_trigger, & 14 cv30_compress, cv30_undilute2, cv30_closure, cv30_mixing, cv30_unsat, & 15 cv30_yield, cv30_tracer, cv30_uncompress, cv30_epmax_fn_cape 16 17 INTEGER noff, minorig, nl, nlp, nlm 18 REAL sigd, spfac 19 REAL pbcrit, ptcrit 20 REAL omtrain 21 REAL dtovsh, dpbase, dttrig 22 REAL dtcrit, tau, beta, alpha 23 REAL delta 24 REAL betad 25 26 !$OMP THREADPRIVATE(sigd, spfac, pbcrit, ptcrit, omtrain, dtovsh, dpbase, dttrig, dtcrit, & 27 !$OMP tau, beta, alpha, delta, betad, noff, minorig, nl, nlp, nlm) 28 CONTAINS 29 30 SUBROUTINE cv30_param(nd, delt) 31 USE conema3_mod_h 32 33 IMPLICIT NONE 34 35 ! ------------------------------------------------------------ 36 ! Set parameters for convectL for iflag_con = 3 37 ! ------------------------------------------------------------ 38 39 40 ! *** PBCRIT IS THE CRITICAL CLOUD DEPTH (MB) BENEATH WHICH THE *** 41 ! *** PRECIPITATION EFFICIENCY IS ASSUMED TO BE ZERO *** 42 ! *** PTCRIT IS THE CLOUD DEPTH (MB) ABOVE WHICH THE PRECIP. *** 43 ! *** EFFICIENCY IS ASSUMED TO BE UNITY *** 44 ! *** SIGD IS THE FRACTIONAL AREA COVERED BY UNSATURATED DNDRAFT *** 45 ! *** SPFAC IS THE FRACTION OF PRECIPITATION FALLING OUTSIDE *** 46 ! *** OF CLOUD *** 47 48 ! [TAU: CHARACTERISTIC TIMESCALE USED TO COMPUTE ALPHA & BETA] 49 ! *** ALPHA AND BETA ARE PARAMETERS THAT CONTROL THE RATE OF *** 50 ! *** APPROACH TO QUASI-EQUILIBRIUM *** 51 ! *** (THEIR STANDARD VALUES ARE 1.0 AND 0.96, RESPECTIVELY) *** 52 ! *** (BETA MUST BE LESS THAN OR EQUAL TO 1) *** 53 54 ! *** DTCRIT IS THE CRITICAL BUOYANCY (K) USED TO ADJUST THE *** 55 ! *** APPROACH TO QUASI-EQUILIBRIUM *** 56 ! *** IT MUST BE LESS THAN 0 *** 57 58 INTEGER nd 59 REAL delt ! timestep (seconds) 60 61 ! noff: integer limit for convection (nd-noff) 62 ! minorig: First level of convection 63 64 ! -- limit levels for convection: 65 66 noff = 1 67 minorig = 1 68 nl = nd - noff 69 nlp = nl + 1 70 nlm = nl - 1 71 72 ! -- "microphysical" parameters: 73 74 sigd = 0.01 75 spfac = 0.15 76 pbcrit = 150.0 77 ptcrit = 500.0 78 ! IM cf. FH epmax = 0.993 79 80 omtrain = 45.0 ! used also for snow (no disctinction rain/snow) 81 82 ! -- misc: 83 84 dtovsh = -0.2 ! dT for overshoot 85 dpbase = -40. ! definition cloud base (400m above LCL) 86 dttrig = 5. ! (loose) condition for triggering 87 88 ! -- rate of approach to quasi-equilibrium: 89 90 dtcrit = -2.0 91 tau = 8000. 92 beta = 1.0 - delt / tau 93 alpha = 1.5E-3 * delt / tau 94 ! increase alpha to compensate W decrease: 95 alpha = alpha * 1.5 96 97 ! -- interface cloud parameterization: 98 99 delta = 0.01 ! cld 100 101 ! -- interface with boundary-layer (gust factor): (sb) 102 103 betad = 10.0 ! original value (from convect 4.3) 104 105 END SUBROUTINE cv30_param 106 107 SUBROUTINE cv30_prelim(len, nd, ndp1, t, q, p, ph, lv, cpn, tv, gz, h, hm, & 108 th) 109 USE cvthermo_mod_h 110 111 IMPLICIT NONE 112 113 ! ===================================================================== 114 ! --- CALCULATE ARRAYS OF GEOPOTENTIAL, HEAT CAPACITY & STATIC ENERGY 115 ! "ori": from convect4.3 (vectorized) 116 ! "convect3": to be exactly consistent with convect3 117 ! ===================================================================== 118 119 ! inputs: 120 INTEGER len, nd, ndp1 121 REAL t(len, nd), q(len, nd), p(len, nd), ph(len, ndp1) 122 123 ! outputs: 124 REAL lv(len, nd), cpn(len, nd), tv(len, nd) 125 REAL gz(len, nd), h(len, nd), hm(len, nd) 126 REAL th(len, nd) 127 128 ! local variables: 129 INTEGER k, i 130 REAL rdcp 131 REAL tvx, tvy ! convect3 132 REAL cpx(len, nd) 133 134 ! ori do 110 k=1,nlp 135 DO k = 1, nl ! convect3 136 DO i = 1, len 137 ! debug lv(i,k)= lv0-clmcpv*(t(i,k)-t0) 138 lv(i, k) = lv0 - clmcpv * (t(i, k) - 273.15) 139 cpn(i, k) = cpd * (1.0 - q(i, k)) + cpv * q(i, k) 140 cpx(i, k) = cpd * (1.0 - q(i, k)) + cl * q(i, k) 141 ! ori tv(i,k)=t(i,k)*(1.0+q(i,k)*epsim1) 142 tv(i, k) = t(i, k) * (1.0 + q(i, k) / eps - q(i, k)) 143 rdcp = (rrd * (1. - q(i, k)) + q(i, k) * rrv) / cpn(i, k) 144 th(i, k) = t(i, k) * (1000.0 / p(i, k))**rdcp 145 END DO 146 END DO 147 148 ! gz = phi at the full levels (same as p). 149 119 150 DO i = 1, len 120 ! debug lv(i,k)= lv0-clmcpv*(t(i,k)-t0) 121 lv(i, k) = lv0 - clmcpv*(t(i,k)-273.15) 122 cpn(i, k) = cpd*(1.0-q(i,k)) + cpv*q(i, k) 123 cpx(i, k) = cpd*(1.0-q(i,k)) + cl*q(i, k) 124 ! ori tv(i,k)=t(i,k)*(1.0+q(i,k)*epsim1) 125 tv(i, k) = t(i, k)*(1.0+q(i,k)/eps-q(i,k)) 126 rdcp = (rrd*(1.-q(i,k))+q(i,k)*rrv)/cpn(i, k) 127 th(i, k) = t(i, k)*(1000.0/p(i,k))**rdcp 128 END DO 129 END DO 130 131 ! gz = phi at the full levels (same as p). 132 133 DO i = 1, len 134 gz(i, 1) = 0.0 135 END DO 136 ! ori do 140 k=2,nlp 137 DO k = 2, nl ! convect3 151 gz(i, 1) = 0.0 152 END DO 153 ! ori do 140 k=2,nlp 154 DO k = 2, nl ! convect3 155 DO i = 1, len 156 tvx = t(i, k) * (1. + q(i, k) / eps - q(i, k)) !convect3 157 tvy = t(i, k - 1) * (1. + q(i, k - 1) / eps - q(i, k - 1)) !convect3 158 gz(i, k) = gz(i, k - 1) + 0.5 * rrd * (tvx + tvy) & !convect3 159 * (p(i, k - 1) - p(i, k)) / ph(i, k) !convect3 160 161 ! ori gz(i,k)=gz(i,k-1)+hrd*(tv(i,k-1)+tv(i,k)) 162 ! ori & *(p(i,k-1)-p(i,k))/ph(i,k) 163 END DO 164 END DO 165 166 ! h = phi + cpT (dry static energy). 167 ! hm = phi + cp(T-Tbase)+Lq 168 169 ! ori do 170 k=1,nlp 170 DO k = 1, nl ! convect3 171 DO i = 1, len 172 h(i, k) = gz(i, k) + cpn(i, k) * t(i, k) 173 hm(i, k) = gz(i, k) + cpx(i, k) * (t(i, k) - t(i, 1)) + lv(i, k) * q(i, k) 174 END DO 175 END DO 176 177 END SUBROUTINE cv30_prelim 178 179 SUBROUTINE cv30_feed(len, nd, t, q, qs, p, ph, hm, gz, nk, icb, icbmax, & 180 iflag, tnk, qnk, gznk, plcl) 181 182 IMPLICIT NONE 183 184 ! ================================================================ 185 ! Purpose: CONVECTIVE FEED 186 187 ! Main differences with cv_feed: 188 ! - ph added in input 189 ! - here, nk(i)=minorig 190 ! - icb defined differently (plcl compared with ph instead of p) 191 192 ! Main differences with convect3: 193 ! - we do not compute dplcldt and dplcldr of CLIFT anymore 194 ! - values iflag different (but tests identical) 195 ! - A,B explicitely defined (!...) 196 ! ================================================================ 197 198 ! inputs: 199 INTEGER len, nd 200 REAL t(len, nd), q(len, nd), qs(len, nd), p(len, nd) 201 REAL hm(len, nd), gz(len, nd) 202 REAL ph(len, nd + 1) 203 204 ! outputs: 205 INTEGER iflag(len), nk(len), icb(len), icbmax 206 REAL tnk(len), qnk(len), gznk(len), plcl(len) 207 208 ! local variables: 209 INTEGER i, k 210 INTEGER ihmin(len) 211 REAL work(len) 212 REAL pnk(len), qsnk(len), rh(len), chi(len) 213 REAL a, b ! convect3 214 ! ym 215 plcl = 0.0 216 ! @ !------------------------------------------------------------------- 217 ! @ ! --- Find level of minimum moist static energy 218 ! @ ! --- If level of minimum moist static energy coincides with 219 ! @ ! --- or is lower than minimum allowable parcel origin level, 220 ! @ ! --- set iflag to 6. 221 ! @ !------------------------------------------------------------------- 222 ! @ 223 ! @ do 180 i=1,len 224 ! @ work(i)=1.0e12 225 ! @ ihmin(i)=nl 226 ! @ 180 continue 227 ! @ do 200 k=2,nlp 228 ! @ do 190 i=1,len 229 ! @ if((hm(i,k).lt.work(i)).AND. 230 ! @ & (hm(i,k).lt.hm(i,k-1)))THEN 231 ! @ work(i)=hm(i,k) 232 ! @ ihmin(i)=k 233 ! @ endif 234 ! @ 190 continue 235 ! @ 200 continue 236 ! @ do 210 i=1,len 237 ! @ ihmin(i)=min(ihmin(i),nlm) 238 ! @ IF(ihmin(i).le.minorig)THEN 239 ! @ iflag(i)=6 240 ! @ endif 241 ! @ 210 continue 242 ! @ c 243 ! @ !------------------------------------------------------------------- 244 ! @ ! --- Find that model level below the level of minimum moist static 245 ! @ ! --- energy that has the maximum value of moist static energy 246 ! @ !------------------------------------------------------------------- 247 ! @ 248 ! @ do 220 i=1,len 249 ! @ work(i)=hm(i,minorig) 250 ! @ nk(i)=minorig 251 ! @ 220 continue 252 ! @ do 240 k=minorig+1,nl 253 ! @ do 230 i=1,len 254 ! @ if((hm(i,k).gt.work(i)).AND.(k.le.ihmin(i)))THEN 255 ! @ work(i)=hm(i,k) 256 ! @ nk(i)=k 257 ! @ endif 258 ! @ 230 continue 259 ! @ 240 continue 260 261 ! ------------------------------------------------------------------- 262 ! --- Origin level of ascending parcels for convect3: 263 ! ------------------------------------------------------------------- 264 138 265 DO i = 1, len 139 tvx = t(i, k)*(1.+q(i,k)/eps-q(i,k)) !convect3 140 tvy = t(i, k-1)*(1.+q(i,k-1)/eps-q(i,k-1)) !convect3 141 gz(i, k) = gz(i, k-1) + 0.5*rrd*(tvx+tvy) & !convect3 142 *(p(i,k-1)-p(i,k))/ph(i, k) !convect3 143 144 ! ori gz(i,k)=gz(i,k-1)+hrd*(tv(i,k-1)+tv(i,k)) 145 ! ori & *(p(i,k-1)-p(i,k))/ph(i,k) 146 END DO 147 END DO 148 149 ! h = phi + cpT (dry static energy). 150 ! hm = phi + cp(T-Tbase)+Lq 151 152 ! ori do 170 k=1,nlp 153 DO k = 1, nl ! convect3 266 nk(i) = minorig 267 END DO 268 269 ! ------------------------------------------------------------------- 270 ! --- Check whether parcel level temperature and specific humidity 271 ! --- are reasonable 272 ! ------------------------------------------------------------------- 154 273 DO i = 1, len 155 h(i, k) = gz(i, k) + cpn(i, k)*t(i, k) 156 hm(i, k) = gz(i, k) + cpx(i, k)*(t(i,k)-t(i,1)) + lv(i, k)*q(i, k) 157 END DO 158 END DO 159 160 RETURN 161 END SUBROUTINE cv30_prelim 162 163 SUBROUTINE cv30_feed(len, nd, t, q, qs, p, ph, hm, gz, nk, icb, icbmax, & 164 iflag, tnk, qnk, gznk, plcl) 165 IMPLICIT NONE 166 167 ! ================================================================ 168 ! Purpose: CONVECTIVE FEED 169 170 ! Main differences with cv_feed: 171 ! - ph added in input 172 ! - here, nk(i)=minorig 173 ! - icb defined differently (plcl compared with ph instead of p) 174 175 ! Main differences with convect3: 176 ! - we do not compute dplcldt and dplcldr of CLIFT anymore 177 ! - values iflag different (but tests identical) 178 ! - A,B explicitely defined (!...) 179 ! ================================================================ 180 181 include "cv30param.h" 182 183 ! inputs: 184 INTEGER len, nd 185 REAL t(len, nd), q(len, nd), qs(len, nd), p(len, nd) 186 REAL hm(len, nd), gz(len, nd) 187 REAL ph(len, nd+1) 188 189 ! outputs: 190 INTEGER iflag(len), nk(len), icb(len), icbmax 191 REAL tnk(len), qnk(len), gznk(len), plcl(len) 192 193 ! local variables: 194 INTEGER i, k 195 INTEGER ihmin(len) 196 REAL work(len) 197 REAL pnk(len), qsnk(len), rh(len), chi(len) 198 REAL a, b ! convect3 199 ! ym 200 plcl = 0.0 201 ! @ !------------------------------------------------------------------- 202 ! @ ! --- Find level of minimum moist static energy 203 ! @ ! --- If level of minimum moist static energy coincides with 204 ! @ ! --- or is lower than minimum allowable parcel origin level, 205 ! @ ! --- set iflag to 6. 206 ! @ !------------------------------------------------------------------- 207 ! @ 208 ! @ do 180 i=1,len 209 ! @ work(i)=1.0e12 210 ! @ ihmin(i)=nl 211 ! @ 180 continue 212 ! @ do 200 k=2,nlp 213 ! @ do 190 i=1,len 214 ! @ if((hm(i,k).lt.work(i)).and. 215 ! @ & (hm(i,k).lt.hm(i,k-1)))then 216 ! @ work(i)=hm(i,k) 217 ! @ ihmin(i)=k 218 ! @ endif 219 ! @ 190 continue 220 ! @ 200 continue 221 ! @ do 210 i=1,len 222 ! @ ihmin(i)=min(ihmin(i),nlm) 223 ! @ if(ihmin(i).le.minorig)then 224 ! @ iflag(i)=6 225 ! @ endif 226 ! @ 210 continue 227 ! @ c 228 ! @ !------------------------------------------------------------------- 229 ! @ ! --- Find that model level below the level of minimum moist static 230 ! @ ! --- energy that has the maximum value of moist static energy 231 ! @ !------------------------------------------------------------------- 232 ! @ 233 ! @ do 220 i=1,len 234 ! @ work(i)=hm(i,minorig) 235 ! @ nk(i)=minorig 236 ! @ 220 continue 237 ! @ do 240 k=minorig+1,nl 238 ! @ do 230 i=1,len 239 ! @ if((hm(i,k).gt.work(i)).and.(k.le.ihmin(i)))then 240 ! @ work(i)=hm(i,k) 241 ! @ nk(i)=k 242 ! @ endif 243 ! @ 230 continue 244 ! @ 240 continue 245 246 ! ------------------------------------------------------------------- 247 ! --- Origin level of ascending parcels for convect3: 248 ! ------------------------------------------------------------------- 249 250 DO i = 1, len 251 nk(i) = minorig 252 END DO 253 254 ! ------------------------------------------------------------------- 255 ! --- Check whether parcel level temperature and specific humidity 256 ! --- are reasonable 257 ! ------------------------------------------------------------------- 258 DO i = 1, len 259 IF (((t(i,nk(i))<250.0) .OR. (q(i,nk(i))<=0.0)) & ! @ & .or.( 260 ! p(i,ihmin(i)).lt.400.0 261 ! ) ) 262 .AND. (iflag(i)==0)) iflag(i) = 7 263 END DO 264 ! ------------------------------------------------------------------- 265 ! --- Calculate lifted condensation level of air at parcel origin level 266 ! --- (Within 0.2% of formula of Bolton, MON. WEA. REV.,1980) 267 ! ------------------------------------------------------------------- 268 269 a = 1669.0 ! convect3 270 b = 122.0 ! convect3 271 272 DO i = 1, len 273 274 IF (iflag(i)/=7) THEN ! modif sb Jun7th 2002 275 274 IF (((t(i, nk(i))<250.0) .OR. (q(i, nk(i))<=0.0)) & ! @ & .OR.( 275 ! p(i,ihmin(i)).lt.400.0 276 ! ) ) 277 .AND. (iflag(i)==0)) iflag(i) = 7 278 END DO 279 ! ------------------------------------------------------------------- 280 ! --- Calculate lifted condensation level of air at parcel origin level 281 ! --- (Within 0.2% of formula of Bolton, MON. WEA. REV.,1980) 282 ! ------------------------------------------------------------------- 283 284 a = 1669.0 ! convect3 285 b = 122.0 ! convect3 286 287 DO i = 1, len 288 289 IF (iflag(i)/=7) THEN ! modif sb Jun7th 2002 290 291 tnk(i) = t(i, nk(i)) 292 qnk(i) = q(i, nk(i)) 293 gznk(i) = gz(i, nk(i)) 294 pnk(i) = p(i, nk(i)) 295 qsnk(i) = qs(i, nk(i)) 296 297 rh(i) = qnk(i) / qsnk(i) 298 ! ori rh(i)=min(1.0,rh(i)) ! removed for convect3 299 ! ori chi(i)=tnk(i)/(1669.0-122.0*rh(i)-tnk(i)) 300 chi(i) = tnk(i) / (a - b * rh(i) - tnk(i)) ! convect3 301 plcl(i) = pnk(i) * (rh(i)**chi(i)) 302 IF (((plcl(i)<200.0) .OR. (plcl(i)>=2000.0)) .AND. (iflag(i)==0)) iflag & 303 (i) = 8 304 305 END IF ! iflag=7 306 307 END DO 308 309 ! ------------------------------------------------------------------- 310 ! --- Calculate first level above lcl (=icb) 311 ! ------------------------------------------------------------------- 312 313 ! @ do 270 i=1,len 314 ! @ icb(i)=nlm 315 ! @ 270 continue 316 ! @c 317 ! @ do 290 k=minorig,nl 318 ! @ do 280 i=1,len 319 ! @ if((k.ge.(nk(i)+1)).AND.(p(i,k).lt.plcl(i))) 320 ! @ & icb(i)=min(icb(i),k) 321 ! @ 280 continue 322 ! @ 290 continue 323 ! @c 324 ! @ do 300 i=1,len 325 ! @ if((icb(i).ge.nlm).AND.(iflag(i).EQ.0))iflag(i)=9 326 ! @ 300 continue 327 328 DO i = 1, len 329 icb(i) = nlm 330 END DO 331 332 ! la modification consiste a comparer plcl a ph et non a p: 333 ! icb est defini par : ph(icb)<plcl<ph(icb-1) 334 ! @ do 290 k=minorig,nl 335 DO k = 3, nl - 1 ! modif pour que icb soit sup/egal a 2 336 DO i = 1, len 337 IF (ph(i, k)<plcl(i)) icb(i) = min(icb(i), k) 338 END DO 339 END DO 340 341 DO i = 1, len 342 ! @ if((icb(i).ge.nlm).AND.(iflag(i).EQ.0))iflag(i)=9 343 IF ((icb(i)==nlm) .AND. (iflag(i)==0)) iflag(i) = 9 344 END DO 345 346 DO i = 1, len 347 icb(i) = icb(i) - 1 ! icb sup ou egal a 2 348 END DO 349 350 ! Compute icbmax. 351 352 icbmax = 2 353 DO i = 1, len 354 ! icbmax=max(icbmax,icb(i)) 355 IF (iflag(i)<7) icbmax = max(icbmax, icb(i)) ! sb Jun7th02 356 END DO 357 358 END SUBROUTINE cv30_feed 359 360 SUBROUTINE cv30_undilute1(len, nd, t, q, qs, gz, plcl, p, nk, icb, tp, tvp, & 361 clw, icbs) 362 USE cvthermo_mod_h 363 364 IMPLICIT NONE 365 366 ! ---------------------------------------------------------------- 367 ! Equivalent de TLIFT entre NK et ICB+1 inclus 368 369 ! Differences with convect4: 370 ! - specify plcl in input 371 ! - icbs is the first level above LCL (may differ from icb) 372 ! - in the iterations, used x(icbs) instead x(icb) 373 ! - many minor differences in the iterations 374 ! - tvp is computed in only one time 375 ! - icbs: first level above Plcl (IMIN de TLIFT) in output 376 ! - if icbs=icb, compute also tp(icb+1),tvp(icb+1) & clw(icb+1) 377 ! ---------------------------------------------------------------- 378 379 380 381 ! inputs: 382 INTEGER len, nd 383 INTEGER nk(len), icb(len) 384 REAL t(len, nd), q(len, nd), qs(len, nd), gz(len, nd) 385 REAL p(len, nd) 386 REAL plcl(len) ! convect3 387 388 ! outputs: 389 REAL tp(len, nd), tvp(len, nd), clw(len, nd) 390 391 ! local variables: 392 INTEGER i, k 393 INTEGER icb1(len), icbs(len), icbsmax2 ! convect3 394 REAL tg, qg, alv, s, ahg, tc, denom, es, rg 395 REAL ah0(len), cpp(len) 396 REAL tnk(len), qnk(len), gznk(len), ticb(len), gzicb(len) 397 REAL qsicb(len) ! convect3 398 REAL cpinv(len) ! convect3 399 400 ! ------------------------------------------------------------------- 401 ! --- Calculates the lifted parcel virtual temperature at nk, 402 ! --- the actual temperature, and the adiabatic 403 ! --- liquid water content. The procedure is to solve the equation. 404 ! cp*tp+L*qp+phi=cp*tnk+L*qnk+gznk. 405 ! ------------------------------------------------------------------- 406 407 DO i = 1, len 276 408 tnk(i) = t(i, nk(i)) 277 409 qnk(i) = q(i, nk(i)) 278 410 gznk(i) = gz(i, nk(i)) 279 pnk(i) = p(i, nk(i)) 280 qsnk(i) = qs(i, nk(i)) 281 282 rh(i) = qnk(i)/qsnk(i) 283 ! ori rh(i)=min(1.0,rh(i)) ! removed for convect3 284 ! ori chi(i)=tnk(i)/(1669.0-122.0*rh(i)-tnk(i)) 285 chi(i) = tnk(i)/(a-b*rh(i)-tnk(i)) ! convect3 286 plcl(i) = pnk(i)*(rh(i)**chi(i)) 287 IF (((plcl(i)<200.0) .OR. (plcl(i)>=2000.0)) .AND. (iflag(i)==0)) iflag & 288 (i) = 8 289 290 END IF ! iflag=7 291 292 END DO 293 294 ! ------------------------------------------------------------------- 295 ! --- Calculate first level above lcl (=icb) 296 ! ------------------------------------------------------------------- 297 298 ! @ do 270 i=1,len 299 ! @ icb(i)=nlm 300 ! @ 270 continue 301 ! @c 302 ! @ do 290 k=minorig,nl 303 ! @ do 280 i=1,len 304 ! @ if((k.ge.(nk(i)+1)).and.(p(i,k).lt.plcl(i))) 305 ! @ & icb(i)=min(icb(i),k) 306 ! @ 280 continue 307 ! @ 290 continue 308 ! @c 309 ! @ do 300 i=1,len 310 ! @ if((icb(i).ge.nlm).and.(iflag(i).eq.0))iflag(i)=9 311 ! @ 300 continue 312 313 DO i = 1, len 314 icb(i) = nlm 315 END DO 316 317 ! la modification consiste a comparer plcl a ph et non a p: 318 ! icb est defini par : ph(icb)<plcl<ph(icb-1) 319 ! @ do 290 k=minorig,nl 320 DO k = 3, nl - 1 ! modif pour que icb soit sup/egal a 2 411 ! ori ticb(i)=t(i,icb(i)) 412 ! ori gzicb(i)=gz(i,icb(i)) 413 END DO 414 415 ! *** Calculate certain parcel quantities, including static energy *** 416 321 417 DO i = 1, len 322 IF (ph(i,k)<plcl(i)) icb(i) = min(icb(i), k) 323 END DO 324 END DO 325 326 DO i = 1, len 327 ! @ if((icb(i).ge.nlm).and.(iflag(i).eq.0))iflag(i)=9 328 IF ((icb(i)==nlm) .AND. (iflag(i)==0)) iflag(i) = 9 329 END DO 330 331 DO i = 1, len 332 icb(i) = icb(i) - 1 ! icb sup ou egal a 2 333 END DO 334 335 ! Compute icbmax. 336 337 icbmax = 2 338 DO i = 1, len 339 ! ! icbmax=max(icbmax,icb(i)) 340 IF (iflag(i)<7) icbmax = max(icbmax, icb(i)) ! sb Jun7th02 341 END DO 342 343 RETURN 344 END SUBROUTINE cv30_feed 345 346 SUBROUTINE cv30_undilute1(len, nd, t, q, qs, gz, plcl, p, nk, icb, tp, tvp, & 347 clw, icbs) 348 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 349 , clmci, eps, epsi, epsim1, ginv, hrd, grav 350 IMPLICIT NONE 351 352 ! ---------------------------------------------------------------- 353 ! Equivalent de TLIFT entre NK et ICB+1 inclus 354 355 ! Differences with convect4: 356 ! - specify plcl in input 357 ! - icbs is the first level above LCL (may differ from icb) 358 ! - in the iterations, used x(icbs) instead x(icb) 359 ! - many minor differences in the iterations 360 ! - tvp is computed in only one time 361 ! - icbs: first level above Plcl (IMIN de TLIFT) in output 362 ! - if icbs=icb, compute also tp(icb+1),tvp(icb+1) & clw(icb+1) 363 ! ---------------------------------------------------------------- 364 include "cv30param.h" 365 366 ! inputs: 367 INTEGER len, nd 368 INTEGER nk(len), icb(len) 369 REAL t(len, nd), q(len, nd), qs(len, nd), gz(len, nd) 370 REAL p(len, nd) 371 REAL plcl(len) ! convect3 372 373 ! outputs: 374 REAL tp(len, nd), tvp(len, nd), clw(len, nd) 375 376 ! local variables: 377 INTEGER i, k 378 INTEGER icb1(len), icbs(len), icbsmax2 ! convect3 379 REAL tg, qg, alv, s, ahg, tc, denom, es, rg 380 REAL ah0(len), cpp(len) 381 REAL tnk(len), qnk(len), gznk(len), ticb(len), gzicb(len) 382 REAL qsicb(len) ! convect3 383 REAL cpinv(len) ! convect3 384 385 ! ------------------------------------------------------------------- 386 ! --- Calculates the lifted parcel virtual temperature at nk, 387 ! --- the actual temperature, and the adiabatic 388 ! --- liquid water content. The procedure is to solve the equation. 389 ! cp*tp+L*qp+phi=cp*tnk+L*qnk+gznk. 390 ! ------------------------------------------------------------------- 391 392 DO i = 1, len 393 tnk(i) = t(i, nk(i)) 394 qnk(i) = q(i, nk(i)) 395 gznk(i) = gz(i, nk(i)) 396 ! ori ticb(i)=t(i,icb(i)) 397 ! ori gzicb(i)=gz(i,icb(i)) 398 END DO 399 400 ! *** Calculate certain parcel quantities, including static energy *** 401 402 DO i = 1, len 403 ah0(i) = (cpd*(1.-qnk(i))+cl*qnk(i))*tnk(i) + qnk(i)*(lv0-clmcpv*(tnk(i)- & 404 273.15)) + gznk(i) 405 cpp(i) = cpd*(1.-qnk(i)) + qnk(i)*cpv 406 cpinv(i) = 1./cpp(i) 407 END DO 408 409 ! *** Calculate lifted parcel quantities below cloud base *** 410 411 DO i = 1, len !convect3 412 icb1(i) = min(max(icb(i), 2), nl) 413 ! if icb is below LCL, start loop at ICB+1: 414 ! (icbs est le premier niveau au-dessus du LCL) 415 icbs(i) = icb1(i) !convect3 416 IF (plcl(i)<p(i,icb1(i))) THEN 417 icbs(i) = min(icbs(i)+1, nl) !convect3 418 ah0(i) = (cpd * (1. - qnk(i)) + cl * qnk(i)) * tnk(i) + qnk(i) * (lv0 - clmcpv * (tnk(i) - & 419 273.15)) + gznk(i) 420 cpp(i) = cpd * (1. - qnk(i)) + qnk(i) * cpv 421 cpinv(i) = 1. / cpp(i) 422 END DO 423 424 ! *** Calculate lifted parcel quantities below cloud base *** 425 426 DO i = 1, len !convect3 427 icb1(i) = min(max(icb(i), 2), nl) 428 ! if icb is below LCL, start loop at ICB+1: 429 ! (icbs est le premier niveau au-dessus du LCL) 430 icbs(i) = icb1(i) !convect3 431 IF (plcl(i)<p(i, icb1(i))) THEN 432 icbs(i) = min(icbs(i) + 1, nl) !convect3 433 END IF 434 END DO !convect3 435 436 DO i = 1, len !convect3 437 ticb(i) = t(i, icbs(i)) !convect3 438 gzicb(i) = gz(i, icbs(i)) !convect3 439 qsicb(i) = qs(i, icbs(i)) !convect3 440 END DO !convect3 441 442 443 ! Re-compute icbsmax (icbsmax2): !convect3 444 !convect3 445 icbsmax2 = 2 !convect3 446 DO i = 1, len !convect3 447 icbsmax2 = max(icbsmax2, icbs(i)) !convect3 448 END DO !convect3 449 450 ! initialization outputs: 451 452 DO k = 1, icbsmax2 ! convect3 453 DO i = 1, len ! convect3 454 tp(i, k) = 0.0 ! convect3 455 tvp(i, k) = 0.0 ! convect3 456 clw(i, k) = 0.0 ! convect3 457 END DO ! convect3 458 END DO ! convect3 459 460 ! tp and tvp below cloud base: 461 462 DO k = minorig, icbsmax2 - 1 463 DO i = 1, len 464 tp(i, k) = tnk(i) - (gz(i, k) - gznk(i)) * cpinv(i) 465 tvp(i, k) = tp(i, k) * (1. + qnk(i) / eps - qnk(i)) !whole thing (convect3) 466 END DO 467 END DO 468 469 ! *** Find lifted parcel quantities above cloud base *** 470 471 DO i = 1, len 472 tg = ticb(i) 473 ! ori qg=qs(i,icb(i)) 474 qg = qsicb(i) ! convect3 475 ! debug alv=lv0-clmcpv*(ticb(i)-t0) 476 alv = lv0 - clmcpv * (ticb(i) - 273.15) 477 478 ! First iteration. 479 480 ! ori s=cpd+alv*alv*qg/(rrv*ticb(i)*ticb(i)) 481 s = cpd * (1. - qnk(i)) + cl * qnk(i) & ! convect3 482 + alv * alv * qg / (rrv * ticb(i) * ticb(i)) ! convect3 483 s = 1. / s 484 ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*ticb(i)+alv*qg+gzicb(i) 485 ahg = cpd * tg + (cl - cpd) * qnk(i) * tg + alv * qg + gzicb(i) ! convect3 486 tg = tg + s * (ah0(i) - ahg) 487 ! ori tg=max(tg,35.0) 488 ! debug tc=tg-t0 489 tc = tg - 273.15 490 denom = 243.5 + tc 491 denom = max(denom, 1.0) ! convect3 492 ! ori IF(tc.ge.0.0)THEN 493 es = 6.112 * exp(17.67 * tc / denom) 494 ! ori else 495 ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) 496 ! ori endif 497 ! ori qg=eps*es/(p(i,icb(i))-es*(1.-eps)) 498 qg = eps * es / (p(i, icbs(i)) - es * (1. - eps)) 499 500 ! Second iteration. 501 502 503 ! ori s=cpd+alv*alv*qg/(rrv*ticb(i)*ticb(i)) 504 ! ori s=1./s 505 ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*ticb(i)+alv*qg+gzicb(i) 506 ahg = cpd * tg + (cl - cpd) * qnk(i) * tg + alv * qg + gzicb(i) ! convect3 507 tg = tg + s * (ah0(i) - ahg) 508 ! ori tg=max(tg,35.0) 509 ! debug tc=tg-t0 510 tc = tg - 273.15 511 denom = 243.5 + tc 512 denom = max(denom, 1.0) ! convect3 513 ! ori IF(tc.ge.0.0)THEN 514 es = 6.112 * exp(17.67 * tc / denom) 515 ! ori else 516 ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) 517 ! ori end if 518 ! ori qg=eps*es/(p(i,icb(i))-es*(1.-eps)) 519 qg = eps * es / (p(i, icbs(i)) - es * (1. - eps)) 520 521 alv = lv0 - clmcpv * (ticb(i) - 273.15) 522 523 ! ori c approximation here: 524 ! ori tp(i,icb(i))=(ah0(i)-(cl-cpd)*qnk(i)*ticb(i) 525 ! ori & -gz(i,icb(i))-alv*qg)/cpd 526 527 ! convect3: no approximation: 528 tp(i, icbs(i)) = (ah0(i) - gz(i, icbs(i)) - alv * qg) / (cpd + (cl - cpd) * qnk(i)) 529 530 ! ori clw(i,icb(i))=qnk(i)-qg 531 ! ori clw(i,icb(i))=max(0.0,clw(i,icb(i))) 532 clw(i, icbs(i)) = qnk(i) - qg 533 clw(i, icbs(i)) = max(0.0, clw(i, icbs(i))) 534 535 rg = qg / (1. - qnk(i)) 536 ! ori tvp(i,icb(i))=tp(i,icb(i))*(1.+rg*epsi) 537 ! convect3: (qg utilise au lieu du vrai mixing ratio rg) 538 tvp(i, icbs(i)) = tp(i, icbs(i)) * (1. + qg / eps - qnk(i)) !whole thing 539 540 END DO 541 542 ! ori do 380 k=minorig,icbsmax2 543 ! ori do 370 i=1,len 544 ! ori tvp(i,k)=tvp(i,k)-tp(i,k)*qnk(i) 545 ! ori 370 continue 546 ! ori 380 continue 547 548 549 ! -- The following is only for convect3: 550 551 ! * icbs is the first level above the LCL: 552 ! if plcl<p(icb), then icbs=icb+1 553 ! if plcl>p(icb), then icbs=icb 554 555 ! * the routine above computes tvp from minorig to icbs (included). 556 557 ! * to compute buoybase (in cv3_trigger.F), both tvp(icb) and tvp(icb+1) 558 ! must be known. This is the case if icbs=icb+1, but not if icbs=icb. 559 560 ! * therefore, in the case icbs=icb, we compute tvp at level icb+1 561 ! (tvp at other levels will be computed in cv3_undilute2.F) 562 563 DO i = 1, len 564 ticb(i) = t(i, icb(i) + 1) 565 gzicb(i) = gz(i, icb(i) + 1) 566 qsicb(i) = qs(i, icb(i) + 1) 567 END DO 568 569 DO i = 1, len 570 tg = ticb(i) 571 qg = qsicb(i) ! convect3 572 ! debug alv=lv0-clmcpv*(ticb(i)-t0) 573 alv = lv0 - clmcpv * (ticb(i) - 273.15) 574 575 ! First iteration. 576 577 ! ori s=cpd+alv*alv*qg/(rrv*ticb(i)*ticb(i)) 578 s = cpd * (1. - qnk(i)) + cl * qnk(i) & ! convect3 579 + alv * alv * qg / (rrv * ticb(i) * ticb(i)) ! convect3 580 s = 1. / s 581 ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*ticb(i)+alv*qg+gzicb(i) 582 ahg = cpd * tg + (cl - cpd) * qnk(i) * tg + alv * qg + gzicb(i) ! convect3 583 tg = tg + s * (ah0(i) - ahg) 584 ! ori tg=max(tg,35.0) 585 ! debug tc=tg-t0 586 tc = tg - 273.15 587 denom = 243.5 + tc 588 denom = max(denom, 1.0) ! convect3 589 ! ori IF(tc.ge.0.0)THEN 590 es = 6.112 * exp(17.67 * tc / denom) 591 ! ori else 592 ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) 593 ! ori endif 594 ! ori qg=eps*es/(p(i,icb(i))-es*(1.-eps)) 595 qg = eps * es / (p(i, icb(i) + 1) - es * (1. - eps)) 596 597 ! Second iteration. 598 599 600 ! ori s=cpd+alv*alv*qg/(rrv*ticb(i)*ticb(i)) 601 ! ori s=1./s 602 ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*ticb(i)+alv*qg+gzicb(i) 603 ahg = cpd * tg + (cl - cpd) * qnk(i) * tg + alv * qg + gzicb(i) ! convect3 604 tg = tg + s * (ah0(i) - ahg) 605 ! ori tg=max(tg,35.0) 606 ! debug tc=tg-t0 607 tc = tg - 273.15 608 denom = 243.5 + tc 609 denom = max(denom, 1.0) ! convect3 610 ! ori IF(tc.ge.0.0)THEN 611 es = 6.112 * exp(17.67 * tc / denom) 612 ! ori else 613 ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) 614 ! ori end if 615 ! ori qg=eps*es/(p(i,icb(i))-es*(1.-eps)) 616 qg = eps * es / (p(i, icb(i) + 1) - es * (1. - eps)) 617 618 alv = lv0 - clmcpv * (ticb(i) - 273.15) 619 620 ! ori c approximation here: 621 ! ori tp(i,icb(i))=(ah0(i)-(cl-cpd)*qnk(i)*ticb(i) 622 ! ori & -gz(i,icb(i))-alv*qg)/cpd 623 624 ! convect3: no approximation: 625 tp(i, icb(i) + 1) = (ah0(i) - gz(i, icb(i) + 1) - alv * qg) / (cpd + (cl - cpd) * qnk(i)) 626 627 ! ori clw(i,icb(i))=qnk(i)-qg 628 ! ori clw(i,icb(i))=max(0.0,clw(i,icb(i))) 629 clw(i, icb(i) + 1) = qnk(i) - qg 630 clw(i, icb(i) + 1) = max(0.0, clw(i, icb(i) + 1)) 631 632 rg = qg / (1. - qnk(i)) 633 ! ori tvp(i,icb(i))=tp(i,icb(i))*(1.+rg*epsi) 634 ! convect3: (qg utilise au lieu du vrai mixing ratio rg) 635 tvp(i, icb(i) + 1) = tp(i, icb(i) + 1) * (1. + qg / eps - qnk(i)) !whole thing 636 637 END DO 638 639 END SUBROUTINE cv30_undilute1 640 641 SUBROUTINE cv30_trigger(len, nd, icb, plcl, p, th, tv, tvp, pbase, buoybase, & 642 iflag, sig, w0) 643 IMPLICIT NONE 644 645 ! ------------------------------------------------------------------- 646 ! --- TRIGGERING 647 648 ! - computes the cloud base 649 ! - triggering (crude in this version) 650 ! - relaxation of sig and w0 when no convection 651 652 ! Caution1: if no convection, we set iflag=4 653 ! (it used to be 0 in convect3) 654 655 ! Caution2: at this stage, tvp (and thus buoy) are know up 656 ! through icb only! 657 ! -> the buoyancy below cloud base not (yet) set to the cloud base buoyancy 658 ! ------------------------------------------------------------------- 659 660 661 662 ! input: 663 INTEGER len, nd 664 INTEGER icb(len) 665 REAL plcl(len), p(len, nd) 666 REAL th(len, nd), tv(len, nd), tvp(len, nd) 667 668 ! output: 669 REAL pbase(len), buoybase(len) 670 671 ! input AND output: 672 INTEGER iflag(len) 673 REAL sig(len, nd), w0(len, nd) 674 675 ! local variables: 676 INTEGER i, k 677 REAL tvpbase, tvbase, tdif, ath, ath1 678 679 680 ! *** set cloud base buoyancy at (plcl+dpbase) level buoyancy 681 682 DO i = 1, len 683 pbase(i) = plcl(i) + dpbase 684 tvpbase = tvp(i, icb(i)) * (pbase(i) - p(i, icb(i) + 1)) / & 685 (p(i, icb(i)) - p(i, icb(i) + 1)) + tvp(i, icb(i) + 1) * (p(i, icb(i)) - pbase(i)) / (& 686 p(i, icb(i)) - p(i, icb(i) + 1)) 687 tvbase = tv(i, icb(i)) * (pbase(i) - p(i, icb(i) + 1)) / & 688 (p(i, icb(i)) - p(i, icb(i) + 1)) + tv(i, icb(i) + 1) * (p(i, icb(i)) - pbase(i)) / (p & 689 (i, icb(i)) - p(i, icb(i) + 1)) 690 buoybase(i) = tvpbase - tvbase 691 END DO 692 693 694 ! *** make sure that column is dry adiabatic between the surface *** 695 ! *** and cloud base, and that lifted air is positively buoyant *** 696 ! *** at cloud base *** 697 ! *** if not, return to calling program after resetting *** 698 ! *** sig(i) and w0(i) *** 699 700 701 ! oct3 do 200 i=1,len 702 ! oct3 703 ! oct3 tdif = buoybase(i) 704 ! oct3 ath1 = th(i,1) 705 ! oct3 ath = th(i,icb(i)-1) - dttrig 706 ! oct3 707 ! oct3 if (tdif.lt.dtcrit .OR. ath.gt.ath1) THEN 708 ! oct3 do 60 k=1,nl 709 ! oct3 sig(i,k) = beta*sig(i,k) - 2.*alpha*tdif*tdif 710 ! oct3 sig(i,k) = AMAX1(sig(i,k),0.0) 711 ! oct3 w0(i,k) = beta*w0(i,k) 712 ! oct3 60 continue 713 ! oct3 iflag(i)=4 ! pour version vectorisee 714 ! oct3c convect3 iflag(i)=0 715 ! oct3cccc RETURN 716 ! oct3 endif 717 ! oct3 718 ! oct3200 continue 719 720 ! -- oct3: on reecrit la boucle 200 (pour la vectorisation) 721 722 DO k = 1, nl 723 DO i = 1, len 724 725 tdif = buoybase(i) 726 ath1 = th(i, 1) 727 ath = th(i, icb(i) - 1) - dttrig 728 729 IF (tdif<dtcrit .OR. ath>ath1) THEN 730 sig(i, k) = beta * sig(i, k) - 2. * alpha * tdif * tdif 731 sig(i, k) = amax1(sig(i, k), 0.0) 732 w0(i, k) = beta * w0(i, k) 733 iflag(i) = 4 ! pour version vectorisee 734 ! convect3 iflag(i)=0 735 END IF 736 737 END DO 738 END DO 739 740 ! fin oct3 -- 741 742 END SUBROUTINE cv30_trigger 743 744 SUBROUTINE cv30_compress(len, nloc, ncum, nd, ntra, iflag1, nk1, icb1, icbs1, & 745 plcl1, tnk1, qnk1, gznk1, pbase1, buoybase1, t1, q1, qs1, u1, v1, gz1, & 746 th1, tra1, h1, lv1, cpn1, p1, ph1, tv1, tp1, tvp1, clw1, sig1, w01, & 747 iflag, nk, icb, icbs, plcl, tnk, qnk, gznk, pbase, buoybase, t, q, qs, u, & 748 v, gz, th, tra, h, lv, cpn, p, ph, tv, tp, tvp, clw, sig, w0) 749 USE print_control_mod, ONLY: lunout 750 IMPLICIT NONE 751 752 753 754 ! inputs: 755 INTEGER len, ncum, nd, ntra, nloc 756 INTEGER iflag1(len), nk1(len), icb1(len), icbs1(len) 757 REAL plcl1(len), tnk1(len), qnk1(len), gznk1(len) 758 REAL pbase1(len), buoybase1(len) 759 REAL t1(len, nd), q1(len, nd), qs1(len, nd), u1(len, nd), v1(len, nd) 760 REAL gz1(len, nd), h1(len, nd), lv1(len, nd), cpn1(len, nd) 761 REAL p1(len, nd), ph1(len, nd + 1), tv1(len, nd), tp1(len, nd) 762 REAL tvp1(len, nd), clw1(len, nd) 763 REAL th1(len, nd) 764 REAL sig1(len, nd), w01(len, nd) 765 REAL tra1(len, nd, ntra) 766 767 ! outputs: 768 ! en fait, on a nloc=len pour l'instant (cf cv_driver) 769 INTEGER iflag(nloc), nk(nloc), icb(nloc), icbs(nloc) 770 REAL plcl(nloc), tnk(nloc), qnk(nloc), gznk(nloc) 771 REAL pbase(nloc), buoybase(nloc) 772 REAL t(nloc, nd), q(nloc, nd), qs(nloc, nd), u(nloc, nd), v(nloc, nd) 773 REAL gz(nloc, nd), h(nloc, nd), lv(nloc, nd), cpn(nloc, nd) 774 REAL p(nloc, nd), ph(nloc, nd + 1), tv(nloc, nd), tp(nloc, nd) 775 REAL tvp(nloc, nd), clw(nloc, nd) 776 REAL th(nloc, nd) 777 REAL sig(nloc, nd), w0(nloc, nd) 778 REAL tra(nloc, nd, ntra) 779 780 ! local variables: 781 INTEGER i, k, nn, j 782 783 CHARACTER (LEN = 20) :: modname = 'cv30_compress' 784 CHARACTER (LEN = 80) :: abort_message 785 786 DO k = 1, nl + 1 787 nn = 0 788 DO i = 1, len 789 IF (iflag1(i)==0) THEN 790 nn = nn + 1 791 sig(nn, k) = sig1(i, k) 792 w0(nn, k) = w01(i, k) 793 t(nn, k) = t1(i, k) 794 q(nn, k) = q1(i, k) 795 qs(nn, k) = qs1(i, k) 796 u(nn, k) = u1(i, k) 797 v(nn, k) = v1(i, k) 798 gz(nn, k) = gz1(i, k) 799 h(nn, k) = h1(i, k) 800 lv(nn, k) = lv1(i, k) 801 cpn(nn, k) = cpn1(i, k) 802 p(nn, k) = p1(i, k) 803 ph(nn, k) = ph1(i, k) 804 tv(nn, k) = tv1(i, k) 805 tp(nn, k) = tp1(i, k) 806 tvp(nn, k) = tvp1(i, k) 807 clw(nn, k) = clw1(i, k) 808 th(nn, k) = th1(i, k) 809 END IF 810 END DO 811 END DO 812 813 ! do 121 j=1,ntra 814 ! do 111 k=1,nd 815 ! nn=0 816 ! do 101 i=1,len 817 ! IF(iflag1(i).EQ.0)THEN 818 ! nn=nn+1 819 ! tra(nn,k,j)=tra1(i,k,j) 820 ! END IF 821 ! 101 continue 822 ! 111 continue 823 ! 121 continue 824 825 IF (nn/=ncum) THEN 826 WRITE (lunout, *) 'strange! nn not equal to ncum: ', nn, ncum 827 abort_message = '' 828 CALL abort_physic(modname, abort_message, 1) 418 829 END IF 419 END DO !convect3 420 421 DO i = 1, len !convect3 422 ticb(i) = t(i, icbs(i)) !convect3 423 gzicb(i) = gz(i, icbs(i)) !convect3 424 qsicb(i) = qs(i, icbs(i)) !convect3 425 END DO !convect3 426 427 428 ! Re-compute icbsmax (icbsmax2): !convect3 429 ! !convect3 430 icbsmax2 = 2 !convect3 431 DO i = 1, len !convect3 432 icbsmax2 = max(icbsmax2, icbs(i)) !convect3 433 END DO !convect3 434 435 ! initialization outputs: 436 437 DO k = 1, icbsmax2 ! convect3 438 DO i = 1, len ! convect3 439 tp(i, k) = 0.0 ! convect3 440 tvp(i, k) = 0.0 ! convect3 441 clw(i, k) = 0.0 ! convect3 442 END DO ! convect3 443 END DO ! convect3 444 445 ! tp and tvp below cloud base: 446 447 DO k = minorig, icbsmax2 - 1 448 DO i = 1, len 449 tp(i, k) = tnk(i) - (gz(i,k)-gznk(i))*cpinv(i) 450 tvp(i, k) = tp(i, k)*(1.+qnk(i)/eps-qnk(i)) !whole thing (convect3) 451 END DO 452 END DO 453 454 ! *** Find lifted parcel quantities above cloud base *** 455 456 DO i = 1, len 457 tg = ticb(i) 458 ! ori qg=qs(i,icb(i)) 459 qg = qsicb(i) ! convect3 460 ! debug alv=lv0-clmcpv*(ticb(i)-t0) 461 alv = lv0 - clmcpv*(ticb(i)-273.15) 462 463 ! First iteration. 464 465 ! ori s=cpd+alv*alv*qg/(rrv*ticb(i)*ticb(i)) 466 s = cpd*(1.-qnk(i)) + cl*qnk(i) & ! convect3 467 +alv*alv*qg/(rrv*ticb(i)*ticb(i)) ! convect3 468 s = 1./s 469 ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*ticb(i)+alv*qg+gzicb(i) 470 ahg = cpd*tg + (cl-cpd)*qnk(i)*tg + alv*qg + gzicb(i) ! convect3 471 tg = tg + s*(ah0(i)-ahg) 472 ! ori tg=max(tg,35.0) 473 ! debug tc=tg-t0 474 tc = tg - 273.15 475 denom = 243.5 + tc 476 denom = max(denom, 1.0) ! convect3 477 ! ori if(tc.ge.0.0)then 478 es = 6.112*exp(17.67*tc/denom) 479 ! ori else 480 ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) 481 ! ori endif 482 ! ori qg=eps*es/(p(i,icb(i))-es*(1.-eps)) 483 qg = eps*es/(p(i,icbs(i))-es*(1.-eps)) 484 485 ! Second iteration. 486 487 488 ! ori s=cpd+alv*alv*qg/(rrv*ticb(i)*ticb(i)) 489 ! ori s=1./s 490 ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*ticb(i)+alv*qg+gzicb(i) 491 ahg = cpd*tg + (cl-cpd)*qnk(i)*tg + alv*qg + gzicb(i) ! convect3 492 tg = tg + s*(ah0(i)-ahg) 493 ! ori tg=max(tg,35.0) 494 ! debug tc=tg-t0 495 tc = tg - 273.15 496 denom = 243.5 + tc 497 denom = max(denom, 1.0) ! convect3 498 ! ori if(tc.ge.0.0)then 499 es = 6.112*exp(17.67*tc/denom) 500 ! ori else 501 ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) 502 ! ori end if 503 ! ori qg=eps*es/(p(i,icb(i))-es*(1.-eps)) 504 qg = eps*es/(p(i,icbs(i))-es*(1.-eps)) 505 506 alv = lv0 - clmcpv*(ticb(i)-273.15) 507 508 ! ori c approximation here: 509 ! ori tp(i,icb(i))=(ah0(i)-(cl-cpd)*qnk(i)*ticb(i) 510 ! ori & -gz(i,icb(i))-alv*qg)/cpd 511 512 ! convect3: no approximation: 513 tp(i, icbs(i)) = (ah0(i)-gz(i,icbs(i))-alv*qg)/(cpd+(cl-cpd)*qnk(i)) 514 515 ! ori clw(i,icb(i))=qnk(i)-qg 516 ! ori clw(i,icb(i))=max(0.0,clw(i,icb(i))) 517 clw(i, icbs(i)) = qnk(i) - qg 518 clw(i, icbs(i)) = max(0.0, clw(i,icbs(i))) 519 520 rg = qg/(1.-qnk(i)) 521 ! ori tvp(i,icb(i))=tp(i,icb(i))*(1.+rg*epsi) 522 ! convect3: (qg utilise au lieu du vrai mixing ratio rg) 523 tvp(i, icbs(i)) = tp(i, icbs(i))*(1.+qg/eps-qnk(i)) !whole thing 524 525 END DO 526 527 ! ori do 380 k=minorig,icbsmax2 528 ! ori do 370 i=1,len 529 ! ori tvp(i,k)=tvp(i,k)-tp(i,k)*qnk(i) 530 ! ori 370 continue 531 ! ori 380 continue 532 533 534 ! -- The following is only for convect3: 535 536 ! * icbs is the first level above the LCL: 537 ! if plcl<p(icb), then icbs=icb+1 538 ! if plcl>p(icb), then icbs=icb 539 540 ! * the routine above computes tvp from minorig to icbs (included). 541 542 ! * to compute buoybase (in cv3_trigger.F), both tvp(icb) and tvp(icb+1) 543 ! must be known. This is the case if icbs=icb+1, but not if icbs=icb. 544 545 ! * therefore, in the case icbs=icb, we compute tvp at level icb+1 546 ! (tvp at other levels will be computed in cv3_undilute2.F) 547 548 549 DO i = 1, len 550 ticb(i) = t(i, icb(i)+1) 551 gzicb(i) = gz(i, icb(i)+1) 552 qsicb(i) = qs(i, icb(i)+1) 553 END DO 554 555 DO i = 1, len 556 tg = ticb(i) 557 qg = qsicb(i) ! convect3 558 ! debug alv=lv0-clmcpv*(ticb(i)-t0) 559 alv = lv0 - clmcpv*(ticb(i)-273.15) 560 561 ! First iteration. 562 563 ! ori s=cpd+alv*alv*qg/(rrv*ticb(i)*ticb(i)) 564 s = cpd*(1.-qnk(i)) + cl*qnk(i) & ! convect3 565 +alv*alv*qg/(rrv*ticb(i)*ticb(i)) ! convect3 566 s = 1./s 567 ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*ticb(i)+alv*qg+gzicb(i) 568 ahg = cpd*tg + (cl-cpd)*qnk(i)*tg + alv*qg + gzicb(i) ! convect3 569 tg = tg + s*(ah0(i)-ahg) 570 ! ori tg=max(tg,35.0) 571 ! debug tc=tg-t0 572 tc = tg - 273.15 573 denom = 243.5 + tc 574 denom = max(denom, 1.0) ! convect3 575 ! ori if(tc.ge.0.0)then 576 es = 6.112*exp(17.67*tc/denom) 577 ! ori else 578 ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) 579 ! ori endif 580 ! ori qg=eps*es/(p(i,icb(i))-es*(1.-eps)) 581 qg = eps*es/(p(i,icb(i)+1)-es*(1.-eps)) 582 583 ! Second iteration. 584 585 586 ! ori s=cpd+alv*alv*qg/(rrv*ticb(i)*ticb(i)) 587 ! ori s=1./s 588 ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*ticb(i)+alv*qg+gzicb(i) 589 ahg = cpd*tg + (cl-cpd)*qnk(i)*tg + alv*qg + gzicb(i) ! convect3 590 tg = tg + s*(ah0(i)-ahg) 591 ! ori tg=max(tg,35.0) 592 ! debug tc=tg-t0 593 tc = tg - 273.15 594 denom = 243.5 + tc 595 denom = max(denom, 1.0) ! convect3 596 ! ori if(tc.ge.0.0)then 597 es = 6.112*exp(17.67*tc/denom) 598 ! ori else 599 ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) 600 ! ori end if 601 ! ori qg=eps*es/(p(i,icb(i))-es*(1.-eps)) 602 qg = eps*es/(p(i,icb(i)+1)-es*(1.-eps)) 603 604 alv = lv0 - clmcpv*(ticb(i)-273.15) 605 606 ! ori c approximation here: 607 ! ori tp(i,icb(i))=(ah0(i)-(cl-cpd)*qnk(i)*ticb(i) 608 ! ori & -gz(i,icb(i))-alv*qg)/cpd 609 610 ! convect3: no approximation: 611 tp(i, icb(i)+1) = (ah0(i)-gz(i,icb(i)+1)-alv*qg)/(cpd+(cl-cpd)*qnk(i)) 612 613 ! ori clw(i,icb(i))=qnk(i)-qg 614 ! ori clw(i,icb(i))=max(0.0,clw(i,icb(i))) 615 clw(i, icb(i)+1) = qnk(i) - qg 616 clw(i, icb(i)+1) = max(0.0, clw(i,icb(i)+1)) 617 618 rg = qg/(1.-qnk(i)) 619 ! ori tvp(i,icb(i))=tp(i,icb(i))*(1.+rg*epsi) 620 ! convect3: (qg utilise au lieu du vrai mixing ratio rg) 621 tvp(i, icb(i)+1) = tp(i, icb(i)+1)*(1.+qg/eps-qnk(i)) !whole thing 622 623 END DO 624 625 RETURN 626 END SUBROUTINE cv30_undilute1 627 628 SUBROUTINE cv30_trigger(len, nd, icb, plcl, p, th, tv, tvp, pbase, buoybase, & 629 iflag, sig, w0) 630 IMPLICIT NONE 631 632 ! ------------------------------------------------------------------- 633 ! --- TRIGGERING 634 635 ! - computes the cloud base 636 ! - triggering (crude in this version) 637 ! - relaxation of sig and w0 when no convection 638 639 ! Caution1: if no convection, we set iflag=4 640 ! (it used to be 0 in convect3) 641 642 ! Caution2: at this stage, tvp (and thus buoy) are know up 643 ! through icb only! 644 ! -> the buoyancy below cloud base not (yet) set to the cloud base buoyancy 645 ! ------------------------------------------------------------------- 646 647 include "cv30param.h" 648 649 ! input: 650 INTEGER len, nd 651 INTEGER icb(len) 652 REAL plcl(len), p(len, nd) 653 REAL th(len, nd), tv(len, nd), tvp(len, nd) 654 655 ! output: 656 REAL pbase(len), buoybase(len) 657 658 ! input AND output: 659 INTEGER iflag(len) 660 REAL sig(len, nd), w0(len, nd) 661 662 ! local variables: 663 INTEGER i, k 664 REAL tvpbase, tvbase, tdif, ath, ath1 665 666 667 ! *** set cloud base buoyancy at (plcl+dpbase) level buoyancy 668 669 DO i = 1, len 670 pbase(i) = plcl(i) + dpbase 671 tvpbase = tvp(i, icb(i))*(pbase(i)-p(i,icb(i)+1))/ & 672 (p(i,icb(i))-p(i,icb(i)+1)) + tvp(i, icb(i)+1)*(p(i,icb(i))-pbase(i))/( & 673 p(i,icb(i))-p(i,icb(i)+1)) 674 tvbase = tv(i, icb(i))*(pbase(i)-p(i,icb(i)+1))/ & 675 (p(i,icb(i))-p(i,icb(i)+1)) + tv(i, icb(i)+1)*(p(i,icb(i))-pbase(i))/(p & 676 (i,icb(i))-p(i,icb(i)+1)) 677 buoybase(i) = tvpbase - tvbase 678 END DO 679 680 681 ! *** make sure that column is dry adiabatic between the surface *** 682 ! *** and cloud base, and that lifted air is positively buoyant *** 683 ! *** at cloud base *** 684 ! *** if not, return to calling program after resetting *** 685 ! *** sig(i) and w0(i) *** 686 687 688 ! oct3 do 200 i=1,len 689 ! oct3 690 ! oct3 tdif = buoybase(i) 691 ! oct3 ath1 = th(i,1) 692 ! oct3 ath = th(i,icb(i)-1) - dttrig 693 ! oct3 694 ! oct3 if (tdif.lt.dtcrit .or. ath.gt.ath1) then 695 ! oct3 do 60 k=1,nl 696 ! oct3 sig(i,k) = beta*sig(i,k) - 2.*alpha*tdif*tdif 697 ! oct3 sig(i,k) = AMAX1(sig(i,k),0.0) 698 ! oct3 w0(i,k) = beta*w0(i,k) 699 ! oct3 60 continue 700 ! oct3 iflag(i)=4 ! pour version vectorisee 701 ! oct3c convect3 iflag(i)=0 702 ! oct3cccc return 703 ! oct3 endif 704 ! oct3 705 ! oct3200 continue 706 707 ! -- oct3: on reecrit la boucle 200 (pour la vectorisation) 708 709 DO k = 1, nl 710 DO i = 1, len 711 712 tdif = buoybase(i) 713 ath1 = th(i, 1) 714 ath = th(i, icb(i)-1) - dttrig 715 716 IF (tdif<dtcrit .OR. ath>ath1) THEN 717 sig(i, k) = beta*sig(i, k) - 2.*alpha*tdif*tdif 718 sig(i, k) = amax1(sig(i,k), 0.0) 719 w0(i, k) = beta*w0(i, k) 720 iflag(i) = 4 ! pour version vectorisee 721 ! convect3 iflag(i)=0 722 END IF 723 724 END DO 725 END DO 726 727 ! fin oct3 -- 728 729 RETURN 730 END SUBROUTINE cv30_trigger 731 732 SUBROUTINE cv30_compress(len, nloc, ncum, nd, ntra, iflag1, nk1, icb1, icbs1, & 733 plcl1, tnk1, qnk1, gznk1, pbase1, buoybase1, t1, q1, qs1, u1, v1, gz1, & 734 th1, tra1, h1, lv1, cpn1, p1, ph1, tv1, tp1, tvp1, clw1, sig1, w01, & 735 iflag, nk, icb, icbs, plcl, tnk, qnk, gznk, pbase, buoybase, t, q, qs, u, & 736 v, gz, th, tra, h, lv, cpn, p, ph, tv, tp, tvp, clw, sig, w0) 737 USE print_control_mod, ONLY: lunout 738 IMPLICIT NONE 739 740 include "cv30param.h" 741 742 ! inputs: 743 INTEGER len, ncum, nd, ntra, nloc 744 INTEGER iflag1(len), nk1(len), icb1(len), icbs1(len) 745 REAL plcl1(len), tnk1(len), qnk1(len), gznk1(len) 746 REAL pbase1(len), buoybase1(len) 747 REAL t1(len, nd), q1(len, nd), qs1(len, nd), u1(len, nd), v1(len, nd) 748 REAL gz1(len, nd), h1(len, nd), lv1(len, nd), cpn1(len, nd) 749 REAL p1(len, nd), ph1(len, nd+1), tv1(len, nd), tp1(len, nd) 750 REAL tvp1(len, nd), clw1(len, nd) 751 REAL th1(len, nd) 752 REAL sig1(len, nd), w01(len, nd) 753 REAL tra1(len, nd, ntra) 754 755 ! outputs: 756 ! en fait, on a nloc=len pour l'instant (cf cv_driver) 757 INTEGER iflag(nloc), nk(nloc), icb(nloc), icbs(nloc) 758 REAL plcl(nloc), tnk(nloc), qnk(nloc), gznk(nloc) 759 REAL pbase(nloc), buoybase(nloc) 760 REAL t(nloc, nd), q(nloc, nd), qs(nloc, nd), u(nloc, nd), v(nloc, nd) 761 REAL gz(nloc, nd), h(nloc, nd), lv(nloc, nd), cpn(nloc, nd) 762 REAL p(nloc, nd), ph(nloc, nd+1), tv(nloc, nd), tp(nloc, nd) 763 REAL tvp(nloc, nd), clw(nloc, nd) 764 REAL th(nloc, nd) 765 REAL sig(nloc, nd), w0(nloc, nd) 766 REAL tra(nloc, nd, ntra) 767 768 ! local variables: 769 INTEGER i, k, nn, j 770 771 CHARACTER (LEN=20) :: modname = 'cv30_compress' 772 CHARACTER (LEN=80) :: abort_message 773 774 775 DO k = 1, nl + 1 830 776 831 nn = 0 777 832 DO i = 1, len 778 833 IF (iflag1(i)==0) THEN 779 834 nn = nn + 1 780 sig(nn, k) = sig1(i, k) 781 w0(nn, k) = w01(i, k) 782 t(nn, k) = t1(i, k) 783 q(nn, k) = q1(i, k) 784 qs(nn, k) = qs1(i, k) 785 u(nn, k) = u1(i, k) 786 v(nn, k) = v1(i, k) 787 gz(nn, k) = gz1(i, k) 788 h(nn, k) = h1(i, k) 789 lv(nn, k) = lv1(i, k) 790 cpn(nn, k) = cpn1(i, k) 791 p(nn, k) = p1(i, k) 792 ph(nn, k) = ph1(i, k) 793 tv(nn, k) = tv1(i, k) 794 tp(nn, k) = tp1(i, k) 795 tvp(nn, k) = tvp1(i, k) 796 clw(nn, k) = clw1(i, k) 797 th(nn, k) = th1(i, k) 835 pbase(nn) = pbase1(i) 836 buoybase(nn) = buoybase1(i) 837 plcl(nn) = plcl1(i) 838 tnk(nn) = tnk1(i) 839 qnk(nn) = qnk1(i) 840 gznk(nn) = gznk1(i) 841 nk(nn) = nk1(i) 842 icb(nn) = icb1(i) 843 icbs(nn) = icbs1(i) 844 iflag(nn) = iflag1(i) 798 845 END IF 799 846 END DO 800 END DO 801 802 ! do 121 j=1,ntra 803 ! do 111 k=1,nd 804 ! nn=0 805 ! do 101 i=1,len 806 ! if(iflag1(i).eq.0)then 807 ! nn=nn+1 808 ! tra(nn,k,j)=tra1(i,k,j) 809 ! endif 810 ! 101 continue 811 ! 111 continue 812 ! 121 continue 813 814 IF (nn/=ncum) THEN 815 WRITE (lunout, *) 'strange! nn not equal to ncum: ', nn, ncum 816 abort_message = '' 817 CALL abort_physic(modname, abort_message, 1) 818 END IF 819 820 nn = 0 821 DO i = 1, len 822 IF (iflag1(i)==0) THEN 823 nn = nn + 1 824 pbase(nn) = pbase1(i) 825 buoybase(nn) = buoybase1(i) 826 plcl(nn) = plcl1(i) 827 tnk(nn) = tnk1(i) 828 qnk(nn) = qnk1(i) 829 gznk(nn) = gznk1(i) 830 nk(nn) = nk1(i) 831 icb(nn) = icb1(i) 832 icbs(nn) = icbs1(i) 833 iflag(nn) = iflag1(i) 834 END IF 835 END DO 836 837 RETURN 838 END SUBROUTINE cv30_compress 839 840 SUBROUTINE cv30_undilute2(nloc, ncum, nd, icb, icbs, nk, tnk, qnk, gznk, t, & 841 q, qs, gz, p, h, tv, lv, pbase, buoybase, plcl, inb, tp, tvp, clw, hp, & 842 ep, sigp, buoy) 847 848 END SUBROUTINE cv30_compress 849 850 SUBROUTINE cv30_undilute2(nloc, ncum, nd, icb, icbs, nk, tnk, qnk, gznk, t, & 851 q, qs, gz, p, h, tv, lv, pbase, buoybase, plcl, inb, tp, tvp, clw, hp, & 852 ep, sigp, buoy) 843 853 ! epmax_cape: ajout arguments 844 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 845 , clmci, eps, epsi, epsim1, ginv, hrd, grav 846 IMPLICIT NONE 847 848 ! --------------------------------------------------------------------- 849 ! Purpose: 850 ! FIND THE REST OF THE LIFTED PARCEL TEMPERATURES 851 ! & 852 ! COMPUTE THE PRECIPITATION EFFICIENCIES AND THE 853 ! FRACTION OF PRECIPITATION FALLING OUTSIDE OF CLOUD 854 ! & 855 ! FIND THE LEVEL OF NEUTRAL BUOYANCY 856 857 ! Main differences convect3/convect4: 858 ! - icbs (input) is the first level above LCL (may differ from icb) 859 ! - many minor differences in the iterations 860 ! - condensed water not removed from tvp in convect3 861 ! - vertical profile of buoyancy computed here (use of buoybase) 862 ! - the determination of inb is different 863 ! - no inb1, only inb in output 864 ! --------------------------------------------------------------------- 865 866 include "cv30param.h" 867 include "conema3.h" 868 869 ! inputs: 870 INTEGER ncum, nd, nloc 871 INTEGER icb(nloc), icbs(nloc), nk(nloc) 872 REAL t(nloc, nd), q(nloc, nd), qs(nloc, nd), gz(nloc, nd) 873 REAL p(nloc, nd) 874 REAL tnk(nloc), qnk(nloc), gznk(nloc) 875 REAL lv(nloc, nd), tv(nloc, nd), h(nloc, nd) 876 REAL pbase(nloc), buoybase(nloc), plcl(nloc) 877 878 ! outputs: 879 INTEGER inb(nloc) 880 REAL tp(nloc, nd), tvp(nloc, nd), clw(nloc, nd) 881 REAL ep(nloc, nd), sigp(nloc, nd), hp(nloc, nd) 882 REAL buoy(nloc, nd) 883 884 ! local variables: 885 INTEGER i, k 886 REAL tg, qg, ahg, alv, s, tc, es, denom, rg, tca, elacrit 887 REAL by, defrac, pden 888 REAL ah0(nloc), cape(nloc), capem(nloc), byp(nloc) 889 LOGICAL lcape(nloc) 890 891 ! ===================================================================== 892 ! --- SOME INITIALIZATIONS 893 ! ===================================================================== 894 895 DO k = 1, nl 896 DO i = 1, ncum 897 ep(i, k) = 0.0 898 sigp(i, k) = spfac 899 END DO 900 END DO 901 902 ! ===================================================================== 903 ! --- FIND THE REST OF THE LIFTED PARCEL TEMPERATURES 904 ! ===================================================================== 905 906 ! --- The procedure is to solve the equation. 907 ! cp*tp+L*qp+phi=cp*tnk+L*qnk+gznk. 908 909 ! *** Calculate certain parcel quantities, including static energy *** 910 911 912 DO i = 1, ncum 913 ah0(i) = (cpd*(1.-qnk(i))+cl*qnk(i))*tnk(i) & ! debug & 914 ! +qnk(i)*(lv0-clmcpv*(tnk(i)-t0))+gznk(i) 915 +qnk(i)*(lv0-clmcpv*(tnk(i)-273.15)) + gznk(i) 916 END DO 917 918 919 ! *** Find lifted parcel quantities above cloud base *** 920 921 922 DO k = minorig + 1, nl 923 DO i = 1, ncum 924 ! ori if(k.ge.(icb(i)+1))then 925 IF (k>=(icbs(i)+1)) THEN ! convect3 926 tg = t(i, k) 927 qg = qs(i, k) 928 ! debug alv=lv0-clmcpv*(t(i,k)-t0) 929 alv = lv0 - clmcpv*(t(i,k)-273.15) 930 931 ! First iteration. 932 933 ! ori s=cpd+alv*alv*qg/(rrv*t(i,k)*t(i,k)) 934 s = cpd*(1.-qnk(i)) + cl*qnk(i) & ! convect3 935 +alv*alv*qg/(rrv*t(i,k)*t(i,k)) ! convect3 936 s = 1./s 937 ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*t(i,k)+alv*qg+gz(i,k) 938 ahg = cpd*tg + (cl-cpd)*qnk(i)*tg + alv*qg + gz(i, k) ! convect3 939 tg = tg + s*(ah0(i)-ahg) 940 ! ori tg=max(tg,35.0) 941 ! debug tc=tg-t0 942 tc = tg - 273.15 943 denom = 243.5 + tc 944 denom = max(denom, 1.0) ! convect3 945 ! ori if(tc.ge.0.0)then 946 es = 6.112*exp(17.67*tc/denom) 947 ! ori else 948 ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) 949 ! ori endif 950 qg = eps*es/(p(i,k)-es*(1.-eps)) 951 952 ! Second iteration. 953 954 ! ori s=cpd+alv*alv*qg/(rrv*t(i,k)*t(i,k)) 955 ! ori s=1./s 956 ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*t(i,k)+alv*qg+gz(i,k) 957 ahg = cpd*tg + (cl-cpd)*qnk(i)*tg + alv*qg + gz(i, k) ! convect3 958 tg = tg + s*(ah0(i)-ahg) 959 ! ori tg=max(tg,35.0) 960 ! debug tc=tg-t0 961 tc = tg - 273.15 962 denom = 243.5 + tc 963 denom = max(denom, 1.0) ! convect3 964 ! ori if(tc.ge.0.0)then 965 es = 6.112*exp(17.67*tc/denom) 966 ! ori else 967 ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) 968 ! ori endif 969 qg = eps*es/(p(i,k)-es*(1.-eps)) 970 971 ! debug alv=lv0-clmcpv*(t(i,k)-t0) 972 alv = lv0 - clmcpv*(t(i,k)-273.15) 973 ! print*,'cpd dans convect2 ',cpd 974 ! print*,'tp(i,k),ah0(i),cl,cpd,qnk(i),t(i,k),gz(i,k),alv,qg,cpd' 975 ! print*,tp(i,k),ah0(i),cl,cpd,qnk(i),t(i,k),gz(i,k),alv,qg,cpd 976 977 ! ori c approximation here: 978 ! ori 979 ! tp(i,k)=(ah0(i)-(cl-cpd)*qnk(i)*t(i,k)-gz(i,k)-alv*qg)/cpd 980 981 ! convect3: no approximation: 982 tp(i, k) = (ah0(i)-gz(i,k)-alv*qg)/(cpd+(cl-cpd)*qnk(i)) 983 984 clw(i, k) = qnk(i) - qg 985 clw(i, k) = max(0.0, clw(i,k)) 986 rg = qg/(1.-qnk(i)) 987 ! ori tvp(i,k)=tp(i,k)*(1.+rg*epsi) 988 ! convect3: (qg utilise au lieu du vrai mixing ratio rg): 989 tvp(i, k) = tp(i, k)*(1.+qg/eps-qnk(i)) ! whole thing 990 END IF 991 END DO 992 END DO 993 994 ! ===================================================================== 995 ! --- SET THE PRECIPITATION EFFICIENCIES AND THE FRACTION OF 996 ! --- PRECIPITATION FALLING OUTSIDE OF CLOUD 997 ! --- THESE MAY BE FUNCTIONS OF TP(I), P(I) AND CLW(I) 998 ! ===================================================================== 999 1000 ! ori do 320 k=minorig+1,nl 1001 DO k = 1, nl ! convect3 1002 DO i = 1, ncum 1003 pden = ptcrit - pbcrit 1004 ep(i, k) = (plcl(i)-p(i,k)-pbcrit)/pden*epmax 1005 ep(i, k) = amax1(ep(i,k), 0.0) 1006 ep(i, k) = amin1(ep(i,k), epmax) 1007 sigp(i, k) = spfac 1008 ! ori if(k.ge.(nk(i)+1))then 1009 ! ori tca=tp(i,k)-t0 1010 ! ori if(tca.ge.0.0)then 1011 ! ori elacrit=elcrit 1012 ! ori else 1013 ! ori elacrit=elcrit*(1.0-tca/tlcrit) 1014 ! ori endif 1015 ! ori elacrit=max(elacrit,0.0) 1016 ! ori ep(i,k)=1.0-elacrit/max(clw(i,k),1.0e-8) 1017 ! ori ep(i,k)=max(ep(i,k),0.0 ) 1018 ! ori ep(i,k)=min(ep(i,k),1.0 ) 1019 ! ori sigp(i,k)=sigs 1020 ! ori endif 1021 END DO 1022 END DO 1023 1024 ! ===================================================================== 1025 ! --- CALCULATE VIRTUAL TEMPERATURE AND LIFTED PARCEL 1026 ! --- VIRTUAL TEMPERATURE 1027 ! ===================================================================== 1028 1029 ! dans convect3, tvp est calcule en une seule fois, et sans retirer 1030 ! l'eau condensee (~> reversible CAPE) 1031 1032 ! ori do 340 k=minorig+1,nl 1033 ! ori do 330 i=1,ncum 1034 ! ori if(k.ge.(icb(i)+1))then 1035 ! ori tvp(i,k)=tvp(i,k)*(1.0-qnk(i)+ep(i,k)*clw(i,k)) 1036 ! oric print*,'i,k,tvp(i,k),qnk(i),ep(i,k),clw(i,k)' 1037 ! oric print*, i,k,tvp(i,k),qnk(i),ep(i,k),clw(i,k) 1038 ! ori endif 1039 ! ori 330 continue 1040 ! ori 340 continue 1041 1042 ! ori do 350 i=1,ncum 1043 ! ori tvp(i,nlp)=tvp(i,nl)-(gz(i,nlp)-gz(i,nl))/cpd 1044 ! ori 350 continue 1045 1046 DO i = 1, ncum ! convect3 1047 tp(i, nlp) = tp(i, nl) ! convect3 1048 END DO ! convect3 1049 1050 ! ===================================================================== 1051 ! --- EFFECTIVE VERTICAL PROFILE OF BUOYANCY (convect3 only): 1052 ! ===================================================================== 1053 1054 ! -- this is for convect3 only: 1055 1056 ! first estimate of buoyancy: 1057 1058 DO i = 1, ncum 1059 DO k = 1, nl 1060 buoy(i, k) = tvp(i, k) - tv(i, k) 1061 END DO 1062 END DO 1063 1064 ! set buoyancy=buoybase for all levels below base 1065 ! for safety, set buoy(icb)=buoybase 1066 1067 DO i = 1, ncum 1068 DO k = 1, nl 1069 IF ((k>=icb(i)) .AND. (k<=nl) .AND. (p(i,k)>=pbase(i))) THEN 1070 buoy(i, k) = buoybase(i) 1071 END IF 1072 END DO 1073 ! IM cf. CRio/JYG 270807 buoy(icb(i),k)=buoybase(i) 1074 buoy(i, icb(i)) = buoybase(i) 1075 END DO 1076 1077 ! -- end convect3 1078 1079 ! ===================================================================== 1080 ! --- FIND THE FIRST MODEL LEVEL (INB) ABOVE THE PARCEL'S 1081 ! --- LEVEL OF NEUTRAL BUOYANCY 1082 ! ===================================================================== 1083 1084 ! -- this is for convect3 only: 1085 1086 DO i = 1, ncum 1087 inb(i) = nl - 1 1088 END DO 1089 1090 DO i = 1, ncum 1091 DO k = 1, nl - 1 1092 IF ((k>=icb(i)) .AND. (buoy(i,k)<dtovsh)) THEN 1093 inb(i) = min(inb(i), k) 1094 END IF 1095 END DO 1096 END DO 1097 1098 ! -- end convect3 1099 1100 ! ori do 510 i=1,ncum 1101 ! ori cape(i)=0.0 1102 ! ori capem(i)=0.0 1103 ! ori inb(i)=icb(i)+1 1104 ! ori inb1(i)=inb(i) 1105 ! ori 510 continue 1106 1107 ! Originial Code 1108 1109 ! do 530 k=minorig+1,nl-1 1110 ! do 520 i=1,ncum 1111 ! if(k.ge.(icb(i)+1))then 1112 ! by=(tvp(i,k)-tv(i,k))*dph(i,k)/p(i,k) 1113 ! byp=(tvp(i,k+1)-tv(i,k+1))*dph(i,k+1)/p(i,k+1) 1114 ! cape(i)=cape(i)+by 1115 ! if(by.ge.0.0)inb1(i)=k+1 1116 ! if(cape(i).gt.0.0)then 1117 ! inb(i)=k+1 1118 ! capem(i)=cape(i) 1119 ! endif 1120 ! endif 1121 ! 520 continue 1122 ! 530 continue 1123 ! do 540 i=1,ncum 1124 ! byp=(tvp(i,nl)-tv(i,nl))*dph(i,nl)/p(i,nl) 1125 ! cape(i)=capem(i)+byp 1126 ! defrac=capem(i)-cape(i) 1127 ! defrac=max(defrac,0.001) 1128 ! frac(i)=-cape(i)/defrac 1129 ! frac(i)=min(frac(i),1.0) 1130 ! frac(i)=max(frac(i),0.0) 1131 ! 540 continue 1132 1133 ! K Emanuel fix 1134 1135 ! call zilch(byp,ncum) 1136 ! do 530 k=minorig+1,nl-1 1137 ! do 520 i=1,ncum 1138 ! if(k.ge.(icb(i)+1))then 1139 ! by=(tvp(i,k)-tv(i,k))*dph(i,k)/p(i,k) 1140 ! cape(i)=cape(i)+by 1141 ! if(by.ge.0.0)inb1(i)=k+1 1142 ! if(cape(i).gt.0.0)then 1143 ! inb(i)=k+1 1144 ! capem(i)=cape(i) 1145 ! byp(i)=(tvp(i,k+1)-tv(i,k+1))*dph(i,k+1)/p(i,k+1) 1146 ! endif 1147 ! endif 1148 ! 520 continue 1149 ! 530 continue 1150 ! do 540 i=1,ncum 1151 ! inb(i)=max(inb(i),inb1(i)) 1152 ! cape(i)=capem(i)+byp(i) 1153 ! defrac=capem(i)-cape(i) 1154 ! defrac=max(defrac,0.001) 1155 ! frac(i)=-cape(i)/defrac 1156 ! frac(i)=min(frac(i),1.0) 1157 ! frac(i)=max(frac(i),0.0) 1158 ! 540 continue 1159 1160 ! J Teixeira fix 1161 1162 ! ori call zilch(byp,ncum) 1163 ! ori do 515 i=1,ncum 1164 ! ori lcape(i)=.true. 1165 ! ori 515 continue 1166 ! ori do 530 k=minorig+1,nl-1 1167 ! ori do 520 i=1,ncum 1168 ! ori if(cape(i).lt.0.0)lcape(i)=.false. 1169 ! ori if((k.ge.(icb(i)+1)).and.lcape(i))then 1170 ! ori by=(tvp(i,k)-tv(i,k))*dph(i,k)/p(i,k) 1171 ! ori byp(i)=(tvp(i,k+1)-tv(i,k+1))*dph(i,k+1)/p(i,k+1) 1172 ! ori cape(i)=cape(i)+by 1173 ! ori if(by.ge.0.0)inb1(i)=k+1 1174 ! ori if(cape(i).gt.0.0)then 1175 ! ori inb(i)=k+1 1176 ! ori capem(i)=cape(i) 1177 ! ori endif 1178 ! ori endif 1179 ! ori 520 continue 1180 ! ori 530 continue 1181 ! ori do 540 i=1,ncum 1182 ! ori cape(i)=capem(i)+byp(i) 1183 ! ori defrac=capem(i)-cape(i) 1184 ! ori defrac=max(defrac,0.001) 1185 ! ori frac(i)=-cape(i)/defrac 1186 ! ori frac(i)=min(frac(i),1.0) 1187 ! ori frac(i)=max(frac(i),0.0) 1188 ! ori 540 continue 1189 1190 ! ===================================================================== 1191 ! --- CALCULATE LIQUID WATER STATIC ENERGY OF LIFTED PARCEL 1192 ! ===================================================================== 1193 1194 ! ym do i=1,ncum*nlp 1195 ! ym hp(i,1)=h(i,1) 1196 ! ym enddo 1197 1198 DO k = 1, nlp 1199 DO i = 1, ncum 1200 hp(i, k) = h(i, k) 1201 END DO 1202 END DO 1203 1204 DO k = minorig + 1, nl 1205 DO i = 1, ncum 1206 IF ((k>=icb(i)) .AND. (k<=inb(i))) THEN 1207 hp(i, k) = h(i, nk(i)) + (lv(i,k)+(cpd-cpv)*t(i,k))*ep(i, k)*clw(i, k & 1208 ) 1209 END IF 1210 END DO 1211 END DO 1212 1213 RETURN 1214 END SUBROUTINE cv30_undilute2 1215 1216 SUBROUTINE cv30_closure(nloc, ncum, nd, icb, inb, pbase, p, ph, tv, buoy, & 1217 sig, w0, cape, m) 1218 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 1219 , clmci, eps, epsi, epsim1, ginv, hrd, grav 1220 IMPLICIT NONE 1221 1222 ! =================================================================== 1223 ! --- CLOSURE OF CONVECT3 1224 1225 ! vectorization: S. Bony 1226 ! =================================================================== 1227 1228 include "cv30param.h" 1229 1230 ! input: 1231 INTEGER ncum, nd, nloc 1232 INTEGER icb(nloc), inb(nloc) 1233 REAL pbase(nloc) 1234 REAL p(nloc, nd), ph(nloc, nd+1) 1235 REAL tv(nloc, nd), buoy(nloc, nd) 1236 1237 ! input/output: 1238 REAL sig(nloc, nd), w0(nloc, nd) 1239 1240 ! output: 1241 REAL cape(nloc) 1242 REAL m(nloc, nd) 1243 1244 ! local variables: 1245 INTEGER i, j, k, icbmax 1246 REAL deltap, fac, w, amu 1247 REAL dtmin(nloc, nd), sigold(nloc, nd) 1248 1249 ! ------------------------------------------------------- 1250 ! -- Initialization 1251 ! ------------------------------------------------------- 1252 1253 DO k = 1, nl 1254 DO i = 1, ncum 1255 m(i, k) = 0.0 1256 END DO 1257 END DO 1258 1259 ! ------------------------------------------------------- 1260 ! -- Reset sig(i) and w0(i) for i>inb and i<icb 1261 ! ------------------------------------------------------- 1262 1263 ! update sig and w0 above LNB: 1264 1265 DO k = 1, nl - 1 1266 DO i = 1, ncum 1267 IF ((inb(i)<(nl-1)) .AND. (k>=(inb(i)+1))) THEN 1268 sig(i, k) = beta*sig(i, k) + 2.*alpha*buoy(i, inb(i))*abs(buoy(i,inb( & 1269 i))) 1270 sig(i, k) = amax1(sig(i,k), 0.0) 1271 w0(i, k) = beta*w0(i, k) 1272 END IF 1273 END DO 1274 END DO 1275 1276 ! compute icbmax: 1277 1278 icbmax = 2 1279 DO i = 1, ncum 1280 icbmax = max(icbmax, icb(i)) 1281 END DO 1282 1283 ! update sig and w0 below cloud base: 1284 1285 DO k = 1, icbmax 1286 DO i = 1, ncum 1287 IF (k<=icb(i)) THEN 1288 sig(i, k) = beta*sig(i, k) - 2.*alpha*buoy(i, icb(i))*buoy(i, icb(i)) 1289 sig(i, k) = amax1(sig(i,k), 0.0) 1290 w0(i, k) = beta*w0(i, k) 1291 END IF 1292 END DO 1293 END DO 1294 1295 ! ! if(inb.lt.(nl-1))then 1296 ! ! do 85 i=inb+1,nl-1 1297 ! ! sig(i)=beta*sig(i)+2.*alpha*buoy(inb)* 1298 ! ! 1 abs(buoy(inb)) 1299 ! ! sig(i)=amax1(sig(i),0.0) 1300 ! ! w0(i)=beta*w0(i) 1301 ! ! 85 continue 1302 ! ! end if 1303 1304 ! ! do 87 i=1,icb 1305 ! ! sig(i)=beta*sig(i)-2.*alpha*buoy(icb)*buoy(icb) 1306 ! ! sig(i)=amax1(sig(i),0.0) 1307 ! ! w0(i)=beta*w0(i) 1308 ! ! 87 continue 1309 1310 ! ------------------------------------------------------------- 1311 ! -- Reset fractional areas of updrafts and w0 at initial time 1312 ! -- and after 10 time steps of no convection 1313 ! ------------------------------------------------------------- 1314 1315 DO k = 1, nl - 1 1316 DO i = 1, ncum 1317 IF (sig(i,nd)<1.5 .OR. sig(i,nd)>12.0) THEN 1318 sig(i, k) = 0.0 1319 w0(i, k) = 0.0 1320 END IF 1321 END DO 1322 END DO 1323 1324 ! ------------------------------------------------------------- 1325 ! -- Calculate convective available potential energy (cape), 1326 ! -- vertical velocity (w), fractional area covered by 1327 ! -- undilute updraft (sig), and updraft mass flux (m) 1328 ! ------------------------------------------------------------- 1329 1330 DO i = 1, ncum 1331 cape(i) = 0.0 1332 END DO 1333 1334 ! compute dtmin (minimum buoyancy between ICB and given level k): 1335 1336 DO i = 1, ncum 1337 DO k = 1, nl 1338 dtmin(i, k) = 100.0 1339 END DO 1340 END DO 1341 1342 DO i = 1, ncum 1343 DO k = 1, nl 1344 DO j = minorig, nl 1345 IF ((k>=(icb(i)+1)) .AND. (k<=inb(i)) .AND. (j>=icb(i)) .AND. (j<=(k- & 1346 1))) THEN 1347 dtmin(i, k) = amin1(dtmin(i,k), buoy(i,j)) 1348 END IF 1349 END DO 1350 END DO 1351 END DO 1352 1353 ! the interval on which cape is computed starts at pbase : 1354 DO k = 1, nl 1355 DO i = 1, ncum 1356 1357 IF ((k>=(icb(i)+1)) .AND. (k<=inb(i))) THEN 1358 1359 deltap = min(pbase(i), ph(i,k-1)) - min(pbase(i), ph(i,k)) 1360 cape(i) = cape(i) + rrd*buoy(i, k-1)*deltap/p(i, k-1) 1361 cape(i) = amax1(0.0, cape(i)) 1362 sigold(i, k) = sig(i, k) 1363 1364 ! dtmin(i,k)=100.0 1365 ! do 97 j=icb(i),k-1 ! mauvaise vectorisation 1366 ! dtmin(i,k)=AMIN1(dtmin(i,k),buoy(i,j)) 1367 ! 97 continue 1368 1369 sig(i, k) = beta*sig(i, k) + alpha*dtmin(i, k)*abs(dtmin(i,k)) 1370 sig(i, k) = amax1(sig(i,k), 0.0) 1371 sig(i, k) = amin1(sig(i,k), 0.01) 1372 fac = amin1(((dtcrit-dtmin(i,k))/dtcrit), 1.0) 1373 w = (1.-beta)*fac*sqrt(cape(i)) + beta*w0(i, k) 1374 amu = 0.5*(sig(i,k)+sigold(i,k))*w 1375 m(i, k) = amu*0.007*p(i, k)*(ph(i,k)-ph(i,k+1))/tv(i, k) 1376 w0(i, k) = w 1377 END IF 1378 1379 END DO 1380 END DO 1381 1382 DO i = 1, ncum 1383 w0(i, icb(i)) = 0.5*w0(i, icb(i)+1) 1384 m(i, icb(i)) = 0.5*m(i, icb(i)+1)*(ph(i,icb(i))-ph(i,icb(i)+1))/ & 1385 (ph(i,icb(i)+1)-ph(i,icb(i)+2)) 1386 sig(i, icb(i)) = sig(i, icb(i)+1) 1387 sig(i, icb(i)-1) = sig(i, icb(i)) 1388 END DO 1389 1390 1391 ! ! cape=0.0 1392 ! ! do 98 i=icb+1,inb 1393 ! ! deltap = min(pbase,ph(i-1))-min(pbase,ph(i)) 1394 ! ! cape=cape+rrd*buoy(i-1)*deltap/p(i-1) 1395 ! ! dcape=rrd*buoy(i-1)*deltap/p(i-1) 1396 ! ! dlnp=deltap/p(i-1) 1397 ! ! cape=amax1(0.0,cape) 1398 ! ! sigold=sig(i) 1399 1400 ! ! dtmin=100.0 1401 ! ! do 97 j=icb,i-1 1402 ! ! dtmin=amin1(dtmin,buoy(j)) 1403 ! ! 97 continue 1404 1405 ! ! sig(i)=beta*sig(i)+alpha*dtmin*abs(dtmin) 1406 ! ! sig(i)=amax1(sig(i),0.0) 1407 ! ! sig(i)=amin1(sig(i),0.01) 1408 ! ! fac=amin1(((dtcrit-dtmin)/dtcrit),1.0) 1409 ! ! w=(1.-beta)*fac*sqrt(cape)+beta*w0(i) 1410 ! ! amu=0.5*(sig(i)+sigold)*w 1411 ! ! m(i)=amu*0.007*p(i)*(ph(i)-ph(i+1))/tv(i) 1412 ! ! w0(i)=w 1413 ! ! 98 continue 1414 ! ! w0(icb)=0.5*w0(icb+1) 1415 ! ! m(icb)=0.5*m(icb+1)*(ph(icb)-ph(icb+1))/(ph(icb+1)-ph(icb+2)) 1416 ! ! sig(icb)=sig(icb+1) 1417 ! ! sig(icb-1)=sig(icb) 1418 1419 RETURN 1420 END SUBROUTINE cv30_closure 1421 1422 SUBROUTINE cv30_mixing(nloc, ncum, nd, na, ntra, icb, nk, inb, ph, t, rr, rs, & 1423 u, v, tra, h, lv, qnk, hp, tv, tvp, ep, clw, m, sig, ment, qent, uent, & 1424 vent, sij, elij, ments, qents, traent) 1425 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 1426 , clmci, eps, epsi, epsim1, ginv, hrd, grav 1427 IMPLICIT NONE 1428 1429 ! --------------------------------------------------------------------- 1430 ! a faire: 1431 ! - changer rr(il,1) -> qnk(il) 1432 ! - vectorisation de la partie normalisation des flux (do 789...) 1433 ! --------------------------------------------------------------------- 1434 1435 include "cv30param.h" 1436 1437 ! inputs: 1438 INTEGER ncum, nd, na, ntra, nloc 1439 INTEGER icb(nloc), inb(nloc), nk(nloc) 1440 REAL sig(nloc, nd) 1441 REAL qnk(nloc) 1442 REAL ph(nloc, nd+1) 1443 REAL t(nloc, nd), rr(nloc, nd), rs(nloc, nd) 1444 REAL u(nloc, nd), v(nloc, nd) 1445 REAL tra(nloc, nd, ntra) ! input of convect3 1446 REAL lv(nloc, na), h(nloc, na), hp(nloc, na) 1447 REAL tv(nloc, na), tvp(nloc, na), ep(nloc, na), clw(nloc, na) 1448 REAL m(nloc, na) ! input of convect3 1449 1450 ! outputs: 1451 REAL ment(nloc, na, na), qent(nloc, na, na) 1452 REAL uent(nloc, na, na), vent(nloc, na, na) 1453 REAL sij(nloc, na, na), elij(nloc, na, na) 1454 REAL traent(nloc, nd, nd, ntra) 1455 REAL ments(nloc, nd, nd), qents(nloc, nd, nd) 1456 REAL sigij(nloc, nd, nd) 1457 1458 ! local variables: 1459 INTEGER i, j, k, il, im, jm 1460 INTEGER num1, num2 1461 INTEGER nent(nloc, na) 1462 REAL rti, bf2, anum, denom, dei, altem, cwat, stemp, qp 1463 REAL alt, smid, sjmin, sjmax, delp, delm 1464 REAL asij(nloc), smax(nloc), scrit(nloc) 1465 REAL asum(nloc, nd), bsum(nloc, nd), csum(nloc, nd) 1466 REAL wgh 1467 REAL zm(nloc, na) 1468 LOGICAL lwork(nloc) 1469 1470 ! ===================================================================== 1471 ! --- INITIALIZE VARIOUS ARRAYS USED IN THE COMPUTATIONS 1472 ! ===================================================================== 1473 1474 ! ori do 360 i=1,ncum*nlp 1475 DO j = 1, nl 1476 DO i = 1, ncum 1477 nent(i, j) = 0 1478 ! in convect3, m is computed in cv3_closure 1479 ! ori m(i,1)=0.0 1480 END DO 1481 END DO 1482 1483 ! ori do 400 k=1,nlp 1484 ! ori do 390 j=1,nlp 1485 DO j = 1, nl 854 USE conema3_mod_h 855 USE cvthermo_mod_h 856 857 IMPLICIT NONE 858 859 ! --------------------------------------------------------------------- 860 ! Purpose: 861 ! FIND THE REST OF THE LIFTED PARCEL TEMPERATURES 862 ! & 863 ! COMPUTE THE PRECIPITATION EFFICIENCIES AND THE 864 ! FRACTION OF PRECIPITATION FALLING OUTSIDE OF CLOUD 865 ! & 866 ! FIND THE LEVEL OF NEUTRAL BUOYANCY 867 868 ! Main differences convect3/convect4: 869 ! - icbs (input) is the first level above LCL (may differ from icb) 870 ! - many minor differences in the iterations 871 ! - condensed water not removed from tvp in convect3 872 ! - vertical profile of buoyancy computed here (use of buoybase) 873 ! - the determination of inb is different 874 ! - no inb1, ONLY inb in output 875 ! --------------------------------------------------------------------- 876 877 878 879 ! inputs: 880 INTEGER ncum, nd, nloc 881 INTEGER icb(nloc), icbs(nloc), nk(nloc) 882 REAL t(nloc, nd), q(nloc, nd), qs(nloc, nd), gz(nloc, nd) 883 REAL p(nloc, nd) 884 REAL tnk(nloc), qnk(nloc), gznk(nloc) 885 REAL lv(nloc, nd), tv(nloc, nd), h(nloc, nd) 886 REAL pbase(nloc), buoybase(nloc), plcl(nloc) 887 888 ! outputs: 889 INTEGER inb(nloc) 890 REAL tp(nloc, nd), tvp(nloc, nd), clw(nloc, nd) 891 REAL ep(nloc, nd), sigp(nloc, nd), hp(nloc, nd) 892 REAL buoy(nloc, nd) 893 894 ! local variables: 895 INTEGER i, k 896 REAL tg, qg, ahg, alv, s, tc, es, denom, rg, tca, elacrit 897 REAL by, defrac, pden 898 REAL ah0(nloc), cape(nloc), capem(nloc), byp(nloc) 899 LOGICAL lcape(nloc) 900 901 ! ===================================================================== 902 ! --- SOME INITIALIZATIONS 903 ! ===================================================================== 904 1486 905 DO k = 1, nl 1487 906 DO i = 1, ncum 1488 qent(i, k, j) = rr(i, j) 1489 uent(i, k, j) = u(i, j) 1490 vent(i, k, j) = v(i, j) 1491 elij(i, k, j) = 0.0 1492 ! ym ment(i,k,j)=0.0 1493 ! ym sij(i,k,j)=0.0 1494 END DO 1495 END DO 1496 END DO 1497 1498 ! ym 1499 ment(1:ncum, 1:nd, 1:nd) = 0.0 1500 sij(1:ncum, 1:nd, 1:nd) = 0.0 1501 1502 ! do k=1,ntra 1503 ! do j=1,nd ! instead nlp 1504 ! do i=1,nd ! instead nlp 1505 ! do il=1,ncum 1506 ! traent(il,i,j,k)=tra(il,j,k) 1507 ! enddo 1508 ! enddo 1509 ! enddo 1510 ! enddo 1511 zm(:, :) = 0. 1512 1513 ! ===================================================================== 1514 ! --- CALCULATE ENTRAINED AIR MASS FLUX (ment), TOTAL WATER MIXING 1515 ! --- RATIO (QENT), TOTAL CONDENSED WATER (elij), AND MIXING 1516 ! --- FRACTION (sij) 1517 ! ===================================================================== 1518 1519 DO i = minorig + 1, nl 1520 1521 DO j = minorig, nl 1522 DO il = 1, ncum 1523 IF ((i>=icb(il)) .AND. (i<=inb(il)) .AND. (j>=(icb(il)- & 1524 1)) .AND. (j<=inb(il))) THEN 1525 1526 rti = rr(il, 1) - ep(il, i)*clw(il, i) 1527 bf2 = 1. + lv(il, j)*lv(il, j)*rs(il, j)/(rrv*t(il,j)*t(il,j)*cpd) 1528 anum = h(il, j) - hp(il, i) + (cpv-cpd)*t(il, j)*(rti-rr(il,j)) 1529 denom = h(il, i) - hp(il, i) + (cpd-cpv)*(rr(il,i)-rti)*t(il, j) 1530 dei = denom 1531 IF (abs(dei)<0.01) dei = 0.01 1532 sij(il, i, j) = anum/dei 1533 sij(il, i, i) = 1.0 1534 altem = sij(il, i, j)*rr(il, i) + (1.-sij(il,i,j))*rti - rs(il, j) 1535 altem = altem/bf2 1536 cwat = clw(il, j)*(1.-ep(il,j)) 1537 stemp = sij(il, i, j) 1538 IF ((stemp<0.0 .OR. stemp>1.0 .OR. altem>cwat) .AND. j>i) THEN 1539 anum = anum - lv(il, j)*(rti-rs(il,j)-cwat*bf2) 1540 denom = denom + lv(il, j)*(rr(il,i)-rti) 1541 IF (abs(denom)<0.01) denom = 0.01 1542 sij(il, i, j) = anum/denom 1543 altem = sij(il, i, j)*rr(il, i) + (1.-sij(il,i,j))*rti - & 1544 rs(il, j) 1545 altem = altem - (bf2-1.)*cwat 907 ep(i, k) = 0.0 908 sigp(i, k) = spfac 909 END DO 910 END DO 911 912 ! ===================================================================== 913 ! --- FIND THE REST OF THE LIFTED PARCEL TEMPERATURES 914 ! ===================================================================== 915 916 ! --- The procedure is to solve the equation. 917 ! cp*tp+L*qp+phi=cp*tnk+L*qnk+gznk. 918 919 ! *** Calculate certain parcel quantities, including static energy *** 920 921 DO i = 1, ncum 922 ah0(i) = (cpd * (1. - qnk(i)) + cl * qnk(i)) * tnk(i) & ! debug & 923 ! +qnk(i)*(lv0-clmcpv*(tnk(i)-t0))+gznk(i) 924 + qnk(i) * (lv0 - clmcpv * (tnk(i) - 273.15)) + gznk(i) 925 END DO 926 927 928 ! *** Find lifted parcel quantities above cloud base *** 929 930 DO k = minorig + 1, nl 931 DO i = 1, ncum 932 ! ori IF(k.ge.(icb(i)+1))THEN 933 IF (k>=(icbs(i) + 1)) THEN ! convect3 934 tg = t(i, k) 935 qg = qs(i, k) 936 ! debug alv=lv0-clmcpv*(t(i,k)-t0) 937 alv = lv0 - clmcpv * (t(i, k) - 273.15) 938 939 ! First iteration. 940 941 ! ori s=cpd+alv*alv*qg/(rrv*t(i,k)*t(i,k)) 942 s = cpd * (1. - qnk(i)) + cl * qnk(i) & ! convect3 943 + alv * alv * qg / (rrv * t(i, k) * t(i, k)) ! convect3 944 s = 1. / s 945 ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*t(i,k)+alv*qg+gz(i,k) 946 ahg = cpd * tg + (cl - cpd) * qnk(i) * tg + alv * qg + gz(i, k) ! convect3 947 tg = tg + s * (ah0(i) - ahg) 948 ! ori tg=max(tg,35.0) 949 ! debug tc=tg-t0 950 tc = tg - 273.15 951 denom = 243.5 + tc 952 denom = max(denom, 1.0) ! convect3 953 ! ori IF(tc.ge.0.0)THEN 954 es = 6.112 * exp(17.67 * tc / denom) 955 ! ori else 956 ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) 957 ! ori endif 958 qg = eps * es / (p(i, k) - es * (1. - eps)) 959 960 ! Second iteration. 961 962 ! ori s=cpd+alv*alv*qg/(rrv*t(i,k)*t(i,k)) 963 ! ori s=1./s 964 ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*t(i,k)+alv*qg+gz(i,k) 965 ahg = cpd * tg + (cl - cpd) * qnk(i) * tg + alv * qg + gz(i, k) ! convect3 966 tg = tg + s * (ah0(i) - ahg) 967 ! ori tg=max(tg,35.0) 968 ! debug tc=tg-t0 969 tc = tg - 273.15 970 denom = 243.5 + tc 971 denom = max(denom, 1.0) ! convect3 972 ! ori IF(tc.ge.0.0)THEN 973 es = 6.112 * exp(17.67 * tc / denom) 974 ! ori else 975 ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) 976 ! ori endif 977 qg = eps * es / (p(i, k) - es * (1. - eps)) 978 979 ! debug alv=lv0-clmcpv*(t(i,k)-t0) 980 alv = lv0 - clmcpv * (t(i, k) - 273.15) 981 ! PRINT*,'cpd dans convect2 ',cpd 982 ! PRINT*,'tp(i,k),ah0(i),cl,cpd,qnk(i),t(i,k),gz(i,k),alv,qg,cpd' 983 ! PRINT*,tp(i,k),ah0(i),cl,cpd,qnk(i),t(i,k),gz(i,k),alv,qg,cpd 984 985 ! ori c approximation here: 986 ! ori 987 ! tp(i,k)=(ah0(i)-(cl-cpd)*qnk(i)*t(i,k)-gz(i,k)-alv*qg)/cpd 988 989 ! convect3: no approximation: 990 tp(i, k) = (ah0(i) - gz(i, k) - alv * qg) / (cpd + (cl - cpd) * qnk(i)) 991 992 clw(i, k) = qnk(i) - qg 993 clw(i, k) = max(0.0, clw(i, k)) 994 rg = qg / (1. - qnk(i)) 995 ! ori tvp(i,k)=tp(i,k)*(1.+rg*epsi) 996 ! convect3: (qg utilise au lieu du vrai mixing ratio rg): 997 tvp(i, k) = tp(i, k) * (1. + qg / eps - qnk(i)) ! whole thing 998 END IF 999 END DO 1000 END DO 1001 1002 ! ===================================================================== 1003 ! --- SET THE PRECIPITATION EFFICIENCIES AND THE FRACTION OF 1004 ! --- PRECIPITATION FALLING OUTSIDE OF CLOUD 1005 ! --- THESE MAY BE FUNCTIONS OF TP(I), P(I) AND CLW(I) 1006 ! ===================================================================== 1007 1008 ! ori do 320 k=minorig+1,nl 1009 DO k = 1, nl ! convect3 1010 DO i = 1, ncum 1011 pden = ptcrit - pbcrit 1012 ep(i, k) = (plcl(i) - p(i, k) - pbcrit) / pden * epmax 1013 ep(i, k) = amax1(ep(i, k), 0.0) 1014 ep(i, k) = amin1(ep(i, k), epmax) 1015 sigp(i, k) = spfac 1016 ! ori IF(k.ge.(nk(i)+1))THEN 1017 ! ori tca=tp(i,k)-t0 1018 ! ori IF(tca.ge.0.0)THEN 1019 ! ori elacrit=elcrit 1020 ! ori else 1021 ! ori elacrit=elcrit*(1.0-tca/tlcrit) 1022 ! ori endif 1023 ! ori elacrit=max(elacrit,0.0) 1024 ! ori ep(i,k)=1.0-elacrit/max(clw(i,k),1.0e-8) 1025 ! ori ep(i,k)=max(ep(i,k),0.0 ) 1026 ! ori ep(i,k)=min(ep(i,k),1.0 ) 1027 ! ori sigp(i,k)=sigs 1028 ! ori endif 1029 END DO 1030 END DO 1031 1032 ! ===================================================================== 1033 ! --- CALCULATE VIRTUAL TEMPERATURE AND LIFTED PARCEL 1034 ! --- VIRTUAL TEMPERATURE 1035 ! ===================================================================== 1036 1037 ! dans convect3, tvp est calcule en une seule fois, et sans retirer 1038 ! l'eau condensee (~> reversible CAPE) 1039 1040 ! ori do 340 k=minorig+1,nl 1041 ! ori do 330 i=1,ncum 1042 ! ori IF(k.ge.(icb(i)+1))THEN 1043 ! ori tvp(i,k)=tvp(i,k)*(1.0-qnk(i)+ep(i,k)*clw(i,k)) 1044 ! oric PRINT*,'i,k,tvp(i,k),qnk(i),ep(i,k),clw(i,k)' 1045 ! oric PRINT*, i,k,tvp(i,k),qnk(i),ep(i,k),clw(i,k) 1046 ! ori endif 1047 ! ori 330 continue 1048 ! ori 340 continue 1049 1050 ! ori do 350 i=1,ncum 1051 ! ori tvp(i,nlp)=tvp(i,nl)-(gz(i,nlp)-gz(i,nl))/cpd 1052 ! ori 350 continue 1053 1054 DO i = 1, ncum ! convect3 1055 tp(i, nlp) = tp(i, nl) ! convect3 1056 END DO ! convect3 1057 1058 ! ===================================================================== 1059 ! --- EFFECTIVE VERTICAL PROFILE OF BUOYANCY (convect3 only): 1060 ! ===================================================================== 1061 1062 ! -- this is for convect3 only: 1063 1064 ! first estimate of buoyancy: 1065 1066 DO i = 1, ncum 1067 DO k = 1, nl 1068 buoy(i, k) = tvp(i, k) - tv(i, k) 1069 END DO 1070 END DO 1071 1072 ! set buoyancy=buoybase for all levels below base 1073 ! for safety, set buoy(icb)=buoybase 1074 1075 DO i = 1, ncum 1076 DO k = 1, nl 1077 IF ((k>=icb(i)) .AND. (k<=nl) .AND. (p(i, k)>=pbase(i))) THEN 1078 buoy(i, k) = buoybase(i) 1079 END IF 1080 END DO 1081 ! IM cf. CRio/JYG 270807 buoy(icb(i),k)=buoybase(i) 1082 buoy(i, icb(i)) = buoybase(i) 1083 END DO 1084 1085 ! -- end convect3 1086 1087 ! ===================================================================== 1088 ! --- FIND THE FIRST MODEL LEVEL (INB) ABOVE THE PARCEL'S 1089 ! --- LEVEL OF NEUTRAL BUOYANCY 1090 ! ===================================================================== 1091 1092 ! -- this is for convect3 only: 1093 1094 DO i = 1, ncum 1095 inb(i) = nl - 1 1096 END DO 1097 1098 DO i = 1, ncum 1099 DO k = 1, nl - 1 1100 IF ((k>=icb(i)) .AND. (buoy(i, k)<dtovsh)) THEN 1101 inb(i) = min(inb(i), k) 1102 END IF 1103 END DO 1104 END DO 1105 1106 ! -- end convect3 1107 1108 ! ori do 510 i=1,ncum 1109 ! ori cape(i)=0.0 1110 ! ori capem(i)=0.0 1111 ! ori inb(i)=icb(i)+1 1112 ! ori inb1(i)=inb(i) 1113 ! ori 510 continue 1114 1115 ! Originial Code 1116 1117 ! do 530 k=minorig+1,nl-1 1118 ! do 520 i=1,ncum 1119 ! IF(k.ge.(icb(i)+1))THEN 1120 ! by=(tvp(i,k)-tv(i,k))*dph(i,k)/p(i,k) 1121 ! byp=(tvp(i,k+1)-tv(i,k+1))*dph(i,k+1)/p(i,k+1) 1122 ! cape(i)=cape(i)+by 1123 ! IF(by.ge.0.0)inb1(i)=k+1 1124 ! IF(cape(i).gt.0.0)THEN 1125 ! inb(i)=k+1 1126 ! capem(i)=cape(i) 1127 ! END IF 1128 ! END IF 1129 ! 520 continue 1130 ! 530 continue 1131 ! do 540 i=1,ncum 1132 ! byp=(tvp(i,nl)-tv(i,nl))*dph(i,nl)/p(i,nl) 1133 ! cape(i)=capem(i)+byp 1134 ! defrac=capem(i)-cape(i) 1135 ! defrac=max(defrac,0.001) 1136 ! frac(i)=-cape(i)/defrac 1137 ! frac(i)=min(frac(i),1.0) 1138 ! frac(i)=max(frac(i),0.0) 1139 ! 540 continue 1140 1141 ! K Emanuel fix 1142 1143 ! CALL zilch(byp,ncum) 1144 ! do 530 k=minorig+1,nl-1 1145 ! do 520 i=1,ncum 1146 ! IF(k.ge.(icb(i)+1))THEN 1147 ! by=(tvp(i,k)-tv(i,k))*dph(i,k)/p(i,k) 1148 ! cape(i)=cape(i)+by 1149 ! IF(by.ge.0.0)inb1(i)=k+1 1150 ! IF(cape(i).gt.0.0)THEN 1151 ! inb(i)=k+1 1152 ! capem(i)=cape(i) 1153 ! byp(i)=(tvp(i,k+1)-tv(i,k+1))*dph(i,k+1)/p(i,k+1) 1154 ! END IF 1155 ! END IF 1156 ! 520 continue 1157 ! 530 continue 1158 ! do 540 i=1,ncum 1159 ! inb(i)=max(inb(i),inb1(i)) 1160 ! cape(i)=capem(i)+byp(i) 1161 ! defrac=capem(i)-cape(i) 1162 ! defrac=max(defrac,0.001) 1163 ! frac(i)=-cape(i)/defrac 1164 ! frac(i)=min(frac(i),1.0) 1165 ! frac(i)=max(frac(i),0.0) 1166 ! 540 continue 1167 1168 ! J Teixeira fix 1169 1170 ! ori CALL zilch(byp,ncum) 1171 ! ori do 515 i=1,ncum 1172 ! ori lcape(i)=.TRUE. 1173 ! ori 515 continue 1174 ! ori do 530 k=minorig+1,nl-1 1175 ! ori do 520 i=1,ncum 1176 ! ori IF(cape(i).lt.0.0)lcape(i)=.FALSE. 1177 ! ori if((k.ge.(icb(i)+1)).AND.lcape(i))THEN 1178 ! ori by=(tvp(i,k)-tv(i,k))*dph(i,k)/p(i,k) 1179 ! ori byp(i)=(tvp(i,k+1)-tv(i,k+1))*dph(i,k+1)/p(i,k+1) 1180 ! ori cape(i)=cape(i)+by 1181 ! ori IF(by.ge.0.0)inb1(i)=k+1 1182 ! ori IF(cape(i).gt.0.0)THEN 1183 ! ori inb(i)=k+1 1184 ! ori capem(i)=cape(i) 1185 ! ori endif 1186 ! ori endif 1187 ! ori 520 continue 1188 ! ori 530 continue 1189 ! ori do 540 i=1,ncum 1190 ! ori cape(i)=capem(i)+byp(i) 1191 ! ori defrac=capem(i)-cape(i) 1192 ! ori defrac=max(defrac,0.001) 1193 ! ori frac(i)=-cape(i)/defrac 1194 ! ori frac(i)=min(frac(i),1.0) 1195 ! ori frac(i)=max(frac(i),0.0) 1196 ! ori 540 continue 1197 1198 ! ===================================================================== 1199 ! --- CALCULATE LIQUID WATER STATIC ENERGY OF LIFTED PARCEL 1200 ! ===================================================================== 1201 1202 ! ym do i=1,ncum*nlp 1203 ! ym hp(i,1)=h(i,1) 1204 ! ym enddo 1205 1206 DO k = 1, nlp 1207 DO i = 1, ncum 1208 hp(i, k) = h(i, k) 1209 END DO 1210 END DO 1211 1212 DO k = minorig + 1, nl 1213 DO i = 1, ncum 1214 IF ((k>=icb(i)) .AND. (k<=inb(i))) THEN 1215 hp(i, k) = h(i, nk(i)) + (lv(i, k) + (cpd - cpv) * t(i, k)) * ep(i, k) * clw(i, k & 1216 ) 1217 END IF 1218 END DO 1219 END DO 1220 1221 END SUBROUTINE cv30_undilute2 1222 1223 SUBROUTINE cv30_closure(nloc, ncum, nd, icb, inb, pbase, p, ph, tv, buoy, & 1224 sig, w0, cape, m) 1225 USE cvthermo_mod_h 1226 1227 IMPLICIT NONE 1228 1229 ! =================================================================== 1230 ! --- CLOSURE OF CONVECT3 1231 1232 ! vectorization: S. Bony 1233 ! =================================================================== 1234 1235 1236 1237 ! input: 1238 INTEGER ncum, nd, nloc 1239 INTEGER icb(nloc), inb(nloc) 1240 REAL pbase(nloc) 1241 REAL p(nloc, nd), ph(nloc, nd + 1) 1242 REAL tv(nloc, nd), buoy(nloc, nd) 1243 1244 ! input/output: 1245 REAL sig(nloc, nd), w0(nloc, nd) 1246 1247 ! output: 1248 REAL cape(nloc) 1249 REAL m(nloc, nd) 1250 1251 ! local variables: 1252 INTEGER i, j, k, icbmax 1253 REAL deltap, fac, w, amu 1254 REAL dtmin(nloc, nd), sigold(nloc, nd) 1255 1256 ! ------------------------------------------------------- 1257 ! -- Initialization 1258 ! ------------------------------------------------------- 1259 1260 DO k = 1, nl 1261 DO i = 1, ncum 1262 m(i, k) = 0.0 1263 END DO 1264 END DO 1265 1266 ! ------------------------------------------------------- 1267 ! -- Reset sig(i) and w0(i) for i>inb and i<icb 1268 ! ------------------------------------------------------- 1269 1270 ! update sig and w0 above LNB: 1271 1272 DO k = 1, nl - 1 1273 DO i = 1, ncum 1274 IF ((inb(i)<(nl - 1)) .AND. (k>=(inb(i) + 1))) THEN 1275 sig(i, k) = beta * sig(i, k) + 2. * alpha * buoy(i, inb(i)) * abs(buoy(i, inb(& 1276 i))) 1277 sig(i, k) = amax1(sig(i, k), 0.0) 1278 w0(i, k) = beta * w0(i, k) 1279 END IF 1280 END DO 1281 END DO 1282 1283 ! compute icbmax: 1284 1285 icbmax = 2 1286 DO i = 1, ncum 1287 icbmax = max(icbmax, icb(i)) 1288 END DO 1289 1290 ! update sig and w0 below cloud base: 1291 1292 DO k = 1, icbmax 1293 DO i = 1, ncum 1294 IF (k<=icb(i)) THEN 1295 sig(i, k) = beta * sig(i, k) - 2. * alpha * buoy(i, icb(i)) * buoy(i, icb(i)) 1296 sig(i, k) = amax1(sig(i, k), 0.0) 1297 w0(i, k) = beta * w0(i, k) 1298 END IF 1299 END DO 1300 END DO 1301 1302 ! IF(inb.lt.(nl-1))THEN 1303 ! do 85 i=inb+1,nl-1 1304 ! sig(i)=beta*sig(i)+2.*alpha*buoy(inb)* 1305 ! 1 abs(buoy(inb)) 1306 ! sig(i)=amax1(sig(i),0.0) 1307 ! w0(i)=beta*w0(i) 1308 ! 85 continue 1309 ! end if 1310 1311 ! do 87 i=1,icb 1312 ! sig(i)=beta*sig(i)-2.*alpha*buoy(icb)*buoy(icb) 1313 ! sig(i)=amax1(sig(i),0.0) 1314 ! w0(i)=beta*w0(i) 1315 ! 87 continue 1316 1317 ! ------------------------------------------------------------- 1318 ! -- Reset fractional areas of updrafts and w0 at initial time 1319 ! -- and after 10 time steps of no convection 1320 ! ------------------------------------------------------------- 1321 1322 DO k = 1, nl - 1 1323 DO i = 1, ncum 1324 IF (sig(i, nd)<1.5 .OR. sig(i, nd)>12.0) THEN 1325 sig(i, k) = 0.0 1326 w0(i, k) = 0.0 1327 END IF 1328 END DO 1329 END DO 1330 1331 ! ------------------------------------------------------------- 1332 ! -- Calculate convective available potential energy (cape), 1333 ! -- vertical velocity (w), fractional area covered by 1334 ! -- undilute updraft (sig), and updraft mass flux (m) 1335 ! ------------------------------------------------------------- 1336 1337 DO i = 1, ncum 1338 cape(i) = 0.0 1339 END DO 1340 1341 ! compute dtmin (minimum buoyancy between ICB and given level k): 1342 1343 DO i = 1, ncum 1344 DO k = 1, nl 1345 dtmin(i, k) = 100.0 1346 END DO 1347 END DO 1348 1349 DO i = 1, ncum 1350 DO k = 1, nl 1351 DO j = minorig, nl 1352 IF ((k>=(icb(i) + 1)) .AND. (k<=inb(i)) .AND. (j>=icb(i)) .AND. (j<=(k - & 1353 1))) THEN 1354 dtmin(i, k) = amin1(dtmin(i, k), buoy(i, j)) 1546 1355 END IF 1547 IF (sij(il,i,j)>0.0 .AND. sij(il,i,j)<0.95) THEN 1548 qent(il, i, j) = sij(il, i, j)*rr(il, i) + (1.-sij(il,i,j))*rti 1549 uent(il, i, j) = sij(il, i, j)*u(il, i) + & 1550 (1.-sij(il,i,j))*u(il, nk(il)) 1551 vent(il, i, j) = sij(il, i, j)*v(il, i) + & 1552 (1.-sij(il,i,j))*v(il, nk(il)) 1553 ! !!! do k=1,ntra 1554 ! !!! traent(il,i,j,k)=sij(il,i,j)*tra(il,i,k) 1555 ! !!! : +(1.-sij(il,i,j))*tra(il,nk(il),k) 1556 ! !!! end do 1557 elij(il, i, j) = altem 1558 elij(il, i, j) = amax1(0.0, elij(il,i,j)) 1559 ment(il, i, j) = m(il, i)/(1.-sij(il,i,j)) 1560 nent(il, i) = nent(il, i) + 1 1561 END IF 1562 sij(il, i, j) = amax1(0.0, sij(il,i,j)) 1563 sij(il, i, j) = amin1(1.0, sij(il,i,j)) 1564 END IF ! new 1565 END DO 1566 END DO 1356 END DO 1357 END DO 1358 END DO 1359 1360 ! the interval on which cape is computed starts at pbase : 1361 DO k = 1, nl 1362 DO i = 1, ncum 1363 1364 IF ((k>=(icb(i) + 1)) .AND. (k<=inb(i))) THEN 1365 1366 deltap = min(pbase(i), ph(i, k - 1)) - min(pbase(i), ph(i, k)) 1367 cape(i) = cape(i) + rrd * buoy(i, k - 1) * deltap / p(i, k - 1) 1368 cape(i) = amax1(0.0, cape(i)) 1369 sigold(i, k) = sig(i, k) 1370 1371 ! dtmin(i,k)=100.0 1372 ! do 97 j=icb(i),k-1 ! mauvaise vectorisation 1373 ! dtmin(i,k)=AMIN1(dtmin(i,k),buoy(i,j)) 1374 ! 97 continue 1375 1376 sig(i, k) = beta * sig(i, k) + alpha * dtmin(i, k) * abs(dtmin(i, k)) 1377 sig(i, k) = amax1(sig(i, k), 0.0) 1378 sig(i, k) = amin1(sig(i, k), 0.01) 1379 fac = amin1(((dtcrit - dtmin(i, k)) / dtcrit), 1.0) 1380 w = (1. - beta) * fac * sqrt(cape(i)) + beta * w0(i, k) 1381 amu = 0.5 * (sig(i, k) + sigold(i, k)) * w 1382 m(i, k) = amu * 0.007 * p(i, k) * (ph(i, k) - ph(i, k + 1)) / tv(i, k) 1383 w0(i, k) = w 1384 END IF 1385 1386 END DO 1387 END DO 1388 1389 DO i = 1, ncum 1390 w0(i, icb(i)) = 0.5 * w0(i, icb(i) + 1) 1391 m(i, icb(i)) = 0.5 * m(i, icb(i) + 1) * (ph(i, icb(i)) - ph(i, icb(i) + 1)) / & 1392 (ph(i, icb(i) + 1) - ph(i, icb(i) + 2)) 1393 sig(i, icb(i)) = sig(i, icb(i) + 1) 1394 sig(i, icb(i) - 1) = sig(i, icb(i)) 1395 END DO 1396 1397 1398 ! cape=0.0 1399 ! do 98 i=icb+1,inb 1400 ! deltap = min(pbase,ph(i-1))-min(pbase,ph(i)) 1401 ! cape=cape+rrd*buoy(i-1)*deltap/p(i-1) 1402 ! dcape=rrd*buoy(i-1)*deltap/p(i-1) 1403 ! dlnp=deltap/p(i-1) 1404 ! cape=amax1(0.0,cape) 1405 ! sigold=sig(i) 1406 1407 ! dtmin=100.0 1408 ! do 97 j=icb,i-1 1409 ! dtmin=amin1(dtmin,buoy(j)) 1410 ! 97 continue 1411 1412 ! sig(i)=beta*sig(i)+alpha*dtmin*abs(dtmin) 1413 ! sig(i)=amax1(sig(i),0.0) 1414 ! sig(i)=amin1(sig(i),0.01) 1415 ! fac=amin1(((dtcrit-dtmin)/dtcrit),1.0) 1416 ! w=(1.-beta)*fac*sqrt(cape)+beta*w0(i) 1417 ! amu=0.5*(sig(i)+sigold)*w 1418 ! m(i)=amu*0.007*p(i)*(ph(i)-ph(i+1))/tv(i) 1419 ! w0(i)=w 1420 ! 98 continue 1421 ! w0(icb)=0.5*w0(icb+1) 1422 ! m(icb)=0.5*m(icb+1)*(ph(icb)-ph(icb+1))/(ph(icb+1)-ph(icb+2)) 1423 ! sig(icb)=sig(icb+1) 1424 ! sig(icb-1)=sig(icb) 1425 1426 END SUBROUTINE cv30_closure 1427 1428 SUBROUTINE cv30_mixing(nloc, ncum, nd, na, ntra, icb, nk, inb, ph, t, rr, rs, & 1429 u, v, tra, h, lv, qnk, hp, tv, tvp, ep, clw, m, sig, ment, qent, uent, & 1430 vent, sij, elij, ments, qents, traent) 1431 USE cvthermo_mod_h 1432 1433 IMPLICIT NONE 1434 1435 ! --------------------------------------------------------------------- 1436 ! a faire: 1437 ! - changer rr(il,1) -> qnk(il) 1438 ! - vectorisation de la partie normalisation des flux (do 789...) 1439 ! --------------------------------------------------------------------- 1440 1441 1442 1443 ! inputs: 1444 INTEGER ncum, nd, na, ntra, nloc 1445 INTEGER icb(nloc), inb(nloc), nk(nloc) 1446 REAL sig(nloc, nd) 1447 REAL qnk(nloc) 1448 REAL ph(nloc, nd + 1) 1449 REAL t(nloc, nd), rr(nloc, nd), rs(nloc, nd) 1450 REAL u(nloc, nd), v(nloc, nd) 1451 REAL tra(nloc, nd, ntra) ! input of convect3 1452 REAL lv(nloc, na), h(nloc, na), hp(nloc, na) 1453 REAL tv(nloc, na), tvp(nloc, na), ep(nloc, na), clw(nloc, na) 1454 REAL m(nloc, na) ! input of convect3 1455 1456 ! outputs: 1457 REAL ment(nloc, na, na), qent(nloc, na, na) 1458 REAL uent(nloc, na, na), vent(nloc, na, na) 1459 REAL sij(nloc, na, na), elij(nloc, na, na) 1460 REAL traent(nloc, nd, nd, ntra) 1461 REAL ments(nloc, nd, nd), qents(nloc, nd, nd) 1462 REAL sigij(nloc, nd, nd) 1463 1464 ! local variables: 1465 INTEGER i, j, k, il, im, jm 1466 INTEGER num1, num2 1467 INTEGER nent(nloc, na) 1468 REAL rti, bf2, anum, denom, dei, altem, cwat, stemp, qp 1469 REAL alt, smid, sjmin, sjmax, delp, delm 1470 REAL asij(nloc), smax(nloc), scrit(nloc) 1471 REAL asum(nloc, nd), bsum(nloc, nd), csum(nloc, nd) 1472 REAL wgh 1473 REAL zm(nloc, na) 1474 LOGICAL lwork(nloc) 1475 1476 ! ===================================================================== 1477 ! --- INITIALIZE VARIOUS ARRAYS USED IN THE COMPUTATIONS 1478 ! ===================================================================== 1479 1480 ! ori do 360 i=1,ncum*nlp 1481 DO j = 1, nl 1482 DO i = 1, ncum 1483 nent(i, j) = 0 1484 ! in convect3, m is computed in cv3_closure 1485 ! ori m(i,1)=0.0 1486 END DO 1487 END DO 1488 1489 ! ori do 400 k=1,nlp 1490 ! ori do 390 j=1,nlp 1491 DO j = 1, nl 1492 DO k = 1, nl 1493 DO i = 1, ncum 1494 qent(i, k, j) = rr(i, j) 1495 uent(i, k, j) = u(i, j) 1496 vent(i, k, j) = v(i, j) 1497 elij(i, k, j) = 0.0 1498 ! ym ment(i,k,j)=0.0 1499 ! ym sij(i,k,j)=0.0 1500 END DO 1501 END DO 1502 END DO 1503 1504 ! ym 1505 ment(1:ncum, 1:nd, 1:nd) = 0.0 1506 sij(1:ncum, 1:nd, 1:nd) = 0.0 1567 1507 1568 1508 ! do k=1,ntra 1569 ! do j=minorig,nl 1509 ! do j=1,nd ! instead nlp 1510 ! do i=1,nd ! instead nlp 1570 1511 ! do il=1,ncum 1571 ! if( (i.ge.icb(il)).and.(i.le.inb(il)).and. 1572 ! : (j.ge.(icb(il)-1)).and.(j.le.inb(il)))then 1573 ! traent(il,i,j,k)=sij(il,i,j)*tra(il,i,k) 1574 ! : +(1.-sij(il,i,j))*tra(il,nk(il),k) 1575 ! endif 1512 ! traent(il,i,j,k)=tra(il,j,k) 1576 1513 ! enddo 1577 1514 ! enddo 1578 1515 ! enddo 1579 1580 1581 ! *** if no air can entrain at level i assume that updraft detrains 1582 ! *** 1583 ! *** at that level and calculate detrained air flux and properties 1584 ! *** 1585 1586 1587 ! @ do 170 i=icb(il),inb(il) 1588 1589 DO il = 1, ncum 1590 IF ((i>=icb(il)) .AND. (i<=inb(il)) .AND. (nent(il,i)==0)) THEN 1591 ! @ if(nent(il,i).eq.0)then 1592 ment(il, i, i) = m(il, i) 1593 qent(il, i, i) = rr(il, nk(il)) - ep(il, i)*clw(il, i) 1594 uent(il, i, i) = u(il, nk(il)) 1595 vent(il, i, i) = v(il, nk(il)) 1596 elij(il, i, i) = clw(il, i) 1597 ! MAF sij(il,i,i)=1.0 1598 sij(il, i, i) = 0.0 1599 END IF 1600 END DO 1601 END DO 1602 1603 ! do j=1,ntra 1604 ! do i=minorig+1,nl 1605 ! do il=1,ncum 1606 ! if (i.ge.icb(il) .and. i.le.inb(il) .and. nent(il,i).eq.0) then 1607 ! traent(il,i,i,j)=tra(il,nk(il),j) 1608 ! endif 1609 ! enddo 1610 ! enddo 1611 ! enddo 1612 1613 DO j = minorig, nl 1614 DO i = minorig, nl 1516 ! enddo 1517 zm(:, :) = 0. 1518 1519 ! ===================================================================== 1520 ! --- CALCULATE ENTRAINED AIR MASS FLUX (ment), TOTAL WATER MIXING 1521 ! --- RATIO (QENT), TOTAL CONDENSED WATER (elij), AND MIXING 1522 ! --- FRACTION (sij) 1523 ! ===================================================================== 1524 1525 DO i = minorig + 1, nl 1526 1527 DO j = minorig, nl 1528 DO il = 1, ncum 1529 IF ((i>=icb(il)) .AND. (i<=inb(il)) .AND. (j>=(icb(il) - & 1530 1)) .AND. (j<=inb(il))) THEN 1531 1532 rti = rr(il, 1) - ep(il, i) * clw(il, i) 1533 bf2 = 1. + lv(il, j) * lv(il, j) * rs(il, j) / (rrv * t(il, j) * t(il, j) * cpd) 1534 anum = h(il, j) - hp(il, i) + (cpv - cpd) * t(il, j) * (rti - rr(il, j)) 1535 denom = h(il, i) - hp(il, i) + (cpd - cpv) * (rr(il, i) - rti) * t(il, j) 1536 dei = denom 1537 IF (abs(dei)<0.01) dei = 0.01 1538 sij(il, i, j) = anum / dei 1539 sij(il, i, i) = 1.0 1540 altem = sij(il, i, j) * rr(il, i) + (1. - sij(il, i, j)) * rti - rs(il, j) 1541 altem = altem / bf2 1542 cwat = clw(il, j) * (1. - ep(il, j)) 1543 stemp = sij(il, i, j) 1544 IF ((stemp<0.0 .OR. stemp>1.0 .OR. altem>cwat) .AND. j>i) THEN 1545 anum = anum - lv(il, j) * (rti - rs(il, j) - cwat * bf2) 1546 denom = denom + lv(il, j) * (rr(il, i) - rti) 1547 IF (abs(denom)<0.01) denom = 0.01 1548 sij(il, i, j) = anum / denom 1549 altem = sij(il, i, j) * rr(il, i) + (1. - sij(il, i, j)) * rti - & 1550 rs(il, j) 1551 altem = altem - (bf2 - 1.) * cwat 1552 END IF 1553 IF (sij(il, i, j)>0.0 .AND. sij(il, i, j)<0.95) THEN 1554 qent(il, i, j) = sij(il, i, j) * rr(il, i) + (1. - sij(il, i, j)) * rti 1555 uent(il, i, j) = sij(il, i, j) * u(il, i) + & 1556 (1. - sij(il, i, j)) * u(il, nk(il)) 1557 vent(il, i, j) = sij(il, i, j) * v(il, i) + & 1558 (1. - sij(il, i, j)) * v(il, nk(il)) 1559 ! !!! do k=1,ntra 1560 ! !!! traent(il,i,j,k)=sij(il,i,j)*tra(il,i,k) 1561 ! !!! : +(1.-sij(il,i,j))*tra(il,nk(il),k) 1562 ! !!! END DO 1563 elij(il, i, j) = altem 1564 elij(il, i, j) = amax1(0.0, elij(il, i, j)) 1565 ment(il, i, j) = m(il, i) / (1. - sij(il, i, j)) 1566 nent(il, i) = nent(il, i) + 1 1567 END IF 1568 sij(il, i, j) = amax1(0.0, sij(il, i, j)) 1569 sij(il, i, j) = amin1(1.0, sij(il, i, j)) 1570 END IF ! new 1571 END DO 1572 END DO 1573 1574 ! do k=1,ntra 1575 ! do j=minorig,nl 1576 ! do il=1,ncum 1577 ! IF( (i.ge.icb(il)).AND.(i.le.inb(il)).AND. 1578 ! : (j.ge.(icb(il)-1)).AND.(j.le.inb(il)))THEN 1579 ! traent(il,i,j,k)=sij(il,i,j)*tra(il,i,k) 1580 ! : +(1.-sij(il,i,j))*tra(il,nk(il),k) 1581 ! END IF 1582 ! enddo 1583 ! enddo 1584 ! enddo 1585 1586 1587 ! *** if no air can entrain at level i assume that updraft detrains 1588 ! *** 1589 ! *** at that level and calculate detrained air flux and properties 1590 ! *** 1591 1592 1593 ! @ do 170 i=icb(il),inb(il) 1594 1615 1595 DO il = 1, ncum 1616 IF ((j>=(icb(il)-1)) .AND. (j<=inb(il)) .AND. (i>=icb(il)) .AND. (i<= & 1617 inb(il))) THEN 1618 sigij(il, i, j) = sij(il, i, j) 1596 IF ((i>=icb(il)) .AND. (i<=inb(il)) .AND. (nent(il, i)==0)) THEN 1597 ! @ IF(nent(il,i).EQ.0)THEN 1598 ment(il, i, i) = m(il, i) 1599 qent(il, i, i) = rr(il, nk(il)) - ep(il, i) * clw(il, i) 1600 uent(il, i, i) = u(il, nk(il)) 1601 vent(il, i, i) = v(il, nk(il)) 1602 elij(il, i, i) = clw(il, i) 1603 ! MAF sij(il,i,i)=1.0 1604 sij(il, i, i) = 0.0 1619 1605 END IF 1620 1606 END DO 1621 1607 END DO 1622 END DO1623 ! @ enddo1624 1625 ! @170 continue1626 1627 ! =====================================================================1628 ! --- NORMALIZE ENTRAINED AIR MASS FLUXES1629 ! --- TO REPRESENT EQUAL PROBABILITIES OF MIXING1630 ! =====================================================================1631 1632 ! ym call zilch(asum,ncum*nd)1633 ! ym call zilch(bsum,ncum*nd)1634 ! ym call zilch(csum,ncum*nd)1635 CALL zilch(asum, nloc*nd)1636 CALL zilch(csum, nloc*nd)1637 CALL zilch(csum, nloc*nd)1638 1639 DO il = 1, ncum1640 lwork(il) = .FALSE.1641 END DO1642 1643 DO i = minorig + 1, nl1644 1645 num1 = 01646 DO il = 1, ncum1647 IF (i>=icb(il) .AND. i<=inb(il)) num1 = num1 + 11648 END DO1649 IF (num1<=0) GO TO 7891650 1651 1652 DO il = 1, ncum1653 IF (i>=icb(il) .AND. i<=inb(il)) THEN1654 lwork(il) = (nent(il,i)/=0)1655 qp = rr(il, 1) - ep(il, i)*clw(il, i)1656 anum = h(il, i) - hp(il, i) - lv(il, i)*(qp-rs(il,i)) + &1657 (cpv-cpd)*t(il, i)*(qp-rr(il,i))1658 denom = h(il, i) - hp(il, i) + lv(il, i)*(rr(il,i)-qp) + &1659 (cpd-cpv)*t(il, i)*(rr(il,i)-qp)1660 IF (abs(denom)<0.01) denom = 0.011661 scrit(il) = anum/denom1662 alt = qp - rs(il, i) + scrit(il)*(rr(il,i)-qp)1663 IF (scrit(il)<=0.0 .OR. alt<=0.0) scrit(il) = 1.01664 smax(il) = 0.01665 asij(il) = 0.01666 END IF1667 END DO1668 1669 DO j = nl, minorig, -11670 1671 num2 = 01672 DO il = 1, ncum1673 IF (i>=icb(il) .AND. i<=inb(il) .AND. j>=(icb( &1674 il)-1) .AND. j<=inb(il) .AND. lwork(il)) num2 = num2 + 11675 END DO1676 IF (num2<=0) GO TO 1751677 1678 DO il = 1, ncum1679 IF (i>=icb(il) .AND. i<=inb(il) .AND. j>=(icb( &1680 il)-1) .AND. j<=inb(il) .AND. lwork(il)) THEN1681 1682 IF (sij(il,i,j)>1.0E-16 .AND. sij(il,i,j)<0.95) THEN1683 wgh = 1.01684 IF (j>i) THEN1685 sjmax = amax1(sij(il,i,j+1), smax(il))1686 sjmax = amin1(sjmax, scrit(il))1687 smax(il) = amax1(sij(il,i,j), smax(il))1688 sjmin = amax1(sij(il,i,j-1), smax(il))1689 sjmin = amin1(sjmin, scrit(il))1690 IF (sij(il,i,j)<(smax(il)-1.0E-16)) wgh = 0.01691 smid = amin1(sij(il,i,j), scrit(il))1692 ELSE1693 sjmax = amax1(sij(il,i,j+1), scrit(il))1694 smid = amax1(sij(il,i,j), scrit(il))1695 sjmin = 0.01696 IF (j>1) sjmin = sij(il, i, j-1)1697 sjmin = amax1(sjmin, scrit(il))1698 END IF1699 delp = abs(sjmax-smid)1700 delm = abs(sjmin-smid)1701 asij(il) = asij(il) + wgh*(delp+delm)1702 ment(il, i, j) = ment(il, i, j)*(delp+delm)*wgh1703 END IF1704 END IF1705 END DO1706 1707 175 END DO1708 1709 DO il = 1, ncum1710 IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il)) THEN1711 asij(il) = amax1(1.0E-16, asij(il))1712 asij(il) = 1.0/asij(il)1713 asum(il, i) = 0.01714 bsum(il, i) = 0.01715 csum(il, i) = 0.01716 END IF1717 END DO1718 1719 DO j = minorig, nl1720 DO il = 1, ncum1721 IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. j>=(icb( &1722 il)-1) .AND. j<=inb(il)) THEN1723 ment(il, i, j) = ment(il, i, j)*asij(il)1724 END IF1725 END DO1726 END DO1727 1728 DO j = minorig, nl1729 DO il = 1, ncum1730 IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. j>=(icb( &1731 il)-1) .AND. j<=inb(il)) THEN1732 asum(il, i) = asum(il, i) + ment(il, i, j)1733 ment(il, i, j) = ment(il, i, j)*sig(il, j)1734 bsum(il, i) = bsum(il, i) + ment(il, i, j)1735 END IF1736 END DO1737 END DO1738 1739 DO il = 1, ncum1740 IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il)) THEN1741 bsum(il, i) = amax1(bsum(il,i), 1.0E-16)1742 bsum(il, i) = 1.0/bsum(il, i)1743 END IF1744 END DO1745 1746 DO j = minorig, nl1747 DO il = 1, ncum1748 IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. j>=(icb( &1749 il)-1) .AND. j<=inb(il)) THEN1750 ment(il, i, j) = ment(il, i, j)*asum(il, i)*bsum(il, i)1751 END IF1752 END DO1753 END DO1754 1755 DO j = minorig, nl1756 DO il = 1, ncum1757 IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. j>=(icb( &1758 il)-1) .AND. j<=inb(il)) THEN1759 csum(il, i) = csum(il, i) + ment(il, i, j)1760 END IF1761 END DO1762 END DO1763 1764 DO il = 1, ncum1765 IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. &1766 csum(il,i)<m(il,i)) THEN1767 nent(il, i) = 01768 ment(il, i, i) = m(il, i)1769 qent(il, i, i) = rr(il, 1) - ep(il, i)*clw(il, i)1770 uent(il, i, i) = u(il, nk(il))1771 vent(il, i, i) = v(il, nk(il))1772 elij(il, i, i) = clw(il, i)1773 ! MAF sij(il,i,i)=1.01774 sij(il, i, i) = 0.01775 END IF1776 END DO ! il1777 1608 1778 1609 ! do j=1,ntra 1610 ! do i=minorig+1,nl 1779 1611 ! do il=1,ncum 1780 ! if ( i.ge.icb(il) .and. i.le.inb(il) .and. lwork(il) 1781 ! : .and. csum(il,i).lt.m(il,i) ) then 1612 ! if (i.ge.icb(il) .AND. i.le.inb(il) .AND. nent(il,i).EQ.0) THEN 1782 1613 ! traent(il,i,i,j)=tra(il,nk(il),j) 1783 ! endif1614 ! END IF 1784 1615 ! enddo 1785 1616 ! enddo 1786 789 END DO 1787 1788 ! MAF: renormalisation de MENT 1789 DO jm = 1, nd 1790 DO im = 1, nd 1617 ! enddo 1618 1619 DO j = minorig, nl 1620 DO i = minorig, nl 1621 DO il = 1, ncum 1622 IF ((j>=(icb(il) - 1)) .AND. (j<=inb(il)) .AND. (i>=icb(il)) .AND. (i<= & 1623 inb(il))) THEN 1624 sigij(il, i, j) = sij(il, i, j) 1625 END IF 1626 END DO 1627 END DO 1628 END DO 1629 ! @ enddo 1630 1631 ! @170 continue 1632 1633 ! ===================================================================== 1634 ! --- NORMALIZE ENTRAINED AIR MASS FLUXES 1635 ! --- TO REPRESENT EQUAL PROBABILITIES OF MIXING 1636 ! ===================================================================== 1637 1638 ! ym CALL zilch(asum,ncum*nd) 1639 ! ym CALL zilch(bsum,ncum*nd) 1640 ! ym CALL zilch(csum,ncum*nd) 1641 CALL zilch(asum, nloc * nd) 1642 CALL zilch(csum, nloc * nd) 1643 CALL zilch(csum, nloc * nd) 1644 1645 DO il = 1, ncum 1646 lwork(il) = .FALSE. 1647 END DO 1648 1649 DO i = minorig + 1, nl 1650 1651 num1 = 0 1791 1652 DO il = 1, ncum 1792 zm(il, im) = zm(il, im) + (1.-sij(il,im,jm))*ment(il, im, jm) 1793 END DO 1794 END DO 1795 END DO 1796 1797 DO jm = 1, nd 1798 DO im = 1, nd 1653 IF (i>=icb(il) .AND. i<=inb(il)) num1 = num1 + 1 1654 END DO 1655 IF (num1<=0) GO TO 789 1656 1799 1657 DO il = 1, ncum 1800 IF (zm(il,im)/=0.) THEN 1801 ment(il, im, jm) = ment(il, im, jm)*m(il, im)/zm(il, im) 1658 IF (i>=icb(il) .AND. i<=inb(il)) THEN 1659 lwork(il) = (nent(il, i)/=0) 1660 qp = rr(il, 1) - ep(il, i) * clw(il, i) 1661 anum = h(il, i) - hp(il, i) - lv(il, i) * (qp - rs(il, i)) + & 1662 (cpv - cpd) * t(il, i) * (qp - rr(il, i)) 1663 denom = h(il, i) - hp(il, i) + lv(il, i) * (rr(il, i) - qp) + & 1664 (cpd - cpv) * t(il, i) * (rr(il, i) - qp) 1665 IF (abs(denom)<0.01) denom = 0.01 1666 scrit(il) = anum / denom 1667 alt = qp - rs(il, i) + scrit(il) * (rr(il, i) - qp) 1668 IF (scrit(il)<=0.0 .OR. alt<=0.0) scrit(il) = 1.0 1669 smax(il) = 0.0 1670 asij(il) = 0.0 1802 1671 END IF 1803 1672 END DO 1804 END DO 1805 END DO 1806 1807 DO jm = 1, nd 1808 DO im = 1, nd 1809 DO il = 1, ncum 1810 qents(il, im, jm) = qent(il, im, jm) 1811 ments(il, im, jm) = ment(il, im, jm) 1812 END DO 1813 END DO 1814 END DO 1815 1816 RETURN 1817 END SUBROUTINE cv30_mixing 1818 1819 1820 SUBROUTINE cv30_unsat(nloc, ncum, nd, na, ntra, icb, inb, t, rr, rs, gz, u, & 1821 v, tra, p, ph, th, tv, lv, cpn, ep, sigp, clw, m, ment, elij, delt, plcl, & 1822 mp, rp, up, vp, trap, wt, water, evap, b & ! RomP-jyg 1823 , wdtraina, wdtrainm) ! 26/08/10 RomP-jyg 1824 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 1825 , clmci, eps, epsi, epsim1, ginv, hrd, grav 1826 USE cvflag_mod_h, ONLY: icvflag_Tpa, cvflag_grav, cvflag_ice, ok_optim_yield, ok_entrain, ok_homo_tend, & 1827 ok_convstop, ok_intermittent, cvflag_prec_eject, qsat_depends_on_qt, adiab_ascent_mass_flux_depends_on_ejectliq, keepbug_ice_frac 1828 IMPLICIT NONE 1829 include "cv30param.h" 1830 1831 ! inputs: 1832 INTEGER ncum, nd, na, ntra, nloc 1833 INTEGER icb(nloc), inb(nloc) 1834 REAL delt, plcl(nloc) 1835 REAL t(nloc, nd), rr(nloc, nd), rs(nloc, nd) 1836 REAL u(nloc, nd), v(nloc, nd) 1837 REAL tra(nloc, nd, ntra) 1838 REAL p(nloc, nd), ph(nloc, nd+1) 1839 REAL th(nloc, na), gz(nloc, na) 1840 REAL lv(nloc, na), ep(nloc, na), sigp(nloc, na), clw(nloc, na) 1841 REAL cpn(nloc, na), tv(nloc, na) 1842 REAL m(nloc, na), ment(nloc, na, na), elij(nloc, na, na) 1843 1844 ! outputs: 1845 REAL mp(nloc, na), rp(nloc, na), up(nloc, na), vp(nloc, na) 1846 REAL water(nloc, na), evap(nloc, na), wt(nloc, na) 1847 REAL trap(nloc, na, ntra) 1848 REAL b(nloc, na) 1849 ! 25/08/10 - RomP---- ajout des masses precipitantes ejectees 1850 ! lascendance adiabatique et des flux melanges Pa et Pm. 1851 ! Distinction des wdtrain 1852 ! Pa = wdtrainA Pm = wdtrainM 1853 REAL wdtraina(nloc, na), wdtrainm(nloc, na) 1854 1855 ! local variables 1856 INTEGER i, j, k, il, num1 1857 REAL tinv, delti 1858 REAL awat, afac, afac1, afac2, bfac 1859 REAL pr1, pr2, sigt, b6, c6, revap, tevap, delth 1860 REAL amfac, amp2, xf, tf, fac2, ur, sru, fac, d, af, bf 1861 REAL ampmax 1862 REAL lvcp(nloc, na) 1863 REAL wdtrain(nloc) 1864 LOGICAL lwork(nloc) 1865 1866 1867 ! ------------------------------------------------------ 1868 1869 delti = 1./delt 1870 tinv = 1./3. 1871 1872 mp(:, :) = 0. 1873 1874 DO i = 1, nl 1875 DO il = 1, ncum 1876 mp(il, i) = 0.0 1877 rp(il, i) = rr(il, i) 1878 up(il, i) = u(il, i) 1879 vp(il, i) = v(il, i) 1880 wt(il, i) = 0.001 1881 water(il, i) = 0.0 1882 evap(il, i) = 0.0 1883 b(il, i) = 0.0 1884 lvcp(il, i) = lv(il, i)/cpn(il, i) 1885 END DO 1886 END DO 1887 1888 ! do k=1,ntra 1889 ! do i=1,nd 1890 ! do il=1,ncum 1891 ! trap(il,i,k)=tra(il,i,k) 1892 ! enddo 1893 ! enddo 1894 ! enddo 1895 ! ! RomP >>> 1896 DO i = 1, nd 1897 DO il = 1, ncum 1898 wdtraina(il, i) = 0.0 1899 wdtrainm(il, i) = 0.0 1900 END DO 1901 END DO 1902 ! ! RomP <<< 1903 1904 ! *** check whether ep(inb)=0, if so, skip precipitating *** 1905 ! *** downdraft calculation *** 1906 1907 1908 DO il = 1, ncum 1909 lwork(il) = .TRUE. 1910 IF (ep(il,inb(il))<0.0001) lwork(il) = .FALSE. 1911 END DO 1912 1913 CALL zilch(wdtrain, ncum) 1914 1915 DO i = nl + 1, 1, -1 1916 1917 num1 = 0 1918 DO il = 1, ncum 1919 IF (i<=inb(il) .AND. lwork(il)) num1 = num1 + 1 1920 END DO 1921 IF (num1<=0) GO TO 400 1922 1923 1924 ! *** integrate liquid water equation to find condensed water *** 1925 ! *** and condensed water flux *** 1926 1927 1928 1929 ! *** begin downdraft loop *** 1930 1931 1932 1933 ! *** calculate detrained precipitation *** 1934 1935 DO il = 1, ncum 1936 IF (i<=inb(il) .AND. lwork(il)) THEN 1937 IF (cvflag_grav) THEN 1938 wdtrain(il) = grav*ep(il, i)*m(il, i)*clw(il, i) 1939 wdtraina(il, i) = wdtrain(il)/grav ! Pa 26/08/10 RomP 1940 ELSE 1941 wdtrain(il) = 10.0*ep(il, i)*m(il, i)*clw(il, i) 1942 wdtraina(il, i) = wdtrain(il)/10. ! Pa 26/08/10 RomP 1943 END IF 1944 END IF 1945 END DO 1946 1947 IF (i>1) THEN 1948 1949 DO j = 1, i - 1 1673 1674 DO j = nl, minorig, -1 1675 1676 num2 = 0 1950 1677 DO il = 1, ncum 1951 IF (i<=inb(il) .AND. lwork(il)) THEN 1952 awat = elij(il, j, i) - (1.-ep(il,i))*clw(il, i) 1953 awat = amax1(awat, 0.0) 1954 IF (cvflag_grav) THEN 1955 wdtrain(il) = wdtrain(il) + grav*awat*ment(il, j, i) 1956 ELSE 1957 wdtrain(il) = wdtrain(il) + 10.0*awat*ment(il, j, i) 1678 IF (i>=icb(il) .AND. i<=inb(il) .AND. j>=(icb(& 1679 il) - 1) .AND. j<=inb(il) .AND. lwork(il)) num2 = num2 + 1 1680 END DO 1681 IF (num2<=0) GO TO 175 1682 1683 DO il = 1, ncum 1684 IF (i>=icb(il) .AND. i<=inb(il) .AND. j>=(icb(& 1685 il) - 1) .AND. j<=inb(il) .AND. lwork(il)) THEN 1686 1687 IF (sij(il, i, j)>1.0E-16 .AND. sij(il, i, j)<0.95) THEN 1688 wgh = 1.0 1689 IF (j>i) THEN 1690 sjmax = amax1(sij(il, i, j + 1), smax(il)) 1691 sjmax = amin1(sjmax, scrit(il)) 1692 smax(il) = amax1(sij(il, i, j), smax(il)) 1693 sjmin = amax1(sij(il, i, j - 1), smax(il)) 1694 sjmin = amin1(sjmin, scrit(il)) 1695 IF (sij(il, i, j)<(smax(il) - 1.0E-16)) wgh = 0.0 1696 smid = amin1(sij(il, i, j), scrit(il)) 1697 ELSE 1698 sjmax = amax1(sij(il, i, j + 1), scrit(il)) 1699 smid = amax1(sij(il, i, j), scrit(il)) 1700 sjmin = 0.0 1701 IF (j>1) sjmin = sij(il, i, j - 1) 1702 sjmin = amax1(sjmin, scrit(il)) 1703 END IF 1704 delp = abs(sjmax - smid) 1705 delm = abs(sjmin - smid) 1706 asij(il) = asij(il) + wgh * (delp + delm) 1707 ment(il, i, j) = ment(il, i, j) * (delp + delm) * wgh 1958 1708 END IF 1959 1709 END IF 1960 1710 END DO 1961 END DO 1711 1712 175 END DO 1713 1962 1714 DO il = 1, ncum 1963 IF (cvflag_grav) THEN 1964 wdtrainm(il, i) = wdtrain(il)/grav - wdtraina(il, i) ! Pm 26/08/10 RomP 1965 ELSE 1966 wdtrainm(il, i) = wdtrain(il)/10. - wdtraina(il, i) ! Pm 26/08/10 RomP 1715 IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il)) THEN 1716 asij(il) = amax1(1.0E-16, asij(il)) 1717 asij(il) = 1.0 / asij(il) 1718 asum(il, i) = 0.0 1719 bsum(il, i) = 0.0 1720 csum(il, i) = 0.0 1967 1721 END IF 1968 1722 END DO 1969 1723 1970 END IF 1971 1972 1973 ! *** find rain water and evaporation using provisional *** 1974 ! *** estimates of rp(i)and rp(i-1) *** 1975 1976 1977 DO il = 1, ncum 1978 1979 IF (i<=inb(il) .AND. lwork(il)) THEN 1980 1981 wt(il, i) = 45.0 1982 1983 IF (i<inb(il)) THEN 1984 rp(il, i) = rp(il, i+1) + (cpd*(t(il,i+1)-t(il, & 1985 i))+gz(il,i+1)-gz(il,i))/lv(il, i) 1986 rp(il, i) = 0.5*(rp(il,i)+rr(il,i)) 1987 END IF 1988 rp(il, i) = amax1(rp(il,i), 0.0) 1989 rp(il, i) = amin1(rp(il,i), rs(il,i)) 1990 rp(il, inb(il)) = rr(il, inb(il)) 1991 1992 IF (i==1) THEN 1993 afac = p(il, 1)*(rs(il,1)-rp(il,1))/(1.0E4+2000.0*p(il,1)*rs(il,1)) 1994 ELSE 1995 rp(il, i-1) = rp(il, i) + (cpd*(t(il,i)-t(il, & 1996 i-1))+gz(il,i)-gz(il,i-1))/lv(il, i) 1997 rp(il, i-1) = 0.5*(rp(il,i-1)+rr(il,i-1)) 1998 rp(il, i-1) = amin1(rp(il,i-1), rs(il,i-1)) 1999 rp(il, i-1) = amax1(rp(il,i-1), 0.0) 2000 afac1 = p(il, i)*(rs(il,i)-rp(il,i))/(1.0E4+2000.0*p(il,i)*rs(il,i) & 2001 ) 2002 afac2 = p(il, i-1)*(rs(il,i-1)-rp(il,i-1))/ & 2003 (1.0E4+2000.0*p(il,i-1)*rs(il,i-1)) 2004 afac = 0.5*(afac1+afac2) 2005 END IF 2006 IF (i==inb(il)) afac = 0.0 2007 afac = amax1(afac, 0.0) 2008 bfac = 1./(sigd*wt(il,i)) 2009 2010 ! jyg1 2011 ! cc sigt=1.0 2012 ! cc if(i.ge.icb)sigt=sigp(i) 2013 ! prise en compte de la variation progressive de sigt dans 2014 ! les couches icb et icb-1: 2015 ! pour plcl<ph(i+1), pr1=0 & pr2=1 2016 ! pour plcl>ph(i), pr1=1 & pr2=0 2017 ! pour ph(i+1)<plcl<ph(i), pr1 est la proportion a cheval 2018 ! sur le nuage, et pr2 est la proportion sous la base du 2019 ! nuage. 2020 pr1 = (plcl(il)-ph(il,i+1))/(ph(il,i)-ph(il,i+1)) 2021 pr1 = max(0., min(1.,pr1)) 2022 pr2 = (ph(il,i)-plcl(il))/(ph(il,i)-ph(il,i+1)) 2023 pr2 = max(0., min(1.,pr2)) 2024 sigt = sigp(il, i)*pr1 + pr2 2025 ! jyg2 2026 2027 b6 = bfac*50.*sigd*(ph(il,i)-ph(il,i+1))*sigt*afac 2028 c6 = water(il, i+1) + bfac*wdtrain(il) - 50.*sigd*bfac*(ph(il,i)-ph( & 2029 il,i+1))*evap(il, i+1) 2030 IF (c6>0.0) THEN 2031 revap = 0.5*(-b6+sqrt(b6*b6+4.*c6)) 2032 evap(il, i) = sigt*afac*revap 2033 water(il, i) = revap*revap 2034 ELSE 2035 evap(il, i) = -evap(il, i+1) + 0.02*(wdtrain(il)+sigd*wt(il,i)* & 2036 water(il,i+1))/(sigd*(ph(il,i)-ph(il,i+1))) 2037 END IF 2038 2039 ! *** calculate precipitating downdraft mass flux under *** 2040 ! *** hydrostatic approximation *** 2041 2042 IF (i/=1) THEN 2043 2044 tevap = amax1(0.0, evap(il,i)) 2045 delth = amax1(0.001, (th(il,i)-th(il,i-1))) 2046 IF (cvflag_grav) THEN 2047 mp(il, i) = 100.*ginv*lvcp(il, i)*sigd*tevap*(p(il,i-1)-p(il,i))/ & 2048 delth 2049 ELSE 2050 mp(il, i) = 10.*lvcp(il, i)*sigd*tevap*(p(il,i-1)-p(il,i))/delth 2051 END IF 2052 2053 ! *** if hydrostatic assumption fails, *** 2054 ! *** solve cubic difference equation for downdraft theta *** 2055 ! *** and mass flux from two simultaneous differential eqns *** 2056 2057 amfac = sigd*sigd*70.0*ph(il, i)*(p(il,i-1)-p(il,i))* & 2058 (th(il,i)-th(il,i-1))/(tv(il,i)*th(il,i)) 2059 amp2 = abs(mp(il,i+1)*mp(il,i+1)-mp(il,i)*mp(il,i)) 2060 IF (amp2>(0.1*amfac)) THEN 2061 xf = 100.0*sigd*sigd*sigd*(ph(il,i)-ph(il,i+1)) 2062 tf = b(il, i) - 5.0*(th(il,i)-th(il,i-1))*t(il, i)/(lvcp(il,i)* & 2063 sigd*th(il,i)) 2064 af = xf*tf + mp(il, i+1)*mp(il, i+1)*tinv 2065 bf = 2.*(tinv*mp(il,i+1))**3 + tinv*mp(il, i+1)*xf*tf + & 2066 50.*(p(il,i-1)-p(il,i))*xf*tevap 2067 fac2 = 1.0 2068 IF (bf<0.0) fac2 = -1.0 2069 bf = abs(bf) 2070 ur = 0.25*bf*bf - af*af*af*tinv*tinv*tinv 2071 IF (ur>=0.0) THEN 2072 sru = sqrt(ur) 2073 fac = 1.0 2074 IF ((0.5*bf-sru)<0.0) fac = -1.0 2075 mp(il, i) = mp(il, i+1)*tinv + (0.5*bf+sru)**tinv + & 2076 fac*(abs(0.5*bf-sru))**tinv 2077 ELSE 2078 d = atan(2.*sqrt(-ur)/(bf+1.0E-28)) 2079 IF (fac2<0.0) d = 3.14159 - d 2080 mp(il, i) = mp(il, i+1)*tinv + 2.*sqrt(af*tinv)*cos(d*tinv) 2081 END IF 2082 mp(il, i) = amax1(0.0, mp(il,i)) 2083 2084 IF (cvflag_grav) THEN 2085 ! jyg : il y a vraisemblablement une erreur dans la ligne 2 2086 ! suivante: 2087 ! il faut diviser par (mp(il,i)*sigd*grav) et non par 2088 ! (mp(il,i)+sigd*0.1). 2089 ! Et il faut bien revoir les facteurs 100. 2090 b(il, i-1) = b(il, i) + 100.0*(p(il,i-1)-p(il,i))*tevap/(mp(il, & 2091 i)+sigd*0.1) - 10.0*(th(il,i)-th(il,i-1))*t(il, i)/(lvcp(il,i & 2092 )*sigd*th(il,i)) 2093 ELSE 2094 b(il, i-1) = b(il, i) + 100.0*(p(il,i-1)-p(il,i))*tevap/(mp(il, & 2095 i)+sigd*0.1) - 10.0*(th(il,i)-th(il,i-1))*t(il, i)/(lvcp(il,i & 2096 )*sigd*th(il,i)) 2097 END IF 2098 b(il, i-1) = amax1(b(il,i-1), 0.0) 2099 END IF 2100 2101 ! *** limit magnitude of mp(i) to meet cfl condition 2102 ! *** 2103 2104 ampmax = 2.0*(ph(il,i)-ph(il,i+1))*delti 2105 amp2 = 2.0*(ph(il,i-1)-ph(il,i))*delti 2106 ampmax = amin1(ampmax, amp2) 2107 mp(il, i) = amin1(mp(il,i), ampmax) 2108 2109 ! *** force mp to decrease linearly to zero 2110 ! *** 2111 ! *** between cloud base and the surface 2112 ! *** 2113 2114 IF (p(il,i)>p(il,icb(il))) THEN 2115 mp(il, i) = mp(il, icb(il))*(p(il,1)-p(il,i))/ & 2116 (p(il,1)-p(il,icb(il))) 2117 END IF 2118 2119 END IF ! i.eq.1 2120 2121 ! *** find mixing ratio of precipitating downdraft *** 2122 2123 2124 IF (i/=inb(il)) THEN 2125 2126 rp(il, i) = rr(il, i) 2127 2128 IF (mp(il,i)>mp(il,i+1)) THEN 2129 2130 IF (cvflag_grav) THEN 2131 rp(il, i) = rp(il, i+1)*mp(il, i+1) + & 2132 rr(il, i)*(mp(il,i)-mp(il,i+1)) + 100.*ginv*0.5*sigd*(ph(il,i & 2133 )-ph(il,i+1))*(evap(il,i+1)+evap(il,i)) 2134 ELSE 2135 rp(il, i) = rp(il, i+1)*mp(il, i+1) + & 2136 rr(il, i)*(mp(il,i)-mp(il,i+1)) + 5.*sigd*(ph(il,i)-ph(il,i+1 & 2137 ))*(evap(il,i+1)+evap(il,i)) 2138 END IF 2139 rp(il, i) = rp(il, i)/mp(il, i) 2140 up(il, i) = up(il, i+1)*mp(il, i+1) + u(il, i)*(mp(il,i)-mp(il,i+ & 2141 1)) 2142 up(il, i) = up(il, i)/mp(il, i) 2143 vp(il, i) = vp(il, i+1)*mp(il, i+1) + v(il, i)*(mp(il,i)-mp(il,i+ & 2144 1)) 2145 vp(il, i) = vp(il, i)/mp(il, i) 2146 2147 ! do j=1,ntra 2148 ! trap(il,i,j)=trap(il,i+1,j)*mp(il,i+1) 2149 ! testmaf : +trap(il,i,j)*(mp(il,i)-mp(il,i+1)) 2150 ! : +tra(il,i,j)*(mp(il,i)-mp(il,i+1)) 2151 ! trap(il,i,j)=trap(il,i,j)/mp(il,i) 2152 ! end do 2153 2154 ELSE 2155 2156 IF (mp(il,i+1)>1.0E-16) THEN 2157 IF (cvflag_grav) THEN 2158 rp(il, i) = rp(il, i+1) + 100.*ginv*0.5*sigd*(ph(il,i)-ph(il, & 2159 i+1))*(evap(il,i+1)+evap(il,i))/mp(il, i+1) 2160 ELSE 2161 rp(il, i) = rp(il, i+1) + 5.*sigd*(ph(il,i)-ph(il,i+1))*(evap & 2162 (il,i+1)+evap(il,i))/mp(il, i+1) 2163 END IF 2164 up(il, i) = up(il, i+1) 2165 vp(il, i) = vp(il, i+1) 2166 2167 ! do j=1,ntra 2168 ! trap(il,i,j)=trap(il,i+1,j) 2169 ! end do 2170 2171 END IF 2172 END IF 2173 rp(il, i) = amin1(rp(il,i), rs(il,i)) 2174 rp(il, i) = amax1(rp(il,i), 0.0) 2175 2176 END IF 2177 END IF 2178 END DO 2179 2180 400 END DO 2181 2182 RETURN 2183 END SUBROUTINE cv30_unsat 2184 2185 SUBROUTINE cv30_yield(nloc, ncum, nd, na, ntra, icb, inb, delt, t, rr, u, v, & 2186 tra, gz, p, ph, h, hp, lv, cpn, th, ep, clw, m, tp, mp, rp, up, vp, trap, & 2187 wt, water, evap, b, ment, qent, uent, vent, nent, elij, traent, sig, tv, & 2188 tvp, iflag, precip, vprecip, ft, fr, fu, fv, ftra, upwd, dnwd, dnwd0, ma, & 2189 mike, tls, tps, qcondc, wd) 2190 USE cvflag_mod_h, ONLY: icvflag_Tpa, cvflag_grav, cvflag_ice, ok_optim_yield, ok_entrain, ok_homo_tend, & 2191 ok_convstop, ok_intermittent, cvflag_prec_eject, qsat_depends_on_qt, adiab_ascent_mass_flux_depends_on_ejectliq, keepbug_ice_frac 2192 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 2193 , clmci, eps, epsi, epsim1, ginv, hrd, grav 2194 IMPLICIT NONE 2195 2196 include "cv30param.h" 2197 include "conema3.h" 2198 2199 ! inputs: 2200 INTEGER ncum, nd, na, ntra, nloc 2201 INTEGER icb(nloc), inb(nloc) 2202 REAL delt 2203 REAL t(nloc, nd), rr(nloc, nd), u(nloc, nd), v(nloc, nd) 2204 REAL tra(nloc, nd, ntra), sig(nloc, nd) 2205 REAL gz(nloc, na), ph(nloc, nd+1), h(nloc, na), hp(nloc, na) 2206 REAL th(nloc, na), p(nloc, nd), tp(nloc, na) 2207 REAL lv(nloc, na), cpn(nloc, na), ep(nloc, na), clw(nloc, na) 2208 REAL m(nloc, na), mp(nloc, na), rp(nloc, na), up(nloc, na) 2209 REAL vp(nloc, na), wt(nloc, nd), trap(nloc, nd, ntra) 2210 REAL water(nloc, na), evap(nloc, na), b(nloc, na) 2211 REAL ment(nloc, na, na), qent(nloc, na, na), uent(nloc, na, na) 2212 ! ym real vent(nloc,na,na), nent(nloc,na), elij(nloc,na,na) 2213 REAL vent(nloc, na, na), elij(nloc, na, na) 2214 INTEGER nent(nloc, na) 2215 REAL traent(nloc, na, na, ntra) 2216 REAL tv(nloc, nd), tvp(nloc, nd) 2217 2218 ! input/output: 2219 INTEGER iflag(nloc) 2220 2221 ! outputs: 2222 REAL precip(nloc) 2223 REAL vprecip(nloc, nd+1) 2224 REAL ft(nloc, nd), fr(nloc, nd), fu(nloc, nd), fv(nloc, nd) 2225 REAL ftra(nloc, nd, ntra) 2226 REAL upwd(nloc, nd), dnwd(nloc, nd), ma(nloc, nd) 2227 REAL dnwd0(nloc, nd), mike(nloc, nd) 2228 REAL tls(nloc, nd), tps(nloc, nd) 2229 REAL qcondc(nloc, nd) ! cld 2230 REAL wd(nloc) ! gust 2231 2232 ! local variables: 2233 INTEGER i, k, il, n, j, num1 2234 REAL rat, awat, delti 2235 REAL ax, bx, cx, dx, ex 2236 REAL cpinv, rdcp, dpinv 2237 REAL lvcp(nloc, na), mke(nloc, na) 2238 REAL am(nloc), work(nloc), ad(nloc), amp1(nloc) 2239 ! !! real up1(nloc), dn1(nloc) 2240 REAL up1(nloc, nd, nd), dn1(nloc, nd, nd) 2241 REAL asum(nloc), bsum(nloc), csum(nloc), dsum(nloc) 2242 REAL qcond(nloc, nd), nqcond(nloc, nd), wa(nloc, nd) ! cld 2243 REAL siga(nloc, nd), sax(nloc, nd), mac(nloc, nd) ! cld 2244 2245 2246 ! ------------------------------------------------------------- 2247 2248 ! initialization: 2249 2250 delti = 1.0/delt 2251 2252 DO il = 1, ncum 2253 precip(il) = 0.0 2254 wd(il) = 0.0 ! gust 2255 vprecip(il, nd+1) = 0. 2256 END DO 2257 2258 DO i = 1, nd 2259 DO il = 1, ncum 2260 vprecip(il, i) = 0.0 2261 ft(il, i) = 0.0 2262 fr(il, i) = 0.0 2263 fu(il, i) = 0.0 2264 fv(il, i) = 0.0 2265 qcondc(il, i) = 0.0 ! cld 2266 qcond(il, i) = 0.0 ! cld 2267 nqcond(il, i) = 0.0 ! cld 2268 END DO 2269 END DO 2270 2271 ! do j=1,ntra 2272 ! do i=1,nd 2273 ! do il=1,ncum 2274 ! ftra(il,i,j)=0.0 2275 ! enddo 2276 ! enddo 2277 ! enddo 2278 2279 DO i = 1, nl 2280 DO il = 1, ncum 2281 lvcp(il, i) = lv(il, i)/cpn(il, i) 2282 END DO 2283 END DO 2284 2285 2286 2287 ! *** calculate surface precipitation in mm/day *** 2288 2289 DO il = 1, ncum 2290 IF (ep(il,inb(il))>=0.0001) THEN 2291 IF (cvflag_grav) THEN 2292 precip(il) = wt(il, 1)*sigd*water(il, 1)*86400.*1000./(rowl*grav) 2293 ELSE 2294 precip(il) = wt(il, 1)*sigd*water(il, 1)*8640. 2295 END IF 2296 END IF 2297 END DO 2298 2299 ! *** CALCULATE VERTICAL PROFILE OF PRECIPITATIONs IN kg/m2/s === 2300 2301 ! MAF rajout pour lessivage 2302 DO k = 1, nl 2303 DO il = 1, ncum 2304 IF (k<=inb(il)) THEN 2305 IF (cvflag_grav) THEN 2306 vprecip(il, k) = wt(il, k)*sigd*water(il, k)/grav 2307 ELSE 2308 vprecip(il, k) = wt(il, k)*sigd*water(il, k)/10. 2309 END IF 2310 END IF 2311 END DO 2312 END DO 2313 2314 2315 ! *** Calculate downdraft velocity scale *** 2316 ! *** NE PAS UTILISER POUR L'INSTANT *** 2317 2318 ! ! do il=1,ncum 2319 ! ! wd(il)=betad*abs(mp(il,icb(il)))*0.01*rrd*t(il,icb(il)) 2320 ! ! : /(sigd*p(il,icb(il))) 2321 ! ! enddo 2322 2323 2324 ! *** calculate tendencies of lowest level potential temperature *** 2325 ! *** and mixing ratio *** 2326 2327 DO il = 1, ncum 2328 work(il) = 1.0/(ph(il,1)-ph(il,2)) 2329 am(il) = 0.0 2330 END DO 2331 2332 DO k = 2, nl 2333 DO il = 1, ncum 2334 IF (k<=inb(il)) THEN 2335 am(il) = am(il) + m(il, k) 2336 END IF 2337 END DO 2338 END DO 2339 2340 DO il = 1, ncum 2341 2342 ! convect3 if((0.1*dpinv*am).ge.delti)iflag(il)=4 2343 IF (cvflag_grav) THEN 2344 IF ((0.01*grav*work(il)*am(il))>=delti) iflag(il) = 1 !consist vect 2345 ft(il, 1) = 0.01*grav*work(il)*am(il)*(t(il,2)-t(il,1)+(gz(il,2)-gz(il, & 2346 1))/cpn(il,1)) 2347 ELSE 2348 IF ((0.1*work(il)*am(il))>=delti) iflag(il) = 1 !consistency vect 2349 ft(il, 1) = 0.1*work(il)*am(il)*(t(il,2)-t(il,1)+(gz(il,2)-gz(il, & 2350 1))/cpn(il,1)) 2351 END IF 2352 2353 ft(il, 1) = ft(il, 1) - 0.5*lvcp(il, 1)*sigd*(evap(il,1)+evap(il,2)) 2354 2355 IF (cvflag_grav) THEN 2356 ft(il, 1) = ft(il, 1) - 0.009*grav*sigd*mp(il, 2)*t(il, 1)*b(il, 1)* & 2357 work(il) 2358 ELSE 2359 ft(il, 1) = ft(il, 1) - 0.09*sigd*mp(il, 2)*t(il, 1)*b(il, 1)*work(il) 2360 END IF 2361 2362 ft(il, 1) = ft(il, 1) + 0.01*sigd*wt(il, 1)*(cl-cpd)*water(il, 2)*(t(il,2 & 2363 )-t(il,1))*work(il)/cpn(il, 1) 2364 2365 IF (cvflag_grav) THEN 2366 ! jyg1 Correction pour mieux conserver l'eau (conformite avec 2367 ! CONVECT4.3) 2368 ! (sb: pour l'instant, on ne fait que le chgt concernant grav, pas 2369 ! evap) 2370 fr(il, 1) = 0.01*grav*mp(il, 2)*(rp(il,2)-rr(il,1))*work(il) + & 2371 sigd*0.5*(evap(il,1)+evap(il,2)) 2372 ! +tard : +sigd*evap(il,1) 2373 2374 fr(il, 1) = fr(il, 1) + 0.01*grav*am(il)*(rr(il,2)-rr(il,1))*work(il) 2375 2376 fu(il, 1) = fu(il, 1) + 0.01*grav*work(il)*(mp(il,2)*(up(il,2)-u(il, & 2377 1))+am(il)*(u(il,2)-u(il,1))) 2378 fv(il, 1) = fv(il, 1) + 0.01*grav*work(il)*(mp(il,2)*(vp(il,2)-v(il, & 2379 1))+am(il)*(v(il,2)-v(il,1))) 2380 ELSE ! cvflag_grav 2381 fr(il, 1) = 0.1*mp(il, 2)*(rp(il,2)-rr(il,1))*work(il) + & 2382 sigd*0.5*(evap(il,1)+evap(il,2)) 2383 fr(il, 1) = fr(il, 1) + 0.1*am(il)*(rr(il,2)-rr(il,1))*work(il) 2384 fu(il, 1) = fu(il, 1) + 0.1*work(il)*(mp(il,2)*(up(il,2)-u(il, & 2385 1))+am(il)*(u(il,2)-u(il,1))) 2386 fv(il, 1) = fv(il, 1) + 0.1*work(il)*(mp(il,2)*(vp(il,2)-v(il, & 2387 1))+am(il)*(v(il,2)-v(il,1))) 2388 END IF ! cvflag_grav 2389 2390 END DO ! il 2391 2392 ! do j=1,ntra 2393 ! do il=1,ncum 2394 ! if (cvflag_grav) then 2395 ! ftra(il,1,j)=ftra(il,1,j)+0.01*grav*work(il) 2396 ! : *(mp(il,2)*(trap(il,2,j)-tra(il,1,j)) 2397 ! : +am(il)*(tra(il,2,j)-tra(il,1,j))) 2398 ! else 2399 ! ftra(il,1,j)=ftra(il,1,j)+0.1*work(il) 2400 ! : *(mp(il,2)*(trap(il,2,j)-tra(il,1,j)) 2401 ! : +am(il)*(tra(il,2,j)-tra(il,1,j))) 2402 ! endif 2403 ! enddo 2404 ! enddo 2405 2406 DO j = 2, nl 2407 DO il = 1, ncum 2408 IF (j<=inb(il)) THEN 2409 IF (cvflag_grav) THEN 2410 fr(il, 1) = fr(il, 1) + 0.01*grav*work(il)*ment(il, j, 1)*(qent(il, & 2411 j,1)-rr(il,1)) 2412 fu(il, 1) = fu(il, 1) + 0.01*grav*work(il)*ment(il, j, 1)*(uent(il, & 2413 j,1)-u(il,1)) 2414 fv(il, 1) = fv(il, 1) + 0.01*grav*work(il)*ment(il, j, 1)*(vent(il, & 2415 j,1)-v(il,1)) 2416 ELSE ! cvflag_grav 2417 fr(il, 1) = fr(il, 1) + 0.1*work(il)*ment(il, j, 1)*(qent(il,j,1)- & 2418 rr(il,1)) 2419 fu(il, 1) = fu(il, 1) + 0.1*work(il)*ment(il, j, 1)*(uent(il,j,1)-u & 2420 (il,1)) 2421 fv(il, 1) = fv(il, 1) + 0.1*work(il)*ment(il, j, 1)*(vent(il,j,1)-v & 2422 (il,1)) 2423 END IF ! cvflag_grav 2424 END IF ! j 2425 END DO 2426 END DO 2427 2428 ! do k=1,ntra 2429 ! do j=2,nl 2430 ! do il=1,ncum 2431 ! if (j.le.inb(il)) then 2432 2433 ! if (cvflag_grav) then 2434 ! ftra(il,1,k)=ftra(il,1,k)+0.01*grav*work(il)*ment(il,j,1) 2435 ! : *(traent(il,j,1,k)-tra(il,1,k)) 2436 ! else 2437 ! ftra(il,1,k)=ftra(il,1,k)+0.1*work(il)*ment(il,j,1) 2438 ! : *(traent(il,j,1,k)-tra(il,1,k)) 2439 ! endif 2440 2441 ! endif 2442 ! enddo 2443 ! enddo 2444 ! enddo 2445 2446 2447 ! *** calculate tendencies of potential temperature and mixing ratio *** 2448 ! *** at levels above the lowest level *** 2449 2450 ! *** first find the net saturated updraft and downdraft mass fluxes *** 2451 ! *** through each level *** 2452 2453 2454 DO i = 2, nl + 1 ! newvecto: mettre nl au lieu nl+1? 2455 2456 num1 = 0 2457 DO il = 1, ncum 2458 IF (i<=inb(il)) num1 = num1 + 1 2459 END DO 2460 IF (num1<=0) GO TO 500 2461 2462 CALL zilch(amp1, ncum) 2463 CALL zilch(ad, ncum) 2464 2465 DO k = i + 1, nl + 1 2466 DO il = 1, ncum 2467 IF (i<=inb(il) .AND. k<=(inb(il)+1)) THEN 2468 amp1(il) = amp1(il) + m(il, k) 2469 END IF 2470 END DO 2471 END DO 2472 2473 DO k = 1, i 2474 DO j = i + 1, nl + 1 1724 DO j = minorig, nl 2475 1725 DO il = 1, ncum 2476 IF (i<=inb(il) .AND. j<=(inb(il)+1)) THEN 2477 amp1(il) = amp1(il) + ment(il, k, j) 1726 IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. j>=(icb(& 1727 il) - 1) .AND. j<=inb(il)) THEN 1728 ment(il, i, j) = ment(il, i, j) * asij(il) 2478 1729 END IF 2479 1730 END DO 2480 1731 END DO 2481 END DO 2482 2483 DO k = 1, i - 1 2484 DO j = i, nl + 1 ! newvecto: nl au lieu nl+1? 1732 1733 DO j = minorig, nl 2485 1734 DO il = 1, ncum 2486 IF (i<=inb(il) .AND. j<=inb(il)) THEN 2487 ad(il) = ad(il) + ment(il, j, k) 1735 IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. j>=(icb(& 1736 il) - 1) .AND. j<=inb(il)) THEN 1737 asum(il, i) = asum(il, i) + ment(il, i, j) 1738 ment(il, i, j) = ment(il, i, j) * sig(il, j) 1739 bsum(il, i) = bsum(il, i) + ment(il, i, j) 2488 1740 END IF 2489 1741 END DO 2490 1742 END DO 2491 END DO 2492 2493 DO il = 1, ncum 2494 IF (i<=inb(il)) THEN 2495 dpinv = 1.0/(ph(il,i)-ph(il,i+1)) 2496 cpinv = 1.0/cpn(il, i) 2497 2498 ! convect3 if((0.1*dpinv*amp1).ge.delti)iflag(il)=4 2499 IF (cvflag_grav) THEN 2500 IF ((0.01*grav*dpinv*amp1(il))>=delti) iflag(il) = 1 ! vecto 2501 ELSE 2502 IF ((0.1*dpinv*amp1(il))>=delti) iflag(il) = 1 ! vecto 1743 1744 DO il = 1, ncum 1745 IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il)) THEN 1746 bsum(il, i) = amax1(bsum(il, i), 1.0E-16) 1747 bsum(il, i) = 1.0 / bsum(il, i) 2503 1748 END IF 2504 2505 IF (cvflag_grav) THEN 2506 ft(il, i) = 0.01*grav*dpinv*(amp1(il)*(t(il,i+1)-t(il, & 2507 i)+(gz(il,i+1)-gz(il,i))*cpinv)-ad(il)*(t(il,i)-t(il, & 2508 i-1)+(gz(il,i)-gz(il,i-1))*cpinv)) - 0.5*sigd*lvcp(il, i)*(evap( & 2509 il,i)+evap(il,i+1)) 2510 rat = cpn(il, i-1)*cpinv 2511 ft(il, i) = ft(il, i) - 0.009*grav*sigd*(mp(il,i+1)*t(il,i)*b(il,i) & 2512 -mp(il,i)*t(il,i-1)*rat*b(il,i-1))*dpinv 2513 ft(il, i) = ft(il, i) + 0.01*grav*dpinv*ment(il, i, i)*(hp(il,i)-h( & 2514 il,i)+t(il,i)*(cpv-cpd)*(rr(il,i)-qent(il,i,i)))*cpinv 2515 ELSE ! cvflag_grav 2516 ft(il, i) = 0.1*dpinv*(amp1(il)*(t(il,i+1)-t(il, & 2517 i)+(gz(il,i+1)-gz(il,i))*cpinv)-ad(il)*(t(il,i)-t(il, & 2518 i-1)+(gz(il,i)-gz(il,i-1))*cpinv)) - 0.5*sigd*lvcp(il, i)*(evap( & 2519 il,i)+evap(il,i+1)) 2520 rat = cpn(il, i-1)*cpinv 2521 ft(il, i) = ft(il, i) - 0.09*sigd*(mp(il,i+1)*t(il,i)*b(il,i)-mp(il & 2522 ,i)*t(il,i-1)*rat*b(il,i-1))*dpinv 2523 ft(il, i) = ft(il, i) + 0.1*dpinv*ment(il, i, i)*(hp(il,i)-h(il,i)+ & 2524 t(il,i)*(cpv-cpd)*(rr(il,i)-qent(il,i,i)))*cpinv 2525 END IF ! cvflag_grav 2526 2527 2528 ft(il, i) = ft(il, i) + 0.01*sigd*wt(il, i)*(cl-cpd)*water(il, i+1)*( & 2529 t(il,i+1)-t(il,i))*dpinv*cpinv 2530 2531 IF (cvflag_grav) THEN 2532 fr(il, i) = 0.01*grav*dpinv*(amp1(il)*(rr(il,i+1)-rr(il, & 2533 i))-ad(il)*(rr(il,i)-rr(il,i-1))) 2534 fu(il, i) = fu(il, i) + 0.01*grav*dpinv*(amp1(il)*(u(il,i+1)-u(il, & 2535 i))-ad(il)*(u(il,i)-u(il,i-1))) 2536 fv(il, i) = fv(il, i) + 0.01*grav*dpinv*(amp1(il)*(v(il,i+1)-v(il, & 2537 i))-ad(il)*(v(il,i)-v(il,i-1))) 2538 ELSE ! cvflag_grav 2539 fr(il, i) = 0.1*dpinv*(amp1(il)*(rr(il,i+1)-rr(il, & 2540 i))-ad(il)*(rr(il,i)-rr(il,i-1))) 2541 fu(il, i) = fu(il, i) + 0.1*dpinv*(amp1(il)*(u(il,i+1)-u(il, & 2542 i))-ad(il)*(u(il,i)-u(il,i-1))) 2543 fv(il, i) = fv(il, i) + 0.1*dpinv*(amp1(il)*(v(il,i+1)-v(il, & 2544 i))-ad(il)*(v(il,i)-v(il,i-1))) 2545 END IF ! cvflag_grav 2546 2547 END IF ! i 1749 END DO 1750 1751 DO j = minorig, nl 1752 DO il = 1, ncum 1753 IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. j>=(icb(& 1754 il) - 1) .AND. j<=inb(il)) THEN 1755 ment(il, i, j) = ment(il, i, j) * asum(il, i) * bsum(il, i) 1756 END IF 1757 END DO 1758 END DO 1759 1760 DO j = minorig, nl 1761 DO il = 1, ncum 1762 IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. j>=(icb(& 1763 il) - 1) .AND. j<=inb(il)) THEN 1764 csum(il, i) = csum(il, i) + ment(il, i, j) 1765 END IF 1766 END DO 1767 END DO 1768 1769 DO il = 1, ncum 1770 IF (i>=icb(il) .AND. i<=inb(il) .AND. lwork(il) .AND. & 1771 csum(il, i)<m(il, i)) THEN 1772 nent(il, i) = 0 1773 ment(il, i, i) = m(il, i) 1774 qent(il, i, i) = rr(il, 1) - ep(il, i) * clw(il, i) 1775 uent(il, i, i) = u(il, nk(il)) 1776 vent(il, i, i) = v(il, nk(il)) 1777 elij(il, i, i) = clw(il, i) 1778 ! MAF sij(il,i,i)=1.0 1779 sij(il, i, i) = 0.0 1780 END IF 1781 END DO ! il 1782 1783 ! do j=1,ntra 1784 ! do il=1,ncum 1785 ! if ( i.ge.icb(il) .AND. i.le.inb(il) .AND. lwork(il) 1786 ! : .AND. csum(il,i).lt.m(il,i) ) THEN 1787 ! traent(il,i,i,j)=tra(il,nk(il),j) 1788 ! END IF 1789 ! enddo 1790 ! enddo 1791 789 END DO 1792 1793 ! MAF: renormalisation de MENT 1794 DO jm = 1, nd 1795 DO im = 1, nd 1796 DO il = 1, ncum 1797 zm(il, im) = zm(il, im) + (1. - sij(il, im, jm)) * ment(il, im, jm) 1798 END DO 1799 END DO 1800 END DO 1801 1802 DO jm = 1, nd 1803 DO im = 1, nd 1804 DO il = 1, ncum 1805 IF (zm(il, im)/=0.) THEN 1806 ment(il, im, jm) = ment(il, im, jm) * m(il, im) / zm(il, im) 1807 END IF 1808 END DO 1809 END DO 1810 END DO 1811 1812 DO jm = 1, nd 1813 DO im = 1, nd 1814 DO il = 1, ncum 1815 qents(il, im, jm) = qent(il, im, jm) 1816 ments(il, im, jm) = ment(il, im, jm) 1817 END DO 1818 END DO 1819 END DO 1820 1821 END SUBROUTINE cv30_mixing 1822 1823 1824 SUBROUTINE cv30_unsat(nloc, ncum, nd, na, ntra, icb, inb, t, rr, rs, gz, u, & 1825 v, tra, p, ph, th, tv, lv, cpn, ep, sigp, clw, m, ment, elij, delt, plcl, & 1826 mp, rp, up, vp, trap, wt, water, evap, b & ! RomP-jyg 1827 , wdtraina, wdtrainm) ! 26/08/10 RomP-jyg 1828 USE cvflag_mod_h 1829 USE cvthermo_mod_h 1830 1831 IMPLICIT NONE 1832 1833 1834 1835 ! inputs: 1836 INTEGER ncum, nd, na, ntra, nloc 1837 INTEGER icb(nloc), inb(nloc) 1838 REAL delt, plcl(nloc) 1839 REAL t(nloc, nd), rr(nloc, nd), rs(nloc, nd) 1840 REAL u(nloc, nd), v(nloc, nd) 1841 REAL tra(nloc, nd, ntra) 1842 REAL p(nloc, nd), ph(nloc, nd + 1) 1843 REAL th(nloc, na), gz(nloc, na) 1844 REAL lv(nloc, na), ep(nloc, na), sigp(nloc, na), clw(nloc, na) 1845 REAL cpn(nloc, na), tv(nloc, na) 1846 REAL m(nloc, na), ment(nloc, na, na), elij(nloc, na, na) 1847 1848 ! outputs: 1849 REAL mp(nloc, na), rp(nloc, na), up(nloc, na), vp(nloc, na) 1850 REAL water(nloc, na), evap(nloc, na), wt(nloc, na) 1851 REAL trap(nloc, na, ntra) 1852 REAL b(nloc, na) 1853 ! 25/08/10 - RomP---- ajout des masses precipitantes ejectees 1854 ! lascendance adiabatique et des flux melanges Pa et Pm. 1855 ! Distinction des wdtrain 1856 ! Pa = wdtrainA Pm = wdtrainM 1857 REAL wdtraina(nloc, na), wdtrainm(nloc, na) 1858 1859 ! local variables 1860 INTEGER i, j, k, il, num1 1861 REAL tinv, delti 1862 REAL awat, afac, afac1, afac2, bfac 1863 REAL pr1, pr2, sigt, b6, c6, revap, tevap, delth 1864 REAL amfac, amp2, xf, tf, fac2, ur, sru, fac, d, af, bf 1865 REAL ampmax 1866 REAL lvcp(nloc, na) 1867 REAL wdtrain(nloc) 1868 LOGICAL lwork(nloc) 1869 1870 1871 ! ------------------------------------------------------ 1872 1873 delti = 1. / delt 1874 tinv = 1. / 3. 1875 1876 mp(:, :) = 0. 1877 1878 DO i = 1, nl 1879 DO il = 1, ncum 1880 mp(il, i) = 0.0 1881 rp(il, i) = rr(il, i) 1882 up(il, i) = u(il, i) 1883 vp(il, i) = v(il, i) 1884 wt(il, i) = 0.001 1885 water(il, i) = 0.0 1886 evap(il, i) = 0.0 1887 b(il, i) = 0.0 1888 lvcp(il, i) = lv(il, i) / cpn(il, i) 1889 END DO 2548 1890 END DO 2549 1891 2550 1892 ! do k=1,ntra 1893 ! do i=1,nd 2551 1894 ! do il=1,ncum 2552 ! if (i.le.inb(il)) then 2553 ! dpinv=1.0/(ph(il,i)-ph(il,i+1)) 2554 ! cpinv=1.0/cpn(il,i) 2555 ! if (cvflag_grav) then 2556 ! ftra(il,i,k)=ftra(il,i,k)+0.01*grav*dpinv 2557 ! : *(amp1(il)*(tra(il,i+1,k)-tra(il,i,k)) 2558 ! : -ad(il)*(tra(il,i,k)-tra(il,i-1,k))) 2559 ! else 2560 ! ftra(il,i,k)=ftra(il,i,k)+0.1*dpinv 2561 ! : *(amp1(il)*(tra(il,i+1,k)-tra(il,i,k)) 2562 ! : -ad(il)*(tra(il,i,k)-tra(il,i-1,k))) 2563 ! endif 2564 ! endif 2565 ! enddo 2566 ! enddo 2567 2568 DO k = 1, i - 1 2569 DO il = 1, ncum 2570 IF (i<=inb(il)) THEN 2571 dpinv = 1.0/(ph(il,i)-ph(il,i+1)) 2572 cpinv = 1.0/cpn(il, i) 2573 2574 awat = elij(il, k, i) - (1.-ep(il,i))*clw(il, i) 2575 awat = amax1(awat, 0.0) 2576 2577 IF (cvflag_grav) THEN 2578 fr(il, i) = fr(il, i) + 0.01*grav*dpinv*ment(il, k, i)*(qent(il,k & 2579 ,i)-awat-rr(il,i)) 2580 fu(il, i) = fu(il, i) + 0.01*grav*dpinv*ment(il, k, i)*(uent(il,k & 2581 ,i)-u(il,i)) 2582 fv(il, i) = fv(il, i) + 0.01*grav*dpinv*ment(il, k, i)*(vent(il,k & 2583 ,i)-v(il,i)) 2584 ELSE ! cvflag_grav 2585 fr(il, i) = fr(il, i) + 0.1*dpinv*ment(il, k, i)*(qent(il,k,i)- & 2586 awat-rr(il,i)) 2587 fu(il, i) = fu(il, i) + 0.01*grav*dpinv*ment(il, k, i)*(uent(il,k & 2588 ,i)-u(il,i)) 2589 fv(il, i) = fv(il, i) + 0.1*dpinv*ment(il, k, i)*(vent(il,k,i)-v( & 2590 il,i)) 2591 END IF ! cvflag_grav 2592 2593 ! (saturated updrafts resulting from mixing) ! cld 2594 qcond(il, i) = qcond(il, i) + (elij(il,k,i)-awat) ! cld 2595 nqcond(il, i) = nqcond(il, i) + 1. ! cld 2596 END IF ! i 2597 END DO 2598 END DO 2599 2600 ! do j=1,ntra 2601 ! do k=1,i-1 2602 ! do il=1,ncum 2603 ! if (i.le.inb(il)) then 2604 ! dpinv=1.0/(ph(il,i)-ph(il,i+1)) 2605 ! cpinv=1.0/cpn(il,i) 2606 ! if (cvflag_grav) then 2607 ! ftra(il,i,j)=ftra(il,i,j)+0.01*grav*dpinv*ment(il,k,i) 2608 ! : *(traent(il,k,i,j)-tra(il,i,j)) 2609 ! else 2610 ! ftra(il,i,j)=ftra(il,i,j)+0.1*dpinv*ment(il,k,i) 2611 ! : *(traent(il,k,i,j)-tra(il,i,j)) 2612 ! endif 2613 ! endif 1895 ! trap(il,i,k)=tra(il,i,k) 2614 1896 ! enddo 2615 1897 ! enddo 2616 1898 ! enddo 2617 2618 DO k = i, nl + 11899 ! RomP >>> 1900 DO i = 1, nd 2619 1901 DO il = 1, ncum 2620 IF (i<=inb(il) .AND. k<=inb(il)) THEN 2621 dpinv = 1.0/(ph(il,i)-ph(il,i+1)) 2622 cpinv = 1.0/cpn(il, i) 2623 1902 wdtraina(il, i) = 0.0 1903 wdtrainm(il, i) = 0.0 1904 END DO 1905 END DO 1906 ! RomP <<< 1907 1908 ! *** check whether ep(inb)=0, if so, skip precipitating *** 1909 ! *** downdraft calculation *** 1910 1911 DO il = 1, ncum 1912 lwork(il) = .TRUE. 1913 IF (ep(il, inb(il))<0.0001) lwork(il) = .FALSE. 1914 END DO 1915 1916 CALL zilch(wdtrain, ncum) 1917 1918 DO i = nl + 1, 1, -1 1919 1920 num1 = 0 1921 DO il = 1, ncum 1922 IF (i<=inb(il) .AND. lwork(il)) num1 = num1 + 1 1923 END DO 1924 IF (num1<=0) GO TO 400 1925 1926 1927 ! *** integrate liquid water equation to find condensed water *** 1928 ! *** and condensed water flux *** 1929 1930 1931 1932 ! *** begin downdraft loop *** 1933 1934 1935 1936 ! *** calculate detrained precipitation *** 1937 1938 DO il = 1, ncum 1939 IF (i<=inb(il) .AND. lwork(il)) THEN 2624 1940 IF (cvflag_grav) THEN 2625 fr(il, i) = fr(il, i) + 0.01*grav*dpinv*ment(il, k, i)*(qent(il,k & 2626 ,i)-rr(il,i)) 2627 fu(il, i) = fu(il, i) + 0.01*grav*dpinv*ment(il, k, i)*(uent(il,k & 2628 ,i)-u(il,i)) 2629 fv(il, i) = fv(il, i) + 0.01*grav*dpinv*ment(il, k, i)*(vent(il,k & 2630 ,i)-v(il,i)) 2631 ELSE ! cvflag_grav 2632 fr(il, i) = fr(il, i) + 0.1*dpinv*ment(il, k, i)*(qent(il,k,i)-rr & 2633 (il,i)) 2634 fu(il, i) = fu(il, i) + 0.1*dpinv*ment(il, k, i)*(uent(il,k,i)-u( & 2635 il,i)) 2636 fv(il, i) = fv(il, i) + 0.1*dpinv*ment(il, k, i)*(vent(il,k,i)-v( & 2637 il,i)) 2638 END IF ! cvflag_grav 2639 END IF ! i and k 1941 wdtrain(il) = grav * ep(il, i) * m(il, i) * clw(il, i) 1942 wdtraina(il, i) = wdtrain(il) / grav ! Pa 26/08/10 RomP 1943 ELSE 1944 wdtrain(il) = 10.0 * ep(il, i) * m(il, i) * clw(il, i) 1945 wdtraina(il, i) = wdtrain(il) / 10. ! Pa 26/08/10 RomP 1946 END IF 1947 END IF 1948 END DO 1949 1950 IF (i>1) THEN 1951 1952 DO j = 1, i - 1 1953 DO il = 1, ncum 1954 IF (i<=inb(il) .AND. lwork(il)) THEN 1955 awat = elij(il, j, i) - (1. - ep(il, i)) * clw(il, i) 1956 awat = amax1(awat, 0.0) 1957 IF (cvflag_grav) THEN 1958 wdtrain(il) = wdtrain(il) + grav * awat * ment(il, j, i) 1959 ELSE 1960 wdtrain(il) = wdtrain(il) + 10.0 * awat * ment(il, j, i) 1961 END IF 1962 END IF 1963 END DO 1964 END DO 1965 DO il = 1, ncum 1966 IF (cvflag_grav) THEN 1967 wdtrainm(il, i) = wdtrain(il) / grav - wdtraina(il, i) ! Pm 26/08/10 RomP 1968 ELSE 1969 wdtrainm(il, i) = wdtrain(il) / 10. - wdtraina(il, i) ! Pm 26/08/10 RomP 1970 END IF 1971 END DO 1972 1973 END IF 1974 1975 1976 ! *** find rain water and evaporation using provisional *** 1977 ! *** estimates of rp(i)and rp(i-1) *** 1978 1979 DO il = 1, ncum 1980 1981 IF (i<=inb(il) .AND. lwork(il)) THEN 1982 1983 wt(il, i) = 45.0 1984 1985 IF (i<inb(il)) THEN 1986 rp(il, i) = rp(il, i + 1) + (cpd * (t(il, i + 1) - t(il, & 1987 i)) + gz(il, i + 1) - gz(il, i)) / lv(il, i) 1988 rp(il, i) = 0.5 * (rp(il, i) + rr(il, i)) 1989 END IF 1990 rp(il, i) = amax1(rp(il, i), 0.0) 1991 rp(il, i) = amin1(rp(il, i), rs(il, i)) 1992 rp(il, inb(il)) = rr(il, inb(il)) 1993 1994 IF (i==1) THEN 1995 afac = p(il, 1) * (rs(il, 1) - rp(il, 1)) / (1.0E4 + 2000.0 * p(il, 1) * rs(il, 1)) 1996 ELSE 1997 rp(il, i - 1) = rp(il, i) + (cpd * (t(il, i) - t(il, & 1998 i - 1)) + gz(il, i) - gz(il, i - 1)) / lv(il, i) 1999 rp(il, i - 1) = 0.5 * (rp(il, i - 1) + rr(il, i - 1)) 2000 rp(il, i - 1) = amin1(rp(il, i - 1), rs(il, i - 1)) 2001 rp(il, i - 1) = amax1(rp(il, i - 1), 0.0) 2002 afac1 = p(il, i) * (rs(il, i) - rp(il, i)) / (1.0E4 + 2000.0 * p(il, i) * rs(il, i) & 2003 ) 2004 afac2 = p(il, i - 1) * (rs(il, i - 1) - rp(il, i - 1)) / & 2005 (1.0E4 + 2000.0 * p(il, i - 1) * rs(il, i - 1)) 2006 afac = 0.5 * (afac1 + afac2) 2007 END IF 2008 IF (i==inb(il)) afac = 0.0 2009 afac = amax1(afac, 0.0) 2010 bfac = 1. / (sigd * wt(il, i)) 2011 2012 ! jyg1 2013 ! cc sigt=1.0 2014 ! cc IF(i.ge.icb)sigt=sigp(i) 2015 ! prise en compte de la variation progressive de sigt dans 2016 ! les couches icb et icb-1: 2017 ! pour plcl<ph(i+1), pr1=0 & pr2=1 2018 ! pour plcl>ph(i), pr1=1 & pr2=0 2019 ! pour ph(i+1)<plcl<ph(i), pr1 est la proportion a cheval 2020 ! sur le nuage, et pr2 est la proportion sous la base du 2021 ! nuage. 2022 pr1 = (plcl(il) - ph(il, i + 1)) / (ph(il, i) - ph(il, i + 1)) 2023 pr1 = max(0., min(1., pr1)) 2024 pr2 = (ph(il, i) - plcl(il)) / (ph(il, i) - ph(il, i + 1)) 2025 pr2 = max(0., min(1., pr2)) 2026 sigt = sigp(il, i) * pr1 + pr2 2027 ! jyg2 2028 2029 b6 = bfac * 50. * sigd * (ph(il, i) - ph(il, i + 1)) * sigt * afac 2030 c6 = water(il, i + 1) + bfac * wdtrain(il) - 50. * sigd * bfac * (ph(il, i) - ph(& 2031 il, i + 1)) * evap(il, i + 1) 2032 IF (c6>0.0) THEN 2033 revap = 0.5 * (-b6 + sqrt(b6 * b6 + 4. * c6)) 2034 evap(il, i) = sigt * afac * revap 2035 water(il, i) = revap * revap 2036 ELSE 2037 evap(il, i) = -evap(il, i + 1) + 0.02 * (wdtrain(il) + sigd * wt(il, i) * & 2038 water(il, i + 1)) / (sigd * (ph(il, i) - ph(il, i + 1))) 2039 END IF 2040 2041 ! *** calculate precipitating downdraft mass flux under *** 2042 ! *** hydrostatic approximation *** 2043 2044 IF (i/=1) THEN 2045 2046 tevap = amax1(0.0, evap(il, i)) 2047 delth = amax1(0.001, (th(il, i) - th(il, i - 1))) 2048 IF (cvflag_grav) THEN 2049 mp(il, i) = 100. * ginv * lvcp(il, i) * sigd * tevap * (p(il, i - 1) - p(il, i)) / & 2050 delth 2051 ELSE 2052 mp(il, i) = 10. * lvcp(il, i) * sigd * tevap * (p(il, i - 1) - p(il, i)) / delth 2053 END IF 2054 2055 ! *** if hydrostatic assumption fails, *** 2056 ! *** solve cubic difference equation for downdraft theta *** 2057 ! *** and mass flux from two simultaneous differential eqns *** 2058 2059 amfac = sigd * sigd * 70.0 * ph(il, i) * (p(il, i - 1) - p(il, i)) * & 2060 (th(il, i) - th(il, i - 1)) / (tv(il, i) * th(il, i)) 2061 amp2 = abs(mp(il, i + 1) * mp(il, i + 1) - mp(il, i) * mp(il, i)) 2062 IF (amp2>(0.1 * amfac)) THEN 2063 xf = 100.0 * sigd * sigd * sigd * (ph(il, i) - ph(il, i + 1)) 2064 tf = b(il, i) - 5.0 * (th(il, i) - th(il, i - 1)) * t(il, i) / (lvcp(il, i) * & 2065 sigd * th(il, i)) 2066 af = xf * tf + mp(il, i + 1) * mp(il, i + 1) * tinv 2067 bf = 2. * (tinv * mp(il, i + 1))**3 + tinv * mp(il, i + 1) * xf * tf + & 2068 50. * (p(il, i - 1) - p(il, i)) * xf * tevap 2069 fac2 = 1.0 2070 IF (bf<0.0) fac2 = -1.0 2071 bf = abs(bf) 2072 ur = 0.25 * bf * bf - af * af * af * tinv * tinv * tinv 2073 IF (ur>=0.0) THEN 2074 sru = sqrt(ur) 2075 fac = 1.0 2076 IF ((0.5 * bf - sru)<0.0) fac = -1.0 2077 mp(il, i) = mp(il, i + 1) * tinv + (0.5 * bf + sru)**tinv + & 2078 fac * (abs(0.5 * bf - sru))**tinv 2079 ELSE 2080 d = atan(2. * sqrt(-ur) / (bf + 1.0E-28)) 2081 IF (fac2<0.0) d = 3.14159 - d 2082 mp(il, i) = mp(il, i + 1) * tinv + 2. * sqrt(af * tinv) * cos(d * tinv) 2083 END IF 2084 mp(il, i) = amax1(0.0, mp(il, i)) 2085 2086 IF (cvflag_grav) THEN 2087 ! jyg : il y a vraisemblablement une erreur dans la ligne 2 2088 ! suivante: 2089 ! il faut diviser par (mp(il,i)*sigd*grav) et non par 2090 ! (mp(il,i)+sigd*0.1). 2091 ! Et il faut bien revoir les facteurs 100. 2092 b(il, i - 1) = b(il, i) + 100.0 * (p(il, i - 1) - p(il, i)) * tevap / (mp(il, & 2093 i) + sigd * 0.1) - 10.0 * (th(il, i) - th(il, i - 1)) * t(il, i) / (lvcp(il, i & 2094 ) * sigd * th(il, i)) 2095 ELSE 2096 b(il, i - 1) = b(il, i) + 100.0 * (p(il, i - 1) - p(il, i)) * tevap / (mp(il, & 2097 i) + sigd * 0.1) - 10.0 * (th(il, i) - th(il, i - 1)) * t(il, i) / (lvcp(il, i & 2098 ) * sigd * th(il, i)) 2099 END IF 2100 b(il, i - 1) = amax1(b(il, i - 1), 0.0) 2101 END IF 2102 2103 ! *** limit magnitude of mp(i) to meet cfl condition 2104 ! *** 2105 2106 ampmax = 2.0 * (ph(il, i) - ph(il, i + 1)) * delti 2107 amp2 = 2.0 * (ph(il, i - 1) - ph(il, i)) * delti 2108 ampmax = amin1(ampmax, amp2) 2109 mp(il, i) = amin1(mp(il, i), ampmax) 2110 2111 ! *** force mp to decrease linearly to zero 2112 ! *** 2113 ! *** between cloud base and the surface 2114 ! *** 2115 2116 IF (p(il, i)>p(il, icb(il))) THEN 2117 mp(il, i) = mp(il, icb(il)) * (p(il, 1) - p(il, i)) / & 2118 (p(il, 1) - p(il, icb(il))) 2119 END IF 2120 2121 END IF ! i.EQ.1 2122 2123 ! *** find mixing ratio of precipitating downdraft *** 2124 2125 IF (i/=inb(il)) THEN 2126 2127 rp(il, i) = rr(il, i) 2128 2129 IF (mp(il, i)>mp(il, i + 1)) THEN 2130 2131 IF (cvflag_grav) THEN 2132 rp(il, i) = rp(il, i + 1) * mp(il, i + 1) + & 2133 rr(il, i) * (mp(il, i) - mp(il, i + 1)) + 100. * ginv * 0.5 * sigd * (ph(il, i & 2134 ) - ph(il, i + 1)) * (evap(il, i + 1) + evap(il, i)) 2135 ELSE 2136 rp(il, i) = rp(il, i + 1) * mp(il, i + 1) + & 2137 rr(il, i) * (mp(il, i) - mp(il, i + 1)) + 5. * sigd * (ph(il, i) - ph(il, i + 1 & 2138 )) * (evap(il, i + 1) + evap(il, i)) 2139 END IF 2140 rp(il, i) = rp(il, i) / mp(il, i) 2141 up(il, i) = up(il, i + 1) * mp(il, i + 1) + u(il, i) * (mp(il, i) - mp(il, i + & 2142 1)) 2143 up(il, i) = up(il, i) / mp(il, i) 2144 vp(il, i) = vp(il, i + 1) * mp(il, i + 1) + v(il, i) * (mp(il, i) - mp(il, i + & 2145 1)) 2146 vp(il, i) = vp(il, i) / mp(il, i) 2147 2148 ! do j=1,ntra 2149 ! trap(il,i,j)=trap(il,i+1,j)*mp(il,i+1) 2150 ! testmaf : +trap(il,i,j)*(mp(il,i)-mp(il,i+1)) 2151 ! : +tra(il,i,j)*(mp(il,i)-mp(il,i+1)) 2152 ! trap(il,i,j)=trap(il,i,j)/mp(il,i) 2153 ! END DO 2154 2155 ELSE 2156 2157 IF (mp(il, i + 1)>1.0E-16) THEN 2158 IF (cvflag_grav) THEN 2159 rp(il, i) = rp(il, i + 1) + 100. * ginv * 0.5 * sigd * (ph(il, i) - ph(il, & 2160 i + 1)) * (evap(il, i + 1) + evap(il, i)) / mp(il, i + 1) 2161 ELSE 2162 rp(il, i) = rp(il, i + 1) + 5. * sigd * (ph(il, i) - ph(il, i + 1)) * (evap & 2163 (il, i + 1) + evap(il, i)) / mp(il, i + 1) 2164 END IF 2165 up(il, i) = up(il, i + 1) 2166 vp(il, i) = vp(il, i + 1) 2167 2168 ! do j=1,ntra 2169 ! trap(il,i,j)=trap(il,i+1,j) 2170 ! END DO 2171 2172 END IF 2173 END IF 2174 rp(il, i) = amin1(rp(il, i), rs(il, i)) 2175 rp(il, i) = amax1(rp(il, i), 0.0) 2176 2177 END IF 2178 END IF 2179 END DO 2180 2181 400 END DO 2182 2183 END SUBROUTINE cv30_unsat 2184 2185 SUBROUTINE cv30_yield(nloc, ncum, nd, na, ntra, icb, inb, delt, t, rr, u, v, & 2186 tra, gz, p, ph, h, hp, lv, cpn, th, ep, clw, m, tp, mp, rp, up, vp, trap, & 2187 wt, water, evap, b, ment, qent, uent, vent, nent, elij, traent, sig, tv, & 2188 tvp, iflag, precip, vprecip, ft, fr, fu, fv, ftra, upwd, dnwd, dnwd0, ma, & 2189 mike, tls, tps, qcondc, wd) 2190 USE conema3_mod_h 2191 USE cvflag_mod_h 2192 USE cvthermo_mod_h 2193 2194 IMPLICIT NONE 2195 2196 ! inputs: 2197 INTEGER ncum, nd, na, ntra, nloc 2198 INTEGER icb(nloc), inb(nloc) 2199 REAL delt 2200 REAL t(nloc, nd), rr(nloc, nd), u(nloc, nd), v(nloc, nd) 2201 REAL tra(nloc, nd, ntra), sig(nloc, nd) 2202 REAL gz(nloc, na), ph(nloc, nd + 1), h(nloc, na), hp(nloc, na) 2203 REAL th(nloc, na), p(nloc, nd), tp(nloc, na) 2204 REAL lv(nloc, na), cpn(nloc, na), ep(nloc, na), clw(nloc, na) 2205 REAL m(nloc, na), mp(nloc, na), rp(nloc, na), up(nloc, na) 2206 REAL vp(nloc, na), wt(nloc, nd), trap(nloc, nd, ntra) 2207 REAL water(nloc, na), evap(nloc, na), b(nloc, na) 2208 REAL ment(nloc, na, na), qent(nloc, na, na), uent(nloc, na, na) 2209 ! ym real vent(nloc,na,na), nent(nloc,na), elij(nloc,na,na) 2210 REAL vent(nloc, na, na), elij(nloc, na, na) 2211 INTEGER nent(nloc, na) 2212 REAL traent(nloc, na, na, ntra) 2213 REAL tv(nloc, nd), tvp(nloc, nd) 2214 2215 ! input/output: 2216 INTEGER iflag(nloc) 2217 2218 ! outputs: 2219 REAL precip(nloc) 2220 REAL vprecip(nloc, nd + 1) 2221 REAL ft(nloc, nd), fr(nloc, nd), fu(nloc, nd), fv(nloc, nd) 2222 REAL ftra(nloc, nd, ntra) 2223 REAL upwd(nloc, nd), dnwd(nloc, nd), ma(nloc, nd) 2224 REAL dnwd0(nloc, nd), mike(nloc, nd) 2225 REAL tls(nloc, nd), tps(nloc, nd) 2226 REAL qcondc(nloc, nd) ! cld 2227 REAL wd(nloc) ! gust 2228 2229 ! local variables: 2230 INTEGER i, k, il, n, j, num1 2231 REAL rat, awat, delti 2232 REAL ax, bx, cx, dx, ex 2233 REAL cpinv, rdcp, dpinv 2234 REAL lvcp(nloc, na), mke(nloc, na) 2235 REAL am(nloc), work(nloc), ad(nloc), amp1(nloc) 2236 ! !! real up1(nloc), dn1(nloc) 2237 REAL up1(nloc, nd, nd), dn1(nloc, nd, nd) 2238 REAL asum(nloc), bsum(nloc), csum(nloc), dsum(nloc) 2239 REAL qcond(nloc, nd), nqcond(nloc, nd), wa(nloc, nd) ! cld 2240 REAL siga(nloc, nd), sax(nloc, nd), mac(nloc, nd) ! cld 2241 2242 2243 ! ------------------------------------------------------------- 2244 2245 ! initialization: 2246 2247 delti = 1.0 / delt 2248 2249 DO il = 1, ncum 2250 precip(il) = 0.0 2251 wd(il) = 0.0 ! gust 2252 vprecip(il, nd + 1) = 0. 2253 END DO 2254 2255 DO i = 1, nd 2256 DO il = 1, ncum 2257 vprecip(il, i) = 0.0 2258 ft(il, i) = 0.0 2259 fr(il, i) = 0.0 2260 fu(il, i) = 0.0 2261 fv(il, i) = 0.0 2262 qcondc(il, i) = 0.0 ! cld 2263 qcond(il, i) = 0.0 ! cld 2264 nqcond(il, i) = 0.0 ! cld 2640 2265 END DO 2641 2266 END DO 2642 2267 2643 2268 ! do j=1,ntra 2644 ! do k=i,nl+12269 ! do i=1,nd 2645 2270 ! do il=1,ncum 2646 ! if (i.le.inb(il) .and. k.le.inb(il)) then 2647 ! dpinv=1.0/(ph(il,i)-ph(il,i+1)) 2648 ! cpinv=1.0/cpn(il,i) 2649 ! if (cvflag_grav) then 2650 ! ftra(il,i,j)=ftra(il,i,j)+0.01*grav*dpinv*ment(il,k,i) 2651 ! : *(traent(il,k,i,j)-tra(il,i,j)) 2652 ! else 2653 ! ftra(il,i,j)=ftra(il,i,j)+0.1*dpinv*ment(il,k,i) 2654 ! : *(traent(il,k,i,j)-tra(il,i,j)) 2655 ! endif 2656 ! endif ! i and k 2271 ! ftra(il,i,j)=0.0 2657 2272 ! enddo 2658 2273 ! enddo 2659 2274 ! enddo 2660 2275 2276 DO i = 1, nl 2277 DO il = 1, ncum 2278 lvcp(il, i) = lv(il, i) / cpn(il, i) 2279 END DO 2280 END DO 2281 2282 2283 2284 ! *** calculate surface precipitation in mm/day *** 2285 2661 2286 DO il = 1, ncum 2662 IF (i<=inb(il)) THEN 2663 dpinv = 1.0/(ph(il,i)-ph(il,i+1)) 2664 cpinv = 1.0/cpn(il, i) 2665 2287 IF (ep(il, inb(il))>=0.0001) THEN 2666 2288 IF (cvflag_grav) THEN 2667 ! sb: on ne fait pas encore la correction permettant de mieux 2668 ! conserver l'eau: 2669 fr(il, i) = fr(il, i) + 0.5*sigd*(evap(il,i)+evap(il,i+1)) + & 2670 0.01*grav*(mp(il,i+1)*(rp(il,i+1)-rr(il,i))-mp(il,i)*(rp(il, & 2671 i)-rr(il,i-1)))*dpinv 2672 2673 fu(il, i) = fu(il, i) + 0.01*grav*(mp(il,i+1)*(up(il,i+1)-u(il, & 2674 i))-mp(il,i)*(up(il,i)-u(il,i-1)))*dpinv 2675 fv(il, i) = fv(il, i) + 0.01*grav*(mp(il,i+1)*(vp(il,i+1)-v(il, & 2676 i))-mp(il,i)*(vp(il,i)-v(il,i-1)))*dpinv 2677 ELSE ! cvflag_grav 2678 fr(il, i) = fr(il, i) + 0.5*sigd*(evap(il,i)+evap(il,i+1)) + & 2679 0.1*(mp(il,i+1)*(rp(il,i+1)-rr(il,i))-mp(il,i)*(rp(il,i)-rr(il, & 2680 i-1)))*dpinv 2681 fu(il, i) = fu(il, i) + 0.1*(mp(il,i+1)*(up(il,i+1)-u(il, & 2682 i))-mp(il,i)*(up(il,i)-u(il,i-1)))*dpinv 2683 fv(il, i) = fv(il, i) + 0.1*(mp(il,i+1)*(vp(il,i+1)-v(il, & 2684 i))-mp(il,i)*(vp(il,i)-v(il,i-1)))*dpinv 2685 END IF ! cvflag_grav 2686 2687 END IF ! i 2688 END DO 2689 2690 ! sb: interface with the cloud parameterization: ! cld 2691 2692 DO k = i + 1, nl 2289 precip(il) = wt(il, 1) * sigd * water(il, 1) * 86400. * 1000. / (rowl * grav) 2290 ELSE 2291 precip(il) = wt(il, 1) * sigd * water(il, 1) * 8640. 2292 END IF 2293 END IF 2294 END DO 2295 2296 ! *** CALCULATE VERTICAL PROFILE OF PRECIPITATIONs IN kg/m2/s === 2297 2298 ! MAF rajout pour lessivage 2299 DO k = 1, nl 2693 2300 DO il = 1, ncum 2694 IF (k<=inb(il) .AND. i<=inb(il)) THEN ! cld 2695 ! (saturated downdrafts resulting from mixing) ! cld 2696 qcond(il, i) = qcond(il, i) + elij(il, k, i) ! cld 2301 IF (k<=inb(il)) THEN 2302 IF (cvflag_grav) THEN 2303 vprecip(il, k) = wt(il, k) * sigd * water(il, k) / grav 2304 ELSE 2305 vprecip(il, k) = wt(il, k) * sigd * water(il, k) / 10. 2306 END IF 2307 END IF 2308 END DO 2309 END DO 2310 2311 2312 ! *** Calculate downdraft velocity scale *** 2313 ! *** NE PAS UTILISER POUR L'INSTANT *** 2314 2315 ! do il=1,ncum 2316 ! wd(il)=betad*abs(mp(il,icb(il)))*0.01*rrd*t(il,icb(il)) 2317 ! : /(sigd*p(il,icb(il))) 2318 ! enddo 2319 2320 2321 ! *** calculate tendencies of lowest level potential temperature *** 2322 ! *** and mixing ratio *** 2323 2324 DO il = 1, ncum 2325 work(il) = 1.0 / (ph(il, 1) - ph(il, 2)) 2326 am(il) = 0.0 2327 END DO 2328 2329 DO k = 2, nl 2330 DO il = 1, ncum 2331 IF (k<=inb(il)) THEN 2332 am(il) = am(il) + m(il, k) 2333 END IF 2334 END DO 2335 END DO 2336 2337 DO il = 1, ncum 2338 2339 ! convect3 if((0.1*dpinv*am).ge.delti)iflag(il)=4 2340 IF (cvflag_grav) THEN 2341 IF ((0.01 * grav * work(il) * am(il))>=delti) iflag(il) = 1 !consist vect 2342 ft(il, 1) = 0.01 * grav * work(il) * am(il) * (t(il, 2) - t(il, 1) + (gz(il, 2) - gz(il, & 2343 1)) / cpn(il, 1)) 2344 ELSE 2345 IF ((0.1 * work(il) * am(il))>=delti) iflag(il) = 1 !consistency vect 2346 ft(il, 1) = 0.1 * work(il) * am(il) * (t(il, 2) - t(il, 1) + (gz(il, 2) - gz(il, & 2347 1)) / cpn(il, 1)) 2348 END IF 2349 2350 ft(il, 1) = ft(il, 1) - 0.5 * lvcp(il, 1) * sigd * (evap(il, 1) + evap(il, 2)) 2351 2352 IF (cvflag_grav) THEN 2353 ft(il, 1) = ft(il, 1) - 0.009 * grav * sigd * mp(il, 2) * t(il, 1) * b(il, 1) * & 2354 work(il) 2355 ELSE 2356 ft(il, 1) = ft(il, 1) - 0.09 * sigd * mp(il, 2) * t(il, 1) * b(il, 1) * work(il) 2357 END IF 2358 2359 ft(il, 1) = ft(il, 1) + 0.01 * sigd * wt(il, 1) * (cl - cpd) * water(il, 2) * (t(il, 2 & 2360 ) - t(il, 1)) * work(il) / cpn(il, 1) 2361 2362 IF (cvflag_grav) THEN 2363 ! jyg1 Correction pour mieux conserver l'eau (conformite avec 2364 ! CONVECT4.3) 2365 ! (sb: pour l'instant, on ne fait que le chgt concernant grav, pas 2366 ! evap) 2367 fr(il, 1) = 0.01 * grav * mp(il, 2) * (rp(il, 2) - rr(il, 1)) * work(il) + & 2368 sigd * 0.5 * (evap(il, 1) + evap(il, 2)) 2369 ! +tard : +sigd*evap(il,1) 2370 2371 fr(il, 1) = fr(il, 1) + 0.01 * grav * am(il) * (rr(il, 2) - rr(il, 1)) * work(il) 2372 2373 fu(il, 1) = fu(il, 1) + 0.01 * grav * work(il) * (mp(il, 2) * (up(il, 2) - u(il, & 2374 1)) + am(il) * (u(il, 2) - u(il, 1))) 2375 fv(il, 1) = fv(il, 1) + 0.01 * grav * work(il) * (mp(il, 2) * (vp(il, 2) - v(il, & 2376 1)) + am(il) * (v(il, 2) - v(il, 1))) 2377 ELSE ! cvflag_grav 2378 fr(il, 1) = 0.1 * mp(il, 2) * (rp(il, 2) - rr(il, 1)) * work(il) + & 2379 sigd * 0.5 * (evap(il, 1) + evap(il, 2)) 2380 fr(il, 1) = fr(il, 1) + 0.1 * am(il) * (rr(il, 2) - rr(il, 1)) * work(il) 2381 fu(il, 1) = fu(il, 1) + 0.1 * work(il) * (mp(il, 2) * (up(il, 2) - u(il, & 2382 1)) + am(il) * (u(il, 2) - u(il, 1))) 2383 fv(il, 1) = fv(il, 1) + 0.1 * work(il) * (mp(il, 2) * (vp(il, 2) - v(il, & 2384 1)) + am(il) * (v(il, 2) - v(il, 1))) 2385 END IF ! cvflag_grav 2386 2387 END DO ! il 2388 2389 ! do j=1,ntra 2390 ! do il=1,ncum 2391 ! if (cvflag_grav) THEN 2392 ! ftra(il,1,j)=ftra(il,1,j)+0.01*grav*work(il) 2393 ! : *(mp(il,2)*(trap(il,2,j)-tra(il,1,j)) 2394 ! : +am(il)*(tra(il,2,j)-tra(il,1,j))) 2395 ! else 2396 ! ftra(il,1,j)=ftra(il,1,j)+0.1*work(il) 2397 ! : *(mp(il,2)*(trap(il,2,j)-tra(il,1,j)) 2398 ! : +am(il)*(tra(il,2,j)-tra(il,1,j))) 2399 ! END IF 2400 ! enddo 2401 ! enddo 2402 2403 DO j = 2, nl 2404 DO il = 1, ncum 2405 IF (j<=inb(il)) THEN 2406 IF (cvflag_grav) THEN 2407 fr(il, 1) = fr(il, 1) + 0.01 * grav * work(il) * ment(il, j, 1) * (qent(il, & 2408 j, 1) - rr(il, 1)) 2409 fu(il, 1) = fu(il, 1) + 0.01 * grav * work(il) * ment(il, j, 1) * (uent(il, & 2410 j, 1) - u(il, 1)) 2411 fv(il, 1) = fv(il, 1) + 0.01 * grav * work(il) * ment(il, j, 1) * (vent(il, & 2412 j, 1) - v(il, 1)) 2413 ELSE ! cvflag_grav 2414 fr(il, 1) = fr(il, 1) + 0.1 * work(il) * ment(il, j, 1) * (qent(il, j, 1) - & 2415 rr(il, 1)) 2416 fu(il, 1) = fu(il, 1) + 0.1 * work(il) * ment(il, j, 1) * (uent(il, j, 1) - u & 2417 (il, 1)) 2418 fv(il, 1) = fv(il, 1) + 0.1 * work(il) * ment(il, j, 1) * (vent(il, j, 1) - v & 2419 (il, 1)) 2420 END IF ! cvflag_grav 2421 END IF ! j 2422 END DO 2423 END DO 2424 2425 ! do k=1,ntra 2426 ! do j=2,nl 2427 ! do il=1,ncum 2428 ! if (j.le.inb(il)) THEN 2429 ! if (cvflag_grav) THEN 2430 ! ftra(il,1,k)=ftra(il,1,k)+0.01*grav*work(il)*ment(il,j,1) 2431 ! : *(traent(il,j,1,k)-tra(il,1,k)) 2432 ! else 2433 ! ftra(il,1,k)=ftra(il,1,k)+0.1*work(il)*ment(il,j,1) 2434 ! : *(traent(il,j,1,k)-tra(il,1,k)) 2435 ! END IF 2436 2437 ! END IF 2438 ! enddo 2439 ! enddo 2440 ! enddo 2441 2442 2443 ! *** calculate tendencies of potential temperature and mixing ratio *** 2444 ! *** at levels above the lowest level *** 2445 2446 ! *** first find the net saturated updraft and downdraft mass fluxes *** 2447 ! *** through each level *** 2448 2449 DO i = 2, nl + 1 ! newvecto: mettre nl au lieu nl+1? 2450 2451 num1 = 0 2452 DO il = 1, ncum 2453 IF (i<=inb(il)) num1 = num1 + 1 2454 END DO 2455 IF (num1<=0) GO TO 500 2456 2457 CALL zilch(amp1, ncum) 2458 CALL zilch(ad, ncum) 2459 2460 DO k = i + 1, nl + 1 2461 DO il = 1, ncum 2462 IF (i<=inb(il) .AND. k<=(inb(il) + 1)) THEN 2463 amp1(il) = amp1(il) + m(il, k) 2464 END IF 2465 END DO 2466 END DO 2467 2468 DO k = 1, i 2469 DO j = i + 1, nl + 1 2470 DO il = 1, ncum 2471 IF (i<=inb(il) .AND. j<=(inb(il) + 1)) THEN 2472 amp1(il) = amp1(il) + ment(il, k, j) 2473 END IF 2474 END DO 2475 END DO 2476 END DO 2477 2478 DO k = 1, i - 1 2479 DO j = i, nl + 1 ! newvecto: nl au lieu nl+1? 2480 DO il = 1, ncum 2481 IF (i<=inb(il) .AND. j<=inb(il)) THEN 2482 ad(il) = ad(il) + ment(il, j, k) 2483 END IF 2484 END DO 2485 END DO 2486 END DO 2487 2488 DO il = 1, ncum 2489 IF (i<=inb(il)) THEN 2490 dpinv = 1.0 / (ph(il, i) - ph(il, i + 1)) 2491 cpinv = 1.0 / cpn(il, i) 2492 2493 ! convect3 if((0.1*dpinv*amp1).ge.delti)iflag(il)=4 2494 IF (cvflag_grav) THEN 2495 IF ((0.01 * grav * dpinv * amp1(il))>=delti) iflag(il) = 1 ! vecto 2496 ELSE 2497 IF ((0.1 * dpinv * amp1(il))>=delti) iflag(il) = 1 ! vecto 2498 END IF 2499 2500 IF (cvflag_grav) THEN 2501 ft(il, i) = 0.01 * grav * dpinv * (amp1(il) * (t(il, i + 1) - t(il, & 2502 i) + (gz(il, i + 1) - gz(il, i)) * cpinv) - ad(il) * (t(il, i) - t(il, & 2503 i - 1) + (gz(il, i) - gz(il, i - 1)) * cpinv)) - 0.5 * sigd * lvcp(il, i) * (evap(& 2504 il, i) + evap(il, i + 1)) 2505 rat = cpn(il, i - 1) * cpinv 2506 ft(il, i) = ft(il, i) - 0.009 * grav * sigd * (mp(il, i + 1) * t(il, i) * b(il, i) & 2507 - mp(il, i) * t(il, i - 1) * rat * b(il, i - 1)) * dpinv 2508 ft(il, i) = ft(il, i) + 0.01 * grav * dpinv * ment(il, i, i) * (hp(il, i) - h(& 2509 il, i) + t(il, i) * (cpv - cpd) * (rr(il, i) - qent(il, i, i))) * cpinv 2510 ELSE ! cvflag_grav 2511 ft(il, i) = 0.1 * dpinv * (amp1(il) * (t(il, i + 1) - t(il, & 2512 i) + (gz(il, i + 1) - gz(il, i)) * cpinv) - ad(il) * (t(il, i) - t(il, & 2513 i - 1) + (gz(il, i) - gz(il, i - 1)) * cpinv)) - 0.5 * sigd * lvcp(il, i) * (evap(& 2514 il, i) + evap(il, i + 1)) 2515 rat = cpn(il, i - 1) * cpinv 2516 ft(il, i) = ft(il, i) - 0.09 * sigd * (mp(il, i + 1) * t(il, i) * b(il, i) - mp(il & 2517 , i) * t(il, i - 1) * rat * b(il, i - 1)) * dpinv 2518 ft(il, i) = ft(il, i) + 0.1 * dpinv * ment(il, i, i) * (hp(il, i) - h(il, i) + & 2519 t(il, i) * (cpv - cpd) * (rr(il, i) - qent(il, i, i))) * cpinv 2520 END IF ! cvflag_grav 2521 2522 ft(il, i) = ft(il, i) + 0.01 * sigd * wt(il, i) * (cl - cpd) * water(il, i + 1) * (& 2523 t(il, i + 1) - t(il, i)) * dpinv * cpinv 2524 2525 IF (cvflag_grav) THEN 2526 fr(il, i) = 0.01 * grav * dpinv * (amp1(il) * (rr(il, i + 1) - rr(il, & 2527 i)) - ad(il) * (rr(il, i) - rr(il, i - 1))) 2528 fu(il, i) = fu(il, i) + 0.01 * grav * dpinv * (amp1(il) * (u(il, i + 1) - u(il, & 2529 i)) - ad(il) * (u(il, i) - u(il, i - 1))) 2530 fv(il, i) = fv(il, i) + 0.01 * grav * dpinv * (amp1(il) * (v(il, i + 1) - v(il, & 2531 i)) - ad(il) * (v(il, i) - v(il, i - 1))) 2532 ELSE ! cvflag_grav 2533 fr(il, i) = 0.1 * dpinv * (amp1(il) * (rr(il, i + 1) - rr(il, & 2534 i)) - ad(il) * (rr(il, i) - rr(il, i - 1))) 2535 fu(il, i) = fu(il, i) + 0.1 * dpinv * (amp1(il) * (u(il, i + 1) - u(il, & 2536 i)) - ad(il) * (u(il, i) - u(il, i - 1))) 2537 fv(il, i) = fv(il, i) + 0.1 * dpinv * (amp1(il) * (v(il, i + 1) - v(il, & 2538 i)) - ad(il) * (v(il, i) - v(il, i - 1))) 2539 END IF ! cvflag_grav 2540 2541 END IF ! i 2542 END DO 2543 2544 ! do k=1,ntra 2545 ! do il=1,ncum 2546 ! if (i.le.inb(il)) THEN 2547 ! dpinv=1.0/(ph(il,i)-ph(il,i+1)) 2548 ! cpinv=1.0/cpn(il,i) 2549 ! if (cvflag_grav) THEN 2550 ! ftra(il,i,k)=ftra(il,i,k)+0.01*grav*dpinv 2551 ! : *(amp1(il)*(tra(il,i+1,k)-tra(il,i,k)) 2552 ! : -ad(il)*(tra(il,i,k)-tra(il,i-1,k))) 2553 ! else 2554 ! ftra(il,i,k)=ftra(il,i,k)+0.1*dpinv 2555 ! : *(amp1(il)*(tra(il,i+1,k)-tra(il,i,k)) 2556 ! : -ad(il)*(tra(il,i,k)-tra(il,i-1,k))) 2557 ! END IF 2558 ! END IF 2559 ! enddo 2560 ! enddo 2561 2562 DO k = 1, i - 1 2563 DO il = 1, ncum 2564 IF (i<=inb(il)) THEN 2565 dpinv = 1.0 / (ph(il, i) - ph(il, i + 1)) 2566 cpinv = 1.0 / cpn(il, i) 2567 2568 awat = elij(il, k, i) - (1. - ep(il, i)) * clw(il, i) 2569 awat = amax1(awat, 0.0) 2570 2571 IF (cvflag_grav) THEN 2572 fr(il, i) = fr(il, i) + 0.01 * grav * dpinv * ment(il, k, i) * (qent(il, k & 2573 , i) - awat - rr(il, i)) 2574 fu(il, i) = fu(il, i) + 0.01 * grav * dpinv * ment(il, k, i) * (uent(il, k & 2575 , i) - u(il, i)) 2576 fv(il, i) = fv(il, i) + 0.01 * grav * dpinv * ment(il, k, i) * (vent(il, k & 2577 , i) - v(il, i)) 2578 ELSE ! cvflag_grav 2579 fr(il, i) = fr(il, i) + 0.1 * dpinv * ment(il, k, i) * (qent(il, k, i) - & 2580 awat - rr(il, i)) 2581 fu(il, i) = fu(il, i) + 0.01 * grav * dpinv * ment(il, k, i) * (uent(il, k & 2582 , i) - u(il, i)) 2583 fv(il, i) = fv(il, i) + 0.1 * dpinv * ment(il, k, i) * (vent(il, k, i) - v(& 2584 il, i)) 2585 END IF ! cvflag_grav 2586 2587 ! (saturated updrafts resulting from mixing) ! cld 2588 qcond(il, i) = qcond(il, i) + (elij(il, k, i) - awat) ! cld 2589 nqcond(il, i) = nqcond(il, i) + 1. ! cld 2590 END IF ! i 2591 END DO 2592 END DO 2593 2594 ! do j=1,ntra 2595 ! do k=1,i-1 2596 ! do il=1,ncum 2597 ! if (i.le.inb(il)) THEN 2598 ! dpinv=1.0/(ph(il,i)-ph(il,i+1)) 2599 ! cpinv=1.0/cpn(il,i) 2600 ! if (cvflag_grav) THEN 2601 ! ftra(il,i,j)=ftra(il,i,j)+0.01*grav*dpinv*ment(il,k,i) 2602 ! : *(traent(il,k,i,j)-tra(il,i,j)) 2603 ! else 2604 ! ftra(il,i,j)=ftra(il,i,j)+0.1*dpinv*ment(il,k,i) 2605 ! : *(traent(il,k,i,j)-tra(il,i,j)) 2606 ! END IF 2607 ! END IF 2608 ! enddo 2609 ! enddo 2610 ! enddo 2611 2612 DO k = i, nl + 1 2613 DO il = 1, ncum 2614 IF (i<=inb(il) .AND. k<=inb(il)) THEN 2615 dpinv = 1.0 / (ph(il, i) - ph(il, i + 1)) 2616 cpinv = 1.0 / cpn(il, i) 2617 2618 IF (cvflag_grav) THEN 2619 fr(il, i) = fr(il, i) + 0.01 * grav * dpinv * ment(il, k, i) * (qent(il, k & 2620 , i) - rr(il, i)) 2621 fu(il, i) = fu(il, i) + 0.01 * grav * dpinv * ment(il, k, i) * (uent(il, k & 2622 , i) - u(il, i)) 2623 fv(il, i) = fv(il, i) + 0.01 * grav * dpinv * ment(il, k, i) * (vent(il, k & 2624 , i) - v(il, i)) 2625 ELSE ! cvflag_grav 2626 fr(il, i) = fr(il, i) + 0.1 * dpinv * ment(il, k, i) * (qent(il, k, i) - rr & 2627 (il, i)) 2628 fu(il, i) = fu(il, i) + 0.1 * dpinv * ment(il, k, i) * (uent(il, k, i) - u(& 2629 il, i)) 2630 fv(il, i) = fv(il, i) + 0.1 * dpinv * ment(il, k, i) * (vent(il, k, i) - v(& 2631 il, i)) 2632 END IF ! cvflag_grav 2633 END IF ! i and k 2634 END DO 2635 END DO 2636 2637 ! do j=1,ntra 2638 ! do k=i,nl+1 2639 ! do il=1,ncum 2640 ! if (i.le.inb(il) .AND. k.le.inb(il)) THEN 2641 ! dpinv=1.0/(ph(il,i)-ph(il,i+1)) 2642 ! cpinv=1.0/cpn(il,i) 2643 ! if (cvflag_grav) THEN 2644 ! ftra(il,i,j)=ftra(il,i,j)+0.01*grav*dpinv*ment(il,k,i) 2645 ! : *(traent(il,k,i,j)-tra(il,i,j)) 2646 ! else 2647 ! ftra(il,i,j)=ftra(il,i,j)+0.1*dpinv*ment(il,k,i) 2648 ! : *(traent(il,k,i,j)-tra(il,i,j)) 2649 ! END IF 2650 ! END IF ! i and k 2651 ! enddo 2652 ! enddo 2653 ! enddo 2654 2655 DO il = 1, ncum 2656 IF (i<=inb(il)) THEN 2657 dpinv = 1.0 / (ph(il, i) - ph(il, i + 1)) 2658 cpinv = 1.0 / cpn(il, i) 2659 2660 IF (cvflag_grav) THEN 2661 ! sb: on ne fait pas encore la correction permettant de mieux 2662 ! conserver l'eau: 2663 fr(il, i) = fr(il, i) + 0.5 * sigd * (evap(il, i) + evap(il, i + 1)) + & 2664 0.01 * grav * (mp(il, i + 1) * (rp(il, i + 1) - rr(il, i)) - mp(il, i) * (rp(il, & 2665 i) - rr(il, i - 1))) * dpinv 2666 2667 fu(il, i) = fu(il, i) + 0.01 * grav * (mp(il, i + 1) * (up(il, i + 1) - u(il, & 2668 i)) - mp(il, i) * (up(il, i) - u(il, i - 1))) * dpinv 2669 fv(il, i) = fv(il, i) + 0.01 * grav * (mp(il, i + 1) * (vp(il, i + 1) - v(il, & 2670 i)) - mp(il, i) * (vp(il, i) - v(il, i - 1))) * dpinv 2671 ELSE ! cvflag_grav 2672 fr(il, i) = fr(il, i) + 0.5 * sigd * (evap(il, i) + evap(il, i + 1)) + & 2673 0.1 * (mp(il, i + 1) * (rp(il, i + 1) - rr(il, i)) - mp(il, i) * (rp(il, i) - rr(il, & 2674 i - 1))) * dpinv 2675 fu(il, i) = fu(il, i) + 0.1 * (mp(il, i + 1) * (up(il, i + 1) - u(il, & 2676 i)) - mp(il, i) * (up(il, i) - u(il, i - 1))) * dpinv 2677 fv(il, i) = fv(il, i) + 0.1 * (mp(il, i + 1) * (vp(il, i + 1) - v(il, & 2678 i)) - mp(il, i) * (vp(il, i) - v(il, i - 1))) * dpinv 2679 END IF ! cvflag_grav 2680 2681 END IF ! i 2682 END DO 2683 2684 ! sb: interface with the cloud parameterization: ! cld 2685 2686 DO k = i + 1, nl 2687 DO il = 1, ncum 2688 IF (k<=inb(il) .AND. i<=inb(il)) THEN ! cld 2689 ! (saturated downdrafts resulting from mixing) ! cld 2690 qcond(il, i) = qcond(il, i) + elij(il, k, i) ! cld 2691 nqcond(il, i) = nqcond(il, i) + 1. ! cld 2692 END IF ! cld 2693 END DO ! cld 2694 END DO ! cld 2695 2696 ! (particular case: no detraining level is found) ! cld 2697 DO il = 1, ncum ! cld 2698 IF (i<=inb(il) .AND. nent(il, i)==0) THEN ! cld 2699 qcond(il, i) = qcond(il, i) + (1. - ep(il, i)) * clw(il, i) ! cld 2697 2700 nqcond(il, i) = nqcond(il, i) + 1. ! cld 2698 2701 END IF ! cld 2699 2702 END DO ! cld 2700 END DO ! cld 2701 2702 ! (particular case: no detraining level is found) ! cld 2703 DO il = 1, ncum ! cld 2704 IF (i<=inb(il) .AND. nent(il,i)==0) THEN ! cld 2705 qcond(il, i) = qcond(il, i) + (1.-ep(il,i))*clw(il, i) ! cld 2706 nqcond(il, i) = nqcond(il, i) + 1. ! cld 2707 END IF ! cld 2708 END DO ! cld 2709 2710 DO il = 1, ncum ! cld 2711 IF (i<=inb(il) .AND. nqcond(il,i)/=0.) THEN ! cld 2712 qcond(il, i) = qcond(il, i)/nqcond(il, i) ! cld 2713 END IF ! cld 2703 2704 DO il = 1, ncum ! cld 2705 IF (i<=inb(il) .AND. nqcond(il, i)/=0.) THEN ! cld 2706 qcond(il, i) = qcond(il, i) / nqcond(il, i) ! cld 2707 END IF ! cld 2708 END DO 2709 2710 ! do j=1,ntra 2711 ! do il=1,ncum 2712 ! if (i.le.inb(il)) THEN 2713 ! dpinv=1.0/(ph(il,i)-ph(il,i+1)) 2714 ! cpinv=1.0/cpn(il,i) 2715 2716 ! if (cvflag_grav) THEN 2717 ! ftra(il,i,j)=ftra(il,i,j)+0.01*grav*dpinv 2718 ! : *(mp(il,i+1)*(trap(il,i+1,j)-tra(il,i,j)) 2719 ! : -mp(il,i)*(trap(il,i,j)-tra(il,i-1,j))) 2720 ! else 2721 ! ftra(il,i,j)=ftra(il,i,j)+0.1*dpinv 2722 ! : *(mp(il,i+1)*(trap(il,i+1,j)-tra(il,i,j)) 2723 ! : -mp(il,i)*(trap(il,i,j)-tra(il,i-1,j))) 2724 ! END IF 2725 ! END IF ! i 2726 ! enddo 2727 ! enddo 2728 2729 500 END DO 2730 2731 2732 ! *** move the detrainment at level inb down to level inb-1 *** 2733 ! *** in such a way as to preserve the vertically *** 2734 ! *** integrated enthalpy and water tendencies *** 2735 2736 DO il = 1, ncum 2737 2738 ax = 0.1 * ment(il, inb(il), inb(il)) * (hp(il, inb(il)) - h(il, inb(il)) + t(il, & 2739 inb(il)) * (cpv - cpd) * (rr(il, inb(il)) - qent(il, inb(il), & 2740 inb(il)))) / (cpn(il, inb(il)) * (ph(il, inb(il)) - ph(il, inb(il) + 1))) 2741 ft(il, inb(il)) = ft(il, inb(il)) - ax 2742 ft(il, inb(il) - 1) = ft(il, inb(il) - 1) + ax * cpn(il, inb(il)) * (ph(il, inb(il & 2743 )) - ph(il, inb(il) + 1)) / (cpn(il, inb(il) - 1) * (ph(il, inb(il) - 1) - ph(il, & 2744 inb(il)))) 2745 2746 bx = 0.1 * ment(il, inb(il), inb(il)) * (qent(il, inb(il), inb(il)) - rr(il, inb(& 2747 il))) / (ph(il, inb(il)) - ph(il, inb(il) + 1)) 2748 fr(il, inb(il)) = fr(il, inb(il)) - bx 2749 fr(il, inb(il) - 1) = fr(il, inb(il) - 1) + bx * (ph(il, inb(il)) - ph(il, inb(il) + & 2750 1)) / (ph(il, inb(il) - 1) - ph(il, inb(il))) 2751 2752 cx = 0.1 * ment(il, inb(il), inb(il)) * (uent(il, inb(il), inb(il)) - u(il, inb(il & 2753 ))) / (ph(il, inb(il)) - ph(il, inb(il) + 1)) 2754 fu(il, inb(il)) = fu(il, inb(il)) - cx 2755 fu(il, inb(il) - 1) = fu(il, inb(il) - 1) + cx * (ph(il, inb(il)) - ph(il, inb(il) + & 2756 1)) / (ph(il, inb(il) - 1) - ph(il, inb(il))) 2757 2758 dx = 0.1 * ment(il, inb(il), inb(il)) * (vent(il, inb(il), inb(il)) - v(il, inb(il & 2759 ))) / (ph(il, inb(il)) - ph(il, inb(il) + 1)) 2760 fv(il, inb(il)) = fv(il, inb(il)) - dx 2761 fv(il, inb(il) - 1) = fv(il, inb(il) - 1) + dx * (ph(il, inb(il)) - ph(il, inb(il) + & 2762 1)) / (ph(il, inb(il) - 1) - ph(il, inb(il))) 2763 2714 2764 END DO 2715 2765 2716 2766 ! do j=1,ntra 2717 2767 ! do il=1,ncum 2718 ! if (i.le.inb(il)) then 2719 ! dpinv=1.0/(ph(il,i)-ph(il,i+1)) 2720 ! cpinv=1.0/cpn(il,i) 2721 2722 ! if (cvflag_grav) then 2723 ! ftra(il,i,j)=ftra(il,i,j)+0.01*grav*dpinv 2724 ! : *(mp(il,i+1)*(trap(il,i+1,j)-tra(il,i,j)) 2725 ! : -mp(il,i)*(trap(il,i,j)-tra(il,i-1,j))) 2726 ! else 2727 ! ftra(il,i,j)=ftra(il,i,j)+0.1*dpinv 2728 ! : *(mp(il,i+1)*(trap(il,i+1,j)-tra(il,i,j)) 2729 ! : -mp(il,i)*(trap(il,i,j)-tra(il,i-1,j))) 2730 ! endif 2731 ! endif ! i 2768 ! ex=0.1*ment(il,inb(il),inb(il)) 2769 ! : *(traent(il,inb(il),inb(il),j)-tra(il,inb(il),j)) 2770 ! : /(ph(il,inb(il))-ph(il,inb(il)+1)) 2771 ! ftra(il,inb(il),j)=ftra(il,inb(il),j)-ex 2772 ! ftra(il,inb(il)-1,j)=ftra(il,inb(il)-1,j) 2773 ! : +ex*(ph(il,inb(il))-ph(il,inb(il)+1)) 2774 ! : /(ph(il,inb(il)-1)-ph(il,inb(il))) 2732 2775 ! enddo 2733 2776 ! enddo 2734 2777 2735 500 END DO 2736 2737 2738 ! *** move the detrainment at level inb down to level inb-1 *** 2739 ! *** in such a way as to preserve the vertically *** 2740 ! *** integrated enthalpy and water tendencies *** 2741 2742 DO il = 1, ncum 2743 2744 ax = 0.1*ment(il, inb(il), inb(il))*(hp(il,inb(il))-h(il,inb(il))+t(il, & 2745 inb(il))*(cpv-cpd)*(rr(il,inb(il))-qent(il,inb(il), & 2746 inb(il))))/(cpn(il,inb(il))*(ph(il,inb(il))-ph(il,inb(il)+1))) 2747 ft(il, inb(il)) = ft(il, inb(il)) - ax 2748 ft(il, inb(il)-1) = ft(il, inb(il)-1) + ax*cpn(il, inb(il))*(ph(il,inb(il & 2749 ))-ph(il,inb(il)+1))/(cpn(il,inb(il)-1)*(ph(il,inb(il)-1)-ph(il, & 2750 inb(il)))) 2751 2752 bx = 0.1*ment(il, inb(il), inb(il))*(qent(il,inb(il),inb(il))-rr(il,inb( & 2753 il)))/(ph(il,inb(il))-ph(il,inb(il)+1)) 2754 fr(il, inb(il)) = fr(il, inb(il)) - bx 2755 fr(il, inb(il)-1) = fr(il, inb(il)-1) + bx*(ph(il,inb(il))-ph(il,inb(il)+ & 2756 1))/(ph(il,inb(il)-1)-ph(il,inb(il))) 2757 2758 cx = 0.1*ment(il, inb(il), inb(il))*(uent(il,inb(il),inb(il))-u(il,inb(il & 2759 )))/(ph(il,inb(il))-ph(il,inb(il)+1)) 2760 fu(il, inb(il)) = fu(il, inb(il)) - cx 2761 fu(il, inb(il)-1) = fu(il, inb(il)-1) + cx*(ph(il,inb(il))-ph(il,inb(il)+ & 2762 1))/(ph(il,inb(il)-1)-ph(il,inb(il))) 2763 2764 dx = 0.1*ment(il, inb(il), inb(il))*(vent(il,inb(il),inb(il))-v(il,inb(il & 2765 )))/(ph(il,inb(il))-ph(il,inb(il)+1)) 2766 fv(il, inb(il)) = fv(il, inb(il)) - dx 2767 fv(il, inb(il)-1) = fv(il, inb(il)-1) + dx*(ph(il,inb(il))-ph(il,inb(il)+ & 2768 1))/(ph(il,inb(il)-1)-ph(il,inb(il))) 2769 2770 END DO 2771 2772 ! do j=1,ntra 2773 ! do il=1,ncum 2774 ! ex=0.1*ment(il,inb(il),inb(il)) 2775 ! : *(traent(il,inb(il),inb(il),j)-tra(il,inb(il),j)) 2776 ! : /(ph(il,inb(il))-ph(il,inb(il)+1)) 2777 ! ftra(il,inb(il),j)=ftra(il,inb(il),j)-ex 2778 ! ftra(il,inb(il)-1,j)=ftra(il,inb(il)-1,j) 2779 ! : +ex*(ph(il,inb(il))-ph(il,inb(il)+1)) 2780 ! : /(ph(il,inb(il)-1)-ph(il,inb(il))) 2781 ! enddo 2782 ! enddo 2783 2784 2785 ! *** homoginize tendencies below cloud base *** 2786 2787 2788 DO il = 1, ncum 2789 asum(il) = 0.0 2790 bsum(il) = 0.0 2791 csum(il) = 0.0 2792 dsum(il) = 0.0 2793 END DO 2794 2795 DO i = 1, nl 2778 2779 ! *** homoginize tendencies below cloud base *** 2780 2796 2781 DO il = 1, ncum 2797 IF (i<=(icb(il)-1)) THEN 2798 asum(il) = asum(il) + ft(il, i)*(ph(il,i)-ph(il,i+1)) 2799 bsum(il) = bsum(il) + fr(il, i)*(lv(il,i)+(cl-cpd)*(t(il,i)-t(il, & 2800 1)))*(ph(il,i)-ph(il,i+1)) 2801 csum(il) = csum(il) + (lv(il,i)+(cl-cpd)*(t(il,i)-t(il, & 2802 1)))*(ph(il,i)-ph(il,i+1)) 2803 dsum(il) = dsum(il) + t(il, i)*(ph(il,i)-ph(il,i+1))/th(il, i) 2804 END IF 2805 END DO 2806 END DO 2807 2808 ! !!! do 700 i=1,icb(il)-1 2809 DO i = 1, nl 2782 asum(il) = 0.0 2783 bsum(il) = 0.0 2784 csum(il) = 0.0 2785 dsum(il) = 0.0 2786 END DO 2787 2788 DO i = 1, nl 2789 DO il = 1, ncum 2790 IF (i<=(icb(il) - 1)) THEN 2791 asum(il) = asum(il) + ft(il, i) * (ph(il, i) - ph(il, i + 1)) 2792 bsum(il) = bsum(il) + fr(il, i) * (lv(il, i) + (cl - cpd) * (t(il, i) - t(il, & 2793 1))) * (ph(il, i) - ph(il, i + 1)) 2794 csum(il) = csum(il) + (lv(il, i) + (cl - cpd) * (t(il, i) - t(il, & 2795 1))) * (ph(il, i) - ph(il, i + 1)) 2796 dsum(il) = dsum(il) + t(il, i) * (ph(il, i) - ph(il, i + 1)) / th(il, i) 2797 END IF 2798 END DO 2799 END DO 2800 2801 ! !!! do 700 i=1,icb(il)-1 2802 DO i = 1, nl 2803 DO il = 1, ncum 2804 IF (i<=(icb(il) - 1)) THEN 2805 ft(il, i) = asum(il) * t(il, i) / (th(il, i) * dsum(il)) 2806 fr(il, i) = bsum(il) / csum(il) 2807 END IF 2808 END DO 2809 END DO 2810 2811 2812 ! *** reset counter and return *** 2813 2810 2814 DO il = 1, ncum 2811 IF (i<=(icb(il)-1)) THEN 2812 ft(il, i) = asum(il)*t(il, i)/(th(il,i)*dsum(il)) 2813 fr(il, i) = bsum(il)/csum(il) 2814 END IF 2815 END DO 2816 END DO 2817 2818 2819 ! *** reset counter and return *** 2820 2821 DO il = 1, ncum 2822 sig(il, nd) = 2.0 2823 END DO 2824 2825 2826 DO i = 1, nd 2827 DO il = 1, ncum 2828 upwd(il, i) = 0.0 2829 dnwd(il, i) = 0.0 2830 END DO 2831 END DO 2832 2833 DO i = 1, nl 2834 DO il = 1, ncum 2835 dnwd0(il, i) = -mp(il, i) 2836 END DO 2837 END DO 2838 DO i = nl + 1, nd 2839 DO il = 1, ncum 2840 dnwd0(il, i) = 0. 2841 END DO 2842 END DO 2843 2844 2845 DO i = 1, nl 2846 DO il = 1, ncum 2847 IF (i>=icb(il) .AND. i<=inb(il)) THEN 2815 sig(il, nd) = 2.0 2816 END DO 2817 2818 DO i = 1, nd 2819 DO il = 1, ncum 2848 2820 upwd(il, i) = 0.0 2849 2821 dnwd(il, i) = 0.0 2850 END IF 2851 END DO 2852 END DO 2853 2854 DO i = 1, nl 2855 DO k = 1, nl 2822 END DO 2823 END DO 2824 2825 DO i = 1, nl 2856 2826 DO il = 1, ncum 2857 up1(il, k, i) = 0.0 2858 dn1(il, k, i) = 0.0 2859 END DO 2860 END DO 2861 END DO 2862 2863 DO i = 1, nl 2864 DO k = i, nl 2865 DO n = 1, i - 1 2827 dnwd0(il, i) = -mp(il, i) 2828 END DO 2829 END DO 2830 DO i = nl + 1, nd 2831 DO il = 1, ncum 2832 dnwd0(il, i) = 0. 2833 END DO 2834 END DO 2835 2836 DO i = 1, nl 2837 DO il = 1, ncum 2838 IF (i>=icb(il) .AND. i<=inb(il)) THEN 2839 upwd(il, i) = 0.0 2840 dnwd(il, i) = 0.0 2841 END IF 2842 END DO 2843 END DO 2844 2845 DO i = 1, nl 2846 DO k = 1, nl 2866 2847 DO il = 1, ncum 2867 IF (i>=icb(il) .AND. i<=inb(il) .AND. k<=inb(il)) THEN 2868 up1(il, k, i) = up1(il, k, i) + ment(il, n, k) 2869 dn1(il, k, i) = dn1(il, k, i) - ment(il, k, n) 2848 up1(il, k, i) = 0.0 2849 dn1(il, k, i) = 0.0 2850 END DO 2851 END DO 2852 END DO 2853 2854 DO i = 1, nl 2855 DO k = i, nl 2856 DO n = 1, i - 1 2857 DO il = 1, ncum 2858 IF (i>=icb(il) .AND. i<=inb(il) .AND. k<=inb(il)) THEN 2859 up1(il, k, i) = up1(il, k, i) + ment(il, n, k) 2860 dn1(il, k, i) = dn1(il, k, i) - ment(il, k, n) 2861 END IF 2862 END DO 2863 END DO 2864 END DO 2865 END DO 2866 2867 DO i = 2, nl 2868 DO k = i, nl 2869 DO il = 1, ncum 2870 ! test if (i.ge.icb(il).AND.i.le.inb(il).AND.k.le.inb(il)) 2871 ! THEN 2872 IF (i<=inb(il) .AND. k<=inb(il)) THEN 2873 upwd(il, i) = upwd(il, i) + m(il, k) + up1(il, k, i) 2874 dnwd(il, i) = dnwd(il, i) + dn1(il, k, i) 2870 2875 END IF 2871 2876 END DO 2872 2877 END DO 2873 2878 END DO 2874 END DO 2875 2876 DO i = 2, nl 2877 DO k = i, nl 2879 2880 2881 ! !!! DO il=1,ncum 2882 ! !!! do i=icb(il),inb(il) 2883 ! !!! 2884 ! !!! upwd(il,i)=0.0 2885 ! !!! dnwd(il,i)=0.0 2886 ! !!! do k=i,inb(il) 2887 ! !!! up1=0.0 2888 ! !!! dn1=0.0 2889 ! !!! do n=1,i-1 2890 ! !!! up1=up1+ment(il,n,k) 2891 ! !!! dn1=dn1-ment(il,k,n) 2892 ! !!! enddo 2893 ! !!! upwd(il,i)=upwd(il,i)+m(il,k)+up1 2894 ! !!! dnwd(il,i)=dnwd(il,i)+dn1 2895 ! !!! enddo 2896 ! !!! enddo 2897 ! !!! 2898 ! !!! ENDDO 2899 2900 ! ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 2901 ! determination de la variation de flux ascendant entre 2902 ! deux niveau non dilue mike 2903 ! ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 2904 2905 DO i = 1, nl 2878 2906 DO il = 1, ncum 2879 ! test if (i.ge.icb(il).and.i.le.inb(il).and.k.le.inb(il)) 2880 ! then 2881 IF (i<=inb(il) .AND. k<=inb(il)) THEN 2882 upwd(il, i) = upwd(il, i) + m(il, k) + up1(il, k, i) 2883 dnwd(il, i) = dnwd(il, i) + dn1(il, k, i) 2907 mike(il, i) = m(il, i) 2908 END DO 2909 END DO 2910 2911 DO i = nl + 1, nd 2912 DO il = 1, ncum 2913 mike(il, i) = 0. 2914 END DO 2915 END DO 2916 2917 DO i = 1, nd 2918 DO il = 1, ncum 2919 ma(il, i) = 0 2920 END DO 2921 END DO 2922 2923 DO i = 1, nl 2924 DO j = i, nl 2925 DO il = 1, ncum 2926 ma(il, i) = ma(il, i) + m(il, j) 2927 END DO 2928 END DO 2929 END DO 2930 2931 DO i = nl + 1, nd 2932 DO il = 1, ncum 2933 ma(il, i) = 0. 2934 END DO 2935 END DO 2936 2937 DO i = 1, nl 2938 DO il = 1, ncum 2939 IF (i<=(icb(il) - 1)) THEN 2940 ma(il, i) = 0 2884 2941 END IF 2885 2942 END DO 2886 2943 END DO 2887 END DO 2888 2889 2890 ! !!! DO il=1,ncum 2891 ! !!! do i=icb(il),inb(il) 2892 ! !!! 2893 ! !!! upwd(il,i)=0.0 2894 ! !!! dnwd(il,i)=0.0 2895 ! !!! do k=i,inb(il) 2896 ! !!! up1=0.0 2897 ! !!! dn1=0.0 2898 ! !!! do n=1,i-1 2899 ! !!! up1=up1+ment(il,n,k) 2900 ! !!! dn1=dn1-ment(il,k,n) 2901 ! !!! enddo 2902 ! !!! upwd(il,i)=upwd(il,i)+m(il,k)+up1 2903 ! !!! dnwd(il,i)=dnwd(il,i)+dn1 2904 ! !!! enddo 2905 ! !!! enddo 2906 ! !!! 2907 ! !!! ENDDO 2908 2909 ! ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 2910 ! determination de la variation de flux ascendant entre 2911 ! deux niveau non dilue mike 2912 ! ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 2913 2914 DO i = 1, nl 2915 DO il = 1, ncum 2916 mike(il, i) = m(il, i) 2917 END DO 2918 END DO 2919 2920 DO i = nl + 1, nd 2921 DO il = 1, ncum 2922 mike(il, i) = 0. 2923 END DO 2924 END DO 2925 2926 DO i = 1, nd 2927 DO il = 1, ncum 2928 ma(il, i) = 0 2929 END DO 2930 END DO 2931 2932 DO i = 1, nl 2933 DO j = i, nl 2944 2945 ! cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 2946 ! icb represente de niveau ou se trouve la 2947 ! base du nuage , et inb le top du nuage 2948 ! ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 2949 2950 DO i = 1, nd 2934 2951 DO il = 1, ncum 2935 ma(il, i) = ma(il, i) + m(il, j) 2936 END DO 2937 END DO 2938 END DO 2939 2940 DO i = nl + 1, nd 2941 DO il = 1, ncum 2942 ma(il, i) = 0. 2943 END DO 2944 END DO 2945 2946 DO i = 1, nl 2947 DO il = 1, ncum 2948 IF (i<=(icb(il)-1)) THEN 2949 ma(il, i) = 0 2950 END IF 2951 END DO 2952 END DO 2953 2954 ! cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 2955 ! icb represente de niveau ou se trouve la 2956 ! base du nuage , et inb le top du nuage 2957 ! ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 2958 2959 DO i = 1, nd 2960 DO il = 1, ncum 2961 mke(il, i) = upwd(il, i) + dnwd(il, i) 2962 END DO 2963 END DO 2964 2965 DO i = 1, nd 2966 DO il = 1, ncum 2967 rdcp = (rrd*(1.-rr(il,i))-rr(il,i)*rrv)/(cpd*(1.-rr(il, & 2968 i))+rr(il,i)*cpv) 2969 tls(il, i) = t(il, i)*(1000.0/p(il,i))**rdcp 2970 tps(il, i) = tp(il, i) 2971 END DO 2972 END DO 2973 2974 2975 ! *** diagnose the in-cloud mixing ratio *** ! cld 2976 ! *** of condensed water *** ! cld 2977 ! ! cld 2978 2979 DO i = 1, nd ! cld 2980 DO il = 1, ncum ! cld 2981 mac(il, i) = 0.0 ! cld 2982 wa(il, i) = 0.0 ! cld 2983 siga(il, i) = 0.0 ! cld 2984 sax(il, i) = 0.0 ! cld 2952 mke(il, i) = upwd(il, i) + dnwd(il, i) 2953 END DO 2954 END DO 2955 2956 DO i = 1, nd 2957 DO il = 1, ncum 2958 rdcp = (rrd * (1. - rr(il, i)) - rr(il, i) * rrv) / (cpd * (1. - rr(il, & 2959 i)) + rr(il, i) * cpv) 2960 tls(il, i) = t(il, i) * (1000.0 / p(il, i))**rdcp 2961 tps(il, i) = tp(il, i) 2962 END DO 2963 END DO 2964 2965 2966 ! *** diagnose the in-cloud mixing ratio *** ! cld 2967 ! *** of condensed water *** ! cld 2968 ! cld 2969 2970 DO i = 1, nd ! cld 2971 DO il = 1, ncum ! cld 2972 mac(il, i) = 0.0 ! cld 2973 wa(il, i) = 0.0 ! cld 2974 siga(il, i) = 0.0 ! cld 2975 sax(il, i) = 0.0 ! cld 2976 END DO ! cld 2985 2977 END DO ! cld 2986 END DO ! cld 2987 2988 DO i = minorig, nl ! cld 2989 DO k = i + 1, nl + 1 ! cld 2978 2979 DO i = minorig, nl ! cld 2980 DO k = i + 1, nl + 1 ! cld 2981 DO il = 1, ncum ! cld 2982 IF (i<=inb(il) .AND. k<=(inb(il) + 1)) THEN ! cld 2983 mac(il, i) = mac(il, i) + m(il, k) ! cld 2984 END IF ! cld 2985 END DO ! cld 2986 END DO ! cld 2987 END DO ! cld 2988 2989 DO i = 1, nl ! cld 2990 DO j = 1, i ! cld 2991 DO il = 1, ncum ! cld 2992 IF (i>=icb(il) .AND. i<=(inb(il) - 1) & ! cld 2993 .AND. j>=icb(il)) THEN ! cld 2994 sax(il, i) = sax(il, i) + rrd * (tvp(il, j) - tv(il, j)) & ! cld 2995 * (ph(il, j) - ph(il, j + 1)) / p(il, j) ! cld 2996 END IF ! cld 2997 END DO ! cld 2998 END DO ! cld 2999 END DO ! cld 3000 3001 DO i = 1, nl ! cld 2990 3002 DO il = 1, ncum ! cld 2991 IF (i<=inb(il) .AND. k<=(inb(il)+1)) THEN ! cld 2992 mac(il, i) = mac(il, i) + m(il, k) ! cld 3003 IF (i>=icb(il) .AND. i<=(inb(il) - 1) & ! cld 3004 .AND. sax(il, i)>0.0) THEN ! cld 3005 wa(il, i) = sqrt(2. * sax(il, i)) ! cld 2993 3006 END IF ! cld 2994 3007 END DO ! cld 2995 3008 END DO ! cld 2996 END DO ! cld 2997 2998 DO i = 1, nl ! cld 2999 DO j = 1, i ! cld 3009 3010 DO i = 1, nl ! cld 3000 3011 DO il = 1, ncum ! cld 3001 IF (i>=icb(il) .AND. i<=(inb(il)-1) & ! cld 3002 .AND. j>=icb(il)) THEN ! cld 3003 sax(il, i) = sax(il, i) + rrd*(tvp(il,j)-tv(il,j)) & ! cld 3004 *(ph(il,j)-ph(il,j+1))/p(il, j) ! cld 3005 END IF ! cld 3012 IF (wa(il, i)>0.0) & ! cld 3013 siga(il, i) = mac(il, i) / wa(il, i) & ! cld 3014 * rrd * tvp(il, i) / p(il, i) / 100. / delta ! cld 3015 siga(il, i) = min(siga(il, i), 1.0) ! cld 3016 ! IM cf. FH 3017 IF (iflag_clw==0) THEN 3018 qcondc(il, i) = siga(il, i) * clw(il, i) * (1. - ep(il, i)) & ! cld 3019 + (1. - siga(il, i)) * qcond(il, i) ! cld 3020 ELSE IF (iflag_clw==1) THEN 3021 qcondc(il, i) = qcond(il, i) ! cld 3022 END IF 3023 3006 3024 END DO ! cld 3007 3025 END DO ! cld 3008 END DO ! cld 3009 3010 DO i = 1, nl ! cld 3011 DO il = 1, ncum ! cld 3012 IF (i>=icb(il) .AND. i<=(inb(il)-1) & ! cld 3013 .AND. sax(il,i)>0.0) THEN ! cld 3014 wa(il, i) = sqrt(2.*sax(il,i)) ! cld 3015 END IF ! cld 3016 END DO ! cld 3017 END DO ! cld 3018 3019 DO i = 1, nl ! cld 3020 DO il = 1, ncum ! cld 3021 IF (wa(il,i)>0.0) & ! cld 3022 siga(il, i) = mac(il, i)/wa(il, i) & ! cld 3023 *rrd*tvp(il, i)/p(il, i)/100./delta ! cld 3024 siga(il, i) = min(siga(il,i), 1.0) ! cld 3025 ! IM cf. FH 3026 IF (iflag_clw==0) THEN 3027 qcondc(il, i) = siga(il, i)*clw(il, i)*(1.-ep(il,i)) & ! cld 3028 +(1.-siga(il,i))*qcond(il, i) ! cld 3029 ELSE IF (iflag_clw==1) THEN 3030 qcondc(il, i) = qcond(il, i) ! cld 3031 END IF 3032 3033 END DO ! cld 3034 END DO ! cld 3035 3036 RETURN 3037 END SUBROUTINE cv30_yield 3038 3039 ! !RomP >>> 3040 SUBROUTINE cv30_tracer(nloc, len, ncum, nd, na, ment, sij, da, phi, phi2, & 3041 d1a, dam, ep, vprecip, elij, clw, epmlmmm, eplamm, icb, inb) 3042 IMPLICIT NONE 3043 3044 include "cv30param.h" 3045 3046 ! inputs: 3047 INTEGER ncum, nd, na, nloc, len 3048 REAL ment(nloc, na, na), sij(nloc, na, na) 3049 REAL clw(nloc, nd), elij(nloc, na, na) 3050 REAL ep(nloc, na) 3051 INTEGER icb(nloc), inb(nloc) 3052 REAL vprecip(nloc, nd+1) 3053 ! ouputs: 3054 REAL da(nloc, na), phi(nloc, na, na) 3055 REAL phi2(nloc, na, na) 3056 REAL d1a(nloc, na), dam(nloc, na) 3057 REAL epmlmmm(nloc, na, na), eplamm(nloc, na) 3058 ! variables pour tracer dans precip de l'AA et des mel 3059 ! local variables: 3060 INTEGER i, j, k, nam1 3061 REAL epm(nloc, na, na) 3062 3063 nam1=na-1 ! Introduced because ep is not defined for j=na 3064 ! variables d'Emanuel : du second indice au troisieme 3065 ! ---> tab(i,k,j) -> de l origine k a l arrivee j 3066 ! ment, sij, elij 3067 ! variables personnelles : du troisieme au second indice 3068 ! ---> tab(i,j,k) -> de k a j 3069 ! phi, phi2 3070 3071 ! initialisations 3072 DO j = 1, na 3073 DO i = 1, ncum 3074 da(i, j) = 0. 3075 d1a(i, j) = 0. 3076 dam(i, j) = 0. 3077 eplamm(i, j) = 0. 3078 END DO 3079 END DO 3080 DO k = 1, na 3026 3027 END SUBROUTINE cv30_yield 3028 3029 !RomP >>> 3030 SUBROUTINE cv30_tracer(nloc, len, ncum, nd, na, ment, sij, da, phi, phi2, & 3031 d1a, dam, ep, vprecip, elij, clw, epmlmmm, eplamm, icb, inb) 3032 IMPLICIT NONE 3033 3034 3035 3036 ! inputs: 3037 INTEGER ncum, nd, na, nloc, len 3038 REAL ment(nloc, na, na), sij(nloc, na, na) 3039 REAL clw(nloc, nd), elij(nloc, na, na) 3040 REAL ep(nloc, na) 3041 INTEGER icb(nloc), inb(nloc) 3042 REAL vprecip(nloc, nd + 1) 3043 ! ouputs: 3044 REAL da(nloc, na), phi(nloc, na, na) 3045 REAL phi2(nloc, na, na) 3046 REAL d1a(nloc, na), dam(nloc, na) 3047 REAL epmlmmm(nloc, na, na), eplamm(nloc, na) 3048 ! variables pour tracer dans precip de l'AA et des mel 3049 ! local variables: 3050 INTEGER i, j, k, nam1 3051 REAL epm(nloc, na, na) 3052 3053 nam1 = na - 1 ! Introduced because ep is not defined for j=na 3054 ! variables d'Emanuel : du second indice au troisieme 3055 ! ---> tab(i,k,j) -> de l origine k a l arrivee j 3056 ! ment, sij, elij 3057 ! variables personnelles : du troisieme au second indice 3058 ! ---> tab(i,j,k) -> de k a j 3059 ! phi, phi2 3060 3061 ! initialisations 3081 3062 DO j = 1, na 3082 3063 DO i = 1, ncum 3083 epm(i, j, k) = 0. 3084 epmlmmm(i, j, k) = 0. 3085 phi(i, j, k) = 0. 3086 phi2(i, j, k) = 0. 3087 END DO 3088 END DO 3089 END DO 3090 3091 ! fraction deau condensee dans les melanges convertie en precip : epm 3092 ! et eau condens�e pr�cipit�e dans masse d'air satur� : l_m*dM_m/dzdz.dzdz 3093 DO j = 1, nam1 3094 DO k = 1, j - 1 3064 da(i, j) = 0. 3065 d1a(i, j) = 0. 3066 dam(i, j) = 0. 3067 eplamm(i, j) = 0. 3068 END DO 3069 END DO 3070 DO k = 1, na 3071 DO j = 1, na 3072 DO i = 1, ncum 3073 epm(i, j, k) = 0. 3074 epmlmmm(i, j, k) = 0. 3075 phi(i, j, k) = 0. 3076 phi2(i, j, k) = 0. 3077 END DO 3078 END DO 3079 END DO 3080 3081 ! fraction deau condensee dans les melanges convertie en precip : epm 3082 ! et eau condensée précipitée dans masse d'air saturé : l_m*dM_m/dzdz.dzdz 3083 DO j = 1, nam1 3084 DO k = 1, j - 1 3085 DO i = 1, ncum 3086 IF (k>=icb(i) .AND. k<=inb(i) .AND. j<=inb(i)) THEN 3087 !jyg epm(i,j,k)=1.-(1.-ep(i,j))*clw(i,j)/elij(i,k,j) 3088 epm(i, j, k) = 1. - (1. - ep(i, j)) * clw(i, j) / max(elij(i, k, j), 1.E-16) 3089 3090 epm(i, j, k) = max(epm(i, j, k), 0.0) 3091 END IF 3092 END DO 3093 END DO 3094 END DO 3095 3096 DO j = 1, nam1 3097 DO k = 1, nam1 3098 DO i = 1, ncum 3099 IF (k>=icb(i) .AND. k<=inb(i)) THEN 3100 eplamm(i, j) = eplamm(i, j) + ep(i, j) * clw(i, j) * ment(i, j, k) * (1. - & 3101 sij(i, j, k)) 3102 END IF 3103 END DO 3104 END DO 3105 END DO 3106 3107 DO j = 1, nam1 3108 DO k = 1, j - 1 3109 DO i = 1, ncum 3110 IF (k>=icb(i) .AND. k<=inb(i) .AND. j<=inb(i)) THEN 3111 epmlmmm(i, j, k) = epm(i, j, k) * elij(i, k, j) * ment(i, k, j) 3112 END IF 3113 END DO 3114 END DO 3115 END DO 3116 3117 ! matrices pour calculer la tendance des concentrations dans cvltr.F90 3118 DO j = 1, nam1 3119 DO k = 1, nam1 3120 DO i = 1, ncum 3121 da(i, j) = da(i, j) + (1. - sij(i, k, j)) * ment(i, k, j) 3122 phi(i, j, k) = sij(i, k, j) * ment(i, k, j) 3123 d1a(i, j) = d1a(i, j) + ment(i, k, j) * ep(i, k) * (1. - sij(i, k, j)) 3124 END DO 3125 END DO 3126 END DO 3127 3128 DO j = 1, nam1 3129 DO k = 1, j - 1 3130 DO i = 1, ncum 3131 dam(i, j) = dam(i, j) + ment(i, k, j) * epm(i, j, k) * (1. - ep(i, k)) * (1. - & 3132 sij(i, k, j)) 3133 phi2(i, j, k) = phi(i, j, k) * epm(i, j, k) 3134 END DO 3135 END DO 3136 END DO 3137 3138 END SUBROUTINE cv30_tracer 3139 ! RomP <<< 3140 3141 SUBROUTINE cv30_uncompress(nloc, len, ncum, nd, ntra, idcum, iflag, precip, & 3142 vprecip, evap, ep, sig, w0, ft, fq, fu, fv, ftra, inb, ma, upwd, dnwd, & 3143 dnwd0, qcondc, wd, cape, da, phi, mp, phi2, d1a, dam, sij, elij, clw, & 3144 epmlmmm, eplamm, wdtraina, wdtrainm, epmax_diag, iflag1, precip1, vprecip1, evap1, & 3145 ep1, sig1, w01, ft1, fq1, fu1, fv1, ftra1, inb1, ma1, upwd1, dnwd1, & 3146 dnwd01, qcondc1, wd1, cape1, da1, phi1, mp1, phi21, d1a1, dam1, sij1, & 3147 elij1, clw1, epmlmmm1, eplamm1, wdtraina1, wdtrainm1, epmax_diag1) ! epmax_cape 3148 IMPLICIT NONE 3149 3150 3151 3152 ! inputs: 3153 INTEGER len, ncum, nd, ntra, nloc 3154 INTEGER idcum(nloc) 3155 INTEGER iflag(nloc) 3156 INTEGER inb(nloc) 3157 REAL precip(nloc) 3158 REAL vprecip(nloc, nd + 1), evap(nloc, nd) 3159 REAL ep(nloc, nd) 3160 REAL sig(nloc, nd), w0(nloc, nd) 3161 REAL ft(nloc, nd), fq(nloc, nd), fu(nloc, nd), fv(nloc, nd) 3162 REAL ftra(nloc, nd, ntra) 3163 REAL ma(nloc, nd) 3164 REAL upwd(nloc, nd), dnwd(nloc, nd), dnwd0(nloc, nd) 3165 REAL qcondc(nloc, nd) 3166 REAL wd(nloc), cape(nloc) 3167 REAL da(nloc, nd), phi(nloc, nd, nd), mp(nloc, nd) 3168 REAL epmax_diag(nloc) ! epmax_cape 3169 ! RomP >>> 3170 REAL phi2(nloc, nd, nd) 3171 REAL d1a(nloc, nd), dam(nloc, nd) 3172 REAL wdtraina(nloc, nd), wdtrainm(nloc, nd) 3173 REAL sij(nloc, nd, nd) 3174 REAL elij(nloc, nd, nd), clw(nloc, nd) 3175 REAL epmlmmm(nloc, nd, nd), eplamm(nloc, nd) 3176 ! RomP <<< 3177 3178 ! outputs: 3179 INTEGER iflag1(len) 3180 INTEGER inb1(len) 3181 REAL precip1(len) 3182 REAL vprecip1(len, nd + 1), evap1(len, nd) !<<< RomP 3183 REAL ep1(len, nd) !<<< RomP 3184 REAL sig1(len, nd), w01(len, nd) 3185 REAL ft1(len, nd), fq1(len, nd), fu1(len, nd), fv1(len, nd) 3186 REAL ftra1(len, nd, ntra) 3187 REAL ma1(len, nd) 3188 REAL upwd1(len, nd), dnwd1(len, nd), dnwd01(len, nd) 3189 REAL qcondc1(nloc, nd) 3190 REAL wd1(nloc), cape1(nloc) 3191 REAL da1(nloc, nd), phi1(nloc, nd, nd), mp1(nloc, nd) 3192 REAL epmax_diag1(len) ! epmax_cape 3193 ! RomP >>> 3194 REAL phi21(len, nd, nd) 3195 REAL d1a1(len, nd), dam1(len, nd) 3196 REAL wdtraina1(len, nd), wdtrainm1(len, nd) 3197 REAL sij1(len, nd, nd) 3198 REAL elij1(len, nd, nd), clw1(len, nd) 3199 REAL epmlmmm1(len, nd, nd), eplamm1(len, nd) 3200 ! RomP <<< 3201 3202 ! local variables: 3203 INTEGER i, k, j 3204 3205 DO i = 1, ncum 3206 precip1(idcum(i)) = precip(i) 3207 iflag1(idcum(i)) = iflag(i) 3208 wd1(idcum(i)) = wd(i) 3209 inb1(idcum(i)) = inb(i) 3210 cape1(idcum(i)) = cape(i) 3211 epmax_diag1(idcum(i)) = epmax_diag(i) ! epmax_cape 3212 END DO 3213 3214 DO k = 1, nl 3095 3215 DO i = 1, ncum 3096 IF (k>=icb(i) .AND. k<=inb(i) .AND. j<=inb(i)) THEN 3097 ! !jyg epm(i,j,k)=1.-(1.-ep(i,j))*clw(i,j)/elij(i,k,j) 3098 epm(i, j, k) = 1. - (1.-ep(i,j))*clw(i, j)/max(elij(i,k,j), 1.E-16) 3099 ! ! 3100 epm(i, j, k) = max(epm(i,j,k), 0.0) 3101 END IF 3102 END DO 3103 END DO 3104 END DO 3105 3106 DO j = 1, nam1 3107 DO k = 1, nam1 3216 vprecip1(idcum(i), k) = vprecip(i, k) 3217 evap1(idcum(i), k) = evap(i, k) !<<< RomP 3218 sig1(idcum(i), k) = sig(i, k) 3219 w01(idcum(i), k) = w0(i, k) 3220 ft1(idcum(i), k) = ft(i, k) 3221 fq1(idcum(i), k) = fq(i, k) 3222 fu1(idcum(i), k) = fu(i, k) 3223 fv1(idcum(i), k) = fv(i, k) 3224 ma1(idcum(i), k) = ma(i, k) 3225 upwd1(idcum(i), k) = upwd(i, k) 3226 dnwd1(idcum(i), k) = dnwd(i, k) 3227 dnwd01(idcum(i), k) = dnwd0(i, k) 3228 qcondc1(idcum(i), k) = qcondc(i, k) 3229 da1(idcum(i), k) = da(i, k) 3230 mp1(idcum(i), k) = mp(i, k) 3231 ! RomP >>> 3232 ep1(idcum(i), k) = ep(i, k) 3233 d1a1(idcum(i), k) = d1a(i, k) 3234 dam1(idcum(i), k) = dam(i, k) 3235 clw1(idcum(i), k) = clw(i, k) 3236 eplamm1(idcum(i), k) = eplamm(i, k) 3237 wdtraina1(idcum(i), k) = wdtraina(i, k) 3238 wdtrainm1(idcum(i), k) = wdtrainm(i, k) 3239 ! RomP <<< 3240 END DO 3241 END DO 3242 3243 DO i = 1, ncum 3244 sig1(idcum(i), nd) = sig(i, nd) 3245 END DO 3246 3247 3248 ! do 2100 j=1,ntra 3249 ! do 2110 k=1,nd ! oct3 3250 ! do 2120 i=1,ncum 3251 ! ftra1(idcum(i),k,j)=ftra(i,k,j) 3252 ! 2120 continue 3253 ! 2110 continue 3254 ! 2100 continue 3255 DO j = 1, nd 3256 DO k = 1, nd 3257 DO i = 1, ncum 3258 sij1(idcum(i), k, j) = sij(i, k, j) 3259 phi1(idcum(i), k, j) = phi(i, k, j) 3260 phi21(idcum(i), k, j) = phi2(i, k, j) 3261 elij1(idcum(i), k, j) = elij(i, k, j) 3262 epmlmmm1(idcum(i), k, j) = epmlmmm(i, k, j) 3263 END DO 3264 END DO 3265 END DO 3266 3267 END SUBROUTINE cv30_uncompress 3268 3269 SUBROUTINE cv30_epmax_fn_cape(nloc, ncum, nd & 3270 , cape, ep, hp, icb, inb, clw, nk, t, h, lv & 3271 , epmax_diag) 3272 USE conema3_mod_h 3273 USE cvthermo_mod_h 3274 3275 IMPLICIT NONE 3276 3277 ! On fait varier epmax en fn de la cape 3278 ! Il faut donc recalculer ep, et hp qui a déjà été calculé et 3279 ! qui en dépend 3280 ! Toutes les autres variables fn de ep sont calculées plus bas. 3281 3282 3283 3284 ! inputs: 3285 INTEGER ncum, nd, nloc 3286 INTEGER icb(nloc), inb(nloc) 3287 REAL cape(nloc) 3288 REAL clw(nloc, nd), lv(nloc, nd), t(nloc, nd), h(nloc, nd) 3289 INTEGER nk(nloc) 3290 ! inouts: 3291 REAL ep(nloc, nd) 3292 REAL hp(nloc, nd) 3293 ! outputs ou local 3294 REAL epmax_diag(nloc) 3295 ! locals 3296 INTEGER i, k 3297 REAL hp_bak(nloc, nd) 3298 CHARACTER (LEN = 20) :: modname = 'cv30_epmax_fn_cape' 3299 CHARACTER (LEN = 80) :: abort_message 3300 3301 ! on recalcule ep et hp 3302 3303 IF (coef_epmax_cape>1e-12) THEN 3108 3304 DO i = 1, ncum 3109 IF (k>=icb(i) .AND. k<=inb(i)) THEN 3110 eplamm(i, j) = eplamm(i, j) + ep(i, j)*clw(i, j)*ment(i, j, k)*(1.- & 3111 sij(i,j,k)) 3112 END IF 3113 END DO 3114 END DO 3115 END DO 3116 3117 DO j = 1, nam1 3118 DO k = 1, j - 1 3305 epmax_diag(i) = epmax - coef_epmax_cape * sqrt(cape(i)) 3306 DO k = 1, nl 3307 ep(i, k) = ep(i, k) / epmax * epmax_diag(i) 3308 ep(i, k) = amax1(ep(i, k), 0.0) 3309 ep(i, k) = amin1(ep(i, k), epmax_diag(i)) 3310 enddo 3311 enddo 3312 3313 ! On recalcule hp: 3314 DO k = 1, nl 3315 DO i = 1, ncum 3316 hp_bak(i, k) = hp(i, k) 3317 enddo 3318 enddo 3319 DO k = 1, nlp 3320 DO i = 1, ncum 3321 hp(i, k) = h(i, k) 3322 enddo 3323 enddo 3324 DO k = minorig + 1, nl 3325 DO i = 1, ncum 3326 IF((k>=icb(i)).AND.(k<=inb(i)))THEN 3327 hp(i, k) = h(i, nk(i)) + (lv(i, k) + (cpd - cpv) * t(i, k)) * ep(i, k) * clw(i, k) 3328 endif 3329 enddo 3330 enddo !do k=minorig+1,n 3331 ! WRITE(*,*) 'cv30_routines 6218: hp(1,20)=',hp(1,20) 3119 3332 DO i = 1, ncum 3120 IF (k>=icb(i) .AND. k<=inb(i) .AND. j<=inb(i)) THEN 3121 epmlmmm(i, j, k) = epm(i, j, k)*elij(i, k, j)*ment(i, k, j) 3122 END IF 3123 END DO 3124 END DO 3125 END DO 3126 3127 ! matrices pour calculer la tendance des concentrations dans cvltr.F90 3128 DO j = 1, nam1 3129 DO k = 1, nam1 3130 DO i = 1, ncum 3131 da(i, j) = da(i, j) + (1.-sij(i,k,j))*ment(i, k, j) 3132 phi(i, j, k) = sij(i, k, j)*ment(i, k, j) 3133 d1a(i, j) = d1a(i, j) + ment(i, k, j)*ep(i, k)*(1.-sij(i,k,j)) 3134 END DO 3135 END DO 3136 END DO 3137 3138 DO j = 1, nam1 3139 DO k = 1, j - 1 3140 DO i = 1, ncum 3141 dam(i, j) = dam(i, j) + ment(i, k, j)*epm(i, j, k)*(1.-ep(i,k))*(1.- & 3142 sij(i,k,j)) 3143 phi2(i, j, k) = phi(i, j, k)*epm(i, j, k) 3144 END DO 3145 END DO 3146 END DO 3147 3148 RETURN 3149 END SUBROUTINE cv30_tracer 3150 ! RomP <<< 3151 3152 SUBROUTINE cv30_uncompress(nloc, len, ncum, nd, ntra, idcum, iflag, precip, & 3153 vprecip, evap, ep, sig, w0, ft, fq, fu, fv, ftra, inb, ma, upwd, dnwd, & 3154 dnwd0, qcondc, wd, cape, da, phi, mp, phi2, d1a, dam, sij, elij, clw, & 3155 epmlmmm, eplamm, wdtraina, wdtrainm,epmax_diag, iflag1, precip1, vprecip1, evap1, & 3156 ep1, sig1, w01, ft1, fq1, fu1, fv1, ftra1, inb1, ma1, upwd1, dnwd1, & 3157 dnwd01, qcondc1, wd1, cape1, da1, phi1, mp1, phi21, d1a1, dam1, sij1, & 3158 elij1, clw1, epmlmmm1, eplamm1, wdtraina1, wdtrainm1,epmax_diag1) ! epmax_cape 3159 IMPLICIT NONE 3160 3161 include "cv30param.h" 3162 3163 ! inputs: 3164 INTEGER len, ncum, nd, ntra, nloc 3165 INTEGER idcum(nloc) 3166 INTEGER iflag(nloc) 3167 INTEGER inb(nloc) 3168 REAL precip(nloc) 3169 REAL vprecip(nloc, nd+1), evap(nloc, nd) 3170 REAL ep(nloc, nd) 3171 REAL sig(nloc, nd), w0(nloc, nd) 3172 REAL ft(nloc, nd), fq(nloc, nd), fu(nloc, nd), fv(nloc, nd) 3173 REAL ftra(nloc, nd, ntra) 3174 REAL ma(nloc, nd) 3175 REAL upwd(nloc, nd), dnwd(nloc, nd), dnwd0(nloc, nd) 3176 REAL qcondc(nloc, nd) 3177 REAL wd(nloc), cape(nloc) 3178 REAL da(nloc, nd), phi(nloc, nd, nd), mp(nloc, nd) 3179 REAL epmax_diag(nloc) ! epmax_cape 3180 ! RomP >>> 3181 REAL phi2(nloc, nd, nd) 3182 REAL d1a(nloc, nd), dam(nloc, nd) 3183 REAL wdtraina(nloc, nd), wdtrainm(nloc, nd) 3184 REAL sij(nloc, nd, nd) 3185 REAL elij(nloc, nd, nd), clw(nloc, nd) 3186 REAL epmlmmm(nloc, nd, nd), eplamm(nloc, nd) 3187 ! RomP <<< 3188 3189 ! outputs: 3190 INTEGER iflag1(len) 3191 INTEGER inb1(len) 3192 REAL precip1(len) 3193 REAL vprecip1(len, nd+1), evap1(len, nd) !<<< RomP 3194 REAL ep1(len, nd) !<<< RomP 3195 REAL sig1(len, nd), w01(len, nd) 3196 REAL ft1(len, nd), fq1(len, nd), fu1(len, nd), fv1(len, nd) 3197 REAL ftra1(len, nd, ntra) 3198 REAL ma1(len, nd) 3199 REAL upwd1(len, nd), dnwd1(len, nd), dnwd01(len, nd) 3200 REAL qcondc1(nloc, nd) 3201 REAL wd1(nloc), cape1(nloc) 3202 REAL da1(nloc, nd), phi1(nloc, nd, nd), mp1(nloc, nd) 3203 REAL epmax_diag1(len) ! epmax_cape 3204 ! RomP >>> 3205 REAL phi21(len, nd, nd) 3206 REAL d1a1(len, nd), dam1(len, nd) 3207 REAL wdtraina1(len, nd), wdtrainm1(len, nd) 3208 REAL sij1(len, nd, nd) 3209 REAL elij1(len, nd, nd), clw1(len, nd) 3210 REAL epmlmmm1(len, nd, nd), eplamm1(len, nd) 3211 ! RomP <<< 3212 3213 ! local variables: 3214 INTEGER i, k, j 3215 3216 DO i = 1, ncum 3217 precip1(idcum(i)) = precip(i) 3218 iflag1(idcum(i)) = iflag(i) 3219 wd1(idcum(i)) = wd(i) 3220 inb1(idcum(i)) = inb(i) 3221 cape1(idcum(i)) = cape(i) 3222 epmax_diag1(idcum(i))=epmax_diag(i) ! epmax_cape 3223 END DO 3224 3225 DO k = 1, nl 3226 DO i = 1, ncum 3227 vprecip1(idcum(i), k) = vprecip(i, k) 3228 evap1(idcum(i), k) = evap(i, k) !<<< RomP 3229 sig1(idcum(i), k) = sig(i, k) 3230 w01(idcum(i), k) = w0(i, k) 3231 ft1(idcum(i), k) = ft(i, k) 3232 fq1(idcum(i), k) = fq(i, k) 3233 fu1(idcum(i), k) = fu(i, k) 3234 fv1(idcum(i), k) = fv(i, k) 3235 ma1(idcum(i), k) = ma(i, k) 3236 upwd1(idcum(i), k) = upwd(i, k) 3237 dnwd1(idcum(i), k) = dnwd(i, k) 3238 dnwd01(idcum(i), k) = dnwd0(i, k) 3239 qcondc1(idcum(i), k) = qcondc(i, k) 3240 da1(idcum(i), k) = da(i, k) 3241 mp1(idcum(i), k) = mp(i, k) 3242 ! RomP >>> 3243 ep1(idcum(i), k) = ep(i, k) 3244 d1a1(idcum(i), k) = d1a(i, k) 3245 dam1(idcum(i), k) = dam(i, k) 3246 clw1(idcum(i), k) = clw(i, k) 3247 eplamm1(idcum(i), k) = eplamm(i, k) 3248 wdtraina1(idcum(i), k) = wdtraina(i, k) 3249 wdtrainm1(idcum(i), k) = wdtrainm(i, k) 3250 ! RomP <<< 3251 END DO 3252 END DO 3253 3254 DO i = 1, ncum 3255 sig1(idcum(i), nd) = sig(i, nd) 3256 END DO 3257 3258 3259 ! do 2100 j=1,ntra 3260 ! do 2110 k=1,nd ! oct3 3261 ! do 2120 i=1,ncum 3262 ! ftra1(idcum(i),k,j)=ftra(i,k,j) 3263 ! 2120 continue 3264 ! 2110 continue 3265 ! 2100 continue 3266 DO j = 1, nd 3267 DO k = 1, nd 3268 DO i = 1, ncum 3269 sij1(idcum(i), k, j) = sij(i, k, j) 3270 phi1(idcum(i), k, j) = phi(i, k, j) 3271 phi21(idcum(i), k, j) = phi2(i, k, j) 3272 elij1(idcum(i), k, j) = elij(i, k, j) 3273 epmlmmm1(idcum(i), k, j) = epmlmmm(i, k, j) 3274 END DO 3275 END DO 3276 END DO 3277 3278 RETURN 3279 END SUBROUTINE cv30_uncompress 3280 3281 subroutine cv30_epmax_fn_cape(nloc,ncum,nd & 3282 ,cape,ep,hp,icb,inb,clw,nk,t,h,lv & 3283 ,epmax_diag) 3284 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 3285 , clmci, eps, epsi, epsim1, ginv, hrd, grav 3286 implicit none 3287 3288 ! On fait varier epmax en fn de la cape 3289 ! Il faut donc recalculer ep, et hp qui a d�j� �t� calcul� et 3290 ! qui en d�pend 3291 ! Toutes les autres variables fn de ep sont calcul�es plus bas. 3292 3293 INCLUDE "cv30param.h" 3294 INCLUDE "conema3.h" 3295 3296 ! inputs: 3297 integer ncum, nd, nloc 3298 integer icb(nloc), inb(nloc) 3299 real cape(nloc) 3300 real clw(nloc,nd),lv(nloc,nd),t(nloc,nd),h(nloc,nd) 3301 integer nk(nloc) 3302 ! inouts: 3303 real ep(nloc,nd) 3304 real hp(nloc,nd) 3305 ! outputs ou local 3306 real epmax_diag(nloc) 3307 ! locals 3308 integer i,k 3309 real hp_bak(nloc,nd) 3310 CHARACTER (LEN=20) :: modname='cv30_epmax_fn_cape' 3311 CHARACTER (LEN=80) :: abort_message 3312 3313 ! on recalcule ep et hp 3314 3315 if (coef_epmax_cape.gt.1e-12) then 3316 do i=1,ncum 3317 epmax_diag(i)=epmax-coef_epmax_cape*sqrt(cape(i)) 3318 do k=1,nl 3319 ep(i,k)=ep(i,k)/epmax*epmax_diag(i) 3320 ep(i,k)=amax1(ep(i,k),0.0) 3321 ep(i,k)=amin1(ep(i,k),epmax_diag(i)) 3322 enddo 3323 enddo 3324 3325 ! On recalcule hp: 3326 do k=1,nl 3327 do i=1,ncum 3328 hp_bak(i,k)=hp(i,k) 3329 enddo 3330 enddo 3331 do k=1,nlp 3332 do i=1,ncum 3333 hp(i,k)=h(i,k) 3334 enddo 3335 enddo 3336 do k=minorig+1,nl 3337 do i=1,ncum 3338 if((k.ge.icb(i)).and.(k.le.inb(i)))then 3339 hp(i,k)=h(i,nk(i))+(lv(i,k)+(cpd-cpv)*t(i,k))*ep(i,k)*clw(i,k) 3340 endif 3341 enddo 3342 enddo !do k=minorig+1,n 3343 ! write(*,*) 'cv30_routines 6218: hp(1,20)=',hp(1,20) 3344 do i=1,ncum 3345 do k=1,nl 3346 if (abs(hp_bak(i,k)-hp(i,k)).gt.0.01) then 3347 write(*,*) 'i,k=',i,k 3348 write(*,*) 'coef_epmax_cape=',coef_epmax_cape 3349 write(*,*) 'epmax_diag(i)=',epmax_diag(i) 3350 write(*,*) 'ep(i,k)=',ep(i,k) 3351 write(*,*) 'hp(i,k)=',hp(i,k) 3352 write(*,*) 'hp_bak(i,k)=',hp_bak(i,k) 3353 write(*,*) 'h(i,k)=',h(i,k) 3354 write(*,*) 'nk(i)=',nk(i) 3355 write(*,*) 'h(i,nk(i))=',h(i,nk(i)) 3356 write(*,*) 'lv(i,k)=',lv(i,k) 3357 write(*,*) 't(i,k)=',t(i,k) 3358 write(*,*) 'clw(i,k)=',clw(i,k) 3359 write(*,*) 'cpd,cpv=',cpd,cpv 3360 CALL abort_physic(modname,abort_message,1) 3361 endif 3362 enddo !do k=1,nl 3363 enddo !do i=1,ncum 3364 endif !if (coef_epmax_cape.gt.1e-12) then 3365 3366 return 3367 end subroutine cv30_epmax_fn_cape 3368 3369 3333 DO k = 1, nl 3334 IF (abs(hp_bak(i, k) - hp(i, k))>0.01) THEN 3335 WRITE(*, *) 'i,k=', i, k 3336 WRITE(*, *) 'coef_epmax_cape=', coef_epmax_cape 3337 WRITE(*, *) 'epmax_diag(i)=', epmax_diag(i) 3338 WRITE(*, *) 'ep(i,k)=', ep(i, k) 3339 WRITE(*, *) 'hp(i,k)=', hp(i, k) 3340 WRITE(*, *) 'hp_bak(i,k)=', hp_bak(i, k) 3341 WRITE(*, *) 'h(i,k)=', h(i, k) 3342 WRITE(*, *) 'nk(i)=', nk(i) 3343 WRITE(*, *) 'h(i,nk(i))=', h(i, nk(i)) 3344 WRITE(*, *) 'lv(i,k)=', lv(i, k) 3345 WRITE(*, *) 't(i,k)=', t(i, k) 3346 WRITE(*, *) 'clw(i,k)=', clw(i, k) 3347 WRITE(*, *) 'cpd,cpv=', cpd, cpv 3348 CALL abort_physic(modname, abort_message, 1) 3349 endif 3350 enddo !do k=1,nl 3351 enddo !do i=1,ncum 3352 ENDIF !if (coef_epmax_cape.gt.1e-12) THEN 3353 END SUBROUTINE cv30_epmax_fn_cape 3354 3355 3356 END MODULE cv30_routines_mod 3357 3358 -
LMDZ6/trunk/libf/phylmd/cv3_routines.f90
r5276 r5283 11 11 USE ioipsl_getin_p_mod, ONLY : getin_p 12 12 use mod_phys_lmdz_para 13 USE conema3_mod_h 13 14 IMPLICIT NONE 14 15 … … 37 38 38 39 include "cv3param.h" 39 include "conema3.h"40 40 41 41 INTEGER, INTENT(IN) :: nd … … 1148 1148 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 1149 1149 , clmci, eps, epsi, epsim1, ginv, hrd, grav 1150 USE conema3_mod_h 1150 1151 IMPLICIT NONE 1151 1152 … … 1169 1170 1170 1171 include "cv3param.h" 1171 include "conema3.h"1172 1172 include "YOMCST2.h" 1173 1173 … … 3471 3471 ftd, fqd, qta, qtc, sigt, detrain, tau_cld_cv, coefw_cld_cv) 3472 3472 3473 USE print_control_mod, ONLY: lunout, prt_level 3473 USE conema3_mod_h 3474 USE print_control_mod, ONLY: lunout, prt_level 3474 3475 USE add_phys_tend_mod, only : fl_cor_ebil 3475 3476 USE cvflag_mod_h, ONLY: icvflag_Tpa, cvflag_grav, cvflag_ice, ok_optim_yield, ok_entrain, ok_homo_tend, & … … 3480 3481 3481 3482 include "cv3param.h" 3482 include "conema3.h"3483 3483 3484 3484 !inputs: … … 5160 5160 , pbase, p, ph, tv, buoy, sig, w0,iflag & 5161 5161 , epmax_diag) 5162 USE cvflag_mod_h, ONLY: icvflag_Tpa, cvflag_grav, cvflag_ice, ok_optim_yield, ok_entrain, ok_homo_tend, & 5162 USE conema3_mod_h 5163 USE cvflag_mod_h, ONLY: icvflag_Tpa, cvflag_grav, cvflag_ice, ok_optim_yield, ok_entrain, ok_homo_tend, & 5163 5164 ok_convstop, ok_intermittent, cvflag_prec_eject, qsat_depends_on_qt, adiab_ascent_mass_flux_depends_on_ejectliq, keepbug_ice_frac 5164 5165 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & … … 5172 5173 5173 5174 include "cv3param.h" 5174 include "conema3.h"5175 5175 5176 5176 ! inputs: -
LMDZ6/trunk/libf/phylmd/cv3p1_closure.f90
r5276 r5283 19 19 ! ************************************************************** 20 20 21 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 21 USE conema3_mod_h 22 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 22 23 , clmci, eps, epsi, epsim1, ginv, hrd, grav 23 24 USE print_control_mod, ONLY: prt_level, lunout … … 39 40 include "YOMCST2.h" 40 41 41 include "conema3.h"42 42 43 43 ! input: -
LMDZ6/trunk/libf/phylmd/cv3p2_closure.f90
r5276 r5283 18 18 ! ************************************************************** 19 19 20 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 20 USE conema3_mod_h 21 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 21 22 , clmci, eps, epsi, epsim1, ginv, hrd, grav 22 23 USE cvflag_mod_h, ONLY: icvflag_Tpa, cvflag_grav, cvflag_ice, ok_optim_yield, ok_entrain, ok_homo_tend, & … … 40 41 include "YOMCST2.h" 41 42 42 include "conema3.h"43 43 44 44 ! input: -
LMDZ6/trunk/libf/phylmd/cv_driver.F90
r5276 r5283 12 12 13 13 USE dimphy 14 USE cv30_routines_mod, ONLY: cv30_param, cv30_prelim, cv30_feed, cv30_undilute1, cv30_trigger, cv30_compress, cv30_undilute2, & 15 cv30_closure, cv30_epmax_fn_cape, cv30_mixing, cv30_unsat, cv30_yield, cv30_tracer, cv30_uncompress 14 16 IMPLICIT NONE 15 17 -
LMDZ6/trunk/libf/phylmd/cvltr.f90
r5274 r5283 10 10 qPa,qMel,qTrdi,dtrcvMA,Mint, & 11 11 zmfd1a,zmfphi2,zmfdam) 12 USE IOIPSL 12 USE conema3_mod_h 13 USE IOIPSL 13 14 USE dimphy 14 15 USE infotrac_phy, ONLY : nbtr … … 34 35 35 36 include "YOECUMF.h" 36 include "conema3.h"37 37 38 38 ! Entree -
LMDZ6/trunk/libf/phylmd/cvltr_scav.f90
r5274 r5283 11 11 zmfd1a,zmfphi2,zmfdam) 12 12 ! 13 USE IOIPSL 13 USE conema3_mod_h 14 USE IOIPSL 14 15 USE dimphy 15 16 USE infotrac_phy, ONLY : nbtr … … 35 36 36 37 include "YOECUMF.h" 37 include "conema3.h"38 38 include "chem.h" 39 39 -
LMDZ6/trunk/libf/phylmd/cvltr_spl.f90
r5274 r5283 11 11 qPa,qMel,qTrdi,dtrcvMA,Mint, & 12 12 zmfd1a,zmfphi2,zmfdam) 13 USE IOIPSL 13 USE conema3_mod_h 14 USE IOIPSL 14 15 USE dimphy 15 16 USE infotrac_phy, ONLY : nbtr … … 35 36 36 37 include "YOECUMF.h" 37 include "conema3.h"38 38 include "chem.h" 39 39 -
LMDZ6/trunk/libf/phylmd/dyn1d/tracstoke_mod_h.f90
r5282 r5283 1 link ../../dyn3d_common/tracstoke .h1 link ../../dyn3d_common/tracstoke_mod_h.f90 -
LMDZ6/trunk/libf/phylmd/physiq_mod.F90
r5282 r5283 371 371 , RALPD, RBETD, RGAMD 372 372 USE clesphys_mod_h 373 USE conema3_mod_h 373 374 374 375 IMPLICIT NONE … … 1184 1185 include "YOETHF.h" 1185 1186 include "FCTTRE.h" 1186 !IM 100106 BEG : pouvoir sortir les ctes de la physique1187 include "conema3.h"1188 1187 include "nuage.h" 1189 1188 include "compbl.h" -
LMDZ6/trunk/libf/phylmdiso/concvl.F90
r5282 r5283 76 76 , RESTT, RALPW, RBETW, RGAMW, RALPS, RBETS, RGAMS & 77 77 , RALPD, RBETD, RGAMD 78 USE conema3_mod_h 78 79 IMPLICIT NONE 79 80 ! ====================================================================== … … 310 311 include "YOETHF.h" 311 312 include "FCTTRE.h" 312 !jyg<313 include "conema3.h"314 !>jyg315 313 316 314 IF (first) THEN -
LMDZ6/trunk/libf/phylmdiso/conema3_mod_h.f90
r5282 r5283 1 link ../phylmd/conema3 .h1 link ../phylmd/conema3_mod_h.f90 -
LMDZ6/trunk/libf/phylmdiso/cv30_routines_mod.F90
r5282 r5283 1 2 ! $Id$ 3 1 MODULE cv30_routines_mod 2 !------------------------------------------------------------ 3 ! Parameters for convectL, iflag_con=30: 4 ! (includes - microphysical parameters, 5 ! - parameters that control the rate of approach 6 ! to quasi-equilibrium) 7 ! - noff & minorig (previously in input of convect1) 8 !------------------------------------------------------------ 9 10 IMPLICIT NONE; PRIVATE 11 PUBLIC sigd, spfac, pbcrit, ptcrit, omtrain, dtovsh, dpbase, dttrig, dtcrit, & 12 tau, beta, alpha, delta, betad, noff, minorig, nl, nlp, nlm, & 13 cv30_param, cv30_prelim, cv30_feed, cv30_undilute1, cv30_trigger, & 14 cv30_compress, cv30_undilute2, cv30_closure, cv30_mixing, cv30_unsat, & 15 cv30_yield, cv30_tracer, cv30_uncompress, cv30_epmax_fn_cape 16 17 INTEGER noff, minorig, nl, nlp, nlm 18 REAL sigd, spfac 19 REAL pbcrit, ptcrit 20 REAL omtrain 21 REAL dtovsh, dpbase, dttrig 22 REAL dtcrit, tau, beta, alpha 23 REAL delta 24 REAL betad 25 26 !$OMP THREADPRIVATE(sigd, spfac, pbcrit, ptcrit, omtrain, dtovsh, dpbase, dttrig, dtcrit, & 27 !$OMP tau, beta, alpha, delta, betad, noff, minorig, nl, nlp, nlm) 28 CONTAINS 4 29 5 30 6 31 SUBROUTINE cv30_param(nd, delt) 7 USE c vthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl &8 , clmci, eps, epsi, epsim1, ginv, hrd, grav 32 USE conema3_mod_h 33 9 34 IMPLICIT NONE 10 35 … … 32 57 ! *** IT MUST BE LESS THAN 0 *** 33 58 34 include "cv30param.h"35 include "conema3.h"36 37 59 INTEGER nd 38 60 REAL delt ! timestep (seconds) … … 82 104 betad = 10.0 ! original value (from convect 4.3) 83 105 84 RETURN 106 85 107 END SUBROUTINE cv30_param 86 108 87 109 SUBROUTINE cv30_prelim(len, nd, ndp1, t, q, p, ph, lv, cpn, tv, gz, h, hm, & 88 110 th) 89 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 90 , clmci, eps, epsi, epsim1, ginv, hrd, grav111 112 USE cvthermo_mod_h 91 113 IMPLICIT NONE 92 114 … … 111 133 REAL tvx, tvy ! convect3 112 134 REAL cpx(len, nd) 113 114 include "cv30param.h"115 135 116 136 … … 158 178 END DO 159 179 160 RETURN 180 161 181 END SUBROUTINE cv30_prelim 162 182 … … 164 184 iflag, tnk, qnk, gznk, plcl & 165 185 #ifdef ISO 166 ,xt,xtnk & 186 ,xt,xtnk & 167 187 #endif 168 188 ) … … 186 206 ! ================================================================ 187 207 188 include "cv30param.h" 208 189 209 190 210 ! inputs: … … 194 214 REAL ph(len, nd+1) 195 215 #ifdef ISO 196 real xt(ntraciso,len,nd)216 REAL xt(ntraciso,len,nd) 197 217 #endif 198 218 … … 201 221 REAL tnk(len), qnk(len), gznk(len), plcl(len) 202 222 #ifdef ISO 203 real xtnk(ntraciso,len)223 REAL xtnk(ntraciso,len) 204 224 #endif 205 225 … … 207 227 INTEGER i, k 208 228 #ifdef ISO 209 integerixt229 INTEGER ixt 210 230 #endif 211 231 INTEGER ihmin(len) … … 228 248 ! @ do 200 k=2,nlp 229 249 ! @ do 190 i=1,len 230 ! @ if((hm(i,k).lt.work(i)). and.231 ! @ & (hm(i,k).lt.hm(i,k-1))) then250 ! @ if((hm(i,k).lt.work(i)).AND. 251 ! @ & (hm(i,k).lt.hm(i,k-1)))THEN 232 252 ! @ work(i)=hm(i,k) 233 253 ! @ ihmin(i)=k … … 237 257 ! @ do 210 i=1,len 238 258 ! @ ihmin(i)=min(ihmin(i),nlm) 239 ! @ if(ihmin(i).le.minorig)then259 ! @ IF(ihmin(i).le.minorig)THEN 240 260 ! @ iflag(i)=6 241 261 ! @ endif … … 253 273 ! @ do 240 k=minorig+1,nl 254 274 ! @ do 230 i=1,len 255 ! @ if((hm(i,k).gt.work(i)). and.(k.le.ihmin(i)))then275 ! @ if((hm(i,k).gt.work(i)).AND.(k.le.ihmin(i)))THEN 256 276 ! @ work(i)=hm(i,k) 257 277 ! @ nk(i)=k … … 273 293 ! ------------------------------------------------------------------- 274 294 DO i = 1, len 275 IF (((t(i,nk(i))<250.0) .OR. (q(i,nk(i))<=0.0)) & ! @ & . or.(295 IF (((t(i,nk(i))<250.0) .OR. (q(i,nk(i))<=0.0)) & ! @ & .OR.( 276 296 ! p(i,ihmin(i)).lt.400.0 277 297 ! ) ) … … 296 316 qsnk(i) = qs(i, nk(i)) 297 317 #ifdef ISO 298 doixt=1,ntraciso318 DO ixt=1,ntraciso 299 319 xtnk(ixt,i) = xt(ixt,i, nk(i)) 300 320 enddo … … 323 343 ! @ do 290 k=minorig,nl 324 344 ! @ do 280 i=1,len 325 ! @ if((k.ge.(nk(i)+1)). and.(p(i,k).lt.plcl(i)))345 ! @ if((k.ge.(nk(i)+1)).AND.(p(i,k).lt.plcl(i))) 326 346 ! @ & icb(i)=min(icb(i),k) 327 347 ! @ 280 continue … … 329 349 ! @c 330 350 ! @ do 300 i=1,len 331 ! @ if((icb(i).ge.nlm). and.(iflag(i).eq.0))iflag(i)=9351 ! @ if((icb(i).ge.nlm).AND.(iflag(i).EQ.0))iflag(i)=9 332 352 ! @ 300 continue 333 353 … … 346 366 347 367 DO i = 1, len 348 ! @ if((icb(i).ge.nlm). and.(iflag(i).eq.0))iflag(i)=9368 ! @ if((icb(i).ge.nlm).AND.(iflag(i).EQ.0))iflag(i)=9 349 369 IF ((icb(i)==nlm) .AND. (iflag(i)==0)) iflag(i) = 9 350 370 END DO … … 358 378 icbmax = 2 359 379 DO i = 1, len 360 ! !icbmax=max(icbmax,icb(i))380 ! icbmax=max(icbmax,icb(i)) 361 381 IF (iflag(i)<7) icbmax = max(icbmax, icb(i)) ! sb Jun7th02 362 382 END DO 363 383 364 RETURN 384 365 385 END SUBROUTINE cv30_feed 366 386 … … 368 388 clw, icbs & 369 389 #ifdef ISO 370 &,xt,xtclw &371 #endif 372 &)390 ,xt,xtclw & 391 #endif 392 ) 373 393 374 394 #ifdef ISO … … 380 400 USE isotopes_routines_mod, ONLY: condiso_liq_ice_vectall_trac 381 401 #ifdef ISOVERIF 382 useisotopes_verif_mod, ONLY: iso_verif_traceur383 #endif 384 #endif 385 #ifdef ISOVERIF 386 useisotopes_verif_mod, ONLY: errmax,errmaxrel,Tmin_verif, &402 USE isotopes_verif_mod, ONLY: iso_verif_traceur 403 #endif 404 #endif 405 #ifdef ISOVERIF 406 USE isotopes_verif_mod, ONLY: errmax,errmaxrel,Tmin_verif, & 387 407 iso_verif_egalite_choix, iso_verif_noNaN,iso_verif_aberrant, & 388 408 iso_verif_egalite,iso_verif_egalite_choix_nostop,iso_verif_positif_nostop, & … … 391 411 #endif 392 412 #endif 393 394 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 395 , clmci, eps, epsi, epsim1, ginv, hrd, grav 413 USE cvthermo_mod_h 414 396 415 IMPLICIT NONE 397 416 … … 409 428 ! ---------------------------------------------------------------- 410 429 411 include "cv30param.h"412 430 413 431 ! inputs: … … 418 436 REAL plcl(len) ! convect3 419 437 #ifdef ISO 420 realxt(ntraciso,len,nd)438 REAL xt(ntraciso,len,nd) 421 439 #endif 422 440 … … 424 442 REAL tp(len, nd), tvp(len, nd), clw(len, nd) 425 443 #ifdef ISO 426 real xtclw(ntraciso,len,nd)427 real tg_save(len,nd)444 REAL xtclw(ntraciso,len,nd) 445 REAL tg_save(len,nd) 428 446 #endif 429 447 … … 437 455 REAL cpinv(len) ! convect3 438 456 #ifdef ISO 439 integerixt440 realzfice(len),zxtliq(ntraciso,len),zxtice(ntraciso,len)441 realq_k(len),clw_k(len),tg_k(len),xt_k(ntraciso,len)442 !#ifdef ISOVERIF 457 INTEGER ixt 458 REAL zfice(len),zxtliq(ntraciso,len),zxtice(ntraciso,len) 459 REAL q_k(len),clw_k(len),tg_k(len),xt_k(ntraciso,len) 460 !#ifdef ISOVERIF 443 461 ! integer iso_verif_positif_nostop 444 462 !#endif … … 453 471 454 472 #ifdef ISOVERIF 455 write(*,*) 'cv30_routine undilute 1 413: entree'473 WRITE(*,*) 'cv30_routine undilute 1 413: entree' 456 474 #endif 457 475 … … 493 511 494 512 ! Re-compute icbsmax (icbsmax2): !convect3 495 ! !convect3513 !convect3 496 514 icbsmax2 = 2 !convect3 497 515 DO i = 1, len !convect3 … … 507 525 clw(i, k) = 0.0 ! convect3 508 526 #ifdef ISO 509 doixt=1,ntraciso527 DO ixt=1,ntraciso 510 528 xtclw(ixt,i,k) = 0.0 511 529 enddo 512 530 513 531 #endif 514 532 END DO ! convect3 … … 548 566 denom = 243.5 + tc 549 567 denom = max(denom, 1.0) ! convect3 550 ! ori if(tc.ge.0.0)then568 ! ori IF(tc.ge.0.0)THEN 551 569 es = 6.112*exp(17.67*tc/denom) 552 570 ! ori else … … 570 588 denom = 243.5 + tc 571 589 denom = max(denom, 1.0) ! convect3 572 ! ori if(tc.ge.0.0)then590 ! ori IF(tc.ge.0.0)THEN 573 591 es = 6.112*exp(17.67*tc/denom) 574 592 ! ori else … … 602 620 #ifdef ISO 603 621 ! calcul de zfice 604 doi=1,len622 DO i=1,len 605 623 zfice(i) = 1.0-(t(i,icbs(i))-pxtice)/(pxtmelt-pxtice) 606 zfice(i) = MIN(MAX(zfice(i),0.0),1.0) 624 zfice(i) = MIN(MAX(zfice(i),0.0),1.0) 607 625 enddo 608 626 ! calcul de la composition du condensat glace et liquide 609 627 610 doi=1,len628 DO i=1,len 611 629 clw_k(i)=clw(i,icbs(i)) 612 tg_k(i)=t(i,icbs(i)) 613 doixt=1,ntraciso614 xt_k(ixt,i)=xt(ixt,i,nk(i)) 615 enddo 630 tg_k(i)=t(i,icbs(i)) 631 DO ixt=1,ntraciso 632 xt_k(ixt,i)=xt(ixt,i,nk(i)) 633 enddo 616 634 enddo 617 635 #ifdef ISOVERIF 618 write(*,*) 'cv30_routine undilute1 573: avant condiso'619 write(*,*) 't(1,1)=',t(1,1)620 doi=1,len621 calliso_verif_positif(t(i,icbs(i))-Tmin_verif, &622 &'cv30_routines 654')636 WRITE(*,*) 'cv30_routine undilute1 573: avant condiso' 637 WRITE(*,*) 't(1,1)=',t(1,1) 638 DO i=1,len 639 CALL iso_verif_positif(t(i,icbs(i))-Tmin_verif, & 640 'cv30_routines 654') 623 641 enddo 624 if (iso_HDO.gt.0) then625 doi=1,len626 if (qnk(i).gt.ridicule) then627 calliso_verif_aberrant(xt_k(iso_hdo,i)/qnk(i), &628 &'cv30_routines 576')629 endif !if (qnk(i).gt.ridicule) then630 enddo 631 endif !if (iso_HDO.gt.0) then632 ! write(*,*) 'i=1, clw_k,qnk=',clw_k(1),qnk(1)633 #endif 634 callcondiso_liq_ice_vectall(xt_k(1,1),qnk(1), &635 &clw_k(1),tg_k(1), &636 & zfice(1),zxtice(1,1),zxtliq(1,1),len)642 IF (iso_HDO.gt.0) THEN 643 DO i=1,len 644 IF (qnk(i).gt.ridicule) THEN 645 CALL iso_verif_aberrant(xt_k(iso_hdo,i)/qnk(i), & 646 'cv30_routines 576') 647 endif !if (qnk(i).gt.ridicule) THEN 648 enddo 649 endif !if (iso_HDO.gt.0) THEN 650 ! WRITE(*,*) 'i=1, clw_k,qnk=',clw_k(1),qnk(1) 651 #endif 652 CALL condiso_liq_ice_vectall(xt_k(1,1),qnk(1), & 653 clw_k(1),tg_k(1), & 654 zfice(1),zxtice(1,1),zxtliq(1,1),len) 637 655 #ifdef ISOTRAC 638 656 #ifdef ISOVERIF 639 write(*,*) 'cv30_routines 658: callcondiso_liq_ice_vectall_trac'640 #endif 641 callcondiso_liq_ice_vectall_trac(xt_k(1,1),qnk(1), &642 &clw_k(1),tg_k(1), &643 &zfice(1),zxtice(1,1),zxtliq(1,1),len)644 #endif 645 doi=1,len646 do ixt = 1, ntraciso647 xtclw(ixt,i,icbs(i))= zxtice(ixt,i)+zxtliq(ixt,i) 657 WRITE(*,*) 'cv30_routines 658: CALL condiso_liq_ice_vectall_trac' 658 #endif 659 CALL condiso_liq_ice_vectall_trac(xt_k(1,1),qnk(1), & 660 clw_k(1),tg_k(1), & 661 zfice(1),zxtice(1,1),zxtliq(1,1),len) 662 #endif 663 DO i=1,len 664 DO ixt = 1, ntraciso 665 xtclw(ixt,i,icbs(i))= zxtice(ixt,i)+zxtliq(ixt,i) 648 666 xtclw(ixt,i,icbs(i))=max(0.0,xtclw(ixt,i,icbs(i))) 649 enddo !do ixt=1,niso 650 enddo !do i=1,len 651 652 #ifdef ISOVERIF 653 write(*,*) 'cv30_routine undilute 1 598: apres condiso'654 655 if (iso_eau.gt.0) then656 doi=1,len657 calliso_verif_egalite_choix(xtclw(iso_eau,i,icbs(i)), &658 &clw(i,icbs(i)),'cv30_routines 577',errmax,errmaxrel)667 enddo !do ixt=1,niso 668 enddo !do i=1,len 669 670 #ifdef ISOVERIF 671 WRITE(*,*) 'cv30_routine undilute 1 598: apres condiso' 672 673 IF (iso_eau.gt.0) THEN 674 DO i=1,len 675 CALL iso_verif_egalite_choix(xtclw(iso_eau,i,icbs(i)), & 676 clw(i,icbs(i)),'cv30_routines 577',errmax,errmaxrel) 659 677 enddo !do i=1,len 660 endif !if (iso_eau.gt.0) then661 #ifdef ISOTRAC 662 doi=1,len663 calliso_verif_traceur(xtclw(1,i,k),'cv30_routines 603')678 endif !if (iso_eau.gt.0) THEN 679 #ifdef ISOTRAC 680 DO i=1,len 681 CALL iso_verif_traceur(xtclw(1,i,k),'cv30_routines 603') 664 682 enddo 665 683 #endif 666 684 667 685 #endif 668 686 #endif … … 716 734 denom = 243.5 + tc 717 735 denom = max(denom, 1.0) ! convect3 718 ! ori if(tc.ge.0.0)then736 ! ori IF(tc.ge.0.0)THEN 719 737 es = 6.112*exp(17.67*tc/denom) 720 738 ! ori else … … 738 756 denom = 243.5 + tc 739 757 denom = max(denom, 1.0) ! convect3 740 ! ori if(tc.ge.0.0)then758 ! ori IF(tc.ge.0.0)THEN 741 759 es = 6.112*exp(17.67*tc/denom) 742 760 ! ori else … … 772 790 773 791 #ifdef ISO 774 doi=1,len792 DO i=1,len 775 793 zfice(i) = 1.0-(t(i,icb(i)+1)-pxtice)/(pxtmelt-pxtice) 776 794 zfice(i) = MIN(MAX(zfice(i),0.0),1.0) 777 ! callcalcul_zfice(tp(i,icb(i)+1),zfice)795 ! CALL calcul_zfice(tp(i,icb(i)+1),zfice) 778 796 enddo !do i=1,len 779 doi=1,len797 DO i=1,len 780 798 clw_k(i)=clw(i,icb(i)+1) 781 799 tg_k(i)=t(i,icb(i)+1) 782 800 #ifdef ISOVERIF 783 call iso_verif_positif(tg_k(i)-Tmin_verif,'cv30_routines 750')784 #endif 785 doixt=1,ntraciso786 xt_k(ixt,i)=xt(ixt,i,nk(i)) 787 enddo 801 CALL iso_verif_positif(tg_k(i)-Tmin_verif,'cv30_routines 750') 802 #endif 803 DO ixt=1,ntraciso 804 xt_k(ixt,i)=xt(ixt,i,nk(i)) 805 enddo 788 806 enddo !do i=1,len 789 #ifdef ISOVERIF 790 write(*,*) 'cv30_routines 739: avant condiso'791 if (iso_HDO.gt.0) then792 doi=1,len793 calliso_verif_aberrant(xt_k(iso_hdo,i)/qnk(i), &794 &'cv30_routines 725')795 enddo 796 endif !if (iso_HDO.gt.0) then797 #ifdef ISOTRAC 798 doi=1,len799 calliso_verif_traceur(xtclw(1,i,k),'cv30_routines 738')807 #ifdef ISOVERIF 808 WRITE(*,*) 'cv30_routines 739: avant condiso' 809 IF (iso_HDO.gt.0) THEN 810 DO i=1,len 811 CALL iso_verif_aberrant(xt_k(iso_hdo,i)/qnk(i), & 812 'cv30_routines 725') 813 enddo 814 endif !if (iso_HDO.gt.0) THEN 815 #ifdef ISOTRAC 816 DO i=1,len 817 CALL iso_verif_traceur(xtclw(1,i,k),'cv30_routines 738') 800 818 enddo 801 #endif 802 #endif 803 callcondiso_liq_ice_vectall(xt_k(1,1),qnk(1), &804 &clw_k(1),tg_k(1), &805 & zfice(1),zxtice(1,1),zxtliq(1,1),len)819 #endif 820 #endif 821 CALL condiso_liq_ice_vectall(xt_k(1,1),qnk(1), & 822 clw_k(1),tg_k(1), & 823 zfice(1),zxtice(1,1),zxtliq(1,1),len) 806 824 #ifdef ISOTRAC 807 callcondiso_liq_ice_vectall_trac(xt_k(1,1),qnk(1), &808 &clw_k(1),tg_k(1), &809 & zfice(1),zxtice(1,1),zxtliq(1,1),len)810 #endif 811 doi=1,len812 doixt = 1, ntraciso813 xtclw(ixt,i,icb(i)+1)=zxtice(ixt,i)+zxtliq(ixt,i) 825 CALL condiso_liq_ice_vectall_trac(xt_k(1,1),qnk(1), & 826 clw_k(1),tg_k(1), & 827 zfice(1),zxtice(1,1),zxtliq(1,1),len) 828 #endif 829 DO i=1,len 830 DO ixt = 1, ntraciso 831 xtclw(ixt,i,icb(i)+1)=zxtice(ixt,i)+zxtliq(ixt,i) 814 832 xtclw(ixt,i,icb(i)+1)=max(0.0,xtclw(ixt,i,icb(i)+1)) 815 833 enddo !do ixt = 1, niso 816 834 enddo !do i=1,len 817 835 818 #ifdef ISOVERIF 819 ! write(*,*) 'DEBUG ISO B'820 doi=1,len821 if (iso_eau.gt.0) then822 calliso_verif_egalite_choix(xtclw(iso_eau,i,icb(i)+1), &823 & clw(i,icb(i)+1),'cv30_routines 708',errmax,errmaxrel)824 endif ! if (iso_eau.gt.0) then825 #ifdef ISOTRAC 826 calliso_verif_traceur(xtclw(1,i,icb(i)+1), &827 &'cv30_routines 760')828 #endif 836 #ifdef ISOVERIF 837 !WRITE(*,*) 'DEBUG ISO B' 838 DO i=1,len 839 IF (iso_eau.gt.0) THEN 840 CALL iso_verif_egalite_choix(xtclw(iso_eau,i,icb(i)+1), & 841 clw(i,icb(i)+1),'cv30_routines 708',errmax,errmaxrel) 842 endif ! if (iso_eau.gt.0) THEN 843 #ifdef ISOTRAC 844 CALL iso_verif_traceur(xtclw(1,i,icb(i)+1), & 845 'cv30_routines 760') 846 #endif 829 847 enddo !do i=1,len 830 ! write(*,*) 'FIN DEBUG ISO B'831 #endif 832 #endif 833 834 RETURN 848 !WRITE(*,*) 'FIN DEBUG ISO B' 849 #endif 850 #endif 851 852 835 853 END SUBROUTINE cv30_undilute1 836 854 … … 854 872 ! ------------------------------------------------------------------- 855 873 856 include "cv30param.h" 874 857 875 858 876 ! input: … … 901 919 ! oct3 ath = th(i,icb(i)-1) - dttrig 902 920 ! oct3 903 ! oct3 if (tdif.lt.dtcrit . or. ath.gt.ath1) then921 ! oct3 if (tdif.lt.dtcrit .OR. ath.gt.ath1) THEN 904 922 ! oct3 do 60 k=1,nl 905 923 ! oct3 sig(i,k) = beta*sig(i,k) - 2.*alpha*tdif*tdif … … 909 927 ! oct3 iflag(i)=4 ! pour version vectorisee 910 928 ! oct3c convect3 iflag(i)=0 911 ! oct3cccc return929 ! oct3cccc RETURN 912 930 ! oct3 endif 913 931 ! oct3 … … 936 954 ! fin oct3 -- 937 955 938 RETURN 956 939 957 END SUBROUTINE cv30_trigger 940 958 … … 943 961 th1, tra1, h1, lv1, cpn1, p1, ph1, tv1, tp1, tvp1, clw1, sig1, w01, & 944 962 iflag, nk, icb, icbs, plcl, tnk, qnk, gznk, pbase, buoybase, t, q, qs, u, & 945 v, gz, th, tra, h, lv, cpn, p, ph, tv, tp, tvp, clw, sig, w0 & 946 #ifdef ISO 947 &,xtnk1,xt1,xtclw1 &948 &,xtnk,xt,xtclw &949 #endif 950 &)963 v, gz, th, tra, h, lv, cpn, p, ph, tv, tp, tvp, clw, sig, w0 & 964 #ifdef ISO 965 ,xtnk1,xt1,xtclw1 & 966 ,xtnk,xt,xtclw & 967 #endif 968 ) 951 969 USE print_control_mod, ONLY: lunout 952 970 #ifdef ISO 953 useinfotrac_phy, ONLY: ntraciso=>ntiso954 useisotopes_mod, ONLY: essai_convergence, iso_eau,iso_HDO955 #ifdef ISOVERIF 956 useisotopes_verif_mod, ONLY: errmax,errmaxrel,Tmin_verif, &971 USE infotrac_phy, ONLY: ntraciso=>ntiso 972 USE isotopes_mod, ONLY: essai_convergence, iso_eau,iso_HDO 973 #ifdef ISOVERIF 974 USE isotopes_verif_mod, ONLY: errmax,errmaxrel,Tmin_verif, & 957 975 iso_verif_egalite_choix, iso_verif_noNaN,iso_verif_aberrant, & 958 976 iso_verif_egalite,iso_verif_egalite_choix_nostop,iso_verif_positif_nostop, & … … 963 981 IMPLICIT NONE 964 982 965 include "cv30param.h" 983 966 984 967 985 ! inputs: … … 979 997 #ifdef ISO 980 998 !integer niso 981 realxt1(ntraciso,len,nd), xtclw1(ntraciso,len,nd)982 realxtnk1(ntraciso,len)999 REAL xt1(ntraciso,len,nd), xtclw1(ntraciso,len,nd) 1000 REAL xtnk1(ntraciso,len) 983 1001 #endif 984 1002 … … 996 1014 REAL tra(nloc, nd, ntra) 997 1015 #ifdef ISO 998 realxt(ntraciso,nloc,nd), xtclw(ntraciso,nloc,nd)999 realxtnk(ntraciso,nloc)1016 REAL xt(ntraciso,nloc,nd), xtclw(ntraciso,nloc,nd) 1017 REAL xtnk(ntraciso,nloc) 1000 1018 #endif 1001 1019 … … 1003 1021 INTEGER i, k, nn, j 1004 1022 #ifdef ISO 1005 integerixt1023 INTEGER ixt 1006 1024 #endif 1007 1025 … … 1011 1029 #ifdef ISO 1012 1030 ! initialisation des champs compresses: 1013 dok=1,nd1014 doi=1,nloc1015 if (essai_convergence) then1031 DO k=1,nd 1032 DO i=1,nloc 1033 IF (essai_convergence) THEN 1016 1034 else 1017 1035 q(i,k)=0.0 1018 1036 clw(i,k)=0.0 ! mise en commentaire le 5 avril pour verif 1019 1037 ! convergence 1020 endif !f (negation(essai_convergence)) then1021 doixt=1,ntraciso1038 endif !f (negation(essai_convergence)) THEN 1039 DO ixt=1,ntraciso 1022 1040 xt(ixt,i,k)=0.0 1023 1041 xtclw(ixt,i,k)=0.0 1024 enddo !do ixt=1,niso 1042 enddo !do ixt=1,niso 1025 1043 enddo !do i=1,len 1026 1044 enddo !do k=1,nd 1027 ! write(*,*) 'q(1,1),xt(iso_eau,1,1)=',q(1,1),xt(iso_eau,1,1)1045 ! WRITE(*,*) 'q(1,1),xt(iso_eau,1,1)=',q(1,1),xt(iso_eau,1,1) 1028 1046 #endif 1029 1047 … … 1052 1070 th(nn, k) = th1(i, k) 1053 1071 #ifdef ISO 1054 doixt = 1, ntraciso1072 DO ixt = 1, ntraciso 1055 1073 xt(ixt,nn,k)=xt1(ixt,i,k) 1056 1074 xtclw(ixt,nn,k)=xtclw1(ixt,i,k) 1057 1075 enddo 1058 ! write(*,*) 'nn,i,k,q(nn,k),xt(iso_eau,nn,k)=', &1076 ! WRITE(*,*) 'nn,i,k,q(nn,k),xt(iso_eau,nn,k)=', & 1059 1077 ! & nn,i,k,q(nn, k),xt(ixt,nn,k) 1060 1078 #endif … … 1067 1085 ! nn=0 1068 1086 ! do 101 i=1,len 1069 ! if(iflag1(i).eq.0)then1087 ! IF(iflag1(i).EQ.0)THEN 1070 1088 ! nn=nn+1 1071 1089 ! tra(nn,k,j)=tra1(i,k,j) 1072 ! endif1090 ! END IF 1073 1091 ! 101 continue 1074 1092 ! 111 continue … … 1096 1114 iflag(nn) = iflag1(i) 1097 1115 #ifdef ISO 1098 doixt=1,ntraciso1116 DO ixt=1,ntraciso 1099 1117 xtnk(ixt,nn) = xtnk1(ixt,i) 1100 1118 enddo … … 1105 1123 #ifdef ISO 1106 1124 #ifdef ISOVERIF 1107 if (iso_eau.gt.0) then1108 dok = 1, nd1109 do i = 1, nloc1110 ! write(*,*) 'i,k=',i,k1111 calliso_verif_egalite_choix(xtclw(iso_eau,i,k),clw(i,k), &1112 &'compress 973',errmax,errmaxrel)1113 calliso_verif_egalite_choix(xt(iso_eau,i,k),q(i,k), &1114 &'compress 975',errmax,errmaxrel)1125 IF (iso_eau.gt.0) THEN 1126 DO k = 1, nd 1127 DO i = 1, nloc 1128 !WRITE(*,*) 'i,k=',i,k 1129 CALL iso_verif_egalite_choix(xtclw(iso_eau,i,k),clw(i,k), & 1130 'compress 973',errmax,errmaxrel) 1131 CALL iso_verif_egalite_choix(xt(iso_eau,i,k),q(i,k), & 1132 'compress 975',errmax,errmaxrel) 1115 1133 enddo 1116 1134 enddo 1117 endif !if (iso_eau.gt.0) then1118 dok = 1, nd1119 doi = 1, nn1120 call iso_verif_positif(q(i,k),'compress 1004')1135 endif !if (iso_eau.gt.0) THEN 1136 DO k = 1, nd 1137 DO i = 1, nn 1138 CALL iso_verif_positif(q(i,k),'compress 1004') 1121 1139 enddo 1122 enddo 1123 #endif 1124 #endif 1125 1126 1127 RETURN 1140 enddo 1141 #endif 1142 #endif 1143 1144 1145 1128 1146 END SUBROUTINE cv30_compress 1129 1147 … … 1132 1150 ep, sigp, buoy & 1133 1151 #ifdef ISO 1134 &,xtnk,xt,xtclw &1135 #endif 1136 &)1152 ,xtnk,xt,xtclw & 1153 #endif 1154 ) 1137 1155 ! epmax_cape: ajout arguments 1138 #ifdef ISO 1139 use infotrac_phy, ONLY: ntraciso=>ntiso 1156 USE conema3_mod_h 1157 #ifdef ISO 1158 USE infotrac_phy, ONLY: ntraciso=>ntiso 1140 1159 USE isotopes_mod, ONLY: pxtmelt,pxtice,pxtmin,pxtmax,cond_temp_env, iso_eau,iso_HDO 1141 1160 USE isotopes_routines_mod, ONLY: condiso_liq_ice_vectall … … 1147 1166 #endif 1148 1167 #ifdef ISOVERIF 1149 useisotopes_verif_mod, ONLY: errmax,errmaxrel,Tmin_verif,Tmax_verif, &1168 USE isotopes_verif_mod, ONLY: errmax,errmaxrel,Tmin_verif,Tmax_verif, & 1150 1169 iso_verif_egalite_choix, iso_verif_noNaN,iso_verif_aberrant, & 1151 1170 iso_verif_egalite,iso_verif_egalite_choix_nostop,iso_verif_positif_nostop, & … … 1154 1173 #endif 1155 1174 #endif 1156 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 1157 , clmci, eps, epsi, epsim1, ginv, hrd, grav 1175 USE cvthermo_mod_h 1158 1176 IMPLICIT NONE 1159 1177 … … 1173 1191 ! - vertical profile of buoyancy computed here (use of buoybase) 1174 1192 ! - the determination of inb is different 1175 ! - no inb1, onlyinb in output1193 ! - no inb1, ONLY inb in output 1176 1194 ! --------------------------------------------------------------------- 1177 1178 include "cv30param.h"1179 include "conema3.h"1180 1195 1181 1196 ! inputs: … … 1202 1217 1203 1218 #ifdef ISO 1204 realxt(ntraciso,nloc,nd), xtclw(ntraciso,nloc,nd)1205 realxtnk(ntraciso,nloc)1219 REAL xt(ntraciso,nloc,nd), xtclw(ntraciso,nloc,nd) 1220 REAL xtnk(ntraciso,nloc) 1206 1221 ! real xtep(ntraciso,nloc,nd) ! le 7 mai: on supprime xtep, car pas besoin 1207 1222 ! la chute de precip ne fractionne pas. 1208 integerixt1209 realzfice(nloc),zxtliq(ntraciso,nloc),zxtice(ntraciso,nloc)1210 realclw_k(nloc),tg_k(nloc)1211 #ifdef ISOVERIF 1212 realqg_save(nloc,nd) ! inout1223 INTEGER ixt 1224 REAL zfice(nloc),zxtliq(ntraciso,nloc),zxtice(ntraciso,nloc) 1225 REAL clw_k(nloc),tg_k(nloc) 1226 #ifdef ISOVERIF 1227 REAL qg_save(nloc,nd) ! inout 1213 1228 !integer iso_verif_positif_nostop 1214 #endif 1229 #endif 1215 1230 #endif 1216 1231 … … 1249 1264 DO k = minorig + 1, nl 1250 1265 DO i = 1, ncum 1251 ! ori if(k.ge.(icb(i)+1))then1266 ! ori IF(k.ge.(icb(i)+1))THEN 1252 1267 IF (k>=(icbs(i)+1)) THEN ! convect3 1253 1268 tg = t(i, k) 1254 1269 qg = qs(i, k) 1255 ! debug 1270 ! debug alv=lv0-clmcpv*(t(i,k)-t0) 1256 1271 alv = lv0 - clmcpv*(t(i,k)-273.15) 1257 1272 1258 1273 ! First iteration. 1259 1274 1260 ! ori 1275 ! ori s=cpd+alv*alv*qg/(rrv*t(i,k)*t(i,k)) 1261 1276 s = cpd*(1.-qnk(i)) + cl*qnk(i) & ! convect3 1262 1277 +alv*alv*qg/(rrv*t(i,k)*t(i,k)) ! convect3 1263 1278 s = 1./s 1264 ! ori 1279 ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*t(i,k)+alv*qg+gz(i,k) 1265 1280 ahg = cpd*tg + (cl-cpd)*qnk(i)*tg + alv*qg + gz(i, k) ! convect3 1266 1281 tg = tg + s*(ah0(i)-ahg) 1267 ! ori 1268 ! debug 1282 ! ori tg=max(tg,35.0) 1283 ! debug tc=tg-t0 1269 1284 tc = tg - 273.15 1270 1285 denom = 243.5 + tc 1271 1286 denom = max(denom, 1.0) ! convect3 1272 ! ori if(tc.ge.0.0)then1287 ! ori IF(tc.ge.0.0)THEN 1273 1288 es = 6.112*exp(17.67*tc/denom) 1274 ! ori 1275 ! ori 1276 ! ori 1289 ! ori else 1290 ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) 1291 ! ori endif 1277 1292 qg = eps*es/(p(i,k)-es*(1.-eps)) 1278 1293 ! qg=max(0.0,qg) ! C Risi … … 1280 1295 ! Second iteration. 1281 1296 1282 ! ori 1283 ! ori 1284 ! ori 1297 ! ori s=cpd+alv*alv*qg/(rrv*t(i,k)*t(i,k)) 1298 ! ori s=1./s 1299 ! ori ahg=cpd*tg+(cl-cpd)*qnk(i)*t(i,k)+alv*qg+gz(i,k) 1285 1300 ahg = cpd*tg + (cl-cpd)*qnk(i)*tg + alv*qg + gz(i, k) ! convect3 1286 1301 tg = tg + s*(ah0(i)-ahg) 1287 ! ori 1288 ! debug 1302 ! ori tg=max(tg,35.0) 1303 ! debug tc=tg-t0 1289 1304 tc = tg - 273.15 1290 1305 denom = 243.5 + tc 1291 1306 denom = max(denom, 1.0) ! convect3 1292 ! ori if(tc.ge.0.0)then1307 ! ori IF(tc.ge.0.0)THEN 1293 1308 es = 6.112*exp(17.67*tc/denom) 1294 ! ori 1295 ! ori 1296 ! ori 1309 ! ori else 1310 ! ori es=exp(23.33086-6111.72784/tg+0.15215*log(tg)) 1311 ! ori endif 1297 1312 qg = eps*es/(p(i,k)-es*(1.-eps)) 1298 1313 ! qg=max(0.0,qg) ! C Risi 1299 1314 1300 ! debug 1315 ! debug alv=lv0-clmcpv*(t(i,k)-t0) 1301 1316 alv = lv0 - clmcpv*(t(i,k)-273.15) 1302 ! print*,'cpd dans convect2 ',cpd1303 ! print*,'tp(i,k),ah0(i),cl,cpd,qnk(i),t(i,k),gz(i,k),alv,qg,cpd'1304 ! print*,tp(i,k),ah0(i),cl,cpd,qnk(i),t(i,k),gz(i,k),alv,qg,cpd1317 ! PRINT*,'cpd dans convect2 ',cpd 1318 ! PRINT*,'tp(i,k),ah0(i),cl,cpd,qnk(i),t(i,k),gz(i,k),alv,qg,cpd' 1319 ! PRINT*,tp(i,k),ah0(i),cl,cpd,qnk(i),t(i,k),gz(i,k),alv,qg,cpd 1305 1320 1306 1321 ! ori c approximation here: … … 1322 1337 #ifdef ISO 1323 1338 ! calcul de zfice 1324 doi=1,ncum1339 DO i=1,ncum 1325 1340 zfice(i) = 1.0-(t(i,k)-pxtice)/(pxtmelt-pxtice) 1326 zfice(i) = MIN(MAX(zfice(i),0.0),1.0) 1341 zfice(i) = MIN(MAX(zfice(i),0.0),1.0) 1327 1342 enddo 1328 doi=1,ncum1343 DO i=1,ncum 1329 1344 clw_k(i)=clw(i,k) 1330 1345 tg_k(i)=t(i,k) 1331 1346 enddo !do i=1,ncum 1332 1347 #ifdef ISOVERIF 1333 ! write(*,*) 'cv30_routine 1259: avant condiso'1334 if (iso_HDO.gt.0) then1335 doi=1,ncum1336 calliso_verif_aberrant(xtnk(iso_hdo,i)/qnk(i), &1337 &'cv30_routines 1231')1338 enddo 1339 endif !if (iso_HDO.gt.0) then1340 if (iso_eau.gt.0) then1341 doi=1,ncum1342 calliso_verif_egalite(xtnk(iso_eau,i),qnk(i), &1343 &'cv30_routines 1373')1344 enddo 1345 endif !if (iso_HDO.gt.0) then1346 doi=1,ncum1347 if((iso_verif_positif_nostop(qnk(i)-clw_k(i), &1348 & 'cv30_routines 1275').eq.1).or. &1349 &(iso_verif_positif_nostop(tg_k(i)-Tmin_verif, &1350 & 'cv30_routines 1297a').eq.1).or. &1351 &(iso_verif_positif_nostop(Tmax_verif-tg_k(i), &1352 & 'cv30_routines 1297b').eq.1)) then1353 write(*,*) 'i,k,qnk,clw_k=',i,k,qnk(i),clw_k(i)1354 write(*,*) 'tg,t,qg=',tg_k(i),t(i,k),qg_save(i,k)1355 write(*,*) 'icbs(i)=',icbs(i)1348 !WRITE(*,*) 'cv30_routine 1259: avant condiso' 1349 IF (iso_HDO.gt.0) THEN 1350 DO i=1,ncum 1351 CALL iso_verif_aberrant(xtnk(iso_hdo,i)/qnk(i), & 1352 'cv30_routines 1231') 1353 enddo 1354 endif !if (iso_HDO.gt.0) THEN 1355 IF (iso_eau.gt.0) THEN 1356 DO i=1,ncum 1357 CALL iso_verif_egalite(xtnk(iso_eau,i),qnk(i), & 1358 'cv30_routines 1373') 1359 enddo 1360 endif !if (iso_HDO.gt.0) THEN 1361 DO i=1,ncum 1362 IF ((iso_verif_positif_nostop(qnk(i)-clw_k(i), & 1363 'cv30_routines 1275').EQ.1).OR. & 1364 (iso_verif_positif_nostop(tg_k(i)-Tmin_verif, & 1365 'cv30_routines 1297a').EQ.1).OR. & 1366 (iso_verif_positif_nostop(Tmax_verif-tg_k(i), & 1367 'cv30_routines 1297b').EQ.1)) THEN 1368 WRITE(*,*) 'i,k,qnk,clw_k=',i,k,qnk(i),clw_k(i) 1369 WRITE(*,*) 'tg,t,qg=',tg_k(i),t(i,k),qg_save(i,k) 1370 WRITE(*,*) 'icbs(i)=',icbs(i) 1356 1371 stop 1357 1372 endif ! if ((iso_verif_positif_nostop 1358 enddo !do i=1,ncum1359 #ifdef ISOTRAC1360 do i=1,ncum1361 call iso_verif_traceur(xtnk(1,i),'cv30_routines 1251')1362 1373 enddo !do i=1,ncum 1363 #endif1364 #endif1365 call condiso_liq_ice_vectall(xtnk(1,1),qnk(1), &1366 & clw_k(1),tg_k(1), &1367 & zfice(1),zxtice(1,1),zxtliq(1,1),ncum)1368 1374 #ifdef ISOTRAC 1369 #ifdef ISOVERIF 1370 write(*,*) 'cv30_routines 1283: condiso pour traceurs' 1371 #endif 1372 call condiso_liq_ice_vectall_trac(xtnk(1,1),qnk(1), & 1373 & clw_k(1),tg_k(1), & 1374 & zfice(1),zxtice(1,1),zxtliq(1,1),ncum) 1375 #endif 1376 do i=1,ncum 1377 do ixt=1,ntraciso 1375 DO i=1,ncum 1376 CALL iso_verif_traceur(xtnk(1,i),'cv30_routines 1251') 1377 enddo !do i=1,ncum 1378 #endif 1379 #endif 1380 CALL condiso_liq_ice_vectall(xtnk(1,1),qnk(1), & 1381 clw_k(1),tg_k(1), & 1382 zfice(1),zxtice(1,1),zxtliq(1,1),ncum) 1383 #ifdef ISOTRAC 1384 #ifdef ISOVERIF 1385 WRITE(*,*) 'cv30_routines 1283: condiso pour traceurs' 1386 #endif 1387 CALL condiso_liq_ice_vectall_trac(xtnk(1,1),qnk(1), & 1388 clw_k(1),tg_k(1), & 1389 zfice(1),zxtice(1,1),zxtliq(1,1),ncum) 1390 #endif 1391 DO i=1,ncum 1392 DO ixt=1,ntraciso 1378 1393 xtclw(ixt,i,k)=zxtice(ixt,i)+zxtliq(ixt,i) 1379 1394 xtclw(ixt,i,k)=max(0.0,xtclw(ixt,i,k)) … … 1381 1396 enddo !do i=1,ncum 1382 1397 #ifdef ISOVERIF 1383 if (iso_eau.gt.0) then1384 do i=1,ncum1385 calliso_verif_egalite_choix(xtclw(iso_eau,i,k), &1386 &clw(i,k),'cv30_routines 1223',errmax,errmaxrel)1398 IF (iso_eau.gt.0) THEN 1399 DO i=1,ncum 1400 CALL iso_verif_egalite_choix(xtclw(iso_eau,i,k), & 1401 clw(i,k),'cv30_routines 1223',errmax,errmaxrel) 1387 1402 enddo 1388 endif !if (iso_eau.gt.0) then1389 #ifdef ISOTRAC 1390 doi=1,ncum1391 calliso_verif_traceur(xtclw(1,i,k),'cv30_routines 1275')1403 endif !if (iso_eau.gt.0) THEN 1404 #ifdef ISOTRAC 1405 DO i=1,ncum 1406 CALL iso_verif_traceur(xtclw(1,i,k),'cv30_routines 1275') 1392 1407 enddo 1393 #endif 1394 #endif 1408 #endif 1409 #endif 1395 1410 #endif 1396 1411 END DO … … 1410 1425 ep(i, k) = amin1(ep(i,k), epmax) 1411 1426 sigp(i, k) = spfac 1412 ! ori if(k.ge.(nk(i)+1))then1427 ! ori IF(k.ge.(nk(i)+1))THEN 1413 1428 ! ori tca=tp(i,k)-t0 1414 ! ori if(tca.ge.0.0)then1429 ! ori IF(tca.ge.0.0)THEN 1415 1430 ! ori elacrit=elcrit 1416 1431 ! ori else … … 1436 1451 ! ori do 340 k=minorig+1,nl 1437 1452 ! ori do 330 i=1,ncum 1438 ! ori if(k.ge.(icb(i)+1))then1453 ! ori IF(k.ge.(icb(i)+1))THEN 1439 1454 ! ori tvp(i,k)=tvp(i,k)*(1.0-qnk(i)+ep(i,k)*clw(i,k)) 1440 ! oric print*,'i,k,tvp(i,k),qnk(i),ep(i,k),clw(i,k)'1441 ! oric print*, i,k,tvp(i,k),qnk(i),ep(i,k),clw(i,k)1455 ! oric PRINT*,'i,k,tvp(i,k),qnk(i),ep(i,k),clw(i,k)' 1456 ! oric PRINT*, i,k,tvp(i,k),qnk(i),ep(i,k),clw(i,k) 1442 1457 ! ori endif 1443 1458 ! ori 330 continue … … 1513 1528 ! do 530 k=minorig+1,nl-1 1514 1529 ! do 520 i=1,ncum 1515 ! if(k.ge.(icb(i)+1))then1530 ! IF(k.ge.(icb(i)+1))THEN 1516 1531 ! by=(tvp(i,k)-tv(i,k))*dph(i,k)/p(i,k) 1517 1532 ! byp=(tvp(i,k+1)-tv(i,k+1))*dph(i,k+1)/p(i,k+1) 1518 1533 ! cape(i)=cape(i)+by 1519 ! if(by.ge.0.0)inb1(i)=k+11520 ! if(cape(i).gt.0.0)then1534 ! IF(by.ge.0.0)inb1(i)=k+1 1535 ! IF(cape(i).gt.0.0)THEN 1521 1536 ! inb(i)=k+1 1522 1537 ! capem(i)=cape(i) 1523 ! endif1524 ! endif1538 ! END IF 1539 ! END IF 1525 1540 ! 520 continue 1526 1541 ! 530 continue … … 1537 1552 ! K Emanuel fix 1538 1553 1539 ! callzilch(byp,ncum)1554 ! CALL zilch(byp,ncum) 1540 1555 ! do 530 k=minorig+1,nl-1 1541 1556 ! do 520 i=1,ncum 1542 ! if(k.ge.(icb(i)+1))then1557 ! IF(k.ge.(icb(i)+1))THEN 1543 1558 ! by=(tvp(i,k)-tv(i,k))*dph(i,k)/p(i,k) 1544 1559 ! cape(i)=cape(i)+by 1545 ! if(by.ge.0.0)inb1(i)=k+11546 ! if(cape(i).gt.0.0)then1560 ! IF(by.ge.0.0)inb1(i)=k+1 1561 ! IF(cape(i).gt.0.0)THEN 1547 1562 ! inb(i)=k+1 1548 1563 ! capem(i)=cape(i) 1549 1564 ! byp(i)=(tvp(i,k+1)-tv(i,k+1))*dph(i,k+1)/p(i,k+1) 1550 ! endif1551 ! endif1565 ! END IF 1566 ! END IF 1552 1567 ! 520 continue 1553 1568 ! 530 continue … … 1564 1579 ! J Teixeira fix 1565 1580 1566 ! ori callzilch(byp,ncum)1581 ! ori CALL zilch(byp,ncum) 1567 1582 ! ori do 515 i=1,ncum 1568 ! ori lcape(i)=. true.1583 ! ori lcape(i)=.TRUE. 1569 1584 ! ori 515 continue 1570 1585 ! ori do 530 k=minorig+1,nl-1 1571 1586 ! ori do 520 i=1,ncum 1572 ! ori if(cape(i).lt.0.0)lcape(i)=.false.1573 ! ori if((k.ge.(icb(i)+1)). and.lcape(i))then1587 ! ori IF(cape(i).lt.0.0)lcape(i)=.FALSE. 1588 ! ori if((k.ge.(icb(i)+1)).AND.lcape(i))THEN 1574 1589 ! ori by=(tvp(i,k)-tv(i,k))*dph(i,k)/p(i,k) 1575 1590 ! ori byp(i)=(tvp(i,k+1)-tv(i,k+1))*dph(i,k+1)/p(i,k+1) 1576 1591 ! ori cape(i)=cape(i)+by 1577 ! ori if(by.ge.0.0)inb1(i)=k+11578 ! ori if(cape(i).gt.0.0)then1592 ! ori IF(by.ge.0.0)inb1(i)=k+1 1593 ! ori IF(cape(i).gt.0.0)THEN 1579 1594 ! ori inb(i)=k+1 1580 1595 ! ori capem(i)=cape(i) … … 1615 1630 END DO 1616 1631 1617 RETURN 1632 1618 1633 END SUBROUTINE cv30_undilute2 1619 1634 1620 1635 SUBROUTINE cv30_closure(nloc, ncum, nd, icb, inb, pbase, p, ph, tv, buoy, & 1621 1636 sig, w0, cape, m) 1622 USE cvthermo_mod_h , ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl &1623 , clmci, eps, epsi, epsim1, ginv, hrd, grav 1637 USE cvthermo_mod_h 1638 1624 1639 IMPLICIT NONE 1625 1640 … … 1629 1644 ! vectorization: S. Bony 1630 1645 ! =================================================================== 1631 1632 include "cv30param.h"1633 1646 1634 1647 ! input: … … 1697 1710 END DO 1698 1711 1699 ! ! if(inb.lt.(nl-1))then1700 ! !do 85 i=inb+1,nl-11701 ! !sig(i)=beta*sig(i)+2.*alpha*buoy(inb)*1702 ! !1 abs(buoy(inb))1703 ! !sig(i)=amax1(sig(i),0.0)1704 ! !w0(i)=beta*w0(i)1705 ! !85 continue1706 ! !end if1707 1708 ! !do 87 i=1,icb1709 ! !sig(i)=beta*sig(i)-2.*alpha*buoy(icb)*buoy(icb)1710 ! !sig(i)=amax1(sig(i),0.0)1711 ! !w0(i)=beta*w0(i)1712 ! !87 continue1712 ! IF(inb.lt.(nl-1))THEN 1713 ! do 85 i=inb+1,nl-1 1714 ! sig(i)=beta*sig(i)+2.*alpha*buoy(inb)* 1715 ! 1 abs(buoy(inb)) 1716 ! sig(i)=amax1(sig(i),0.0) 1717 ! w0(i)=beta*w0(i) 1718 ! 85 continue 1719 ! end if 1720 1721 ! do 87 i=1,icb 1722 ! sig(i)=beta*sig(i)-2.*alpha*buoy(icb)*buoy(icb) 1723 ! sig(i)=amax1(sig(i),0.0) 1724 ! w0(i)=beta*w0(i) 1725 ! 87 continue 1713 1726 1714 1727 ! ------------------------------------------------------------- … … 1793 1806 1794 1807 1795 ! !cape=0.01796 ! !do 98 i=icb+1,inb1797 ! !deltap = min(pbase,ph(i-1))-min(pbase,ph(i))1798 ! !cape=cape+rrd*buoy(i-1)*deltap/p(i-1)1799 ! !dcape=rrd*buoy(i-1)*deltap/p(i-1)1800 ! !dlnp=deltap/p(i-1)1801 ! !cape=amax1(0.0,cape)1802 ! !sigold=sig(i)1803 1804 ! !dtmin=100.01805 ! !do 97 j=icb,i-11806 ! !dtmin=amin1(dtmin,buoy(j))1807 ! !97 continue1808 1809 ! !sig(i)=beta*sig(i)+alpha*dtmin*abs(dtmin)1810 ! !sig(i)=amax1(sig(i),0.0)1811 ! !sig(i)=amin1(sig(i),0.01)1812 ! !fac=amin1(((dtcrit-dtmin)/dtcrit),1.0)1813 ! !w=(1.-beta)*fac*sqrt(cape)+beta*w0(i)1814 ! !amu=0.5*(sig(i)+sigold)*w1815 ! !m(i)=amu*0.007*p(i)*(ph(i)-ph(i+1))/tv(i)1816 ! !w0(i)=w1817 ! !98 continue1818 ! !w0(icb)=0.5*w0(icb+1)1819 ! !m(icb)=0.5*m(icb+1)*(ph(icb)-ph(icb+1))/(ph(icb+1)-ph(icb+2))1820 ! !sig(icb)=sig(icb+1)1821 ! !sig(icb-1)=sig(icb)1822 1823 RETURN 1808 ! cape=0.0 1809 ! do 98 i=icb+1,inb 1810 ! deltap = min(pbase,ph(i-1))-min(pbase,ph(i)) 1811 ! cape=cape+rrd*buoy(i-1)*deltap/p(i-1) 1812 ! dcape=rrd*buoy(i-1)*deltap/p(i-1) 1813 ! dlnp=deltap/p(i-1) 1814 ! cape=amax1(0.0,cape) 1815 ! sigold=sig(i) 1816 1817 ! dtmin=100.0 1818 ! do 97 j=icb,i-1 1819 ! dtmin=amin1(dtmin,buoy(j)) 1820 ! 97 continue 1821 1822 ! sig(i)=beta*sig(i)+alpha*dtmin*abs(dtmin) 1823 ! sig(i)=amax1(sig(i),0.0) 1824 ! sig(i)=amin1(sig(i),0.01) 1825 ! fac=amin1(((dtcrit-dtmin)/dtcrit),1.0) 1826 ! w=(1.-beta)*fac*sqrt(cape)+beta*w0(i) 1827 ! amu=0.5*(sig(i)+sigold)*w 1828 ! m(i)=amu*0.007*p(i)*(ph(i)-ph(i+1))/tv(i) 1829 ! w0(i)=w 1830 ! 98 continue 1831 ! w0(icb)=0.5*w0(icb+1) 1832 ! m(icb)=0.5*m(icb+1)*(ph(icb)-ph(icb+1))/(ph(icb+1)-ph(icb+2)) 1833 ! sig(icb)=sig(icb+1) 1834 ! sig(icb-1)=sig(icb) 1835 1836 1824 1837 END SUBROUTINE cv30_closure 1825 1838 … … 1828 1841 vent, sij, elij, ments, qents, traent & 1829 1842 #ifdef ISO 1830 &,xt,xtnk,xtclw &1831 &,xtent,xtelij &1832 #endif 1833 &)1834 1835 #ifdef ISO 1836 useinfotrac_phy, ONLY: ntraciso=>ntiso,niso,itZonIso1843 ,xt,xtnk,xtclw & 1844 ,xtent,xtelij & 1845 #endif 1846 ) 1847 1848 #ifdef ISO 1849 USE infotrac_phy, ONLY: ntraciso=>ntiso,niso,itZonIso 1837 1850 USE isotopes_mod, ONLY: pxtmelt,pxtice,pxtmin,pxtmax, iso_eau,iso_HDO, & 1838 1851 ridicule 1839 1852 USE isotopes_routines_mod, ONLY: condiso_liq_ice_vectall 1840 1853 #ifdef ISOVERIF 1841 useisotopes_verif_mod, ONLY: errmax,errmaxrel,Tmin_verif,deltalim, &1854 USE isotopes_verif_mod, ONLY: errmax,errmaxrel,Tmin_verif,deltalim, & 1842 1855 iso_verif_egalite_choix,iso_verif_aberrant_choix, iso_verif_noNaN, & 1843 1856 iso_verif_aberrant, & … … 1847 1860 #endif 1848 1861 #ifdef ISOTRAC 1849 use isotrac_mod, only: option_tmin,option_traceurs,seuil_tag_tmin, &1862 USE isotrac_mod, ONLY: option_tmin,option_traceurs,seuil_tag_tmin, & 1850 1863 & option_cond,index_zone,izone_cond,index_iso 1851 use isotrac_routines_mod, only: iso_recolorise_condensation1852 use isotopes_routines_mod, only: condiso_liq_ice_vectall_trac1853 #ifdef ISOVERIF 1854 useisotopes_verif_mod, ONLY: iso_verif_trac17_q_deltad,iso_verif_traceur, &1864 USE isotrac_routines_mod, ONLY: iso_recolorise_condensation 1865 USE isotopes_routines_mod, ONLY: condiso_liq_ice_vectall_trac 1866 #ifdef ISOVERIF 1867 USE isotopes_verif_mod, ONLY: iso_verif_trac17_q_deltad,iso_verif_traceur, & 1855 1868 & iso_verif_traceur_justmass 1856 1869 #endif 1857 1870 #endif 1858 1871 #endif 1859 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 1860 , clmci, eps, epsi, epsim1, ginv, hrd, grav 1872 USE cvthermo_mod_h 1873 1861 1874 IMPLICIT NONE 1862 1875 … … 1866 1879 ! - vectorisation de la partie normalisation des flux (do 789...) 1867 1880 ! --------------------------------------------------------------------- 1868 1869 include "cv30param.h"1870 1881 1871 1882 ! inputs: … … 1882 1893 REAL m(nloc, na) ! input of convect3 1883 1894 #ifdef ISO 1884 realxt(ntraciso,nloc,na), xtclw(ntraciso,nloc,na)1885 realtg_save(nloc,nd)1886 realxtnk(ntraciso,nloc)1895 REAL xt(ntraciso,nloc,na), xtclw(ntraciso,nloc,na) 1896 REAL tg_save(nloc,nd) 1897 REAL xtnk(ntraciso,nloc) 1887 1898 ! real xtep(ntraciso,nloc,na) 1888 1899 #endif … … 1896 1907 REAL sigij(nloc, nd, nd) 1897 1908 #ifdef ISO 1898 realxtent(ntraciso,nloc,nd,nd)1899 real xtelij(ntraciso,nloc,nd,nd)1909 REAL xtent(ntraciso,nloc,nd,nd) 1910 REAL xtelij(ntraciso,nloc,nd,nd) 1900 1911 #endif 1901 1912 … … 1912 1923 LOGICAL lwork(nloc) 1913 1924 #ifdef ISO 1914 integerixt1915 realxtrti(ntraciso,nloc)1916 realxtres(ntraciso)1925 INTEGER ixt 1926 REAL xtrti(ntraciso,nloc) 1927 REAL xtres(ntraciso) 1917 1928 ! on ajoute la dimension nloc a xtrti pour verifs dans les tags: 5 fev 1918 1929 ! 2010 1919 realzfice(nloc),zxtliq(ntraciso,nloc),zxtice(ntraciso,nloc)1930 REAL zfice(nloc),zxtliq(ntraciso,nloc),zxtice(ntraciso,nloc) 1920 1931 ! real xt_reduit(ntraciso) 1921 ! logicalnegation1932 ! LOGICAL negation 1922 1933 !#ifdef ISOVERIF 1923 1934 ! integer iso_verif_positif_nostop … … 1930 1941 #ifdef ISO 1931 1942 #ifdef ISOVERIF 1932 write(*,*) 'cv30_routines 1820: entree dans cv3_mixing'1933 if (iso_eau.gt.0) then1934 calliso_verif_egalite_vect2D( &1935 &xtclw,clw, &1936 &'cv30_mixing 1841',ntraciso,nloc,na)1943 WRITE(*,*) 'cv30_routines 1820: entree dans cv3_mixing' 1944 IF (iso_eau.gt.0) THEN 1945 CALL iso_verif_egalite_vect2D( & 1946 xtclw,clw, & 1947 'cv30_mixing 1841',ntraciso,nloc,na) 1937 1948 endif 1938 1949 #endif … … 1965 1976 1966 1977 #ifdef ISO 1967 doj=1,nd1968 dok=1,nd1969 doi=1,ncum1970 doixt =1,ntraciso1978 DO j=1,nd 1979 DO k=1,nd 1980 DO i=1,ncum 1981 DO ixt =1,ntraciso 1971 1982 xtent(ixt,i,k,j)=xt(ixt,i,j) 1972 1983 xtelij(ixt,i,k,j)=0.0 … … 1975 1986 ! valeurs en nd=nl+1 ne sont pas utilisees 1976 1987 qent(i,k,j)=rr(i,j) 1977 elij(i,k,j)=0.0 1988 elij(i,k,j)=0.0 1978 1989 enddo !do i=1,ncum 1979 1990 enddo !do k=1,nl 1980 enddo !do j=1,nl 1991 enddo !do j=1,nl 1981 1992 #endif 1982 1993 … … 2039 2050 ! !!! traent(il,i,j,k)=sij(il,i,j)*tra(il,i,k) 2040 2051 ! !!! : +(1.-sij(il,i,j))*tra(il,nk(il),k) 2041 ! !!! end do2052 ! !!! END DO 2042 2053 elij(il, i, j) = altem 2043 2054 elij(il, i, j) = amax1(0.0, elij(il,i,j)) … … 2053 2064 #ifdef ISO 2054 2065 #ifdef ISOVERIF 2055 ! write(*,*) 'cv30_routines tmp 2078'2056 #endif 2057 doil=1,ncum2066 !WRITE(*,*) 'cv30_routines tmp 2078' 2067 #endif 2068 DO il=1,ncum 2058 2069 zfice(il) = 1.0-(t(il,j)-pxtice)/(pxtmelt-pxtice) 2059 zfice(il) = MIN(MAX(zfice(il),0.0),1.0) 2060 if( (i.ge.icb(il)).and.(i.le.inb(il)).and. &2061 & (j.ge.(icb(il)-1)).and.(j.le.inb(il)))then2062 doixt=1,ntraciso2070 zfice(il) = MIN(MAX(zfice(il),0.0),1.0) 2071 IF( (i.ge.icb(il)).AND.(i.le.inb(il)).AND. & 2072 (j.ge.(icb(il)-1)).AND.(j.le.inb(il)))THEN 2073 DO ixt=1,ntraciso 2063 2074 ! xtrti(ixt)=xt(ixt,il,1)-xtep(ixt,il,i)*xtclw(ixt,il,i) ! le 7 mai: on supprime xtep 2064 xtrti(ixt,il)=xt(ixt,il,1)-ep(il,i)*xtclw(ixt,il,i) 2075 xtrti(ixt,il)=xt(ixt,il,1)-ep(il,i)*xtclw(ixt,il,i) 2065 2076 enddo 2066 if(sij(il,i,j).gt.0.0.and.sij(il,i,j).lt.0.95)then2077 IF(sij(il,i,j).gt.0.0.AND.sij(il,i,j).lt.0.95)THEN 2067 2078 ! temperature of condensation (within mixtures): 2068 ! tcond(il)=t(il,j) 2069 ! : + ( sij(il,i,j)*rr(il,i)+(1.-sij(il,i,j))*rti 2079 ! tcond(il)=t(il,j) 2080 ! : + ( sij(il,i,j)*rr(il,i)+(1.-sij(il,i,j))*rti 2070 2081 ! : - elij(il,i,j) - rs(il,j) ) 2071 2082 ! : / ( cpd*(bf2-1.0)/lv(il,j) ) 2072 2073 doixt = 1, ntraciso2083 2084 DO ixt = 1, ntraciso 2074 2085 ! total mixing ratio in the mixtures before precipitation: 2075 2086 xtent(ixt,il,i,j)=sij(il,i,j)*xt(ixt,il,i) & 2076 &+(1.-sij(il,i,j))*xtrti(ixt,il)2087 +(1.-sij(il,i,j))*xtrti(ixt,il) 2077 2088 enddo !do ixt = 1, ntraciso 2078 endif ! if(sij(il,i,j).gt.0.0.and.sij(il,i,j).lt.0.95)then2079 endif ! if( (i.ge.icb(il)).and.(i.le.inb(il)).and.2080 enddo !do il=1,ncum 2081 2082 callcondiso_liq_ice_vectall(xtent(1,1,i,j),qent(1,i,j), &2083 &elij(1,i,j), &2084 &t(1,j),zfice(1),zxtice(1,1),zxtliq(1,1),ncum)2089 endif !IF(sij(il,i,j).gt.0.0.AND.sij(il,i,j).lt.0.95)THEN 2090 endif !IF( (i.ge.icb(il)).AND.(i.le.inb(il)).AND. 2091 enddo !do il=1,ncum 2092 2093 CALL condiso_liq_ice_vectall(xtent(1,1,i,j),qent(1,i,j), & 2094 elij(1,i,j), & 2095 t(1,j),zfice(1),zxtice(1,1),zxtliq(1,1),ncum) 2085 2096 #ifdef ISOTRAC 2086 callcondiso_liq_ice_vectall_trac(xtent(1,1,i,j),qent(1,i,j), &2087 &elij(1,i,j), &2088 & t(1,j),zfice(1),zxtice(1,1),zxtliq(1,1),ncum)2089 #ifdef ISOVERIF 2090 doil=1,ncum2091 calliso_verif_traceur(xt(1,il,i),'cv30_routines 1967')2092 if( (i.ge.icb(il)).and.(i.le.inb(il)).and. &2093 & (j.ge.(icb(il)-1)).and.(j.le.inb(il)))then2094 calliso_verif_traceur(xtrti(1,il),'cv30_routines 1968')2095 endif ! if( (i.ge.icb(il)).and.(i.le.inb(il)).and.2096 calliso_verif_traceur(xtent(1,il,i,j),'cv30_routines 1969')2097 2097 CALL condiso_liq_ice_vectall_trac(xtent(1,1,i,j),qent(1,i,j), & 2098 elij(1,i,j), & 2099 t(1,j),zfice(1),zxtice(1,1),zxtliq(1,1),ncum) 2100 #ifdef ISOVERIF 2101 DO il=1,ncum 2102 CALL iso_verif_traceur(xt(1,il,i),'cv30_routines 1967') 2103 IF( (i.ge.icb(il)).AND.(i.le.inb(il)).AND. & 2104 (j.ge.(icb(il)-1)).AND.(j.le.inb(il)))THEN 2105 CALL iso_verif_traceur(xtrti(1,il),'cv30_routines 1968') 2106 endif !IF( (i.ge.icb(il)).AND.(i.le.inb(il)).AND. 2107 CALL iso_verif_traceur(xtent(1,il,i,j),'cv30_routines 1969') 2108 2098 2109 enddo !do il=1,ncum 2099 #endif 2100 #endif 2101 doil=1,ncum2102 doixt = 1, ntraciso2110 #endif 2111 #endif 2112 DO il=1,ncum 2113 DO ixt = 1, ntraciso 2103 2114 xtelij(ixt,il,i,j)=zxtice(ixt,il)+zxtliq(ixt,il) 2104 2115 enddo !do ixt = 1, ntraciso … … 2106 2117 2107 2118 #ifdef ISOVERIF 2108 if ((j.eq.15).and.(i.eq.15)) then2119 IF ((j.EQ.15).AND.(i.EQ.15)) THEN 2109 2120 il=2722 2110 if (il.le.ncum) then2111 write(*,*) 'cv30_routines tmp 2194, il,i,j=',il,i,j2112 write(*,*) 'qent,elij=',qent(il,i,j),elij(il,i,j)2113 write(*,*) 'tgsave,zfice=',t(il,j),zfice(il)2114 write(*,*) 'deltaDqent=',deltaD(xtent(iso_HDO,il,i,j)/qent(il,i,j))2115 write(*,*) 'deltaDelij=',deltaD(xtelij(iso_HDO,il,i,j)/elij(il,i,j))2116 write(*,*) 'deltaDice=',deltaD(zxtice(iso_HDO,il)/(zfice(il)*elij(il,i,j)))2117 write(*,*) 'deltaDliq=',deltaD(zxtliq(iso_HDO,il)/(1.0-zfice(il)*elij(il,i,j)))2121 IF (il.le.ncum) THEN 2122 WRITE(*,*) 'cv30_routines tmp 2194, il,i,j=',il,i,j 2123 WRITE(*,*) 'qent,elij=',qent(il,i,j),elij(il,i,j) 2124 WRITE(*,*) 'tgsave,zfice=',t(il,j),zfice(il) 2125 WRITE(*,*) 'deltaDqent=',deltaD(xtent(iso_HDO,il,i,j)/qent(il,i,j)) 2126 WRITE(*,*) 'deltaDelij=',deltaD(xtelij(iso_HDO,il,i,j)/elij(il,i,j)) 2127 WRITE(*,*) 'deltaDice=',deltaD(zxtice(iso_HDO,il)/(zfice(il)*elij(il,i,j))) 2128 WRITE(*,*) 'deltaDliq=',deltaD(zxtliq(iso_HDO,il)/(1.0-zfice(il)*elij(il,i,j))) 2118 2129 endif 2119 2130 endif 2120 2131 #endif 2121 2132 2122 #ifdef ISOTRAC 2123 ! write(*,*) 'cv30_routines tmp 1987,option_traceurs=',2133 #ifdef ISOTRAC 2134 ! WRITE(*,*) 'cv30_routines tmp 1987,option_traceurs=', 2124 2135 ! : option_traceurs 2125 if (option_tmin.ge.1) then2126 do il=1,ncum2127 ! write(*,*) 'cv3 tmp 1991 il,i,j,xtent(:,il,i,j),',2136 IF (option_tmin.ge.1) THEN 2137 DO il=1,ncum 2138 ! WRITE(*,*) 'cv3 tmp 1991 il,i,j,xtent(:,il,i,j),', 2128 2139 ! : 'tcond(il),rs(il,j)=', 2129 2140 ! : il,i,j,xtent(:,il,i,j),tcond(il),rs(il,j) 2130 2141 ! colorier la vapeur residuelle selon temperature de 2131 2142 ! condensation, et le condensat en un tag spEcifique 2132 if ((elij(il,i,j).gt.0.0).and.(qent(il,i,j).gt.0.0)) then2133 if (option_traceurs.eq.17) then2134 calliso_recolorise_condensation(qent(il,i,j),elij(il,i,j), &2135 &xtent(1,il,i,j),xtelij(1,il,i,j),t(1,j), &2136 &0.0,xtres, &2137 &seuil_tag_tmin)2138 else !if (option_traceurs. eq.17) then2139 ! write(*,*) 'cv3 2002: il,i,j =',il,i,j2140 calliso_recolorise_condensation(qent(il,i,j),elij(il,i,j), &2141 &xtent(1,il,i,j),xtelij(1,il,i,j),rs(il,j),0.0,xtres, &2142 &seuil_tag_tmin)2143 endif !if (option_traceurs. eq.17) then2144 doixt=1+niso,ntraciso2143 IF ((elij(il,i,j).gt.0.0).AND.(qent(il,i,j).gt.0.0)) THEN 2144 IF (option_traceurs.EQ.17) THEN 2145 CALL iso_recolorise_condensation(qent(il,i,j),elij(il,i,j), & 2146 xtent(1,il,i,j),xtelij(1,il,i,j),t(1,j), & 2147 0.0,xtres, & 2148 seuil_tag_tmin) 2149 else !if (option_traceurs.EQ.17) THEN 2150 ! WRITE(*,*) 'cv3 2002: il,i,j =',il,i,j 2151 CALL iso_recolorise_condensation(qent(il,i,j),elij(il,i,j), & 2152 xtent(1,il,i,j),xtelij(1,il,i,j),rs(il,j),0.0,xtres, & 2153 seuil_tag_tmin) 2154 endif !if (option_traceurs.EQ.17) THEN 2155 DO ixt=1+niso,ntraciso 2145 2156 xtent(ixt,il,i,j)=xtres(ixt) 2146 enddo 2147 endif !if (cond.gt.0.0) then2157 enddo 2158 endif !if (cond.gt.0.0) THEN 2148 2159 enddo !do il=1,ncum 2149 2160 #ifdef ISOVERIF 2150 do il=1,ncum2151 calliso_verif_traceur(xtent(1,il,i,j),'cv30_routines 1996')2152 calliso_verif_traceur(xtelij(1,il,i,j),'cv30_routines 1997')2153 calliso_verif_trac17_q_deltaD(xtent(1,il,i,j), &2154 &'cv30_routines 2042')2155 enddo !do il=1,ncum 2156 #endif 2157 endif !if (option_tmin.ge.1) then2161 DO il=1,ncum 2162 CALL iso_verif_traceur(xtent(1,il,i,j),'cv30_routines 1996') 2163 CALL iso_verif_traceur(xtelij(1,il,i,j),'cv30_routines 1997') 2164 CALL iso_verif_trac17_q_deltaD(xtent(1,il,i,j), & 2165 'cv30_routines 2042') 2166 enddo !do il=1,ncum 2167 #endif 2168 endif !if (option_tmin.ge.1) THEN 2158 2169 #endif 2159 2170 2160 2171 ! fractionation: 2161 #ifdef ISOVERIF 2162 ! write(*,*) 'cv30_routines 2050: avant condiso'2163 doil=1,ncum2164 if ((i.ge.icb(il)).and.(i.le.inb(il)).and. &2165 & (j.ge.(icb(il)-1)).and.(j.le.inb(il))) then2166 if (sij(il,i,j).gt.0.0.and.sij(il,i,j).lt.0.95) then2167 if (iso_eau.gt.0) then2168 calliso_verif_egalite_choix(xtent(iso_eau,il,i,j), &2169 & qent(il,i,j),'cv30_routines 1889',errmax,errmaxrel)2170 calliso_verif_egalite_choix(xtelij(iso_eau,il,i,j), &2171 & elij(il,i,j),'cv30_routines 1890',errmax,errmaxrel)2172 #ifdef ISOVERIF 2173 ! WRITE(*,*) 'cv30_routines 2050: avant condiso' 2174 DO il=1,ncum 2175 IF ((i.ge.icb(il)).AND.(i.le.inb(il)).AND. & 2176 (j.ge.(icb(il)-1)).AND.(j.le.inb(il))) THEN 2177 IF (sij(il,i,j).gt.0.0.AND.sij(il,i,j).lt.0.95) THEN 2178 IF (iso_eau.gt.0) THEN 2179 CALL iso_verif_egalite_choix(xtent(iso_eau,il,i,j), & 2180 qent(il,i,j),'cv30_routines 1889',errmax,errmaxrel) 2181 CALL iso_verif_egalite_choix(xtelij(iso_eau,il,i,j), & 2182 elij(il,i,j),'cv30_routines 1890',errmax,errmaxrel) 2172 2183 endif 2173 if (iso_HDO.gt.0) then2174 calliso_verif_aberrant_choix(xt(iso_HDO,il,i),rr(il,i), &2175 & ridicule,deltalim,'cv30_routines 1997')2176 calliso_verif_aberrant_choix( &2177 &xtent(iso_HDO,il,i,j),qent(il,i,j), &2178 &ridicule,deltalim,'cv30_routines 1931')2179 calliso_verif_aberrant_choix( &2180 &xtelij(iso_HDO,il,i,j),elij(il,i,j), &2181 &ridicule,deltalim,'cv30_routines 1993')2182 endif !if (iso_HDO.gt.0) then2183 #ifdef ISOTRAC 2184 ! write(*,*) 'cv30_routines tmp 2039 il=',il2185 calliso_verif_traceur(xtent(1,il,i,j), &2186 &'cv30_routines 2031')2187 calliso_verif_traceur(xtelij(1,il,i,j), &2188 &'cv30_routines 2033')2189 #endif 2190 2191 endif ! if(sij(il,i,j).gt.0.0.and.sij(il,i,j).lt.0.95)then2192 endif ! if( (i.ge.icb(il)).and.(i.le.inb(il)).and.2184 IF (iso_HDO.gt.0) THEN 2185 CALL iso_verif_aberrant_choix(xt(iso_HDO,il,i),rr(il,i), & 2186 ridicule,deltalim,'cv30_routines 1997') 2187 CALL iso_verif_aberrant_choix( & 2188 xtent(iso_HDO,il,i,j),qent(il,i,j), & 2189 ridicule,deltalim,'cv30_routines 1931') 2190 CALL iso_verif_aberrant_choix( & 2191 xtelij(iso_HDO,il,i,j),elij(il,i,j), & 2192 ridicule,deltalim,'cv30_routines 1993') 2193 endif !if (iso_HDO.gt.0) THEN 2194 #ifdef ISOTRAC 2195 ! WRITE(*,*) 'cv30_routines tmp 2039 il=',il 2196 CALL iso_verif_traceur(xtent(1,il,i,j), & 2197 'cv30_routines 2031') 2198 CALL iso_verif_traceur(xtelij(1,il,i,j), & 2199 'cv30_routines 2033') 2200 #endif 2201 2202 endif !IF(sij(il,i,j).gt.0.0.AND.sij(il,i,j).lt.0.95)THEN 2203 endif !IF( (i.ge.icb(il)).AND.(i.le.inb(il)).AND. 2193 2204 enddo !do il=1,ncum 2194 2205 #endif 2195 ! write(*,*) 'cv30_routine tmp 1984: cond=',elij(il,i,j)2196 2197 2206 ! WRITE(*,*) 'cv30_routine tmp 1984: cond=',elij(il,i,j) 2207 2208 2198 2209 #endif 2199 2210 … … 2203 2214 ! do j=minorig,nl 2204 2215 ! do il=1,ncum 2205 ! if( (i.ge.icb(il)).and.(i.le.inb(il)).and.2206 ! : (j.ge.(icb(il)-1)). and.(j.le.inb(il)))then2216 ! IF( (i.ge.icb(il)).AND.(i.le.inb(il)).AND. 2217 ! : (j.ge.(icb(il)-1)).AND.(j.le.inb(il)))THEN 2207 2218 ! traent(il,i,j,k)=sij(il,i,j)*tra(il,i,k) 2208 2219 ! : +(1.-sij(il,i,j))*tra(il,nk(il),k) 2209 ! endif2220 ! END IF 2210 2221 ! enddo 2211 2222 ! enddo … … 2223 2234 DO il = 1, ncum 2224 2235 IF ((i>=icb(il)) .AND. (i<=inb(il)) .AND. (nent(il,i)==0)) THEN 2225 ! @ if(nent(il,i).eq.0)then2236 ! @ IF(nent(il,i).EQ.0)THEN 2226 2237 ment(il, i, i) = m(il, i) 2227 2238 qent(il, i, i) = rr(il, nk(il)) - ep(il, i)*clw(il, i) … … 2232 2243 sij(il, i, i) = 0.0 2233 2244 #ifdef ISO 2234 doixt = 1, ntraciso2245 DO ixt = 1, ntraciso 2235 2246 xtent(ixt,il,i,i)=xt(ixt,il,nk(il))-ep(il,i)*xtclw(ixt,il,i) 2236 ! xtent(ixt,il,i,i)=xt(ixt,il,nk(il))-xtep(ixt,il,i)*xtclw(ixt,il,i) 2247 ! xtent(ixt,il,i,i)=xt(ixt,il,nk(il))-xtep(ixt,il,i)*xtclw(ixt,il,i) 2237 2248 ! le 7 mai: on supprime xtep 2238 2249 xtelij(ixt,il,i,i)=xtclw(ixt,il,i) ! rq: ne sera pas utilise ensuite … … 2240 2251 2241 2252 #ifdef ISOVERIF 2242 if (iso_eau.gt.0) then2243 calliso_verif_egalite_choix(xtelij(iso_eau,il,i,i), &2244 & elij(il,i,i),'cv30_mixing 2117',errmax,errmaxrel)2245 endif !if (iso_eau.gt.0) then2246 #endif 2247 2248 #ifdef ISOTRAC 2249 if (option_tmin.ge.1) then2253 IF (iso_eau.gt.0) THEN 2254 CALL iso_verif_egalite_choix(xtelij(iso_eau,il,i,i), & 2255 elij(il,i,i),'cv30_mixing 2117',errmax,errmaxrel) 2256 endif !if (iso_eau.gt.0) THEN 2257 #endif 2258 2259 #ifdef ISOTRAC 2260 IF (option_tmin.ge.1) THEN 2250 2261 ! colorier la vapeur residuelle selon temperature de 2251 2262 ! condensation, et le condensat en un tag specifique 2252 ! write(*,*) 'cv3 tmp 2095 il,i,j,xtent(:,il,i,j)=',2263 ! WRITE(*,*) 'cv3 tmp 2095 il,i,j,xtent(:,il,i,j)=', 2253 2264 ! : il,i,j,xtent(:,il,i,j) 2254 if ((elij(il,i,i).gt.0.0).and.(qent(il,i,i).gt.0.0)) then2255 if (option_traceurs.eq.17) then2256 calliso_recolorise_condensation(qent(il,i,i), &2257 &elij(il,i,i), &2258 &xt(1,il,nk(il)),xtclw(1,il,i),t(il,i),ep(il,i), &2259 &xtres, &2260 &seuil_tag_tmin)2261 else !if (option_traceurs. eq.17) then2262 calliso_recolorise_condensation(qent(il,i,i), &2263 &elij(il,i,i), &2264 &xt(1,il,nk(il)),xtclw(1,il,i),rs(il,i),ep(il,i), &2265 &xtres, &2266 &seuil_tag_tmin)2267 endif !if (option_traceurs. eq.17) then2268 doixt=1+niso,ntraciso2265 IF ((elij(il,i,i).gt.0.0).AND.(qent(il,i,i).gt.0.0)) THEN 2266 IF (option_traceurs.EQ.17) THEN 2267 CALL iso_recolorise_condensation(qent(il,i,i), & 2268 elij(il,i,i), & 2269 xt(1,il,nk(il)),xtclw(1,il,i),t(il,i),ep(il,i), & 2270 xtres, & 2271 seuil_tag_tmin) 2272 else !if (option_traceurs.EQ.17) THEN 2273 CALL iso_recolorise_condensation(qent(il,i,i), & 2274 elij(il,i,i), & 2275 xt(1,il,nk(il)),xtclw(1,il,i),rs(il,i),ep(il,i), & 2276 xtres, & 2277 seuil_tag_tmin) 2278 endif !if (option_traceurs.EQ.17) THEN 2279 DO ixt=1+niso,ntraciso 2269 2280 xtent(ixt,il,i,i)=xtres(ixt) 2270 2281 enddo 2271 #ifdef ISOVERIF 2272 doixt=1,niso2273 calliso_verif_egalite_choix(xtres(ixt),xtent(ixt,il,i,i), &2274 &'cv30_routines 2102',errmax,errmaxrel)2275 calliso_verif_trac17_q_deltaD(xtent(1,il,i,j), &2276 &'cv30_routines 2154')2282 #ifdef ISOVERIF 2283 DO ixt=1,niso 2284 CALL iso_verif_egalite_choix(xtres(ixt),xtent(ixt,il,i,i), & 2285 'cv30_routines 2102',errmax,errmaxrel) 2286 CALL iso_verif_trac17_q_deltaD(xtent(1,il,i,j), & 2287 'cv30_routines 2154') 2277 2288 enddo 2278 #endif 2279 endif !if (cond.gt.0.0) then 2280 2281 #ifdef ISOVERIF 2282 call iso_verif_egalite_choix(xtent(iso_eau,il,i,i), & 2283 & qent(il,i,i),'cv30_routines 2103',errmax,errmaxrel) 2284 call iso_verif_traceur(xtent(1,il,i,i),'cv30_routines 2095') 2285 call iso_verif_traceur(xtelij(1,il,i,i),'cv30_routines 2096') 2286 #endif 2287 endif !if (option_tmin.ge.1) then 2289 #endif 2290 endif !if (cond.gt.0.0) THEN 2291 #ifdef ISOVERIF 2292 CALL iso_verif_egalite_choix(xtent(iso_eau,il,i,i), & 2293 qent(il,i,i),'cv30_routines 2103',errmax,errmaxrel) 2294 CALL iso_verif_traceur(xtent(1,il,i,i),'cv30_routines 2095') 2295 CALL iso_verif_traceur(xtelij(1,il,i,i),'cv30_routines 2096') 2296 #endif 2297 endif !if (option_tmin.ge.1) THEN 2288 2298 #endif 2289 2299 … … 2296 2306 ! do i=minorig+1,nl 2297 2307 ! do il=1,ncum 2298 ! if (i.ge.icb(il) . and. i.le.inb(il) .and. nent(il,i).eq.0) then2308 ! if (i.ge.icb(il) .AND. i.le.inb(il) .AND. nent(il,i).EQ.0) THEN 2299 2309 ! traent(il,i,i,j)=tra(il,nk(il),j) 2300 ! endif2310 ! END IF 2301 2311 ! enddo 2302 2312 ! enddo … … 2322 2332 ! ===================================================================== 2323 2333 2324 ! ym callzilch(asum,ncum*nd)2325 ! ym callzilch(bsum,ncum*nd)2326 ! ym callzilch(csum,ncum*nd)2334 ! ym CALL zilch(asum,ncum*nd) 2335 ! ym CALL zilch(bsum,ncum*nd) 2336 ! ym CALL zilch(csum,ncum*nd) 2327 2337 CALL zilch(asum, nloc*nd) 2328 2338 CALL zilch(csum, nloc*nd) … … 2466 2476 sij(il, i, i) = 0.0 2467 2477 #ifdef ISO 2468 doixt = 1, ntraciso2478 DO ixt = 1, ntraciso 2469 2479 ! xtent(ixt,il,i,i)=xt(ixt,il,1)-xtep(ixt,il,i)*xtclw(ixt,il,i) 2470 2480 xtent(ixt,il,i,i)=xt(ixt,il,1)-ep(il,i)*xtclw(ixt,il,i) … … 2474 2484 2475 2485 #ifdef ISOVERIF 2476 if (iso_eau.gt.0) then2477 calliso_verif_egalite_choix(xtelij(iso_eau,il,i,i), &2478 & elij(il,i,i),'cv30_mixing 2354',errmax,errmaxrel)2479 endif !if (iso_eau.gt.0) then2480 #endif 2481 2482 #ifdef ISOTRAC 2483 if (option_tmin.ge.1) then2486 IF (iso_eau.gt.0) THEN 2487 CALL iso_verif_egalite_choix(xtelij(iso_eau,il,i,i), & 2488 elij(il,i,i),'cv30_mixing 2354',errmax,errmaxrel) 2489 endif !if (iso_eau.gt.0) THEN 2490 #endif 2491 2492 #ifdef ISOTRAC 2493 IF (option_tmin.ge.1) THEN 2484 2494 ! colorier la vapeur residuelle selon temperature de 2485 2495 ! condensation, et le condensat en un tag specifique 2486 ! write(*,*) 'cv3 tmp 2314 il,i,j,xtent(:,il,i,j)=',2496 ! WRITE(*,*) 'cv3 tmp 2314 il,i,j,xtent(:,il,i,j)=', 2487 2497 ! : il,i,j,xtent(:,il,i,j) 2488 if ((elij(il,i,i).gt.0.0).and.(qent(il,i,i).gt.0.0)) then2489 if (option_traceurs.eq.17) then2490 calliso_recolorise_condensation(qent(il,i,i), &2491 &elij(il,i,i), &2492 &xt(1,il,1),xtclw(1,il,i),t(il,i),ep(il,i), &2493 &xtres, &2494 &seuil_tag_tmin)2495 else !if (option_traceurs. eq.17) then2496 calliso_recolorise_condensation(qent(il,i,i), &2497 &elij(il,i,i), &2498 &xt(1,il,1),xtclw(1,il,i),rs(il,i),ep(il,i), &2499 &xtres, &2500 &seuil_tag_tmin)2501 endif ! if (option_traceurs. eq.17) then2502 doixt=1+niso,ntraciso2498 IF ((elij(il,i,i).gt.0.0).AND.(qent(il,i,i).gt.0.0)) THEN 2499 IF (option_traceurs.EQ.17) THEN 2500 CALL iso_recolorise_condensation(qent(il,i,i), & 2501 elij(il,i,i), & 2502 xt(1,il,1),xtclw(1,il,i),t(il,i),ep(il,i), & 2503 xtres, & 2504 seuil_tag_tmin) 2505 else !if (option_traceurs.EQ.17) THEN 2506 CALL iso_recolorise_condensation(qent(il,i,i), & 2507 elij(il,i,i), & 2508 xt(1,il,1),xtclw(1,il,i),rs(il,i),ep(il,i), & 2509 xtres, & 2510 seuil_tag_tmin) 2511 endif ! if (option_traceurs.EQ.17) THEN 2512 DO ixt=1+niso,ntraciso 2503 2513 xtent(ixt,il,i,i)=xtres(ixt) 2504 enddo2505 #ifdef ISOVERIF2506 do ixt=1,niso2507 call iso_verif_egalite_choix(xtres(ixt),xtent(ixt,il,i,i), &2508 & 'cv30_routines 2318',errmax,errmaxrel)2509 call iso_verif_trac17_q_deltaD(xtent(1,il,i,j), &2510 & 'cv30_routines 2383')2511 2514 enddo 2512 #endif 2513 endif !if (cond.gt.0.0) then 2514 #ifdef ISOVERIF 2515 call iso_verif_egalite_choix(xtent(iso_eau,il,i,i), & 2516 & qent(il,i,i),'cv30_routines 2321',errmax,errmaxrel) 2517 call iso_verif_traceur(xtent(1,il,i,i),'cv30_routines 2322') 2518 call iso_verif_traceur(xtelij(1,il,i,i),'cv30_routines 2323') 2519 #endif 2520 endif !if (option_tmin.ge.1) then 2515 #ifdef ISOVERIF 2516 DO ixt=1,niso 2517 CALL iso_verif_egalite_choix(xtres(ixt),xtent(ixt,il,i,i), & 2518 'cv30_routines 2318',errmax,errmaxrel) 2519 CALL iso_verif_trac17_q_deltaD(xtent(1,il,i,j), & 2520 'cv30_routines 2383') 2521 enddo 2522 #endif 2523 endif !if (cond.gt.0.0) THEN 2524 #ifdef ISOVERIF 2525 CALL iso_verif_egalite_choix(xtent(iso_eau,il,i,i), & 2526 qent(il,i,i),'cv30_routines 2321',errmax,errmaxrel) 2527 CALL iso_verif_traceur(xtent(1,il,i,i),'cv30_routines 2322') 2528 CALL iso_verif_traceur(xtelij(1,il,i,i),'cv30_routines 2323') 2529 #endif 2530 endif !if (option_tmin.ge.1) THEN 2521 2531 #endif 2522 2532 END IF … … 2525 2535 ! do j=1,ntra 2526 2536 ! do il=1,ncum 2527 ! if ( i.ge.icb(il) . and. i.le.inb(il) .and. lwork(il)2528 ! : . and. csum(il,i).lt.m(il,i) ) then2537 ! if ( i.ge.icb(il) .AND. i.le.inb(il) .AND. lwork(il) 2538 ! : .AND. csum(il,i).lt.m(il,i) ) THEN 2529 2539 ! traent(il,i,i,j)=tra(il,nk(il),j) 2530 ! endif2540 ! END IF 2531 2541 ! enddo 2532 2542 ! enddo … … 2565 2575 !c--debug 2566 2576 #ifdef ISOVERIF 2567 doim = 1, nd2568 dojm = 1, nd2569 doil = 1, ncum2570 if (iso_eau.gt.0) then2571 calliso_verif_egalite_choix(xtelij(iso_eau,il,im,jm), &2572 &elij(il,im,jm),'cv30_mixing 2110',errmax,errmaxrel)2573 call iso_verif_egalite_choix(xtent(iso_eau,il,im,jm), &2574 &qent(il,im,jm),'cv30_mixing 2112',errmax,errmaxrel)2575 endif !if (iso_eau.gt.0) then2577 DO im = 1, nd 2578 DO jm = 1, nd 2579 DO il = 1, ncum 2580 IF (iso_eau.gt.0) THEN 2581 CALL iso_verif_egalite_choix(xtelij(iso_eau,il,im,jm), & 2582 elij(il,im,jm),'cv30_mixing 2110',errmax,errmaxrel) 2583 CALL iso_verif_egalite_choix(xtent(iso_eau,il,im,jm), & 2584 qent(il,im,jm),'cv30_mixing 2112',errmax,errmaxrel) 2585 endif !if (iso_eau.gt.0) THEN 2576 2586 #ifdef ISOTRAC 2577 call iso_verif_traceur_justmass(xtelij(1,il,im,jm), &2578 &'cv30_routine 2250')2579 #endif 2587 CALL iso_verif_traceur_justmass(xtelij(1,il,im,jm), & 2588 'cv30_routine 2250') 2589 #endif 2580 2590 enddo !do il = 1, nloc 2581 2591 enddo !do jm = 1, klev 2582 2592 enddo !do im = 1, klev 2583 2593 #endif 2584 #endif 2594 #endif 2585 2595 2586 2596 #ifdef ISO 2587 2597 #ifdef ISOTRAC 2588 2598 ! seulement a la fin on taggue le condensat 2589 if (option_cond.ge.1) then2590 doim = 1, nd2591 dojm = 1, nd2592 do il = 1, ncum2599 IF (option_cond.ge.1) THEN 2600 DO im = 1, nd 2601 DO jm = 1, nd 2602 DO il = 1, ncum 2593 2603 ! colorier le condensat en un tag specifique 2594 doixt=niso+1,ntraciso2595 if (index_zone(ixt).eq.izone_cond) then2604 DO ixt=niso+1,ntraciso 2605 IF (index_zone(ixt).EQ.izone_cond) THEN 2596 2606 xtelij(ixt,il,im,jm)=xtelij(index_iso(ixt),il,im,jm) 2597 else !if (index_zone(ixt). eq.izone_cond) then2607 else !if (index_zone(ixt).EQ.izone_cond) THEN 2598 2608 xtelij(ixt,il,im,jm)=0.0 2599 endif !if (index_zone(ixt). eq.izone_cond) then2600 enddo !do ixt=1,ntraciso 2601 #ifdef ISOVERIF 2602 calliso_verif_egalite_choix(xtelij(iso_eau,il,im,jm), &2603 &elij(il,im,jm),'cv30_routines 2408',errmax,errmaxrel)2604 calliso_verif_traceur(xtelij(1,il,im,jm), &2605 &'condiso_liq_ice_vectiso_trac 358')2606 #endif 2607 enddo !do il = 1, ncum 2609 endif !if (index_zone(ixt).EQ.izone_cond) THEN 2610 enddo !do ixt=1,ntraciso 2611 #ifdef ISOVERIF 2612 CALL iso_verif_egalite_choix(xtelij(iso_eau,il,im,jm), & 2613 elij(il,im,jm),'cv30_routines 2408',errmax,errmaxrel) 2614 CALL iso_verif_traceur(xtelij(1,il,im,jm), & 2615 'condiso_liq_ice_vectiso_trac 358') 2616 #endif 2617 enddo !do il = 1, ncum 2608 2618 enddo !do jm = 1, nd 2609 2619 enddo !do im = 1, nd 2610 doim = 1, nd2611 do il = 1, ncum2620 DO im = 1, nd 2621 DO il = 1, ncum 2612 2622 ! colorier le condensat en un tag specifique 2613 doixt=niso+1,ntraciso2614 if (index_zone(ixt).eq.izone_cond) then2623 DO ixt=niso+1,ntraciso 2624 IF (index_zone(ixt).EQ.izone_cond) THEN 2615 2625 xtclw(ixt,il,im)=xtclw(index_iso(ixt),il,im) 2616 else !if (index_zone(ixt). eq.izone_cond) then2626 else !if (index_zone(ixt).EQ.izone_cond) THEN 2617 2627 xtclw(ixt,il,im)=0.0 2618 endif !if (index_zone(ixt). eq.izone_cond) then2619 enddo !do ixt=1,ntraciso 2620 #ifdef ISOVERIF 2621 calliso_verif_egalite_choix(xtclw(iso_eau,il,im), &2622 &clw(il,im),'cv30_routines 2427',errmax,errmaxrel)2623 calliso_verif_traceur(xtclw(1,il,im), &2624 &'condiso_liq_ice_vectiso_trac 358')2625 if(iso_verif_positif_nostop(xtclw(itZonIso( &2626 &izone_cond,iso_eau),i,k)-xtclw(iso_eau,i,k) &2627 & ,'cv30_routines 909').eq.1) then2628 write(*,*) 'i,k=',i,k2629 write(*,*) 'xtclw=',xtclw(:,i,k)2630 write(*,*) 'niso,ntraciso,index_zone,izone_cond=', &2631 & niso,ntraciso,index_zone,izone_cond2628 endif !if (index_zone(ixt).EQ.izone_cond) THEN 2629 enddo !do ixt=1,ntraciso 2630 #ifdef ISOVERIF 2631 CALL iso_verif_egalite_choix(xtclw(iso_eau,il,im), & 2632 clw(il,im),'cv30_routines 2427',errmax,errmaxrel) 2633 CALL iso_verif_traceur(xtclw(1,il,im), & 2634 'condiso_liq_ice_vectiso_trac 358') 2635 IF (iso_verif_positif_nostop(xtclw(itZonIso( & 2636 izone_cond,iso_eau),i,k)-xtclw(iso_eau,i,k) & 2637 ,'cv30_routines 909').EQ.1) THEN 2638 WRITE(*,*) 'i,k=',i,k 2639 WRITE(*,*) 'xtclw=',xtclw(:,i,k) 2640 WRITE(*,*) 'niso,ntraciso,index_zone,izone_cond=', & 2641 niso,ntraciso,index_zone,izone_cond 2632 2642 stop 2633 2643 endif !if (iso_verif_positif_nostop(xtclw(itZonIso( 2634 #endif 2635 enddo !do il = 1, ncum 2644 #endif 2645 enddo !do il = 1, ncum 2636 2646 enddo !do im = 1, nd 2637 ! write(*,*) 'xtclw(:,1,2)=',xtclw(:,1,2)2638 endif !if (option_tmin. eq.1) then2639 #endif 2640 #endif 2641 2642 RETURN 2647 ! WRITE(*,*) 'xtclw(:,1,2)=',xtclw(:,1,2) 2648 endif !if (option_tmin.EQ.1) THEN 2649 #endif 2650 #endif 2651 2652 2643 2653 END SUBROUTINE cv30_mixing 2644 2654 … … 2649 2659 , wdtraina, wdtrainm & ! 26/08/10 RomP-jyg 2650 2660 #ifdef ISO 2651 &,xt,xtclw,xtelij &2652 &,xtp,xtwater,xtevap,xtwdtraina &2653 #endif 2654 &)2655 #ifdef ISO 2656 useinfotrac_phy, ONLY: ntraciso=>ntiso, niso2657 useisotopes_mod, ONLY: essai_convergence, iso_eau,iso_HDO,ridicule2658 useisotopes_routines_mod, ONLY: appel_stewart_vectall,appel_stewart_debug2659 #ifdef ISOVERIF 2660 useisotopes_verif_mod, ONLY: errmax,errmaxrel, &2661 ,xt,xtclw,xtelij & 2662 ,xtp,xtwater,xtevap,xtwdtraina & 2663 #endif 2664 ) 2665 #ifdef ISO 2666 USE infotrac_phy, ONLY: ntraciso=>ntiso, niso 2667 USE isotopes_mod, ONLY: essai_convergence, iso_eau,iso_HDO,ridicule 2668 USE isotopes_routines_mod, ONLY: appel_stewart_vectall,appel_stewart_debug 2669 #ifdef ISOVERIF 2670 USE isotopes_verif_mod, ONLY: errmax,errmaxrel, & 2661 2671 iso_verif_egalite_choix, iso_verif_noNaN,iso_verif_aberrant, & 2662 2672 iso_verif_egalite,iso_verif_egalite_choix_nostop,iso_verif_positif_nostop, & … … 2665 2675 #endif 2666 2676 #ifdef ISOTRAC 2667 use isotrac_mod, only: option_cond,izone_cond2668 useinfotrac_phy, ONLY: itZonIso2669 #ifdef ISOVERIF 2670 useisotopes_verif_mod, ONLY: iso_verif_traceur_justmass, &2677 USE isotrac_mod, ONLY: option_cond,izone_cond 2678 USE infotrac_phy, ONLY: itZonIso 2679 #ifdef ISOVERIF 2680 USE isotopes_verif_mod, ONLY: iso_verif_traceur_justmass, & 2671 2681 & iso_verif_traceur 2672 use isotrac_routines_mod, ONLY: iso_verif_traceur_pbidouille 2673 #endif 2674 #endif 2675 #endif 2676 2677 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 2678 , clmci, eps, epsi, epsim1, ginv, hrd, grav 2679 USE cvflag_mod_h, ONLY: icvflag_Tpa, cvflag_grav, cvflag_ice, ok_optim_yield, ok_entrain, ok_homo_tend, & 2680 ok_convstop, ok_intermittent, cvflag_prec_eject, qsat_depends_on_qt, adiab_ascent_mass_flux_depends_on_ejectliq, keepbug_ice_frac 2682 USE isotrac_routines_mod, ONLY: iso_verif_traceur_pbidouille 2683 #endif 2684 #endif 2685 #endif 2686 USE cvflag_mod_h 2687 USE cvthermo_mod_h 2688 2681 2689 IMPLICIT NONE 2682 2683 2684 include "cv30param.h"2685 2690 2686 2691 ! inputs: … … 2697 2702 REAL m(nloc, na), ment(nloc, na, na), elij(nloc, na, na) 2698 2703 #ifdef ISO 2699 realxt(ntraciso,nloc,nd), xtclw(ntraciso,nloc,na)2700 realxtelij(ntraciso,nloc,na,na)2704 REAL xt(ntraciso,nloc,nd), xtclw(ntraciso,nloc,na) 2705 REAL xtelij(ntraciso,nloc,na,na) 2701 2706 ! real xtep(ntraciso,nloc,na) ! le 7 mai: on supprime xtep 2702 2707 #endif … … 2714 2719 2715 2720 #ifdef ISO 2716 realxtp(ntraciso,nloc,na)2717 realxtwater(ntraciso,nloc,na), xtevap(ntraciso,nloc,na)2718 realxtwdtraina(ntraciso,nloc,na)2721 REAL xtp(ntraciso,nloc,na) 2722 REAL xtwater(ntraciso,nloc,na), xtevap(ntraciso,nloc,na) 2723 REAL xtwdtraina(ntraciso,nloc,na) 2719 2724 #endif 2720 2725 … … 2731 2736 2732 2737 #ifdef ISO 2733 integerixt2734 realxtawat(ntraciso)2738 INTEGER ixt 2739 REAL xtawat(ntraciso) 2735 2740 REAL xtwdtrain(ntraciso,nloc) 2736 ! logicalnegation2737 realrpprec(nloc,na)2741 ! LOGICAL negation 2742 REAL rpprec(nloc,na) 2738 2743 !#ifdef ISOVERIF 2739 2744 ! integer iso_verif_aberrant_nostop 2740 !#ifdef ISOTRAC 2745 !#ifdef ISOTRAC 2741 2746 ! integer iso_verif_traceur_choix_nostop 2742 2747 ! integer iso_verif_positif_nostop 2743 !#endif 2744 !#endif 2748 !#endif 2749 !#endif 2745 2750 #endif 2746 2751 … … 2748 2753 ! ------------------------------------------------------ 2749 2754 !#ifdef ISOVERIF 2750 ! write(*,*) 'cv30_routines 2382: entree dans cv3_unsat'2755 ! WRITE(*,*) 'cv30_routines 2382: entree dans cv3_unsat' 2751 2756 !#endif 2752 2757 … … 2777 2782 #ifdef ISO 2778 2783 rpprec(il,i)=rp(il,i) 2779 doixt=1,ntraciso2784 DO ixt=1,ntraciso 2780 2785 xtp(ixt,il,i)=xt(ixt,il,i) 2781 2786 xtwater(ixt,il,i)=0.0 … … 2784 2789 !-- debug 2785 2790 #ifdef ISOVERIF 2786 if(iso_eau.gt.0) then2787 calliso_verif_egalite_choix(xt(iso_eau,il,i),rr(il,i), &2788 &'cv30_unsat 2245 ',errmax,errmaxrel)2789 calliso_verif_egalite_choix(xtp(iso_eau,il,i),rp(il,i), &2790 &'cv30_unsat 2247 ',errmax,errmaxrel)2791 endif ! if(iso_eau.gt.0) then2791 IF(iso_eau.gt.0) THEN 2792 CALL iso_verif_egalite_choix(xt(iso_eau,il,i),rr(il,i), & 2793 'cv30_unsat 2245 ',errmax,errmaxrel) 2794 CALL iso_verif_egalite_choix(xtp(iso_eau,il,i),rp(il,i), & 2795 'cv30_unsat 2247 ',errmax,errmaxrel) 2796 endif !IF(iso_eau.gt.0) THEN 2792 2797 #ifdef ISOTRAC 2793 calliso_verif_traceur(xt(1,il,i),'cv30_routine 2410')2794 calliso_verif_traceur(xtp(1,il,i),'cv30_routine 2411')2795 #endif 2798 CALL iso_verif_traceur(xt(1,il,i),'cv30_routine 2410') 2799 CALL iso_verif_traceur(xtp(1,il,i),'cv30_routine 2411') 2800 #endif 2796 2801 #endif 2797 2802 #endif … … 2807 2812 ! enddo 2808 2813 ! enddo 2809 ! !RomP >>>2814 ! RomP >>> 2810 2815 DO i = 1, nd 2811 2816 DO il = 1, ncum … … 2814 2819 END DO 2815 2820 END DO 2816 ! !RomP <<<2821 ! RomP <<< 2817 2822 2818 2823 ! *** check whether ep(inb)=0, if so, skip precipitating *** … … 2827 2832 CALL zilch(wdtrain, ncum) 2828 2833 #ifdef ISO 2829 callzilch(xtwdtrain,ncum*ntraciso)2834 CALL zilch(xtwdtrain,ncum*ntraciso) 2830 2835 #endif 2831 2836 … … 2856 2861 wdtraina(il, i) = wdtrain(il)/grav ! Pa 26/08/10 RomP 2857 2862 #ifdef ISO 2858 doixt=1,ntraciso2863 DO ixt=1,ntraciso 2859 2864 ! xtwdtrain(ixt,il)=grav*xtep(ixt,il,i)*m(il,i)*xtclw(ixt,il,i) 2860 2865 xtwdtrain(ixt,il)=grav*ep(il,i)*m(il,i)*xtclw(ixt,il,i) … … 2862 2867 !--debug: 2863 2868 #ifdef ISOVERIF 2864 if (iso_eau.gt.0) then2865 calliso_verif_egalite_choix(xtwdtrain(iso_eau,il), &2866 &wdtrain(il),'cv30_routines 2313',errmax,errmaxrel)2867 endif !if (iso_eau.gt.0) then2869 IF (iso_eau.gt.0) THEN 2870 CALL iso_verif_egalite_choix(xtwdtrain(iso_eau,il), & 2871 wdtrain(il),'cv30_routines 2313',errmax,errmaxrel) 2872 endif !if (iso_eau.gt.0) THEN 2868 2873 #ifdef ISOTRAC 2869 call iso_verif_traceur(xtwdtrain(1,il),'cv30_routine 2480')2870 #endif 2874 CALL iso_verif_traceur(xtwdtrain(1,il),'cv30_routine 2480') 2875 #endif 2871 2876 #endif 2872 2877 !--end debug … … 2877 2882 wdtraina(il, i) = wdtrain(il)/10. ! Pa 26/08/10 RomP 2878 2883 #ifdef ISO 2879 doixt=1,ntraciso2884 DO ixt=1,ntraciso 2880 2885 ! xtwdtrain(ixt,il)=10.0*xtep(ixt,il,i)*m(il,i)*xtclw(ixt,il,i) 2881 2886 xtwdtrain(ixt,il)=10.0*ep(il,i)*m(il,i)*xtclw(ixt,il,i) 2882 xtwdtraina(ixt,il, i) = xtwdtrain(ixt,il)/10. 2887 xtwdtraina(ixt,il, i) = xtwdtrain(ixt,il)/10. 2883 2888 enddo 2884 2889 #endif … … 2895 2900 awat = amax1(awat, 0.0) 2896 2901 #ifdef ISO 2897 ! precip mixed drafts computed from: xtawat/xtelij = awat/elij 2898 if (elij(il,j,i).ne.0.0) then2899 doixt=1,ntraciso2902 ! precip mixed drafts computed from: xtawat/xtelij = awat/elij 2903 IF (elij(il,j,i).NE.0.0) THEN 2904 DO ixt=1,ntraciso 2900 2905 xtawat(ixt)=xtelij(ixt,il,j,i)*(awat/elij(il,j,i)) 2901 2906 xtawat(ixt)=amax1(xtawat(ixt),0.0) … … 2903 2908 !! xtawat(ixt)=amin1(xtawat(ixt),xtelij(ixt,il,j,i)) !security.. 2904 2909 else 2905 doixt=1,ntraciso2910 DO ixt=1,ntraciso 2906 2911 xtawat(ixt)=0.0 2907 2912 enddo !do ixt=1,niso 2908 endif 2909 2910 #ifdef ISOVERIF 2911 if (iso_eau.gt.0) then2912 calliso_verif_egalite_choix(xtawat(iso_eau), &2913 &awat,'cv30_routines 2391',errmax,errmaxrel)2914 endif !if (iso_eau.gt.0) then2913 endif 2914 2915 #ifdef ISOVERIF 2916 IF (iso_eau.gt.0) THEN 2917 CALL iso_verif_egalite_choix(xtawat(iso_eau), & 2918 awat,'cv30_routines 2391',errmax,errmaxrel) 2919 endif !if (iso_eau.gt.0) THEN 2915 2920 #ifdef ISOTRAC 2916 calliso_verif_traceur(xtawat(1),'cv30_routine 2522')2917 #endif 2921 CALL iso_verif_traceur(xtawat(1),'cv30_routine 2522') 2922 #endif 2918 2923 #endif 2919 2924 #endif … … 2921 2926 wdtrain(il) = wdtrain(il) + grav*awat*ment(il, j, i) 2922 2927 #ifdef ISO 2923 doixt=1,ntraciso2928 DO ixt=1,ntraciso 2924 2929 xtwdtrain(ixt,il)=xtwdtrain(ixt,il) & 2925 &+grav*xtawat(ixt)*ment(il,j,i)2930 +grav*xtawat(ixt)*ment(il,j,i) 2926 2931 enddo !do ixt=1,ntraciso 2927 2932 #endif 2928 2933 ELSE 2929 2934 wdtrain(il) = wdtrain(il) + 10.0*awat*ment(il, j, i) 2930 #ifdef ISO 2931 doixt=1,ntraciso2935 #ifdef ISO 2936 DO ixt=1,ntraciso 2932 2937 xtwdtrain(ixt,il)=xtwdtrain(ixt,il) & 2933 &+10.0*xtawat(ixt)*ment(il,j,i)2938 +10.0*xtawat(ixt)*ment(il,j,i) 2934 2939 enddo !!do ixt=1,ntraciso 2935 2940 #endif 2936 END IF !if (cvflag_grav) then2941 END IF !if (cvflag_grav) THEN 2937 2942 #ifdef ISO 2938 2943 !--debug: 2939 2944 #ifdef ISOVERIF 2940 if (iso_eau.gt.0) then2941 calliso_verif_egalite_choix(xtwdtrain(iso_eau,il), &2942 &wdtrain(il),'cv30_routines 2366',errmax,errmaxrel)2943 endif !if (iso_eau.gt.0) then2945 IF (iso_eau.gt.0) THEN 2946 CALL iso_verif_egalite_choix(xtwdtrain(iso_eau,il), & 2947 wdtrain(il),'cv30_routines 2366',errmax,errmaxrel) 2948 endif !if (iso_eau.gt.0) THEN 2944 2949 #ifdef ISOTRAC 2945 calliso_verif_traceur(xtwdtrain(1,il),'cv30_routine 2540')2946 if (option_cond.ge.1) then2950 CALL iso_verif_traceur(xtwdtrain(1,il),'cv30_routine 2540') 2951 IF (option_cond.ge.1) THEN 2947 2952 ! on verifie que tout le detrainement est tagge condensat 2948 if(iso_verif_positif_nostop( &2949 &xtwdtrain(itZonIso(izone_cond,iso_eau),il) &2950 &-xtwdtrain(iso_eau,il), &2951 & 'cv30_routines 2795').eq.1) then2952 write(*,*) 'xtwdtrain(:,il)=',xtwdtrain(:,il)2953 write(*,*) 'xtelij(:,il,j,i)=',xtelij(:,il,j,i)2954 write(*,*) 'xtclw(:,il,i)=',xtclw(:,il,i)2953 IF (iso_verif_positif_nostop( & 2954 xtwdtrain(itZonIso(izone_cond,iso_eau),il) & 2955 -xtwdtrain(iso_eau,il), & 2956 'cv30_routines 2795').EQ.1) THEN 2957 WRITE(*,*) 'xtwdtrain(:,il)=',xtwdtrain(:,il) 2958 WRITE(*,*) 'xtelij(:,il,j,i)=',xtelij(:,il,j,i) 2959 WRITE(*,*) 'xtclw(:,il,i)=',xtclw(:,il,i) 2955 2960 stop 2956 2961 endif !if (iso_verif_positif_nostop(Pxtisup(iso_eau,il)- 2957 endif !if (option_cond.ge.1) then2958 #endif 2962 endif !if (option_cond.ge.1) THEN 2963 #endif 2959 2964 #endif 2960 2965 #endif … … 3013 3018 ! jyg1 3014 3019 ! cc sigt=1.0 3015 ! cc if(i.ge.icb)sigt=sigp(i)3020 ! cc IF(i.ge.icb)sigt=sigp(i) 3016 3021 ! prise en compte de la variation progressive de sigt dans 3017 3022 ! les couches icb et icb-1: … … 3044 3049 ! water(il,i)=max(0.0,water(il,i)) ! ceci est toujours verifie 3045 3050 #ifdef ISOVERIF 3046 calliso_verif_positif(water(il,i),'cv30_unsat 2376')3051 CALL iso_verif_positif(water(il,i),'cv30_unsat 2376') 3047 3052 #endif 3048 3053 ! evap(il,i)=max(0.0,evap(il,i)) ! evap<0 permet la conservation de … … 3131 3136 END IF 3132 3137 3133 END IF ! i. eq.13138 END IF ! i.EQ.1 3134 3139 3135 3140 ! *** find mixing ratio of precipitating downdraft *** … … 3164 3169 ! : +tra(il,i,j)*(mp(il,i)-mp(il,i+1)) 3165 3170 ! trap(il,i,j)=trap(il,i,j)/mp(il,i) 3166 ! end do3171 ! END DO 3167 3172 3168 3173 ELSE … … 3181 3186 ! do j=1,ntra 3182 3187 ! trap(il,i,j)=trap(il,i+1,j) 3183 ! end do3188 ! END DO 3184 3189 3185 3190 END IF 3186 3191 END IF 3187 #ifdef ISO 3188 rpprec(il,i)=max(rp(il,i),0.0) 3192 #ifdef ISO 3193 rpprec(il,i)=max(rp(il,i),0.0) 3189 3194 #endif 3190 3195 rp(il, i) = amin1(rp(il,i), rs(il,i)) … … 3199 3204 #ifdef ISOVERIF 3200 3205 ! verif des inputs a appel stewart 3201 ! write(*,*) 'cv30_routines 2842 tmp: appel de appel_stewart'3202 do il=1,ncum3203 if (i.le.inb(il) .and. lwork(il)) then3204 if (iso_eau.gt.0) then3205 calliso_verif_egalite_choix(xt(iso_eau,il,i), &3206 &rr(il,i),'appel_stewart 262, cas 1.1',errmax,errmaxrel)3207 endif !if (iso_eau.gt.0) then3206 ! WRITE(*,*) 'cv30_routines 2842 tmp: appel de appel_stewart' 3207 DO il=1,ncum 3208 IF (i.le.inb(il) .AND. lwork(il)) THEN 3209 IF (iso_eau.gt.0) THEN 3210 CALL iso_verif_egalite_choix(xt(iso_eau,il,i), & 3211 rr(il,i),'appel_stewart 262, cas 1.1',errmax,errmaxrel) 3212 endif !if (iso_eau.gt.0) THEN 3208 3213 !#ifdef ISOTRAC 3209 ! if (option_tmin.ge.1) then3210 ! calliso_verif_positif(xtwater(3214 ! if (option_tmin.ge.1) THEN 3215 ! CALL iso_verif_positif(xtwater( 3211 3216 ! : itZonIso(izone_cond,iso_eau),il,i+1) 3212 3217 ! : -xtwater(iso_eau,il,i+1), 3213 3218 ! : 'cv30_routines 3083') 3214 ! endif !if (option_tmin.ge.1) then3219 ! endif !if (option_tmin.ge.1) THEN 3215 3220 !#endif 3216 3221 endif … … 3218 3223 #endif 3219 3224 3220 if (1.eq.0) then3225 IF (1.EQ.0) THEN 3221 3226 ! appel de appel_stewart_vectorise 3222 callappel_stewart_vectall(lwork,ncum, &3223 &ph,t,evap,xtwdtrain, &3224 &wdtrain, &3225 &water,rr,xt,rs,rpprec,mp,wt, & ! inputs physiques3226 &xtwater,xtp, & ! outputs indispensables3227 &xtevap, & ! diagnostiques3228 &sigd, & ! inputs tunables3229 & i,inb, & ! altitude: car cas particulier en INB3230 &na,nd,nloc,cvflag_grav,ginv,1e-16)3231 3232 else !if (1. eq.0) then3227 CALL appel_stewart_vectall(lwork,ncum, & 3228 ph,t,evap,xtwdtrain, & 3229 wdtrain, & 3230 water,rr,xt,rs,rpprec,mp,wt, & ! inputs physiques 3231 xtwater,xtp, & ! outputs indispensables 3232 xtevap, & ! diagnostiques 3233 sigd, & ! inputs tunables 3234 i,inb, & ! altitude: car cas particulier en INB 3235 na,nd,nloc,cvflag_grav,ginv,1e-16) 3236 3237 else !if (1.EQ.0) THEN 3233 3238 ! truc simple sans fractionnement 3234 3239 ! juste pour debuggage 3235 callappel_stewart_debug(lwork,nloc,inb,na,i, &3240 CALL appel_stewart_debug(lwork,nloc,inb,na,i, & 3236 3241 evap,water,rpprec,rr,wdtrain, & 3237 3242 xtevap,xtwater,xtp,xt,xtwdtrain) 3238 endif ! if (1.eq.0) then 3239 3240 3241 #ifdef ISOVERIF 3242 ! write(*,*) 'cv30_routines 2864 tmp: sortie de appel_stewart' 3243 endif ! if (1.EQ.0) THEN 3244 #ifdef ISOVERIF 3245 ! WRITE(*,*) 'cv30_routines 2864 tmp: sortie de appel_stewart' 3243 3246 ! verif des outputs de appel stewart 3244 doil=1,ncum3245 if (i.le.inb(il) .and. lwork(il)) then3246 do ixt=1,ntraciso3247 calliso_verif_noNAN(xtp(ixt,il,i),'cv30_unsat 3382')3248 calliso_verif_noNAN(xtwater(ixt,il,i),'cv30_unsat 3381')3249 calliso_verif_noNAN(xtevap(ixt,il,i),'cv30_unsat 2661')3250 enddo 3251 if (iso_eau.gt.0) then3252 calliso_verif_egalite_choix(xtp(iso_eau,il,i), &3253 & rpprec(il,i),'cv30_unsat 2736',errmax,errmaxrel)3254 calliso_verif_egalite_choix(xtwater(iso_eau,il,i), &3255 & water(il,i),'cv30_unsat 2747',errmax,errmaxrel)3256 ! write(*,*) 'xtwater(4,il,i)=',xtwater(4,il,i)3257 ! write(*,*) 'water(il,i)=',water(il,i)3258 calliso_verif_egalite_choix(xtevap(iso_eau,il,i), &3259 &evap(il,i),'cv30_unsat 2751',errmax,errmaxrel)3260 endif !if (iso_eau.gt.0) then3261 if ((iso_HDO.gt.0).and. &3262 & (rp(il,i).gt.ridicule)) then3263 calliso_verif_aberrant(xtp(iso_HDO,il,i)/rpprec(il,i), &3264 &'cv3unsat 2756')3265 endif !if ((iso_HDO.gt.0). and.3247 DO il=1,ncum 3248 IF (i.le.inb(il) .AND. lwork(il)) THEN 3249 DO ixt=1,ntraciso 3250 CALL iso_verif_noNAN(xtp(ixt,il,i),'cv30_unsat 3382') 3251 CALL iso_verif_noNAN(xtwater(ixt,il,i),'cv30_unsat 3381') 3252 CALL iso_verif_noNAN(xtevap(ixt,il,i),'cv30_unsat 2661') 3253 enddo 3254 IF (iso_eau.gt.0) THEN 3255 CALL iso_verif_egalite_choix(xtp(iso_eau,il,i), & 3256 rpprec(il,i),'cv30_unsat 2736',errmax,errmaxrel) 3257 CALL iso_verif_egalite_choix(xtwater(iso_eau,il,i), & 3258 water(il,i),'cv30_unsat 2747',errmax,errmaxrel) 3259 ! WRITE(*,*) 'xtwater(4,il,i)=',xtwater(4,il,i) 3260 ! WRITE(*,*) 'water(il,i)=',water(il,i) 3261 CALL iso_verif_egalite_choix(xtevap(iso_eau,il,i), & 3262 evap(il,i),'cv30_unsat 2751',errmax,errmaxrel) 3263 endif !if (iso_eau.gt.0) THEN 3264 IF ((iso_HDO.gt.0).AND. & 3265 (rp(il,i).gt.ridicule)) THEN 3266 CALL iso_verif_aberrant(xtp(iso_HDO,il,i)/rpprec(il,i), & 3267 'cv3unsat 2756') 3268 endif !if ((iso_HDO.gt.0).AND. 3266 3269 #ifdef ISOTRAC 3267 ! if (il. eq.602) then3268 ! write(*,*) 'cv30_routine tmp: il,i=',il,i3269 ! write(*,*) 'xtp(iso_eau:ntraciso:3,il,i)=',3270 ! if (il.EQ.602) THEN 3271 ! WRITE(*,*) 'cv30_routine tmp: il,i=',il,i 3272 ! WRITE(*,*) 'xtp(iso_eau:ntraciso:3,il,i)=', 3270 3273 ! : xtp(iso_eau:ntraciso:3,il,i) 3271 3274 ! endif 3272 calliso_verif_traceur(xtp(1,il,i),'cv30_routine 2852')3273 calliso_verif_traceur(xtwater(1,il,1), &3274 &'cv30_routine 2853 unsat apres appel')3275 calliso_verif_traceur_pbidouille(xtwater(1,il,i), &3276 &'cv30_routine 2853b')3277 calliso_verif_traceur_justmass(xtevap(1,il,i), &3278 &'cv30_routine 2854')3279 ! if (option_tmin.ge.1) then3280 ! calliso_verif_positif(xtwater(3275 CALL iso_verif_traceur(xtp(1,il,i),'cv30_routine 2852') 3276 CALL iso_verif_traceur(xtwater(1,il,1), & 3277 'cv30_routine 2853 unsat apres appel') 3278 CALL iso_verif_traceur_pbidouille(xtwater(1,il,i), & 3279 'cv30_routine 2853b') 3280 CALL iso_verif_traceur_justmass(xtevap(1,il,i), & 3281 'cv30_routine 2854') 3282 ! if (option_tmin.ge.1) THEN 3283 ! CALL iso_verif_positif(xtwater( 3281 3284 ! : itZonIso(izone_cond,iso_eau),il,i) 3282 3285 ! : -xtwater(iso_eau,il,i), 3283 3286 ! : 'cv30_routines 3143') 3284 ! endif !if (option_tmin.ge.1) then3285 #endif 3286 endif !if (i.le.inb(il) . and. lwork(il)) then3287 ! endif !if (option_tmin.ge.1) THEN 3288 #endif 3289 endif !if (i.le.inb(il) .AND. lwork(il)) THEN 3287 3290 enddo !do il=1,ncum 3288 3291 #endif 3289 3292 3290 3293 ! equivalent isotopique de rp(il,i)=amin1(rp(il,i),rs(il,i)) 3291 do il=1,ncum 3292 if (i.lt.inb(il) .and. lwork(il)) then 3293 3294 if (rpprec(il,i).gt.rs(il,i)) then 3295 if (rs(il,i).le.0) then 3296 write(*,*) 'cv3unsat 2640' 3294 DO il=1,ncum 3295 IF (i.lt.inb(il) .AND. lwork(il)) THEN 3296 IF (rpprec(il,i).gt.rs(il,i)) THEN 3297 IF (rs(il,i).le.0) THEN 3298 WRITE(*,*) 'cv3unsat 2640' 3297 3299 stop 3298 3300 endif 3299 doixt=1,ntraciso3301 DO ixt=1,ntraciso 3300 3302 xtp(ixt,il,i)=xtp(ixt,il,i)/rpprec(il,i)*rs(il,i) 3301 3303 xtp(ixt,il,i)=max(0.0,xtp(ixt,il,i)) 3302 enddo !do ixt=1,niso 3303 #ifdef ISOVERIF 3304 do ixt=1,ntraciso3305 call iso_verif_noNaN(xtp(ixt,il,i),'cv3unsat 2641')3304 enddo !do ixt=1,niso 3305 #ifdef ISOVERIF 3306 DO ixt=1,ntraciso 3307 CALL iso_verif_noNaN(xtp(ixt,il,i),'cv3unsat 2641') 3306 3308 enddo !do ixt=1,niso 3307 if (iso_eau.gt.0) then3308 ! write(*,*) 'xtp(iso_eau,il,i)=',xtp(iso_eau,il,i)3309 calliso_verif_egalite_choix(xtp(iso_eau,il,i),rp(il,i), &3310 &'cv3unsat 2653',errmax,errmaxrel)3311 calliso_verif_egalite_choix(xtp(iso_eau,il,i), &3312 & rs(il,i),'cv3unsat 2654',errmax,errmaxrel)3313 endif 3314 if ((iso_HDO.gt.0).and. &3315 & (rp(il,i).gt.ridicule)) then3316 if(iso_verif_aberrant_nostop(xtp(iso_HDO,il,i)/rp(il,i), &3317 & 'cv3unsat 2658').eq.1) then3318 write(*,*) 'rpprec(il,i),rs(il,i),rp(il,i)=', &3319 &rpprec(il,i),rs(il,i),rp(il,i)3309 IF (iso_eau.gt.0) THEN 3310 ! WRITE(*,*) 'xtp(iso_eau,il,i)=',xtp(iso_eau,il,i) 3311 CALL iso_verif_egalite_choix(xtp(iso_eau,il,i),rp(il,i), & 3312 'cv3unsat 2653',errmax,errmaxrel) 3313 CALL iso_verif_egalite_choix(xtp(iso_eau,il,i), & 3314 rs(il,i),'cv3unsat 2654',errmax,errmaxrel) 3315 endif 3316 IF ((iso_HDO.gt.0).AND. & 3317 (rp(il,i).gt.ridicule)) THEN 3318 IF (iso_verif_aberrant_nostop(xtp(iso_HDO,il,i)/rp(il,i), & 3319 'cv3unsat 2658').EQ.1) THEN 3320 WRITE(*,*) 'rpprec(il,i),rs(il,i),rp(il,i)=', & 3321 rpprec(il,i),rs(il,i),rp(il,i) 3320 3322 stop 3321 3323 endif 3322 3324 endif 3323 3325 #ifdef ISOTRAC 3324 calliso_verif_traceur(xtp(1,il,i),'cv30_routine 2893')3325 #endif 3326 #endif 3327 rpprec(il,i)=rs(il,i) 3328 endif !if (rp(il,i).gt.rs(il,i)) then3326 CALL iso_verif_traceur(xtp(1,il,i),'cv30_routine 2893') 3327 #endif 3328 #endif 3329 rpprec(il,i)=rs(il,i) 3330 endif !if (rp(il,i).gt.rs(il,i)) THEN 3329 3331 endif !if (i.lt.INB et lwork) 3330 3332 enddo ! il=1,ncum … … 3335 3337 3336 3338 ! fin de la boucle en i (altitude) 3337 #ifdef ISO 3338 write(*,*) 'nl=',nl,'nd=',nd,'; ncum=',ncum3339 #ifdef ISOVERIF 3340 doi=1,nl !nl3341 doil=1,ncum3342 if (iso_eau.gt.0) then3343 ! write(*,*) 'cv30_routines 2767:i,il,lwork(il),inb(il)=',3339 #ifdef ISO 3340 WRITE(*,*) 'nl=',nl,'nd=',nd,'; ncum=',ncum 3341 #ifdef ISOVERIF 3342 DO i=1,nl !nl 3343 DO il=1,ncum 3344 IF (iso_eau.gt.0) THEN 3345 ! WRITE(*,*) 'cv30_routines 2767:i,il,lwork(il),inb(il)=', 3344 3346 ! : i,il,lwork(il),inb(il) 3345 ! write(*,*) 'rp(il,i),xtp(iso_eau,il,i)=',3346 ! : rp(il,i),xtp(iso_eau,il,i) 3347 calliso_verif_egalite_choix(xt(iso_eau,il,i), &3348 &rr(il,i),'cv30_unsat 2668',errmax,errmaxrel)3349 calliso_verif_egalite_choix(xtp(iso_eau,il,i), &3350 &rp(il,i),'cv30_unsat 2670',errmax,errmaxrel)3351 calliso_verif_egalite_choix(xtwater(iso_eau,il,i), &3352 &water(il,i),'cv30_unsat 2672',errmax,errmaxrel)3353 endif !if (iso_eau.gt.0) then3347 ! WRITE(*,*) 'rp(il,i),xtp(iso_eau,il,i)=', 3348 ! : rp(il,i),xtp(iso_eau,il,i) 3349 CALL iso_verif_egalite_choix(xt(iso_eau,il,i), & 3350 rr(il,i),'cv30_unsat 2668',errmax,errmaxrel) 3351 CALL iso_verif_egalite_choix(xtp(iso_eau,il,i), & 3352 rp(il,i),'cv30_unsat 2670',errmax,errmaxrel) 3353 CALL iso_verif_egalite_choix(xtwater(iso_eau,il,i), & 3354 water(il,i),'cv30_unsat 2672',errmax,errmaxrel) 3355 endif !if (iso_eau.gt.0) THEN 3354 3356 !#ifdef ISOTRAC 3355 3357 ! if (iso_verif_traceur_choix_nostop(xtwater(1,il,i), 3356 3358 ! : 'cv30_routine 2982 unsat',errmax, 3357 ! : errmaxrel,ridicule_trac,deltalimtrac). eq.1) then3358 ! write(*,*) 'il,i,inb(il),lwork(il)=',3359 ! : errmaxrel,ridicule_trac,deltalimtrac).EQ.1) THEN 3360 ! WRITE(*,*) 'il,i,inb(il),lwork(il)=', 3359 3361 ! : il,i,inb(il),lwork(il) 3360 ! write(*,*) 'xtwater(:,il,i)=',xtwater(:,il,i)3362 ! WRITE(*,*) 'xtwater(:,il,i)=',xtwater(:,il,i) 3361 3363 ! stop 3362 3364 ! endif 3363 !#endif 3365 !#endif 3364 3366 enddo !do il=1,nloc!ncum 3365 3367 enddo !do i=1,nl!nl 3366 3368 il=5 3367 i=39 3368 write(*,*) 'cv30_unsat 2780: il,water(il,i),xtwater(iso_eau,il,i)=' &3369 i=39 3370 WRITE(*,*) 'cv30_unsat 2780: il,water(il,i),xtwater(iso_eau,il,i)=' & 3369 3371 ,il,water(il,i),xtwater(iso_eau,il,i) 3370 3372 #endif 3371 3373 #endif 3372 RETURN 3374 3373 3375 END SUBROUTINE cv30_unsat 3374 3376 … … 3379 3381 mike, tls, tps, qcondc, wd & 3380 3382 #ifdef ISO 3381 &,xt,xtclw,xtp,xtwater,xtevap &3382 &,xtent,xtelij,xtprecip,fxt,xtVprecip &3383 ,xt,xtclw,xtp,xtwater,xtevap & 3384 ,xtent,xtelij,xtprecip,fxt,xtVprecip & 3383 3385 #ifdef DIAGISO 3384 & ,fq_detrainement,fq_ddft,fq_fluxmasse,fq_evapprecip & 3385 & ,fxt_detrainement,fxt_ddft,fxt_fluxmasse,fxt_evapprecip & 3386 & ,f_detrainement,q_detrainement,xt_detrainement & 3387 #endif 3388 #endif 3389 & ) 3390 #ifdef ISO 3391 use infotrac_phy, ONLY: ntraciso=>ntiso, niso, nzone, itZonIso 3392 use isotopes_mod, ONLY: essai_convergence,ridicule,iso_eau,iso_HDO,iso_O18 3393 #ifdef ISOVERIF 3394 use isotopes_verif_mod, ONLY: errmax,errmaxrel, & 3386 ,fq_detrainement,fq_ddft,fq_fluxmasse,fq_evapprecip & 3387 ,fxt_detrainement,fxt_ddft,fxt_fluxmasse,fxt_evapprecip & 3388 ,f_detrainement,q_detrainement,xt_detrainement & 3389 #endif 3390 #endif 3391 ) 3392 USE conema3_mod_h 3393 #ifdef ISO 3394 USE infotrac_phy, ONLY: ntraciso=>ntiso, niso, nzone, itZonIso 3395 USE isotopes_mod, ONLY: essai_convergence,ridicule,iso_eau,iso_HDO,iso_O18 3396 #ifdef ISOVERIF 3397 USE isotopes_verif_mod, ONLY: errmax,errmaxrel, & 3395 3398 iso_verif_egalite_choix, iso_verif_noNaN,iso_verif_aberrant, & 3396 3399 iso_verif_egalite,iso_verif_egalite_choix_nostop,iso_verif_positif_nostop, & … … 3401 3404 #endif 3402 3405 #ifdef ISOTRAC 3403 use isotrac_mod, only: option_traceurs, &3406 USE isotrac_mod, ONLY: option_traceurs, & 3404 3407 izone_revap,izone_poubelle,izone_ddft 3405 3408 #ifdef ISOVERIF 3406 useisotopes_verif_mod, ONLY: iso_verif_traceur_choix_nostop,deltalimtrac, &3409 USE isotopes_verif_mod, ONLY: iso_verif_traceur_choix_nostop,deltalimtrac, & 3407 3410 & iso_verif_tracpos_choix_nostop,iso_verif_traceur,iso_verif_traceur_justmass 3408 use isotrac_mod, only: ridicule_trac 3409 #endif 3410 #endif 3411 #endif 3412 3413 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 3414 , clmci, eps, epsi, epsim1, ginv, hrd, grav 3415 USE cvflag_mod_h, ONLY: icvflag_Tpa, cvflag_grav, cvflag_ice, ok_optim_yield, ok_entrain, ok_homo_tend, & 3416 ok_convstop, ok_intermittent, cvflag_prec_eject, qsat_depends_on_qt, adiab_ascent_mass_flux_depends_on_ejectliq, keepbug_ice_frac 3411 USE isotrac_mod, ONLY: ridicule_trac 3412 #endif 3413 #endif 3414 #endif 3415 USE cvflag_mod_h 3416 USE cvthermo_mod_h 3417 3417 3418 IMPLICIT NONE 3418 3419 include "cv30param.h"3420 include "conema3.h"3421 3422 3419 ! inputs: 3423 3420 INTEGER ncum, nd, na, ntra, nloc … … 3439 3436 REAL tv(nloc, nd), tvp(nloc, nd) 3440 3437 #ifdef ISO 3441 realxt(ntraciso,nloc,nd)3438 REAL xt(ntraciso,nloc,nd) 3442 3439 ! real xtep(ntraciso,nloc,na) ! le 7 mai: on supprime xtep 3443 realxtclw(ntraciso,nloc,na), xtp(ntraciso,nloc,na)3444 realxtwater(ntraciso,nloc,na), xtevap(ntraciso,nloc,na)3445 realxtent(ntraciso,nloc,na,na), xtelij(ntraciso,nloc,na,na)3446 #ifdef ISOVERIF 3440 REAL xtclw(ntraciso,nloc,na), xtp(ntraciso,nloc,na) 3441 REAL xtwater(ntraciso,nloc,na), xtevap(ntraciso,nloc,na) 3442 REAL xtent(ntraciso,nloc,na,na), xtelij(ntraciso,nloc,na,na) 3443 #ifdef ISOVERIF 3447 3444 CHARACTER (LEN=20) :: modname='cv30_compress' 3448 3445 CHARACTER (LEN=80) :: abort_message … … 3464 3461 REAL wd(nloc) ! gust 3465 3462 #ifdef ISO 3466 realxtprecip(ntraciso,nloc), fxt(ntraciso,nloc,nd)3467 realxtVprecip(ntraciso,nloc,nd+1)3463 REAL xtprecip(ntraciso,nloc), fxt(ntraciso,nloc,nd) 3464 REAL xtVprecip(ntraciso,nloc,nd+1) 3468 3465 #endif 3469 3466 … … 3481 3478 REAL siga(nloc, nd), sax(nloc, nd), mac(nloc, nd) ! cld 3482 3479 #ifdef ISO 3483 integerixt3484 realxtbx(ntraciso), xtawat(ntraciso)3480 INTEGER ixt 3481 REAL xtbx(ntraciso), xtawat(ntraciso) 3485 3482 ! cam debug 3486 3483 ! pour l'homogeneisation sous le nuage: 3487 realfrsum(nloc), bxtsum(ntraciso,nloc), fxtsum(ntraciso,nloc)3484 REAL frsum(nloc), bxtsum(ntraciso,nloc), fxtsum(ntraciso,nloc) 3488 3485 ! correction dans calcul tendance liee a Am: 3489 realdq_tmp,k_tmp,dx_tmp,R_tmp,dqreste_tmp,dxreste_tmp,kad_tmp3490 logicalcorrection_excess_aberrant3491 parameter (correction_excess_aberrant=. false.)3486 REAL dq_tmp,k_tmp,dx_tmp,R_tmp,dqreste_tmp,dxreste_tmp,kad_tmp 3487 LOGICAL correction_excess_aberrant 3488 parameter (correction_excess_aberrant=.FALSE.) 3492 3489 ! correction qui permettait d'eviter deltas et dexcess aberrants. Mais 3493 3490 ! pb: ne conserve pas la masse d'isotopes! 3494 3491 #ifdef DIAGISO 3495 3492 ! diagnostiques juste: tendance des differents processus 3496 realfxt_detrainement(ntraciso,nloc,nd)3497 realfxt_fluxmasse(ntraciso,nloc,nd)3498 realfxt_evapprecip(ntraciso,nloc,nd)3499 realfxt_ddft(ntraciso,nloc,nd)3500 realfq_detrainement(nloc,nd)3501 realq_detrainement(nloc,nd)3502 realxt_detrainement(ntraciso,nloc,nd)3503 realf_detrainement(nloc,nd)3504 realfq_fluxmasse(nloc,nd)3505 realfq_evapprecip(nloc,nd)3506 realfq_ddft(nloc,nd)3507 #endif 3493 REAL fxt_detrainement(ntraciso,nloc,nd) 3494 REAL fxt_fluxmasse(ntraciso,nloc,nd) 3495 REAL fxt_evapprecip(ntraciso,nloc,nd) 3496 REAL fxt_ddft(ntraciso,nloc,nd) 3497 REAL fq_detrainement(nloc,nd) 3498 REAL q_detrainement(nloc,nd) 3499 REAL xt_detrainement(ntraciso,nloc,nd) 3500 REAL f_detrainement(nloc,nd) 3501 REAL fq_fluxmasse(nloc,nd) 3502 REAL fq_evapprecip(nloc,nd) 3503 REAL fq_ddft(nloc,nd) 3504 #endif 3508 3505 !#ifdef ISOVERIF 3509 3506 ! integer iso_verif_aberrant_nostop 3510 3507 ! real deltaD 3511 !#endif 3512 #ifdef ISOTRAC 3508 !#endif 3509 #ifdef ISOTRAC 3513 3510 ! integer iso_verif_traceur_choix_nostop 3514 3511 ! integer iso_verif_tracpos_choix_nostop 3515 realxtnew(ntraciso)3512 REAL xtnew(ntraciso) 3516 3513 ! real conversion(niso) 3517 realfxtYe(niso)3518 realfxtqe(niso)3519 realfxtXe(niso)3520 realfxt_revap(niso)3521 realXe(niso)3522 integerixt_revap,izone3523 integer ixt_poubelle, ixt_ddft,iiso3514 REAL fxtYe(niso) 3515 REAL fxtqe(niso) 3516 REAL fxtXe(niso) 3517 REAL fxt_revap(niso) 3518 REAL Xe(niso) 3519 INTEGER ixt_revap,izone 3520 INTEGER ixt_poubelle, ixt_ddft,iiso 3524 3521 #endif 3525 3522 #endif … … 3538 3535 #ifdef ISO 3539 3536 ! cam debug 3540 ! write(*,*) 'cv30_routines 3082: entree dans cv3_yield'3537 ! WRITE(*,*) 'cv30_routines 3082: entree dans cv3_yield' 3541 3538 ! en cam debug 3542 doixt = 1, ntraciso3539 DO ixt = 1, ntraciso 3543 3540 xtprecip(ixt,il)=0.0 3544 3541 xtVprecip(ixt,il,nd+1)=0.0 … … 3558 3555 nqcond(il, i) = 0.0 ! cld 3559 3556 #ifdef ISO 3560 doixt = 1, ntraciso3557 DO ixt = 1, ntraciso 3561 3558 fxt(ixt,il,i)=0.0 3562 3559 xtVprecip(ixt,il,i)=0.0 … … 3569 3566 fq_evapprecip(il,i)=0.0 3570 3567 fq_ddft(il,i)=0.0 3571 doixt = 1, niso3568 DO ixt = 1, niso 3572 3569 fxt_fluxmasse(ixt,il,i)=0.0 3573 3570 fxt_detrainement(ixt,il,i)=0.0 … … 3575 3572 fxt_evapprecip(ixt,il,i)=0.0 3576 3573 fxt_ddft(ixt,il,i)=0.0 3577 enddo 3578 #endif 3574 enddo 3575 #endif 3579 3576 #endif 3580 3577 END DO … … 3605 3602 3606 3603 #ifdef ISO 3607 doixt = 1, ntraciso3604 DO ixt = 1, ntraciso 3608 3605 xtprecip(ixt,il)=wt(il,1)*sigd*xtwater(ixt,il,1) & 3609 &*86400.*1000./(rowl*grav) ! en mm/jour3606 *86400.*1000./(rowl*grav) ! en mm/jour 3610 3607 enddo 3611 3608 ! cam verif 3612 3609 #ifdef ISOVERIF 3613 if (iso_eau.gt.0) then3614 ! write(*,*) 'cv30_yield 2952: '//3610 IF (iso_eau.gt.0) THEN 3611 ! WRITE(*,*) 'cv30_yield 2952: '// 3615 3612 ! : 'il,water(il,1),xtwater(iso_eau,il,1)=' 3616 3613 ! : ,il,water(il,1),xtwater(iso_eau,il,1) 3617 calliso_verif_egalite_choix(xtwater(iso_eau,il,1), &3618 &water(il,1),'cv30_routines 2959', &3619 &errmax,errmaxrel)3614 CALL iso_verif_egalite_choix(xtwater(iso_eau,il,1), & 3615 water(il,1),'cv30_routines 2959', & 3616 errmax,errmaxrel) 3620 3617 !Rq: wt(il,1)*sigd*86400.*1000./(rowl*grav)=3964.6565 3621 3618 ! -> on auatorise 3e3 fois plus d'erreur dans precip 3622 calliso_verif_egalite_choix(xtprecip(iso_eau,il), &3623 &precip(il),'cv30_routines 3138', &3624 &errmax*4e3,errmaxrel)3625 endif !if (iso_eau.gt.0) then3619 CALL iso_verif_egalite_choix(xtprecip(iso_eau,il), & 3620 precip(il),'cv30_routines 3138', & 3621 errmax*4e3,errmaxrel) 3622 endif !if (iso_eau.gt.0) THEN 3626 3623 #ifdef ISOTRAC 3627 calliso_verif_traceur(xtwater(1,il,1), &3628 &'cv30_routine 3146')3629 if(iso_verif_traceur_choix_nostop(xtprecip(1,il), &3630 &'cv30_routine 3147',errmax*1e2, &3631 & errmaxrel,ridicule_trac,deltalimtrac).eq.1) then3632 write(*,*) 'il,inb(il)=',il,inb(il)3633 write(*,*) 'xtwater(:,il,1)=',xtwater(:,il,1)3634 write(*,*) 'xtprecip(:,il)=',xtprecip(:,il)3635 write(*,*) 'fac=',wt(il,1)*sigd*86400.*1000./(rowl*grav)3624 CALL iso_verif_traceur(xtwater(1,il,1), & 3625 'cv30_routine 3146') 3626 IF (iso_verif_traceur_choix_nostop(xtprecip(1,il), & 3627 'cv30_routine 3147',errmax*1e2, & 3628 errmaxrel,ridicule_trac,deltalimtrac).EQ.1) THEN 3629 WRITE(*,*) 'il,inb(il)=',il,inb(il) 3630 WRITE(*,*) 'xtwater(:,il,1)=',xtwater(:,il,1) 3631 WRITE(*,*) 'xtprecip(:,il)=',xtprecip(:,il) 3632 WRITE(*,*) 'fac=',wt(il,1)*sigd*86400.*1000./(rowl*grav) 3636 3633 stop 3637 3634 endif 3638 #endif 3635 #endif 3639 3636 #endif 3640 3637 ! end cam verif … … 3643 3640 precip(il) = wt(il, 1)*sigd*water(il, 1)*8640. 3644 3641 #ifdef ISO 3645 doixt = 1, ntraciso3642 DO ixt = 1, ntraciso 3646 3643 xtprecip(ixt,il)=wt(il,1)*sigd*xtwater(ixt,il,1)*8640. 3647 3644 enddo 3648 3645 ! cam verif 3649 #ifdef ISOVERIF 3650 if (iso_eau.gt.0) then3651 calliso_verif_egalite_choix(xtprecip(iso_eau,il), &3652 &precip(il),'cv30_routines 3139', &3653 &errmax,errmaxrel)3654 endif !if (iso_eau.gt.0) then3646 #ifdef ISOVERIF 3647 IF (iso_eau.gt.0) THEN 3648 CALL iso_verif_egalite_choix(xtprecip(iso_eau,il), & 3649 precip(il),'cv30_routines 3139', & 3650 errmax,errmaxrel) 3651 endif !if (iso_eau.gt.0) THEN 3655 3652 #ifdef ISOTRAC 3656 calliso_verif_traceur(xtprecip(1,il),'cv30_routine 3166')3657 #endif 3653 CALL iso_verif_traceur(xtprecip(1,il),'cv30_routine 3166') 3654 #endif 3658 3655 #endif 3659 3656 ! end cam verif … … 3672 3669 vprecip(il, k) = wt(il, k)*sigd*water(il, k)/grav 3673 3670 #ifdef ISO 3674 doixt=1,ntraciso3671 DO ixt=1,ntraciso 3675 3672 xtVPrecip(ixt,il,k) = wt(il,k)*sigd & 3676 &*xtwater(ixt,il,k)/grav3673 *xtwater(ixt,il,k)/grav 3677 3674 enddo 3678 3675 #endif … … 3680 3677 vprecip(il, k) = wt(il, k)*sigd*water(il, k)/10. 3681 3678 #ifdef ISO 3682 doixt=1,ntraciso3679 DO ixt=1,ntraciso 3683 3680 xtVPrecip(ixt,il,k) = wt(il,k)*sigd & 3684 &*xtwater(ixt,il,k)/10.03681 *xtwater(ixt,il,k)/10.0 3685 3682 enddo 3686 3683 #endif … … 3694 3691 ! *** NE PAS UTILISER POUR L'INSTANT *** 3695 3692 3696 ! !do il=1,ncum3697 ! !wd(il)=betad*abs(mp(il,icb(il)))*0.01*rrd*t(il,icb(il))3698 ! !: /(sigd*p(il,icb(il)))3699 ! !enddo3693 ! do il=1,ncum 3694 ! wd(il)=betad*abs(mp(il,icb(il)))*0.01*rrd*t(il,icb(il)) 3695 ! : /(sigd*p(il,icb(il))) 3696 ! enddo 3700 3697 3701 3698 … … 3752 3749 fr(il, 1) = fr(il, 1) + 0.01*grav*am(il)*(rr(il,2)-rr(il,1))*work(il) 3753 3750 3754 #ifdef ISO 3751 #ifdef ISO 3755 3752 ! juste Mp et evap pour l'instant, voir plus bas pour am 3756 doixt = 1, ntraciso3753 DO ixt = 1, ntraciso 3757 3754 fxt(ixt,il,1)= & 3758 &0.01*grav*mp(il,2)*(xtp(ixt,il,2)-xt(ixt,il,1))*work(il) &3759 &+sigd*0.5*(xtevap(ixt,il,1)+xtevap(ixt,il,2))3760 !c+tard : +sigd*xtevap(ixt,il,1) 3755 0.01*grav*mp(il,2)*(xtp(ixt,il,2)-xt(ixt,il,1))*work(il) & 3756 +sigd*0.5*(xtevap(ixt,il,1)+xtevap(ixt,il,2)) 3757 !c+tard : +sigd*xtevap(ixt,il,1) 3761 3758 enddo !do ixt = 1, ntraciso ! pour water tagging option 6: pas besoin ici de faire de conversion. 3762 3759 3763 3760 #ifdef DIAGISO 3764 3761 fq_ddft(il,1)=fq_ddft(il,1) & 3765 &+0.01*grav*mp(il,2)*(rp(il,2)-rr(il,1))*work(il)3762 +0.01*grav*mp(il,2)*(rp(il,2)-rr(il,1))*work(il) 3766 3763 fq_evapprecip(il,1)=fq_evapprecip(il,1) & 3767 &+sigd*0.5*(evap(il,1)+evap(il,2))3764 +sigd*0.5*(evap(il,1)+evap(il,2)) 3768 3765 fq_fluxmasse(il,1)=fq_fluxmasse(il,1) & 3769 &+0.01*grav*am(il)*(rr(il,2)-rr(il,1))*work(il)3770 doixt = 1, ntraciso3766 +0.01*grav*am(il)*(rr(il,2)-rr(il,1))*work(il) 3767 DO ixt = 1, ntraciso 3771 3768 ! fxt_fluxmasse(ixt,il,1)=fxt_fluxmasse(ixt,il,1) & 3772 3769 ! & +0.01*grav*am(il)*(xt(ixt,il,2)-xt(ixt,il,1))*work(il) ! deplace 3773 3770 ! plus haut car il existe differents cas 3774 3771 fxt_ddft(ixt,il,1)=fxt_ddft(ixt,il,1) & 3775 &+0.01*grav*mp(il,2)*(xtp(ixt,il,2)-xt(ixt,il,1))*work(il)3772 +0.01*grav*mp(il,2)*(xtp(ixt,il,2)-xt(ixt,il,1))*work(il) 3776 3773 fxt_evapprecip(ixt,il,1)=fxt_evapprecip(ixt,il,1) & 3777 &+sigd*0.5*(xtevap(ixt,il,1)+xtevap(ixt,il,2))3774 +sigd*0.5*(xtevap(ixt,il,1)+xtevap(ixt,il,2)) 3778 3775 enddo 3779 #endif 3776 #endif 3780 3777 3781 3778 … … 3787 3784 ! Mais on plante dans un cas pathologique en decembre 2017 lors du test 3788 3785 ! d'un cas d'Anne Cozic: les isotopes deviennent negatifs. 3789 ! C'est un cas pas physique: on perd 99% de la masse de vapeur d'eau! 3786 ! C'est un cas pas physique: on perd 99% de la masse de vapeur d'eau! 3790 3787 ! q2=1.01e-3 et q1=1.25e-3 kg/kg 3791 3788 ! et dq=-1.24e-3: comment est-ce possible qu'un flux venant d'un air a … … 3797 3794 ! sortant. 3798 3795 ! Ainsi, le flux de masse sortant ne modifie pas la composition 3799 ! isotopique de la vapeur d'eau q1. 3796 ! isotopique de la vapeur d'eau q1. 3800 3797 ! A la fin, on a R=(x1+dx)/(q1+dq)=(x1+k*x2)/(q1+k*q2) 3801 3798 ! On verifie que quand k est petit, on tend vers la formulation … … 3810 3807 ! calcule R_tmp. 3811 3808 dq_tmp=0.01*grav*am(il)*(rr(il,2)-rr(il,1))*work(il)*delt ! utile ci-dessous 3812 if ((dq_tmp/rr(il,1).lt.-0.9).and.correction_excess_aberrant) then3809 IF ((dq_tmp/rr(il,1).lt.-0.9).AND.correction_excess_aberrant) THEN 3813 3810 ! nouvelle formulation ou on fait d'abord entrer k*q2 et ensuite 3814 3811 ! seulement on fait sortir k*q1 sans changement de composition … … 3816 3813 k_tmp=0.01*grav*am(il)*work(il)*delt 3817 3814 dqreste_tmp= 0.01*grav*mp(il, 2)*(rp(il,2)-rr(il,1))*work(il)*delt + & 3818 &sigd*0.5*(evap(il,1)+evap(il,2))*delt3819 doixt = 1, ntraciso3815 sigd*0.5*(evap(il,1)+evap(il,2))*delt 3816 DO ixt = 1, ntraciso 3820 3817 dxreste_tmp= 0.01*grav*mp(il,2)*(xtp(ixt,il,2)-xt(ixt,il,1))*work(il)*delt & 3821 &+sigd*0.5*(xtevap(ixt,il,1)+xtevap(ixt,il,2))*delt3818 +sigd*0.5*(xtevap(ixt,il,1)+xtevap(ixt,il,2))*delt 3822 3819 R_tmp=(xt(ixt,il,1)+dxreste_tmp+k_tmp*xt(ixt,il,2))/(rr(il,1)+dqreste_tmp+k_tmp*rr(il,2)) 3823 3820 dx_tmp=R_tmp*(rr(il,1)+dqreste_tmp+dq_tmp)-(xt(ixt,il,1)+dxreste_tmp) 3824 3821 fxt(ixt,il,1)=fxt(ixt,il,1) & 3825 & + dx_tmp/delt3826 #ifdef ISOVERIF 3827 if (ixt.eq.iso_HDO) then3828 write(*,*) 'cv30_routines 3888: il=',il3829 write(*,*) 'dq_tmp,rr(il,1)=',dq_tmp,rr(il,1)3830 write(*,*) 'R_tmp,dx_tmp,delt=',R_tmp,dx_tmp,delt3831 write(*,*) 'xt(ixt,il,1:2)=',xt(ixt,il,1:2)3832 write(*,*) 'rr(il,1:2)=',rr(il,1:2)3833 write(*,*) 'fxt=',dx_tmp/delt3834 write(*,*) 'rr(il,1)+dq_tmp=',rr(il,1)+dq_tmp3835 write(*,*) 'xt(ixt,il,1)+dx_tmp=',xt(ixt,il,1)+dx_tmp3836 write(*,*) 'xt(ixt,il,1)+fxt(ixt,il,1)*delt=', &3837 &xt(ixt,il,1)+fxt(ixt,il,1)*delt3838 write(*,*) 'dqreste_tmp,dxreste_tmp=',dqreste_tmp,dxreste_tmp3839 write(*,*) 'formule classique: fxt_Am=',0.01*grav*am(il)*(xt(ixt,il,2)-xt(ixt,il,1))*work(il)3840 write(*,*) 'donnerait dxt=',0.01*grav*am(il)*(xt(ixt,il,2)-xt(ixt,il,1))*work(il)*delt3841 endif !if (ixt. eq.iso_HDO) then3822 + dx_tmp/delt 3823 #ifdef ISOVERIF 3824 IF (ixt.EQ.iso_HDO) THEN 3825 WRITE(*,*) 'cv30_routines 3888: il=',il 3826 WRITE(*,*) 'dq_tmp,rr(il,1)=',dq_tmp,rr(il,1) 3827 WRITE(*,*) 'R_tmp,dx_tmp,delt=',R_tmp,dx_tmp,delt 3828 WRITE(*,*) 'xt(ixt,il,1:2)=',xt(ixt,il,1:2) 3829 WRITE(*,*) 'rr(il,1:2)=',rr(il,1:2) 3830 WRITE(*,*) 'fxt=',dx_tmp/delt 3831 WRITE(*,*) 'rr(il,1)+dq_tmp=',rr(il,1)+dq_tmp 3832 WRITE(*,*) 'xt(ixt,il,1)+dx_tmp=',xt(ixt,il,1)+dx_tmp 3833 WRITE(*,*) 'xt(ixt,il,1)+fxt(ixt,il,1)*delt=', & 3834 xt(ixt,il,1)+fxt(ixt,il,1)*delt 3835 WRITE(*,*) 'dqreste_tmp,dxreste_tmp=',dqreste_tmp,dxreste_tmp 3836 WRITE(*,*) 'formule classique: fxt_Am=',0.01*grav*am(il)*(xt(ixt,il,2)-xt(ixt,il,1))*work(il) 3837 WRITE(*,*) 'donnerait dxt=',0.01*grav*am(il)*(xt(ixt,il,2)-xt(ixt,il,1))*work(il)*delt 3838 endif !if (ixt.EQ.iso_HDO) THEN 3842 3839 #endif 3843 3840 #ifdef DIAGISO 3844 if (ixt.le.niso) then3841 IF (ixt.le.niso) THEN 3845 3842 fxt_fluxmasse(ixt,il,1)=fxt_fluxmasse(ixt,il,1) & 3846 & + dx_tmp/delt3843 + dx_tmp/delt 3847 3844 endif 3848 3845 #endif 3849 3846 enddo ! do ixt = 1, ntraciso 3850 else !if (dq_tmp/rr(il,1).lt.-0.9) then3847 else !if (dq_tmp/rr(il,1).lt.-0.9) THEN 3851 3848 ! formulation habituelle qui avait toujours marche de 2006 a 3852 3849 ! decembre 2017. 3853 do ixt = 1, ntraciso3850 DO ixt = 1, ntraciso 3854 3851 fxt(ixt,il,1)=fxt(ixt,il,1) & 3855 &+0.01*grav*am(il)*(xt(ixt,il,2)-xt(ixt,il,1))*work(il)3852 +0.01*grav*am(il)*(xt(ixt,il,2)-xt(ixt,il,1))*work(il) 3856 3853 #ifdef DIAGISO 3857 if (ixt.le.niso) then3854 IF (ixt.le.niso) THEN 3858 3855 fxt_fluxmasse(ixt,il,1)=fxt_fluxmasse(ixt,il,1) & 3859 &+0.01*grav*am(il)*(xt(ixt,il,2)-xt(ixt,il,1))*work(il)3856 +0.01*grav*am(il)*(xt(ixt,il,2)-xt(ixt,il,1))*work(il) 3860 3857 endif 3861 3858 #endif 3862 3859 enddo !do ixt = 1, ntraciso 3863 endif !if (dq_tmp/rr(il,1).lt.-0.9) then 3864 3860 endif !if (dq_tmp/rr(il,1).lt.-0.9) THEN 3865 3861 ! cam verif 3866 3862 #ifdef ISOVERIF 3867 if (iso_eau.gt.0) then3868 calliso_verif_egalite_choix(fxt(iso_eau,il,1), &3869 &fr(il,1),'cv30_routines 3251', &3870 &errmax,errmaxrel)3871 endif !if (iso_eau.gt.0) then3872 ! write(*,*) 'il,am(il)=',il,am(il)3873 if ((iso_HDO.gt.0).and. &3874 & (rr(il,1)+delt*fr(il,1).gt.ridicule)) then3875 if(iso_verif_aberrant_enc_nostop((xt(iso_HDO,il,1) &3876 &+delt*fxt(iso_HDO,il,1))/(rr(il,1)+delt*fr(il,1)), &3877 & 'cv30_yield 3125, ddft en 1').eq.1) then3878 write(*,*) 'il,rr(il,1),delt=',il,rr(il,1),delt3879 write(*,*) 'deltaDxt=',deltaD(xt(iso_HDO,il,1)/rr(il,1))3880 write(*,*) 'delt*fr(il,1),fr(il,1)=',delt*fr(il,1),fr(il,1)3881 write(*,*) 'fxt=',fxt(iso_HDO,il,1)3882 write(*,*) 'fq_ddft(il,1)=',0.01*grav*mp(il,2)*(rp(il,2)-rr(il,1))*work(il)3883 write(*,*) 'fq_evapprecip(il,1)=',sigd*0.5*(evap(il,1)+evap(il,2))3884 write(*,*) 'fq_fluxmasse(il,1)=', 0.01*grav*am(il)*(rr(il,2)-rr(il,1))*work(il)3885 write(*,*) 'deltaDfq_ddft=',deltaD((xtp(iso_HDO,il,2)-xt(iso_HDO,il,1))/(rp(il,2)-rr(il,1)))3886 write(*,*) 'deltaDfq_evapprecip=',deltaD((xtevap(iso_HDO,il,1)+xtevap(iso_HDO,il,2))/(evap(il,1)+evap(il,2)))3887 write(*,*) 'deltaDfq_fluxmasse=',deltaD((xt(iso_HDO,il,2)-xt(iso_HDO,il,1))/(rr(il,2)-rr(il,1)))3888 write(*,*) 'rr(il,2),rr(il,1)=',rr(il,2),rr(il,1)3889 write(*,*) 'xt(iso_HDO,il,2),xt(iso_HDO,il,1)',xt(iso_HDO,il,2),xt(iso_HDO,il,1)3890 write(*,*) 'dq_tmp=',dq_tmp3891 callabort_physic('cv30_routines','cv30_yield',1)3863 IF (iso_eau.gt.0) THEN 3864 CALL iso_verif_egalite_choix(fxt(iso_eau,il,1), & 3865 fr(il,1),'cv30_routines 3251', & 3866 errmax,errmaxrel) 3867 endif !if (iso_eau.gt.0) THEN 3868 !WRITE(*,*) 'il,am(il)=',il,am(il) 3869 IF ((iso_HDO.gt.0).AND. & 3870 (rr(il,1)+delt*fr(il,1).gt.ridicule)) THEN 3871 IF (iso_verif_aberrant_enc_nostop((xt(iso_HDO,il,1) & 3872 +delt*fxt(iso_HDO,il,1))/(rr(il,1)+delt*fr(il,1)), & 3873 'cv30_yield 3125, ddft en 1').EQ.1) THEN 3874 WRITE(*,*) 'il,rr(il,1),delt=',il,rr(il,1),delt 3875 WRITE(*,*) 'deltaDxt=',deltaD(xt(iso_HDO,il,1)/rr(il,1)) 3876 WRITE(*,*) 'delt*fr(il,1),fr(il,1)=',delt*fr(il,1),fr(il,1) 3877 WRITE(*,*) 'fxt=',fxt(iso_HDO,il,1) 3878 WRITE(*,*) 'fq_ddft(il,1)=',0.01*grav*mp(il,2)*(rp(il,2)-rr(il,1))*work(il) 3879 WRITE(*,*) 'fq_evapprecip(il,1)=',sigd*0.5*(evap(il,1)+evap(il,2)) 3880 WRITE(*,*) 'fq_fluxmasse(il,1)=', 0.01*grav*am(il)*(rr(il,2)-rr(il,1))*work(il) 3881 WRITE(*,*) 'deltaDfq_ddft=',deltaD((xtp(iso_HDO,il,2)-xt(iso_HDO,il,1))/(rp(il,2)-rr(il,1))) 3882 WRITE(*,*) 'deltaDfq_evapprecip=',deltaD((xtevap(iso_HDO,il,1)+xtevap(iso_HDO,il,2))/(evap(il,1)+evap(il,2))) 3883 WRITE(*,*) 'deltaDfq_fluxmasse=',deltaD((xt(iso_HDO,il,2)-xt(iso_HDO,il,1))/(rr(il,2)-rr(il,1))) 3884 WRITE(*,*) 'rr(il,2),rr(il,1)=',rr(il,2),rr(il,1) 3885 WRITE(*,*) 'xt(iso_HDO,il,2),xt(iso_HDO,il,1)',xt(iso_HDO,il,2),xt(iso_HDO,il,1) 3886 WRITE(*,*) 'dq_tmp=',dq_tmp 3887 CALL abort_physic('cv30_routines','cv30_yield',1) 3892 3888 endif ! iso_verif_aberrant_enc_nostop 3893 endif !if (iso_HDO.gt.0) then3889 endif !if (iso_HDO.gt.0) THEN 3894 3890 #ifdef ISOTRAC 3895 calliso_verif_traceur_justmass(fxt(1,il,1),'cv30_routine 3417')3896 doixt=1,ntraciso3891 CALL iso_verif_traceur_justmass(fxt(1,il,1),'cv30_routine 3417') 3892 DO ixt=1,ntraciso 3897 3893 xtnew(ixt)=xt(ixt,il,1)+delt*fxt(ixt,il,1) 3898 3894 enddo 3899 if(iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 3395',1e-5) &3900 & .eq.1) then3901 write(*,*) 'il=',il3902 write(*,*) 'delt,fxt(:,il,1)=',delt,fxt(:,il,1)3903 write(*,*) 'xt(:,il,1)=' ,xt(:,il,1)3895 IF (iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 3395',1e-5) & 3896 .EQ.1) THEN 3897 WRITE(*,*) 'il=',il 3898 WRITE(*,*) 'delt,fxt(:,il,1)=',delt,fxt(:,il,1) 3899 WRITE(*,*) 'xt(:,il,1)=' ,xt(:,il,1) 3904 3900 #ifdef DIAGISO 3905 write(*,*) 'fxt_fluxmasse(:,il,1)=',fxt_fluxmasse(:,il,1)3906 write(*,*) 'fxt_ddft(:,il,1)=',fxt_ddft(:,il,1)3907 write(*,*) 'fxt_evapprecip(:,il,1)=', &3908 &fxt_evapprecip(:,il,1)3909 write(*,*) 'xt(:,il,2)=',xt(:,il,2)3910 write(*,*) 'xtp(:,il,2)=',xtp(:,il,2)3911 write(*,*) 'xtevap(:,il,1)=',xtevap(:,il,1)3912 write(*,*) 'xtevap(:,il,2)=',xtevap(:,il,2)3913 write(*,*) 'facam,facmp,facev=',0.01*grav*am(il)*work(il), &3914 &0.01*grav*mp(il,2)*work(il),sigd*0.53915 #endif 3901 WRITE(*,*) 'fxt_fluxmasse(:,il,1)=',fxt_fluxmasse(:,il,1) 3902 WRITE(*,*) 'fxt_ddft(:,il,1)=',fxt_ddft(:,il,1) 3903 WRITE(*,*) 'fxt_evapprecip(:,il,1)=', & 3904 fxt_evapprecip(:,il,1) 3905 WRITE(*,*) 'xt(:,il,2)=',xt(:,il,2) 3906 WRITE(*,*) 'xtp(:,il,2)=',xtp(:,il,2) 3907 WRITE(*,*) 'xtevap(:,il,1)=',xtevap(:,il,1) 3908 WRITE(*,*) 'xtevap(:,il,2)=',xtevap(:,il,2) 3909 WRITE(*,*) 'facam,facmp,facev=',0.01*grav*am(il)*work(il), & 3910 0.01*grav*mp(il,2)*work(il),sigd*0.5 3911 #endif 3916 3912 ! stop 3917 3913 endif 3918 #endif 3914 #endif 3919 3915 #endif 3920 3916 ! end cam verif … … 3932 3928 3933 3929 #ifdef ISO 3934 doixt = 1, ntraciso3930 DO ixt = 1, ntraciso 3935 3931 fxt(ixt,il,1)=0.1*mp(il,2)*(xtp(ixt,il,2)-xt(ixt,il,1))*work(il) & 3936 &+sigd*0.5*(xtevap(ixt,il,1)+xtevap(ixt,il,2))3932 +sigd*0.5*(xtevap(ixt,il,1)+xtevap(ixt,il,2)) 3937 3933 fxt(ixt,il,1)=fxt(ixt,il,1) & 3938 &+0.1*am(il)*(xt(ixt,il,2)-xt(ixt,il,1))*work(il)3934 +0.1*am(il)*(xt(ixt,il,2)-xt(ixt,il,1))*work(il) 3939 3935 enddo 3940 3936 3941 3937 #ifdef DIAGISO 3942 3938 fq_ddft(il,1)=fq_ddft(il,1) & 3943 &+0.1*mp(il,2)*(rp(il,2)-rr(il,1))*work(il)3939 +0.1*mp(il,2)*(rp(il,2)-rr(il,1))*work(il) 3944 3940 fq_evapprecip(il,1)=fq_evapprecip(il,1) & 3945 &+sigd*0.5*(evap(il,1)+evap(il,2))3941 +sigd*0.5*(evap(il,1)+evap(il,2)) 3946 3942 fq_fluxmasse(il,1)=fq_fluxmasse(il,1) & 3947 &+0.1*am(il)*(rr(il,2)-rr(il,1))*work(il)3948 doixt = 1, niso3943 +0.1*am(il)*(rr(il,2)-rr(il,1))*work(il) 3944 DO ixt = 1, niso 3949 3945 fxt_fluxmasse(ixt,il,1)=fxt(ixt,il,1) & 3950 &+0.1*am(il)*(xt(ixt,il,2)-xt(ixt,il,1))*work(il)3946 +0.1*am(il)*(xt(ixt,il,2)-xt(ixt,il,1))*work(il) 3951 3947 fxt_ddft(ixt,il,1)=fxt(ixt,il,1) & 3952 &+0.1*mp(il,2)*(xtp(ixt,il,2)-xt(ixt,il,1))*work(il)3948 +0.1*mp(il,2)*(xtp(ixt,il,2)-xt(ixt,il,1))*work(il) 3953 3949 fxt_evapprecip(ixt,il,1)=fxt(ixt,il,1) & 3954 &+sigd*0.5*(xtevap(ixt,il,1)+xtevap(ixt,il,2))3950 +sigd*0.5*(xtevap(ixt,il,1)+xtevap(ixt,il,2)) 3955 3951 enddo 3956 3952 #endif 3957 3958 3953 3954 3959 3955 ! cam verif 3960 #ifdef ISOVERIF 3961 if (iso_eau.gt.0) then3962 calliso_verif_egalite_choix(fxt(iso_eau,il,1), &3963 &fr(il,1),'cv30_routines 3023', &3964 &errmax,errmaxrel)3965 endif !if (iso_eau.gt.0) then3966 if ((iso_HDO.gt.0).and. &3967 & (rr(il,1)+delt*fr(il,1).gt.ridicule)) then3968 calliso_verif_aberrant_encadre((xt(iso_HDO,il,1) &3969 &+delt*fxt(iso_HDO,il,1)) &3970 &/(rr(il,1)+delt*fr(il,1)), &3971 &'cv30_yield 3125b, ddft en 1')3972 endif !if (iso_HDO.gt.0) then3956 #ifdef ISOVERIF 3957 IF (iso_eau.gt.0) THEN 3958 CALL iso_verif_egalite_choix(fxt(iso_eau,il,1), & 3959 fr(il,1),'cv30_routines 3023', & 3960 errmax,errmaxrel) 3961 endif !if (iso_eau.gt.0) THEN 3962 IF ((iso_HDO.gt.0).AND. & 3963 (rr(il,1)+delt*fr(il,1).gt.ridicule)) THEN 3964 CALL iso_verif_aberrant_encadre((xt(iso_HDO,il,1) & 3965 +delt*fxt(iso_HDO,il,1)) & 3966 /(rr(il,1)+delt*fr(il,1)), & 3967 'cv30_yield 3125b, ddft en 1') 3968 endif !if (iso_HDO.gt.0) THEN 3973 3969 #ifdef ISOTRAC 3974 calliso_verif_traceur_justmass(fxt(1,il,1), &3975 &'cv30_routine 3417')3976 doixt=1,ntraciso3970 CALL iso_verif_traceur_justmass(fxt(1,il,1), & 3971 'cv30_routine 3417') 3972 DO ixt=1,ntraciso 3977 3973 xtnew(ixt)=xt(ixt,il,1)+delt*fxt(ixt,il,1) 3978 3974 enddo 3979 if(iso_verif_tracpos_choix_nostop(xtnew, &3980 &'cv30_yield 3449',1e-5) &3981 & .eq.1) then3982 write(*,*) 'il=',il3983 write(*,*) 'delt,fxt(:,il,1)=',delt,fxt(:,il,1)3984 write(*,*) 'xt(:,il,1)=' ,xt(:,il,1)3975 IF (iso_verif_tracpos_choix_nostop(xtnew, & 3976 'cv30_yield 3449',1e-5) & 3977 .EQ.1) THEN 3978 WRITE(*,*) 'il=',il 3979 WRITE(*,*) 'delt,fxt(:,il,1)=',delt,fxt(:,il,1) 3980 WRITE(*,*) 'xt(:,il,1)=' ,xt(:,il,1) 3985 3981 ! stop 3986 3982 endif 3987 #endif 3983 #endif 3988 3984 #endif 3989 3985 ! end cam verif … … 3999 3995 ! do j=1,ntra 4000 3996 ! do il=1,ncum 4001 ! if (cvflag_grav) then3997 ! if (cvflag_grav) THEN 4002 3998 ! ftra(il,1,j)=ftra(il,1,j)+0.01*grav*work(il) 4003 3999 ! : *(mp(il,2)*(trap(il,2,j)-tra(il,1,j)) … … 4007 4003 ! : *(mp(il,2)*(trap(il,2,j)-tra(il,1,j)) 4008 4004 ! : +am(il)*(tra(il,2,j)-tra(il,1,j))) 4009 ! endif4005 ! END IF 4010 4006 ! enddo 4011 4007 ! enddo … … 4023 4019 4024 4020 #ifdef ISO 4025 doixt = 1, ntraciso4021 DO ixt = 1, ntraciso 4026 4022 fxt(ixt,il,1)=fxt(ixt,il,1) & 4027 &+0.01*grav*work(il)*ment(il,j,1)*(xtent(ixt,il,j,1)-xt(ixt,il,1))4023 +0.01*grav*work(il)*ment(il,j,1)*(xtent(ixt,il,j,1)-xt(ixt,il,1)) 4028 4024 enddo 4029 4025 4030 4026 #ifdef DIAGISO 4031 4027 fq_detrainement(il,1)=fq_detrainement(il,1) & 4032 &+0.01*grav*work(il)*ment(il,j,1)*(qent(il,j,1)-rr(il,1))4028 +0.01*grav*work(il)*ment(il,j,1)*(qent(il,j,1)-rr(il,1)) 4033 4029 f_detrainement(il,1)=f_detrainement(il,1) & 4034 &+0.01*grav*work(il)*ment(il,j,1)4030 +0.01*grav*work(il)*ment(il,j,1) 4035 4031 q_detrainement(il,1)=q_detrainement(il,1) & 4036 &+0.01*grav*work(il)*ment(il,j,1)*qent(il,j,1)4037 doixt = 1, niso4032 +0.01*grav*work(il)*ment(il,j,1)*qent(il,j,1) 4033 DO ixt = 1, niso 4038 4034 fxt_detrainement(ixt,il,1)=fxt_detrainement(ixt,il,1) & 4039 &+0.01*grav*work(il)*ment(il,j,1)*(xtent(ixt,il,j,1)-xt(ixt,il,1))4035 +0.01*grav*work(il)*ment(il,j,1)*(xtent(ixt,il,j,1)-xt(ixt,il,1)) 4040 4036 xt_detrainement(ixt,il,1)=xt_detrainement(ixt,il,1) & 4041 &+0.01*grav*work(il)*ment(il,j,1)*xtent(ixt,il,j,1)4037 +0.01*grav*work(il)*ment(il,j,1)*xtent(ixt,il,j,1) 4042 4038 enddo 4043 4039 #endif … … 4045 4041 ! cam verif 4046 4042 #ifdef ISOVERIF 4047 if (iso_eau.gt.0) then4048 calliso_verif_egalite_choix(fxt(iso_eau,il,1), &4049 &fr(il,1),'cv30_routines 3251',errmax,errmaxrel)4050 endif !if (iso_eau.gt.0) then4051 if ((iso_HDO.gt.0).and. &4052 & (rr(il,1)+delt*fr(il,1).gt.ridicule)) then4053 calliso_verif_aberrant_encadre((xt(iso_HDO,il,1) &4054 &+delt*fxt(iso_HDO,il,1))/(rr(il,1)+delt*fr(il,1)), &4055 &'cv30_yield 3127, dtr melanges')4056 endif !if (iso_HDO.gt.0) then4043 IF (iso_eau.gt.0) THEN 4044 CALL iso_verif_egalite_choix(fxt(iso_eau,il,1), & 4045 fr(il,1),'cv30_routines 3251',errmax,errmaxrel) 4046 endif !if (iso_eau.gt.0) THEN 4047 IF ((iso_HDO.gt.0).AND. & 4048 (rr(il,1)+delt*fr(il,1).gt.ridicule)) THEN 4049 CALL iso_verif_aberrant_encadre((xt(iso_HDO,il,1) & 4050 +delt*fxt(iso_HDO,il,1))/(rr(il,1)+delt*fr(il,1)), & 4051 'cv30_yield 3127, dtr melanges') 4052 endif !if (iso_HDO.gt.0) THEN 4057 4053 #ifdef ISOTRAC 4058 calliso_verif_traceur_justmass(fxt(1,il,1),'cv30_routine 3417')4059 doixt=1,ntraciso4054 CALL iso_verif_traceur_justmass(fxt(1,il,1),'cv30_routine 3417') 4055 DO ixt=1,ntraciso 4060 4056 xtnew(ixt)=xt(ixt,il,1)+delt*fxt(ixt,il,1) 4061 4057 enddo 4062 if(iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 3525',1e-5) &4063 & .eq.1) then4064 write(*,*) 'il=',il4065 write(*,*) 'delt,fxt(:,il,1)=',delt,fxt(:,il,1)4066 write(*,*) 'fac=', 0.01*grav*work(il)*ment(il,j,1)4067 write(*,*) 'xt(:,il,1)=' ,xt(:,il,1)4068 write(*,*) 'xtent(:,il,j,1)=' ,xtent(:,il,j,1)4058 IF (iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 3525',1e-5) & 4059 .EQ.1) THEN 4060 WRITE(*,*) 'il=',il 4061 WRITE(*,*) 'delt,fxt(:,il,1)=',delt,fxt(:,il,1) 4062 WRITE(*,*) 'fac=', 0.01*grav*work(il)*ment(il,j,1) 4063 WRITE(*,*) 'xt(:,il,1)=' ,xt(:,il,1) 4064 WRITE(*,*) 'xtent(:,il,j,1)=' ,xtent(:,il,j,1) 4069 4065 ! stop 4070 4066 endif 4071 #endif 4067 #endif 4072 4068 #endif 4073 4069 ! end cam verif … … 4083 4079 4084 4080 #ifdef ISO 4085 doixt = 1, ntraciso4081 DO ixt = 1, ntraciso 4086 4082 fxt(ixt,il,1)=fxt(ixt,il,1) & 4087 &+0.1*work(il)*ment(il,j,1)*(xtent(ixt,il,j,1)-xt(ixt,il,1))4083 +0.1*work(il)*ment(il,j,1)*(xtent(ixt,il,j,1)-xt(ixt,il,1)) 4088 4084 enddo 4089 4085 4090 4086 #ifdef DIAGISO 4091 4087 fq_detrainement(il,1)=fq_detrainement(il,1) & 4092 &+0.1*work(il)*ment(il,j,1)*(qent(il,j,1)-rr(il,1))4088 +0.1*work(il)*ment(il,j,1)*(qent(il,j,1)-rr(il,1)) 4093 4089 f_detrainement(il,1)=f_detrainement(il,1) & 4094 &+0.1*work(il)*ment(il,j,1)4090 +0.1*work(il)*ment(il,j,1) 4095 4091 q_detrainement(il,1)=q_detrainement(il,1) & 4096 &+0.1*work(il)*ment(il,j,1)*qent(il,j,1)4097 doixt = 1, niso4092 +0.1*work(il)*ment(il,j,1)*qent(il,j,1) 4093 DO ixt = 1, niso 4098 4094 fxt_detrainement(ixt,il,1)=fxt_detrainement(ixt,il,1) & 4099 &+0.1*work(il)*ment(il,j,1)*(xtent(ixt,il,j,1)-xt(ixt,il,1))4095 +0.1*work(il)*ment(il,j,1)*(xtent(ixt,il,j,1)-xt(ixt,il,1)) 4100 4096 xt_detrainement(ixt,il,1)=xt_detrainement(ixt,il,1) & 4101 &+0.1*work(il)*ment(il,j,1)*xtent(ixt,il,j,1)4097 +0.1*work(il)*ment(il,j,1)*xtent(ixt,il,j,1) 4102 4098 enddo 4103 4099 #endif … … 4105 4101 ! cam verif 4106 4102 #ifdef ISOVERIF 4107 if (iso_eau.gt.0) then4108 calliso_verif_egalite_choix(fxt(iso_eau,il,1), &4109 &fr(il,1),'cv30_routines 3092',errmax,errmaxrel)4110 endif !if (iso_eau.gt.0) then4111 if ((iso_HDO.gt.0).and. &4112 & (rr(il,1)+delt*fr(il,1).gt.ridicule)) then4113 calliso_verif_aberrant_encadre((xt(iso_HDO,il,1) &4114 &+delt*fxt(iso_HDO,il,1))/(rr(il,1)+delt*fr(il,1)), &4115 &'cv30_yield 3127b, dtr melanges')4116 endif !if (iso_HDO.gt.0) then4103 IF (iso_eau.gt.0) THEN 4104 CALL iso_verif_egalite_choix(fxt(iso_eau,il,1), & 4105 fr(il,1),'cv30_routines 3092',errmax,errmaxrel) 4106 endif !if (iso_eau.gt.0) THEN 4107 IF ((iso_HDO.gt.0).AND. & 4108 (rr(il,1)+delt*fr(il,1).gt.ridicule)) THEN 4109 CALL iso_verif_aberrant_encadre((xt(iso_HDO,il,1) & 4110 +delt*fxt(iso_HDO,il,1))/(rr(il,1)+delt*fr(il,1)), & 4111 'cv30_yield 3127b, dtr melanges') 4112 endif !if (iso_HDO.gt.0) THEN 4117 4113 #ifdef ISOTRAC 4118 calliso_verif_traceur_justmass(fxt(1,il,1),'cv30_routine 3462')4119 doixt=1,ntraciso4114 CALL iso_verif_traceur_justmass(fxt(1,il,1),'cv30_routine 3462') 4115 DO ixt=1,ntraciso 4120 4116 xtnew(ixt)=xt(ixt,il,1)+delt*fxt(ixt,il,1) 4121 4117 enddo 4122 if(iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 3753',1e-5) &4123 & .eq.1) then4124 write(*,*) 'il=',il4118 IF (iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 3753',1e-5) & 4119 .EQ.1) THEN 4120 WRITE(*,*) 'il=',il 4125 4121 endif 4126 #endif 4122 #endif 4127 4123 #endif 4128 4124 ! end cam verif … … 4137 4133 ! do j=2,nl 4138 4134 ! do il=1,ncum 4139 ! if (j.le.inb(il)) then 4140 4141 ! if (cvflag_grav) then 4135 ! if (j.le.inb(il)) THEN 4136 ! if (cvflag_grav) THEN 4142 4137 ! ftra(il,1,k)=ftra(il,1,k)+0.01*grav*work(il)*ment(il,j,1) 4143 4138 ! : *(traent(il,j,1,k)-tra(il,1,k)) … … 4145 4140 ! ftra(il,1,k)=ftra(il,1,k)+0.1*work(il)*ment(il,j,1) 4146 4141 ! : *(traent(il,j,1,k)-tra(il,1,k)) 4147 ! endif4148 4149 ! endif4142 ! END IF 4143 4144 ! END IF 4150 4145 ! enddo 4151 4146 ! enddo … … 4248 4243 #ifdef DIAGISO 4249 4244 fq_fluxmasse(il,i)=fq_fluxmasse(il,i) & 4250 &+0.01*grav*dpinv*(amp1(il)*(rr(il,i+1)-rr(il,i)) &4251 &-ad(il)*(rr(il,i)-rr(il,i-1)))4245 +0.01*grav*dpinv*(amp1(il)*(rr(il,i+1)-rr(il,i)) & 4246 -ad(il)*(rr(il,i)-rr(il,i-1))) 4252 4247 ! modif 2 fev: pour avoir subsidence compensatoire totale, on retranche 4253 4248 ! ad. … … 4260 4255 ! meme temps. 4261 4256 dq_tmp= 0.01*grav*dpinv*(amp1(il)*(rr(il,i+1)-rr(il,i)) & 4262 &-ad(il)*(rr(il,i)-rr(il,i-1)))*delt4257 -ad(il)*(rr(il,i)-rr(il,i-1)))*delt 4263 4258 ! c'est equivalent a dqi= kamp1*qip1+kad*qim1-(kamp1+kad)*qi 4264 if ((dq_tmp/rr(il,i).lt.-0.9).and.correction_excess_aberrant) then4259 IF ((dq_tmp/rr(il,i).lt.-0.9).AND.correction_excess_aberrant) THEN 4265 4260 ! nouvelle formulation 4266 4261 k_tmp=0.01*grav*dpinv*amp1(il)*delt 4267 4262 kad_tmp=0.01*grav*dpinv*ad(il)*delt 4268 doixt = 1, ntraciso4263 DO ixt = 1, ntraciso 4269 4264 R_tmp=(xt(ixt,il,i)+k_tmp*xt(ixt,il,i+1)+kad_tmp*xt(ixt,il,i-1)) & 4270 &/(rr(il,i)+k_tmp*rr(il,i+1)+kad_tmp*rr(il,i-1))4265 /(rr(il,i)+k_tmp*rr(il,i+1)+kad_tmp*rr(il,i-1)) 4271 4266 dx_tmp= R_tmp*( rr(il,i)+ dq_tmp)-xt(ixt,il,i) 4272 4267 fxt(ixt,il,i)= dx_tmp/delt 4273 4268 #ifdef ISOVERIF 4274 if ((ixt.eq.iso_HDO).or.(ixt.eq.iso_eau)) then4275 write(*,*) 'cv30_routines 4367: il,i,ixt=',il,i,ixt4276 write(*,*) 'dq_tmp,rr(il,i)=',dq_tmp,rr(il,i)4277 write(*,*) 'R_tmp,dx_tmp,delt=',R_tmp,dx_tmp,delt4278 write(*,*) 'amp1(il),ad(il)=',amp1(il),ad(il)4279 write(*,*) 'xt(ixt,il,i-1:i+1)=',xt(ixt,il,i-1:i+1)4280 write(*,*) 'rr(il,i-1:i+1)=',rr(il,i-1:i+1)4281 write(*,*) 'fxt=',dx_tmp/delt4282 write(*,*) 'rr(il,i)+dq_tmp=',rr(il,1)+dq_tmp4283 write(*,*) 'xt(ixt,il,i)+dx_tmp=',xt(ixt,il,i)+dx_tmp4284 write(*,*) 'xt(ixt,il,i)+fxt(ixt,il,i)*delt=', &4285 &xt(ixt,il,i)+fxt(ixt,il,i)*delt4286 write(*,*) 'fxt(:,il,i)=',fxt(:,il,i)4287 endif !if (ixt. eq.iso_HDO) then4288 #endif 4289 enddo ! do ixt = 1, ntraciso 4269 IF ((ixt.EQ.iso_HDO).OR.(ixt.EQ.iso_eau)) THEN 4270 WRITE(*,*) 'cv30_routines 4367: il,i,ixt=',il,i,ixt 4271 WRITE(*,*) 'dq_tmp,rr(il,i)=',dq_tmp,rr(il,i) 4272 WRITE(*,*) 'R_tmp,dx_tmp,delt=',R_tmp,dx_tmp,delt 4273 WRITE(*,*) 'amp1(il),ad(il)=',amp1(il),ad(il) 4274 WRITE(*,*) 'xt(ixt,il,i-1:i+1)=',xt(ixt,il,i-1:i+1) 4275 WRITE(*,*) 'rr(il,i-1:i+1)=',rr(il,i-1:i+1) 4276 WRITE(*,*) 'fxt=',dx_tmp/delt 4277 WRITE(*,*) 'rr(il,i)+dq_tmp=',rr(il,1)+dq_tmp 4278 WRITE(*,*) 'xt(ixt,il,i)+dx_tmp=',xt(ixt,il,i)+dx_tmp 4279 WRITE(*,*) 'xt(ixt,il,i)+fxt(ixt,il,i)*delt=', & 4280 xt(ixt,il,i)+fxt(ixt,il,i)*delt 4281 WRITE(*,*) 'fxt(:,il,i)=',fxt(:,il,i) 4282 endif !if (ixt.EQ.iso_HDO) THEN 4283 #endif 4284 enddo ! do ixt = 1, ntraciso 4290 4285 #ifdef DIAGISO 4291 doixt = 1, niso4286 DO ixt = 1, niso 4292 4287 fxt_fluxmasse(ixt,il,i)=fxt(ixt,il,i) 4293 4288 enddo 4294 #endif 4295 else !if (dq_tmp/rr(il,i).lt.-0.9) then4289 #endif 4290 else !if (dq_tmp/rr(il,i).lt.-0.9) THEN 4296 4291 ! ancienne formulation 4297 doixt = 1, ntraciso4292 DO ixt = 1, ntraciso 4298 4293 fxt(ixt,il,i)= & 4299 &0.01*grav*dpinv*(amp1(il)*(xt(ixt,il,i+1)-xt(ixt,il,i)) &4300 &-ad(il)*(xt(ixt,il,i)-xt(ixt,il,i-1)))4294 0.01*grav*dpinv*(amp1(il)*(xt(ixt,il,i+1)-xt(ixt,il,i)) & 4295 -ad(il)*(xt(ixt,il,i)-xt(ixt,il,i-1))) 4301 4296 enddo 4302 4297 #ifdef DIAGISO 4303 doixt = 1, niso4298 DO ixt = 1, niso 4304 4299 fxt_fluxmasse(ixt,il,i)=fxt_fluxmasse(ixt,il,i)+ & 4305 &0.01*grav*dpinv*(amp1(il)*(xt(ixt,il,i+1)-xt(ixt,il,i)) &4306 &-ad(il)*(xt(ixt,il,i)-xt(ixt,il,i-1)))4300 0.01*grav*dpinv*(amp1(il)*(xt(ixt,il,i+1)-xt(ixt,il,i)) & 4301 -ad(il)*(xt(ixt,il,i)-xt(ixt,il,i-1))) 4307 4302 enddo 4308 #endif 4309 endif !if (dq_tmp/rr(il,i).lt.-0.9) then 4310 4311 4303 #endif 4304 endif !if (dq_tmp/rr(il,i).lt.-0.9) THEN 4312 4305 ! cam verif 4313 4306 #ifdef ISOVERIF 4314 if (iso_eau.gt.0) then4315 calliso_verif_egalite_choix(fxt(iso_eau,il,i), &4316 &fr(il,i),'cv30_routines 3226',errmax,errmaxrel)4317 endif !if (iso_eau.gt.0) then4318 doixt=1,niso4319 calliso_verif_noNAN(fxt(ixt,il,i),'cv30_routines 3229')4307 IF (iso_eau.gt.0) THEN 4308 CALL iso_verif_egalite_choix(fxt(iso_eau,il,i), & 4309 fr(il,i),'cv30_routines 3226',errmax,errmaxrel) 4310 endif !if (iso_eau.gt.0) THEN 4311 DO ixt=1,niso 4312 CALL iso_verif_noNAN(fxt(ixt,il,i),'cv30_routines 3229') 4320 4313 enddo 4321 if ((iso_HDO.gt.0).and. &4322 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then4323 calliso_verif_aberrant_encadre((xt(iso_HDO,il,i) &4324 &+delt*fxt(iso_HDO,il,i)) &4325 &/(rr(il,i)+delt*fr(il,i)), &4326 &'cv30_yield 3384, flux masse')4327 endif !if (iso_HDO.gt.0) then4328 if ((iso_HDO.gt.0).and.(iso_O18.gt.0).and. &4329 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then4330 calliso_verif_O18_aberrant( &4331 &(xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), &4332 &(xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i))/(rr(il,i)+delt*fr(il,i)), &4333 &'cv30_yield 3384,O18, flux masse')4334 endif !if (iso_HDO.gt.0) then4314 IF ((iso_HDO.gt.0).AND. & 4315 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 4316 CALL iso_verif_aberrant_encadre((xt(iso_HDO,il,i) & 4317 +delt*fxt(iso_HDO,il,i)) & 4318 /(rr(il,i)+delt*fr(il,i)), & 4319 'cv30_yield 3384, flux masse') 4320 endif !if (iso_HDO.gt.0) THEN 4321 IF ((iso_HDO.gt.0).AND.(iso_O18.gt.0).AND. & 4322 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 4323 CALL iso_verif_O18_aberrant( & 4324 (xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), & 4325 (xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i))/(rr(il,i)+delt*fr(il,i)), & 4326 'cv30_yield 3384,O18, flux masse') 4327 endif !if (iso_HDO.gt.0) THEN 4335 4328 #ifdef ISOTRAC 4336 calliso_verif_traceur_justmass(fxt(1,il,1),'cv30_routine 3626')4337 doixt=1,ntraciso4329 CALL iso_verif_traceur_justmass(fxt(1,il,1),'cv30_routine 3626') 4330 DO ixt=1,ntraciso 4338 4331 xtnew(ixt)=xt(ixt,il,i)+delt*fxt(ixt,il,i) 4339 4332 enddo 4340 if(iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 3727',1e-5) &4341 & .eq.1) then4342 write(*,*) 'il,i=',il,i4343 write(*,*) 'fxt(:,il,i)=',fxt(:,il,i)4344 write(*,*) 'amp1(il),ad(il),fac=', &4345 &1(il),ad(il),0.01*grav*dpinv4346 write(*,*) 'xt(:,il,i+1)=' ,xt(:,il,i+1)4347 write(*,*) 'xt(:,il,i)=' ,xt(:,il,i)4348 write(*,*) 'xt(:,il,i-1)=' ,xt(:,il,i-1)4333 IF (iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 3727',1e-5) & 4334 .EQ.1) THEN 4335 WRITE(*,*) 'il,i=',il,i 4336 WRITE(*,*) 'fxt(:,il,i)=',fxt(:,il,i) 4337 WRITE(*,*) 'amp1(il),ad(il),fac=', & 4338 amp1(il),ad(il),0.01*grav*dpinv 4339 WRITE(*,*) 'xt(:,il,i+1)=' ,xt(:,il,i+1) 4340 WRITE(*,*) 'xt(:,il,i)=' ,xt(:,il,i) 4341 WRITE(*,*) 'xt(:,il,i-1)=' ,xt(:,il,i-1) 4349 4342 ! stop 4350 4343 endif 4351 #endif 4352 #endif 4353 ! end cam verif 4344 #endif 4345 #endif 4346 ! end cam verif 4354 4347 #endif 4355 4348 ELSE ! cvflag_grav … … 4362 4355 4363 4356 #ifdef ISO 4364 doixt = 1, ntraciso4357 DO ixt = 1, ntraciso 4365 4358 fxt(ixt,il,i)= & 4366 &0.1*dpinv*(amp1(il)*(xt(ixt,il,i+1)-xt(ixt,il,i)) &4367 &-ad(il)*(xt(ixt,il,i)-xt(ixt,il,i-1)))4359 0.1*dpinv*(amp1(il)*(xt(ixt,il,i+1)-xt(ixt,il,i)) & 4360 -ad(il)*(xt(ixt,il,i)-xt(ixt,il,i-1))) 4368 4361 enddo 4369 4362 4370 4363 #ifdef DIAGISO 4371 4364 fq_fluxmasse(il,i)=fq_fluxmasse(il,i) & 4372 &+0.1*dpinv*(amp1(il)*(rr(il,i+1)-rr(il,i)) &4373 &-ad(il)*(rr(il,i)-rr(il,i-1)))4374 doixt = 1, niso4365 +0.1*dpinv*(amp1(il)*(rr(il,i+1)-rr(il,i)) & 4366 -ad(il)*(rr(il,i)-rr(il,i-1))) 4367 DO ixt = 1, niso 4375 4368 fxt_fluxmasse(ixt,il,i)=fxt_fluxmasse(ixt,il,i)+ & 4376 &0.1*dpinv*(amp1(il)*(xt(ixt,il,i+1)-xt(ixt,il,i)) &4377 &-ad(il)*(xt(ixt,il,i)-xt(ixt,il,i-1)))4369 0.1*dpinv*(amp1(il)*(xt(ixt,il,i+1)-xt(ixt,il,i)) & 4370 -ad(il)*(xt(ixt,il,i)-xt(ixt,il,i-1))) 4378 4371 enddo 4379 #endif 4372 #endif 4380 4373 4381 4374 ! cam verif 4382 4375 #ifdef ISOVERIF 4383 if (iso_eau.gt.0) then4384 calliso_verif_egalite_choix(fxt(iso_eau,il,i), &4385 &fr(il,i),'cv30_routines 3252',errmax,errmaxrel)4386 endif !if (iso_eau.gt.0) then4387 doixt=1,niso4388 calliso_verif_noNAN(fxt(ixt,il,i),'cv30_routines 3229')4376 IF (iso_eau.gt.0) THEN 4377 CALL iso_verif_egalite_choix(fxt(iso_eau,il,i), & 4378 fr(il,i),'cv30_routines 3252',errmax,errmaxrel) 4379 endif !if (iso_eau.gt.0) THEN 4380 DO ixt=1,niso 4381 CALL iso_verif_noNAN(fxt(ixt,il,i),'cv30_routines 3229') 4389 4382 enddo 4390 4383 ! correction 21 oct 2008 4391 if ((iso_HDO.gt.0).and. &4392 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then4393 calliso_verif_aberrant_encadre((xt(iso_HDO,il,i) &4394 &+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), &4395 &'cv30_yield 3384b flux masse')4396 if (iso_O18.gt.0) then4397 calliso_verif_O18_aberrant( &4398 &(xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i)) &4399 &/(rr(il,i)+delt*fr(il,i)), &4400 &(xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i)) &4401 &/(rr(il,i)+delt*fr(il,i)), &4402 &'cv30_yield 3384bO18 flux masse')4403 endif !if (iso_O18.gt.0) then4404 endif !if (iso_HDO.gt.0) then4384 IF ((iso_HDO.gt.0).AND. & 4385 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 4386 CALL iso_verif_aberrant_encadre((xt(iso_HDO,il,i) & 4387 +delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), & 4388 'cv30_yield 3384b flux masse') 4389 IF (iso_O18.gt.0) THEN 4390 CALL iso_verif_O18_aberrant( & 4391 (xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i)) & 4392 /(rr(il,i)+delt*fr(il,i)), & 4393 (xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i)) & 4394 /(rr(il,i)+delt*fr(il,i)), & 4395 'cv30_yield 3384bO18 flux masse') 4396 endif !if (iso_O18.gt.0) THEN 4397 endif !if (iso_HDO.gt.0) THEN 4405 4398 #ifdef ISOTRAC 4406 calliso_verif_traceur_justmass(fxt(1,il,1),'cv30_routine 3674')4407 doixt=1,ntraciso4399 CALL iso_verif_traceur_justmass(fxt(1,il,1),'cv30_routine 3674') 4400 DO ixt=1,ntraciso 4408 4401 xtnew(ixt)=xt(ixt,il,i)+delt*fxt(ixt,il,i) 4409 4402 enddo 4410 if(iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 3775',1e-5) &4411 & .eq.1) then4412 write(*,*) 'il,i=',il,i4403 IF (iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 3775',1e-5) & 4404 .EQ.1) THEN 4405 WRITE(*,*) 'il,i=',il,i 4413 4406 endif 4414 #endif 4415 #endif 4416 ! end cam verif 4407 #endif 4408 #endif 4409 ! end cam verif 4417 4410 #endif 4418 4411 END IF ! cvflag_grav … … 4423 4416 ! do k=1,ntra 4424 4417 ! do il=1,ncum 4425 ! if (i.le.inb(il)) then4418 ! if (i.le.inb(il)) THEN 4426 4419 ! dpinv=1.0/(ph(il,i)-ph(il,i+1)) 4427 4420 ! cpinv=1.0/cpn(il,i) 4428 ! if (cvflag_grav) then4421 ! if (cvflag_grav) THEN 4429 4422 ! ftra(il,i,k)=ftra(il,i,k)+0.01*grav*dpinv 4430 4423 ! : *(amp1(il)*(tra(il,i+1,k)-tra(il,i,k)) … … 4434 4427 ! : *(amp1(il)*(tra(il,i+1,k)-tra(il,i,k)) 4435 4428 ! : -ad(il)*(tra(il,i,k)-tra(il,i-1,k))) 4436 ! endif4437 ! endif4429 ! END IF 4430 ! END IF 4438 4431 ! enddo 4439 4432 ! enddo … … 4458 4451 ! ce surplus a la meme compo que le elij, sans fractionnement. 4459 4452 ! d'ou le nouveau traitement ci-dessous. 4460 if (elij(il,k,i).gt.0.0) then4461 doixt = 1, ntraciso4453 IF (elij(il,k,i).gt.0.0) THEN 4454 DO ixt = 1, ntraciso 4462 4455 xtawat(ixt)=awat*(xtelij(ixt,il,k,i)/elij(il,k,i)) 4463 4456 ! xtawat(ixt)=amax1(xtawat(ixt),0.0) ! pas necessaire 4464 4457 enddo 4465 else !if (elij(il,k,i).gt.0.0) then4458 else !if (elij(il,k,i).gt.0.0) THEN 4466 4459 ! normalement, si elij(il,k,i)<=0, alors awat=0 4467 4460 ! on le verifie. Si c'est vrai -> xtawat=0 aussi 4468 4461 #ifdef ISOVERIF 4469 calliso_verif_egalite(awat,0.0,'cv30_yield 3779')4470 #endif 4471 doixt = 1, ntraciso4462 CALL iso_verif_egalite(awat,0.0,'cv30_yield 3779') 4463 #endif 4464 DO ixt = 1, ntraciso 4472 4465 xtawat(ixt)=0.0 4473 enddo 4466 enddo 4474 4467 endif 4475 4468 4476 4469 ! cam verif 4477 4470 #ifdef ISOVERIF 4478 if (iso_eau.gt.0) then4479 calliso_verif_egalite_choix(xtawat(iso_eau), &4480 &awat,'cv30_routines 3301',errmax,errmaxrel)4481 endif !if (iso_eau.gt.0) then4471 IF (iso_eau.gt.0) THEN 4472 CALL iso_verif_egalite_choix(xtawat(iso_eau), & 4473 awat,'cv30_routines 3301',errmax,errmaxrel) 4474 endif !if (iso_eau.gt.0) THEN 4482 4475 #ifdef ISOTRAC 4483 calliso_verif_traceur_justmass(xtawat(1),'cv30_routine 3729')4484 #endif 4485 #endif 4486 ! end cam verif 4476 CALL iso_verif_traceur_justmass(xtawat(1),'cv30_routine 3729') 4477 #endif 4478 #endif 4479 ! end cam verif 4487 4480 #endif 4488 4481 … … 4496 4489 4497 4490 #ifdef ISO 4498 doixt = 1, ntraciso4491 DO ixt = 1, ntraciso 4499 4492 fxt(ixt,il,i)=fxt(ixt,il,i) & 4500 &+0.01*grav*dpinv*ment(il,k,i) &4501 & *(xtent(ixt,il,k,i)-xtawat(ixt)-xt(ixt,il,i))4493 +0.01*grav*dpinv*ment(il,k,i) & 4494 *(xtent(ixt,il,k,i)-xtawat(ixt)-xt(ixt,il,i)) 4502 4495 enddo 4503 4496 4504 4497 #ifdef DIAGISO 4505 4498 fq_detrainement(il,i)=fq_detrainement(il,i) & 4506 &+0.01*grav*dpinv*ment(il,k,i) &4507 &*(qent(il,k,i)-awat-rr(il,i))4508 f_detrainement(il,i)=f_detrainement(il,i)& 4509 &+0.01*grav*dpinv*ment(il,k,i)4499 +0.01*grav*dpinv*ment(il,k,i) & 4500 *(qent(il,k,i)-awat-rr(il,i)) 4501 f_detrainement(il,i)=f_detrainement(il,i)& 4502 +0.01*grav*dpinv*ment(il,k,i) 4510 4503 q_detrainement(il,i)=q_detrainement(il,i) & 4511 &+0.01*grav*dpinv*ment(il,k,i)*qent(il,k,i)4512 doixt = 1, niso4504 +0.01*grav*dpinv*ment(il,k,i)*qent(il,k,i) 4505 DO ixt = 1, niso 4513 4506 fxt_detrainement(ixt,il,i)=fxt_detrainement(ixt,il,i) & 4514 &+0.01*grav*dpinv*ment(il,k,i) &4515 &*(xtent(ixt,il,k,i)-xtawat(ixt)-xt(ixt,il,i))4507 +0.01*grav*dpinv*ment(il,k,i) & 4508 *(xtent(ixt,il,k,i)-xtawat(ixt)-xt(ixt,il,i)) 4516 4509 xt_detrainement(ixt,il,i)=xt_detrainement(ixt,il,i) & 4517 &+0.01*grav*dpinv*ment(il,k,i)*xtent(ixt,il,k,i)4510 +0.01*grav*dpinv*ment(il,k,i)*xtent(ixt,il,k,i) 4518 4511 enddo 4519 #endif 4512 #endif 4520 4513 ! cam verif 4521 4514 #ifdef ISOVERIF 4522 if (iso_eau.gt.0) then4523 calliso_verif_egalite_choix(fxt(iso_eau,il,i), &4524 &fr(il,i),'cv30_routines 3325',errmax,errmaxrel)4525 endif !if (iso_eau.gt.0) then4526 doixt=1,niso4527 calliso_verif_noNAN(fxt(ixt,il,i),'cv30_routines 3328')4515 IF (iso_eau.gt.0) THEN 4516 CALL iso_verif_egalite_choix(fxt(iso_eau,il,i), & 4517 fr(il,i),'cv30_routines 3325',errmax,errmaxrel) 4518 endif !if (iso_eau.gt.0) THEN 4519 DO ixt=1,niso 4520 CALL iso_verif_noNAN(fxt(ixt,il,i),'cv30_routines 3328') 4528 4521 enddo 4529 if ((iso_HDO.gt.0).and. &4530 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then4531 if(iso_verif_aberrant_enc_nostop((xt(iso_HDO,il,i) &4532 &+delt*fxt(iso_HDO,il,i)) &4533 &/(rr(il,i)+delt*fr(il,i)),'cv30_yield 3396a, dtr mels') &4534 & .eq.1) then4535 write(*,*) 'il,k,i=',il,k,i4536 write(*,*) 'rr,delt,fr=',rr(il,i),delt,fr(il,i)4537 write(*,*) 'frnew=',0.01*grav*dpinv*ment(il, k, i)*(qent(il,k,i)-awat-rr(il,i))4538 write(*,*) 'frold=',fr(il,i)-0.01*grav*dpinv*ment(il, k, i)*(qent(il,k,i)-awat-rr(il,i))4539 write(*,*) 'deltaDfrnew=',deltaD((xtent(iso_HDO,il,k,i)-xtawat(iso_HDO)-xt(iso_HDO,il,i)) &4522 IF ((iso_HDO.gt.0).AND. & 4523 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 4524 IF (iso_verif_aberrant_enc_nostop((xt(iso_HDO,il,i) & 4525 +delt*fxt(iso_HDO,il,i)) & 4526 /(rr(il,i)+delt*fr(il,i)),'cv30_yield 3396a, dtr mels') & 4527 .EQ.1) THEN 4528 WRITE(*,*) 'il,k,i=',il,k,i 4529 WRITE(*,*) 'rr,delt,fr=',rr(il,i),delt,fr(il,i) 4530 WRITE(*,*) 'frnew=',0.01*grav*dpinv*ment(il, k, i)*(qent(il,k,i)-awat-rr(il,i)) 4531 WRITE(*,*) 'frold=',fr(il,i)-0.01*grav*dpinv*ment(il, k, i)*(qent(il,k,i)-awat-rr(il,i)) 4532 WRITE(*,*) 'deltaDfrnew=',deltaD((xtent(iso_HDO,il,k,i)-xtawat(iso_HDO)-xt(iso_HDO,il,i)) & 4540 4533 /(qent(il,k,i)-awat-rr(il,i))) 4541 write(*,*) 'deltaDfrold=',deltaD((fxt(iso_HDO,il,i) &4534 WRITE(*,*) 'deltaDfrold=',deltaD((fxt(iso_HDO,il,i) & 4542 4535 -0.01*grav*dpinv*ment(il, k, i)*(xtent(iso_HDO,il,k,i)-xtawat(iso_HDO)-xt(iso_HDO,il,i))) & 4543 4536 /(fr(il,i)-0.01*grav*dpinv*ment(il, k, i)*(qent(il,k,i)-awat-rr(il,i)))) 4544 write(*,*) 'q+=',rr(il,i)+delt*fr(il,i)4545 write(*,*) 'qent,awat=',qent(il,k,i),awat4546 write(*,*) 'elij,clw,ep=',elij(il,k,i),clw(il,i),ep(il,i)4547 write(*,*) 'deltaDfr=',deltaD(fxt(iso_hdo,il,i)/fr(il,i))4548 write(*,*) 'deltaDrr=',deltaD(xt(iso_hdo,il,i)/rr(il,i))4549 write(*,*) 'deltaDqent=',deltaD(xtent(iso_hdo,il,k,i) &4550 &/qent(il,k,i))4551 write(*,*) 'deltaDqent-awat=',deltaD((xtent(iso_hdo,il,k,i)-xtawat(iso_HDO)) &4552 &/(qent(il,k,i)-awat))4553 write(*,*) 'deltaDawat=',deltaD(xtawat(iso_hdo)/awat)4554 write(*,*) 'deltaDclw=',deltaD(xtclw(iso_hdo,il,i)/clw(il,i))4537 WRITE(*,*) 'q+=',rr(il,i)+delt*fr(il,i) 4538 WRITE(*,*) 'qent,awat=',qent(il,k,i),awat 4539 WRITE(*,*) 'elij,clw,ep=',elij(il,k,i),clw(il,i),ep(il,i) 4540 WRITE(*,*) 'deltaDfr=',deltaD(fxt(iso_hdo,il,i)/fr(il,i)) 4541 WRITE(*,*) 'deltaDrr=',deltaD(xt(iso_hdo,il,i)/rr(il,i)) 4542 WRITE(*,*) 'deltaDqent=',deltaD(xtent(iso_hdo,il,k,i) & 4543 /qent(il,k,i)) 4544 WRITE(*,*) 'deltaDqent-awat=',deltaD((xtent(iso_hdo,il,k,i)-xtawat(iso_HDO)) & 4545 /(qent(il,k,i)-awat)) 4546 WRITE(*,*) 'deltaDawat=',deltaD(xtawat(iso_hdo)/awat) 4547 WRITE(*,*) 'deltaDclw=',deltaD(xtclw(iso_hdo,il,i)/clw(il,i)) 4555 4548 ! stop 4556 4549 endif 4557 if (iso_O18.gt.0) then4558 calliso_verif_O18_aberrant( &4559 &(xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i)) &4560 &/(rr(il,i)+delt*fr(il,i)), &4561 &(xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i)) &4562 &/(rr(il,i)+delt*fr(il,i)), &4563 &'cv30_yield 3396aO18, dtr mels')4564 endif !if (iso_O18.gt.0) then4565 endif !if (iso_HDO.gt.0) then4550 IF (iso_O18.gt.0) THEN 4551 CALL iso_verif_O18_aberrant( & 4552 (xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i)) & 4553 /(rr(il,i)+delt*fr(il,i)), & 4554 (xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i)) & 4555 /(rr(il,i)+delt*fr(il,i)), & 4556 'cv30_yield 3396aO18, dtr mels') 4557 endif !if (iso_O18.gt.0) THEN 4558 endif !if (iso_HDO.gt.0) THEN 4566 4559 #ifdef ISOTRAC 4567 calliso_verif_traceur_justmass(fxt(1,il,i),'cv30_routine 3784')4568 doixt=1,ntraciso4560 CALL iso_verif_traceur_justmass(fxt(1,il,i),'cv30_routine 3784') 4561 DO ixt=1,ntraciso 4569 4562 xtnew(ixt)=xt(ixt,il,i)+delt*fxt(ixt,il,i) 4570 4563 enddo 4571 if(iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 3905',1e-5) &4572 & .eq.1) then4573 write(*,*) 'il,i=',il,i4564 IF (iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 3905',1e-5) & 4565 .EQ.1) THEN 4566 WRITE(*,*) 'il,i=',il,i 4574 4567 endif 4575 ! calliso_verif_tracpos_choix(xtnew,'cv30_yield 3905',1e-5)4576 #endif 4568 ! CALL iso_verif_tracpos_choix(xtnew,'cv30_yield 3905',1e-5) 4569 #endif 4577 4570 #endif 4578 4571 #endif … … 4586 4579 4587 4580 #ifdef ISO 4588 doixt = 1, ntraciso4581 DO ixt = 1, ntraciso 4589 4582 fxt(ixt,il,i)=fxt(ixt,il,i) & 4590 &+0.1*dpinv*ment(il,k,i) &4591 &*(xtent(ixt,il,k,i)-xtawat(ixt)-xt(ixt,il,i))4583 +0.1*dpinv*ment(il,k,i) & 4584 *(xtent(ixt,il,k,i)-xtawat(ixt)-xt(ixt,il,i)) 4592 4585 enddo 4593 4586 4594 4587 #ifdef DIAGISO 4595 4588 fq_detrainement(il,i)=fq_detrainement(il,i) & 4596 &+0.1*dpinv*ment(il,k,i)*(qent(il,k,i)-awat-rr(il,i))4589 +0.1*dpinv*ment(il,k,i)*(qent(il,k,i)-awat-rr(il,i)) 4597 4590 f_detrainement(il,i)=f_detrainement(il,i) & 4598 &+0.1*dpinv*ment(il,k,i)4591 +0.1*dpinv*ment(il,k,i) 4599 4592 q_detrainement(il,i)=q_detrainement(il,i) & 4600 &+0.1*dpinv*ment(il,k,i)*qent(il,k,i)4601 doixt = 1, niso4593 +0.1*dpinv*ment(il,k,i)*qent(il,k,i) 4594 DO ixt = 1, niso 4602 4595 fxt_detrainement(ixt,il,i)=fxt_detrainement(ixt,il,i) & 4603 &+0.1*dpinv*ment(il,k,i) &4604 &*(xtent(ixt,il,k,i)-xtawat(ixt)-xt(ixt,il,i))4596 +0.1*dpinv*ment(il,k,i) & 4597 *(xtent(ixt,il,k,i)-xtawat(ixt)-xt(ixt,il,i)) 4605 4598 xt_detrainement(ixt,il,i)=xt_detrainement(ixt,il,i) & 4606 &+0.1*dpinv*ment(il,k,i)*xtent(ixt,il,k,i)4599 +0.1*dpinv*ment(il,k,i)*xtent(ixt,il,k,i) 4607 4600 enddo 4608 #endif 4601 #endif 4609 4602 4610 4603 ! cam verif 4611 4604 #ifdef ISOVERIF 4612 if (iso_eau.gt.0) then4613 calliso_verif_egalite_choix(fxt(iso_eau,il,i), &4614 &fr(il,i),'cv30_routines 3350',errmax,errmaxrel)4615 endif !if (iso_eau.gt.0) then4616 doixt=1,niso4617 calliso_verif_noNAN(fxt(ixt,il,i),'cv30_routines 3353')4605 IF (iso_eau.gt.0) THEN 4606 CALL iso_verif_egalite_choix(fxt(iso_eau,il,i), & 4607 fr(il,i),'cv30_routines 3350',errmax,errmaxrel) 4608 endif !if (iso_eau.gt.0) THEN 4609 DO ixt=1,niso 4610 CALL iso_verif_noNAN(fxt(ixt,il,i),'cv30_routines 3353') 4618 4611 enddo 4619 if ((iso_HDO.gt.0).and. &4620 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then4621 calliso_verif_aberrant_encadre((xt(iso_HDO,il,i) &4622 &+delt*fxt(iso_HDO,il,i)) &4623 &/(rr(il,i)+delt*fr(il,i)),'cv30_yield 3396b, dtr mels')4624 endif !if (iso_HDO.gt.0) then4625 if ((iso_HDO.gt.0).and.(iso_O18.gt.0).and. &4626 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then4627 calliso_verif_O18_aberrant( &4628 &(xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), &4629 &(xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i))/(rr(il,i)+delt*fr(il,i)), &4630 &'cv30_yield 3396b,O18, dtr mels')4631 endif !if (iso_HDO.gt.0) then4612 IF ((iso_HDO.gt.0).AND. & 4613 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 4614 CALL iso_verif_aberrant_encadre((xt(iso_HDO,il,i) & 4615 +delt*fxt(iso_HDO,il,i)) & 4616 /(rr(il,i)+delt*fr(il,i)),'cv30_yield 3396b, dtr mels') 4617 endif !if (iso_HDO.gt.0) THEN 4618 IF ((iso_HDO.gt.0).AND.(iso_O18.gt.0).AND. & 4619 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 4620 CALL iso_verif_O18_aberrant( & 4621 (xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), & 4622 (xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i))/(rr(il,i)+delt*fr(il,i)), & 4623 'cv30_yield 3396b,O18, dtr mels') 4624 endif !if (iso_HDO.gt.0) THEN 4632 4625 #ifdef ISOTRAC 4633 calliso_verif_traceur_justmass(fxt(1,il,i),'cv30_routine 3828')4634 doixt=1,ntraciso4626 CALL iso_verif_traceur_justmass(fxt(1,il,i),'cv30_routine 3828') 4627 DO ixt=1,ntraciso 4635 4628 xtnew(ixt)=xt(ixt,il,i)+delt*fxt(ixt,il,i) 4636 4629 enddo 4637 if(iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 3949',1e-5) &4638 & .eq.1) then4639 write(*,*) 'il,i=',il,i4630 IF (iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 3949',1e-5) & 4631 .EQ.1) THEN 4632 WRITE(*,*) 'il,i=',il,i 4640 4633 endif 4641 ! calliso_verif_tracpos_choix(xtnew,'cv30_yield 3949',1e-5)4642 #endif 4643 #endif 4644 ! end cam verif 4634 ! CALL iso_verif_tracpos_choix(xtnew,'cv30_yield 3949',1e-5) 4635 #endif 4636 #endif 4637 ! end cam verif 4645 4638 #endif 4646 4639 … … 4657 4650 ! do k=1,i-1 4658 4651 ! do il=1,ncum 4659 ! if (i.le.inb(il)) then4652 ! if (i.le.inb(il)) THEN 4660 4653 ! dpinv=1.0/(ph(il,i)-ph(il,i+1)) 4661 4654 ! cpinv=1.0/cpn(il,i) 4662 ! if (cvflag_grav) then4655 ! if (cvflag_grav) THEN 4663 4656 ! ftra(il,i,j)=ftra(il,i,j)+0.01*grav*dpinv*ment(il,k,i) 4664 4657 ! : *(traent(il,k,i,j)-tra(il,i,j)) … … 4666 4659 ! ftra(il,i,j)=ftra(il,i,j)+0.1*dpinv*ment(il,k,i) 4667 4660 ! : *(traent(il,k,i,j)-tra(il,i,j)) 4668 ! endif4669 ! endif4661 ! END IF 4662 ! END IF 4670 4663 ! enddo 4671 4664 ! enddo … … 4686 4679 ,i)-v(il,i)) 4687 4680 #ifdef ISO 4688 doixt = 1, ntraciso4681 DO ixt = 1, ntraciso 4689 4682 fxt(ixt,il,i)=fxt(ixt,il,i) & 4690 &+0.01*grav*dpinv*ment(il,k,i)*(xtent(ixt,il,k,i)-xt(ixt,il,i))4683 +0.01*grav*dpinv*ment(il,k,i)*(xtent(ixt,il,k,i)-xt(ixt,il,i)) 4691 4684 enddo 4692 4685 4693 4686 #ifdef DIAGISO 4694 4687 fq_detrainement(il,i)=fq_detrainement(il,i) & 4695 & +0.01*grav*dpinv*ment(il,k,i)*(qent(il,k,i)-rr(il,i))4688 +0.01*grav*dpinv*ment(il,k,i)*(qent(il,k,i)-rr(il,i)) 4696 4689 f_detrainement(il,i)=f_detrainement(il,i) & 4697 &+0.01*grav*dpinv*ment(il,k,i)4690 +0.01*grav*dpinv*ment(il,k,i) 4698 4691 q_detrainement(il,i)=q_detrainement(il,i) & 4699 &+0.01*grav*dpinv*ment(il,k,i)*qent(il,k,i)4700 doixt = 1, niso4692 +0.01*grav*dpinv*ment(il,k,i)*qent(il,k,i) 4693 DO ixt = 1, niso 4701 4694 fxt_detrainement(ixt,il,i)=fxt_detrainement(ixt,il,i) & 4702 &+0.01*grav*dpinv*ment(il,k,i)*(xtent(ixt,il,k,i)-xt(ixt,il,i))4695 +0.01*grav*dpinv*ment(il,k,i)*(xtent(ixt,il,k,i)-xt(ixt,il,i)) 4703 4696 xt_detrainement(ixt,il,i)=xt_detrainement(ixt,il,i) & 4704 &+0.01*grav*dpinv*ment(il,k,i)*xtent(ixt,il,k,i)4697 +0.01*grav*dpinv*ment(il,k,i)*xtent(ixt,il,k,i) 4705 4698 enddo 4706 #endif 4707 4699 #endif 4700 4708 4701 ! cam verif 4709 4702 #ifdef ISOVERIF 4710 if ((il.eq.1636).and.(i.eq.9)) then4711 write(*,*) 'cv30 4785: on ajoute le dtr ici:'4712 write(*,*) 'M=',0.01*grav*dpinv*ment(il, k, i)4713 write(*,*) 'q,qe=',rr(il,i),qent(il,k,i)4703 IF ((il.EQ.1636).AND.(i.EQ.9)) THEN 4704 WRITE(*,*) 'cv30 4785: on ajoute le dtr ici:' 4705 WRITE(*,*) 'M=',0.01*grav*dpinv*ment(il, k, i) 4706 WRITE(*,*) 'q,qe=',rr(il,i),qent(il,k,i) 4714 4707 bx=0.01*grav*dpinv*ment(il,k,i)*(qent(il,k,i)-rr(il,i)) 4715 doixt=1,niso4708 DO ixt=1,niso 4716 4709 xtbx(ixt)=0.01*grav*dpinv*ment(il,k,i)*(xtent(ixt,il,k,i)-xt(ixt,il,i)) 4717 4710 enddo 4718 4711 endif 4719 do ixt=1,niso 4720 call iso_verif_noNaN(fxt(ixt,il,i),'cv30_yield 4351') 4721 enddo 4722 #endif 4723 #ifdef ISOVERIF 4724 if (iso_eau.gt.0) then 4725 call iso_verif_egalite_choix(fxt(iso_eau,il,i), & 4726 & fr(il,i),'cv30_routines 3408',errmax,errmaxrel) 4727 endif !if (iso_eau.gt.0) then 4728 do ixt=1,niso 4729 call iso_verif_noNAN(fxt(ixt,il,i),'cv30_routines 3411') 4712 DO ixt=1,niso 4713 CALL iso_verif_noNaN(fxt(ixt,il,i),'cv30_yield 4351') 4730 4714 enddo 4731 if (1.eq.0) then 4732 if ((iso_HDO.gt.0).and.(delt*fr(il,i).gt.ridicule)) then 4733 if (iso_verif_aberrant_enc_nostop( & 4734 & fxt(iso_HDO,il,i)/fr(il,i), & 4735 & 'cv30_yield 3572, dtr mels').eq.1) then 4736 write(*,*) 'i,icb(il),inb(il)=',i,icb(il),inb(il) 4737 write(*,*) 'fr(il,i)=',fr(il,i) 4738 ! if (fr(il,i).gt.ridicule*1e5) then 4715 #endif 4716 #ifdef ISOVERIF 4717 IF (iso_eau.gt.0) THEN 4718 CALL iso_verif_egalite_choix(fxt(iso_eau,il,i), & 4719 fr(il,i),'cv30_routines 3408',errmax,errmaxrel) 4720 endif !if (iso_eau.gt.0) THEN 4721 DO ixt=1,niso 4722 CALL iso_verif_noNAN(fxt(ixt,il,i),'cv30_routines 3411') 4723 enddo 4724 IF (1.EQ.0) THEN 4725 IF ((iso_HDO.gt.0).AND.(delt*fr(il,i).gt.ridicule)) THEN 4726 IF (iso_verif_aberrant_enc_nostop( & 4727 fxt(iso_HDO,il,i)/fr(il,i), & 4728 'cv30_yield 3572, dtr mels').EQ.1) THEN 4729 WRITE(*,*) 'i,icb(il),inb(il)=',i,icb(il),inb(il) 4730 WRITE(*,*) 'fr(il,i)=',fr(il,i) 4731 ! if (fr(il,i).gt.ridicule*1e5) THEN 4739 4732 ! stop 4740 4733 ! endif 4741 4734 endif 4742 endif !if (iso_HDO.gt.0) then4743 endif !if (1. eq.0) then4744 if ((iso_HDO.gt.0).and. &4745 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then4746 calliso_verif_aberrant_encadre((xt(iso_HDO,il,i) &4747 &+delt*fxt(iso_HDO,il,i)) &4748 & /(rr(il,i)+delt*fr(il,i)),'cv30_yield 3605, dtr mels')4749 if (iso_O18.gt.0) then4750 calliso_verif_O18_aberrant( &4751 &(xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i)) &4752 &/(rr(il,i)+delt*fr(il,i)), &4753 &(xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i)) &4754 &/(rr(il,i)+delt*fr(il,i)), &4755 &'cv30_yield 3605O18, dtr mels')4756 if ((il.eq.1636).and.(i.eq.9)) then4757 calliso_verif_O18_aberrant( &4758 &(xt(iso_HDO,il,i)+delt*(fxt(iso_HDO,il,i)-xtbx(iso_HDO))) &4759 &/(rr(il,i)+delt*(fr(il,i)-bx)), &4760 &(xt(iso_O18,il,i)+delt*(fxt(iso_O18,il,i)-xtbx(iso_O18))) &4761 &/(rr(il,i)+delt*(fr(il,i)-bx)), &4762 &'cv30_yield 3605O18_nobx, dtr mels')4763 endif !if ((il. eq.1636).and.(i.eq.9)) then4764 endif !if (iso_O18.gt.0) then4765 endif !if (iso_HDO.gt.0) then4735 endif !if (iso_HDO.gt.0) THEN 4736 endif !if (1.EQ.0) THEN 4737 IF ((iso_HDO.gt.0).AND. & 4738 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 4739 CALL iso_verif_aberrant_encadre((xt(iso_HDO,il,i) & 4740 +delt*fxt(iso_HDO,il,i)) & 4741 /(rr(il,i)+delt*fr(il,i)),'cv30_yield 3605, dtr mels') 4742 IF (iso_O18.gt.0) THEN 4743 CALL iso_verif_O18_aberrant( & 4744 (xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i)) & 4745 /(rr(il,i)+delt*fr(il,i)), & 4746 (xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i)) & 4747 /(rr(il,i)+delt*fr(il,i)), & 4748 'cv30_yield 3605O18, dtr mels') 4749 IF ((il.EQ.1636).AND.(i.EQ.9)) THEN 4750 CALL iso_verif_O18_aberrant( & 4751 (xt(iso_HDO,il,i)+delt*(fxt(iso_HDO,il,i)-xtbx(iso_HDO))) & 4752 /(rr(il,i)+delt*(fr(il,i)-bx)), & 4753 (xt(iso_O18,il,i)+delt*(fxt(iso_O18,il,i)-xtbx(iso_O18))) & 4754 /(rr(il,i)+delt*(fr(il,i)-bx)), & 4755 'cv30_yield 3605O18_nobx, dtr mels') 4756 endif !if ((il.EQ.1636).AND.(i.EQ.9)) THEN 4757 endif !if (iso_O18.gt.0) THEN 4758 endif !if (iso_HDO.gt.0) THEN 4766 4759 #ifdef ISOTRAC 4767 calliso_verif_traceur_justmass(fxt(1,il,i),'cv30_routine 3921')4768 doixt=1,ntraciso4760 CALL iso_verif_traceur_justmass(fxt(1,il,i),'cv30_routine 3921') 4761 DO ixt=1,ntraciso 4769 4762 xtnew(ixt)=xt(ixt,il,i)+delt*fxt(ixt,il,i) 4770 4763 enddo 4771 if(iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 4036',1e-5) &4772 & .eq.1) then4773 write(*,*) 'il,i=',il,i4764 IF (iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 4036',1e-5) & 4765 .EQ.1) THEN 4766 WRITE(*,*) 'il,i=',il,i 4774 4767 endif 4775 ! calliso_verif_tracpos_choix(xtnew,'cv30_yield 4036',1e-5)4776 #endif 4777 #endif 4778 ! end cam verif 4768 ! CALL iso_verif_tracpos_choix(xtnew,'cv30_yield 4036',1e-5) 4769 #endif 4770 #endif 4771 ! end cam verif 4779 4772 #endif 4780 4773 ELSE ! cvflag_grav … … 4787 4780 4788 4781 #ifdef ISO 4789 doixt = 1, ntraciso4782 DO ixt = 1, ntraciso 4790 4783 fxt(ixt,il,i)=fxt(ixt,il,i) & 4791 &+0.1*dpinv*ment(il,k,i)*(xtent(ixt,il,k,i)-xt(ixt,il,i))4784 +0.1*dpinv*ment(il,k,i)*(xtent(ixt,il,k,i)-xt(ixt,il,i)) 4792 4785 enddo 4793 4786 4794 4787 #ifdef DIAGISO 4795 4788 fq_detrainement(il,i)=fq_detrainement(il,i) & 4796 & +0.1*dpinv*ment(il,k,i)*(qent(il,k,i)-rr(il,i))4789 +0.1*dpinv*ment(il,k,i)*(qent(il,k,i)-rr(il,i)) 4797 4790 f_detrainement(il,i)=f_detrainement(il,i) & 4798 &+0.1*dpinv*ment(il,k,i)4791 +0.1*dpinv*ment(il,k,i) 4799 4792 q_detrainement(il,i)=q_detrainement(il,i) & 4800 &+0.1*dpinv*ment(il,k,i)*qent(il,k,i)4801 doixt = 1, niso4793 +0.1*dpinv*ment(il,k,i)*qent(il,k,i) 4794 DO ixt = 1, niso 4802 4795 fxt_detrainement(ixt,il,i)=fxt_detrainement(ixt,il,i) & 4803 &+0.1*dpinv*ment(il,k,i)*(xtent(ixt,il,k,i)-xt(ixt,il,i))4796 +0.1*dpinv*ment(il,k,i)*(xtent(ixt,il,k,i)-xt(ixt,il,i)) 4804 4797 xt_detrainement(ixt,il,i)=xt_detrainement(ixt,il,i) & 4805 &+0.1*dpinv*ment(il,k,i)*xtent(ixt,il,k,i)4798 +0.1*dpinv*ment(il,k,i)*xtent(ixt,il,k,i) 4806 4799 enddo 4807 #endif 4808 4800 #endif 4801 4809 4802 ! cam verif 4810 4803 #ifdef ISOVERIF 4811 if ((il.eq.1636).and.(i.eq.9)) then4812 write(*,*) 'cv30 4785b: on ajoute le dtr ici:'4813 write(*,*) 'M=',0.1*dpinv*ment(il, k, i)4814 write(*,*) 'q,qe=',rr(il,i),qent(il,k,i)4804 IF ((il.EQ.1636).AND.(i.EQ.9)) THEN 4805 WRITE(*,*) 'cv30 4785b: on ajoute le dtr ici:' 4806 WRITE(*,*) 'M=',0.1*dpinv*ment(il, k, i) 4807 WRITE(*,*) 'q,qe=',rr(il,i),qent(il,k,i) 4815 4808 endif 4816 if (iso_eau.gt.0) then4817 calliso_verif_egalite_choix(fxt(iso_eau,il,i), &4818 &fr(il,i),'cv30_routines 3433',errmax,errmaxrel)4819 endif !if (iso_eau.gt.0) then4820 doixt=1,niso4821 calliso_verif_noNAN(fxt(ixt,il,i),'cv30_routines 3436')4809 IF (iso_eau.gt.0) THEN 4810 CALL iso_verif_egalite_choix(fxt(iso_eau,il,i), & 4811 fr(il,i),'cv30_routines 3433',errmax,errmaxrel) 4812 endif !if (iso_eau.gt.0) THEN 4813 DO ixt=1,niso 4814 CALL iso_verif_noNAN(fxt(ixt,il,i),'cv30_routines 3436') 4822 4815 enddo 4823 if ((iso_HDO.gt.0).and.(delt*fr(il,i).gt.ridicule)) then4824 if(iso_verif_aberrant_enc_nostop( &4825 &fxt(iso_HDO,il,i)/fr(il,i), &4826 & 'cv30_yield 3597').eq.1) then4827 write(*,*) 'i,icb(il),inb(il)=',i,icb(il),inb(il)4816 IF ((iso_HDO.gt.0).AND.(delt*fr(il,i).gt.ridicule)) THEN 4817 IF (iso_verif_aberrant_enc_nostop( & 4818 fxt(iso_HDO,il,i)/fr(il,i), & 4819 'cv30_yield 3597').EQ.1) THEN 4820 WRITE(*,*) 'i,icb(il),inb(il)=',i,icb(il),inb(il) 4828 4821 stop 4829 4822 endif 4830 endif !if (iso_HDO.gt.0) then4831 if ((iso_HDO.gt.0).and. &4832 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then4833 calliso_verif_aberrant_encadre((xt(iso_HDO,il,i) &4834 &+delt*fxt(iso_HDO,il,i)) &4835 &/(rr(il,i)+delt*fr(il,i)),'cv30_yield 3605b, dtr mels')4836 endif !if (iso_HDO.gt.0) then4823 endif !if (iso_HDO.gt.0) THEN 4824 IF ((iso_HDO.gt.0).AND. & 4825 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 4826 CALL iso_verif_aberrant_encadre((xt(iso_HDO,il,i) & 4827 +delt*fxt(iso_HDO,il,i)) & 4828 /(rr(il,i)+delt*fr(il,i)),'cv30_yield 3605b, dtr mels') 4829 endif !if (iso_HDO.gt.0) THEN 4837 4830 #ifdef ISOTRAC 4838 calliso_verif_traceur_justmass(fxt(1,il,i),'cv30_routine 3972')4839 doixt=1,ntraciso4831 CALL iso_verif_traceur_justmass(fxt(1,il,i),'cv30_routine 3972') 4832 DO ixt=1,ntraciso 4840 4833 xtnew(ixt)=xt(ixt,il,i)+delt*fxt(ixt,il,i) 4841 4834 enddo 4842 if(iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 4091',1e-5) &4843 & .eq.1) then4844 write(*,*) 'il,i=',il,i4835 IF (iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 4091',1e-5) & 4836 .EQ.1) THEN 4837 WRITE(*,*) 'il,i=',il,i 4845 4838 endif 4846 ! calliso_verif_tracpos_choix(xtnew,'cv30_yield 4091',1e-5)4847 #endif 4848 #endif 4849 ! end cam verif 4839 ! CALL iso_verif_tracpos_choix(xtnew,'cv30_yield 4091',1e-5) 4840 #endif 4841 #endif 4842 ! end cam verif 4850 4843 #endif 4851 4844 END IF ! cvflag_grav … … 4857 4850 ! do k=i,nl+1 4858 4851 ! do il=1,ncum 4859 ! if (i.le.inb(il) . and. k.le.inb(il)) then4852 ! if (i.le.inb(il) .AND. k.le.inb(il)) THEN 4860 4853 ! dpinv=1.0/(ph(il,i)-ph(il,i+1)) 4861 4854 ! cpinv=1.0/cpn(il,i) 4862 ! if (cvflag_grav) then4855 ! if (cvflag_grav) THEN 4863 4856 ! ftra(il,i,j)=ftra(il,i,j)+0.01*grav*dpinv*ment(il,k,i) 4864 4857 ! : *(traent(il,k,i,j)-tra(il,i,j)) … … 4866 4859 ! ftra(il,i,j)=ftra(il,i,j)+0.1*dpinv*ment(il,k,i) 4867 4860 ! : *(traent(il,k,i,j)-tra(il,i,j)) 4868 ! endif4869 ! endif! i and k4861 ! END IF 4862 ! END IF ! i and k 4870 4863 ! enddo 4871 4864 ! enddo … … 4889 4882 i))-mp(il,i)*(vp(il,i)-v(il,i-1)))*dpinv 4890 4883 #ifdef ISO 4891 doixt = 1, niso4884 DO ixt = 1, niso 4892 4885 fxt(ixt,il,i)=fxt(ixt,il,i) & 4893 &+0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1)) &4894 &+0.01*grav*(mp(il,i+1)*(xtp(ixt,il,i+1)-xt(ixt,il,i)) &4895 &-mp(il,i) &4896 &*(xtp(ixt,il,i)-xt(ixt,il,i-1)))*dpinv4886 +0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1)) & 4887 +0.01*grav*(mp(il,i+1)*(xtp(ixt,il,i+1)-xt(ixt,il,i)) & 4888 -mp(il,i) & 4889 *(xtp(ixt,il,i)-xt(ixt,il,i-1)))*dpinv 4897 4890 enddo 4898 4891 4899 4892 #ifdef DIAGISO 4900 4893 fq_evapprecip(il,i)=fq_evapprecip(il,i) & 4901 &+0.5*sigd*(evap(il,i)+evap(il,i+1))4894 +0.5*sigd*(evap(il,i)+evap(il,i+1)) 4902 4895 fq_ddft(il,i)=fq_ddft(il,i) & 4903 &+0.01*grav*(mp(il,i+1)*(rp(il,i+1)-rr(il,i))-mp(il,i) &4904 & *(rp(il,i)-rr(il,i-1)))*dpinv4905 doixt = 1, niso4896 +0.01*grav*(mp(il,i+1)*(rp(il,i+1)-rr(il,i))-mp(il,i) & 4897 *(rp(il,i)-rr(il,i-1)))*dpinv 4898 DO ixt = 1, niso 4906 4899 fxt_evapprecip(ixt,il,i)=fxt_evapprecip(ixt,il,i) & 4907 &+0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1))4900 +0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1)) 4908 4901 fxt_ddft(ixt,il,i)=fxt_ddft(ixt,il,i) & 4909 &+0.01*grav*(mp(il,i+1)*(xtp(ixt,il,i+1)-xt(ixt,il,i)) &4910 &-mp(il,i)*(xtp(ixt,il,i)-xt(ixt,il,i-1)))*dpinv4911 enddo 4912 #endif 4913 4914 #ifdef ISOVERIF 4915 doixt=1,niso4916 calliso_verif_noNaN(xt(ixt,il,i),'cv30_yield 4514')4917 calliso_verif_noNaN(fxt(ixt,il,i),'cv30_yield 4515')4902 +0.01*grav*(mp(il,i+1)*(xtp(ixt,il,i+1)-xt(ixt,il,i)) & 4903 -mp(il,i)*(xtp(ixt,il,i)-xt(ixt,il,i-1)))*dpinv 4904 enddo 4905 #endif 4906 4907 #ifdef ISOVERIF 4908 DO ixt=1,niso 4909 CALL iso_verif_noNaN(xt(ixt,il,i),'cv30_yield 4514') 4910 CALL iso_verif_noNaN(fxt(ixt,il,i),'cv30_yield 4515') 4918 4911 enddo 4919 if ((iso_HDO.gt.0).and. &4920 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then4921 if(iso_verif_aberrant_enc_nostop((xt(iso_HDO,il,i) &4922 &+delt*fxt(iso_HDO,il,i)) &4923 &/(rr(il,i)+delt*fr(il,i)),'cv30_yield 4175') &4924 & .eq.1) then4925 write(*,*) 'il,i=',il,i4926 if (rr(il,i).ne.0.0) then4927 write(*,*) 'il,i,rr,deltaD=',il,i,rr(il,i),deltaD &4928 &(xt(iso_HDO,il,i)/rr(il,i))4912 IF ((iso_HDO.gt.0).AND. & 4913 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 4914 IF (iso_verif_aberrant_enc_nostop((xt(iso_HDO,il,i) & 4915 +delt*fxt(iso_HDO,il,i)) & 4916 /(rr(il,i)+delt*fr(il,i)),'cv30_yield 4175') & 4917 .EQ.1) THEN 4918 WRITE(*,*) 'il,i=',il,i 4919 IF (rr(il,i).NE.0.0) THEN 4920 WRITE(*,*) 'il,i,rr,deltaD=',il,i,rr(il,i),deltaD & 4921 (xt(iso_HDO,il,i)/rr(il,i)) 4929 4922 endif 4930 if (fr(il,i).ne.0.0) then4931 write(*,*) 'fr,fxt,deltaD=',fr(il,i),fxt(iso_HDO,il,i), &4932 &deltaD(fxt(iso_HDO,il,i)/fr(il,i))4923 IF (fr(il,i).NE.0.0) THEN 4924 WRITE(*,*) 'fr,fxt,deltaD=',fr(il,i),fxt(iso_HDO,il,i), & 4925 deltaD(fxt(iso_HDO,il,i)/fr(il,i)) 4933 4926 endif 4934 #ifdef DIAGISO 4935 if (fq_ddft(il,i).ne.0.0) then4936 write(*,*) 'fq_ddft,deltaD=',fq_ddft(il,i),deltaD( &4937 &fxt_ddft(iso_HDO,il,i)/fq_ddft(il,i))4927 #ifdef DIAGISO 4928 IF (fq_ddft(il,i).NE.0.0) THEN 4929 WRITE(*,*) 'fq_ddft,deltaD=',fq_ddft(il,i),deltaD( & 4930 fxt_ddft(iso_HDO,il,i)/fq_ddft(il,i)) 4938 4931 endif 4939 if (fq_evapprecip(il,i).ne.0.0) then4940 write(*,*) 'fq_evapprecip,deltaD=',fq_evapprecip(il,i),deltaD( &4941 &fxt_evapprecip(iso_HDO,il,i)/fq_evapprecip(il,i))4932 IF (fq_evapprecip(il,i).NE.0.0) THEN 4933 WRITE(*,*) 'fq_evapprecip,deltaD=',fq_evapprecip(il,i),deltaD( & 4934 fxt_evapprecip(iso_HDO,il,i)/fq_evapprecip(il,i)) 4942 4935 endif 4943 #endif 4944 write(*,*) 'sigd,evap(il,i),evap(il,i+1)=', &4945 &sigd,evap(il,i),evap(il,i+1)4946 write(*,*) 'xtevap(iso_HDO,il,i),xtevap(iso_HDO,il,i+1)=', &4947 &xtevap(iso_HDO,il,i),xtevap(iso_HDO,il,i+1)4948 write(*,*) 'grav,mp(il,i+1),mp(il,i),dpinv=', &4949 &grav,mp(il,i+1),mp(il,i),dpinv4950 write(*,*) 'rp(il,i+1),rr(il,i),rp(il,i),rr(il,i-1)=', &4951 &rp(il,i+1),rr(il,i),rp(il,i),rr(il,i-1)4952 write(*,*) 'xtp(il,i+1),xt(il,i),xtp(il,i),xt(il,i-1)=', &4953 &xtp(iso_HDO,il,i+1),xt(iso_HDO,il,i), &4954 &xtp(iso_HDO,il,i),xt(iso_HDO,il,i-1)4936 #endif 4937 WRITE(*,*) 'sigd,evap(il,i),evap(il,i+1)=', & 4938 sigd,evap(il,i),evap(il,i+1) 4939 WRITE(*,*) 'xtevap(iso_HDO,il,i),xtevap(iso_HDO,il,i+1)=', & 4940 xtevap(iso_HDO,il,i),xtevap(iso_HDO,il,i+1) 4941 WRITE(*,*) 'grav,mp(il,i+1),mp(il,i),dpinv=', & 4942 grav,mp(il,i+1),mp(il,i),dpinv 4943 WRITE(*,*) 'rp(il,i+1),rr(il,i),rp(il,i),rr(il,i-1)=', & 4944 rp(il,i+1),rr(il,i),rp(il,i),rr(il,i-1) 4945 WRITE(*,*) 'xtp(il,i+1),xt(il,i),xtp(il,i),xt(il,i-1)=', & 4946 xtp(iso_HDO,il,i+1),xt(iso_HDO,il,i), & 4947 xtp(iso_HDO,il,i),xt(iso_HDO,il,i-1) 4955 4948 stop 4956 4949 endif 4957 endif !if (iso_HDO.gt.0) then4958 if ((iso_HDO.gt.0).and.(iso_O18.gt.0).and. &4959 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then4960 calliso_verif_O18_aberrant( &4961 &(xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), &4962 &(xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i))/(rr(il,i)+delt*fr(il,i)), &4963 &'cv30_yield 5029,O18, evap')4964 if ((il.eq.1636).and.(i.eq.9)) then4965 write(*,*) 'cv30_yield 5057: ici, on verifie deltaD_nobx'4966 write(*,*) 'il,i=',il,i4967 write(*,*) 'fr(il,i),bx,fr(il,i)-bx=',fr(il,i),bx,fr(il,i)-bx4968 write(*,*) 'q,q+=',rr(il,i),rr(il,i)+delt*(fr(il,i)-bx)4969 write(*,*) 'deltaD,deltaD+=',deltaD(xt(iso_HDO,il,inb(il))/rr(il,inb(il))), &4970 &deltaD( (xt(iso_HDO,il,i)+delt*(fxt(iso_HDO,il,i)-xtbx(iso_HDO)))/(rr(il,i)+delt*(fr(il,i)-bx)))4971 write(*,*) 'deltaO18,deltaO18+=',deltaO(xt(iso_O18,il,inb(il))/rr(il,inb(il))), &4972 &deltaO( (xt(iso_O18,il,i)+delt*(fxt(iso_O18,il,i)-xtbx(iso_O18)))/(rr(il,i)+delt*(fr(il,i)-bx)))4973 calliso_verif_O18_aberrant( &4974 &(xt(iso_HDO,il,i)+delt*(fxt(iso_HDO,il,i)-xtbx(iso_HDO))) &4975 &/(rr(il,i)+delt*(fr(il,i)-bx)), &4976 &(xt(iso_O18,il,i)+delt*(fxt(iso_O18,il,i)-xtbx(iso_O18))) &4977 &/(rr(il,i)+delt*(fr(il,i)-bx)), &4978 &'cv30_yield 5029_nobx,O18, evap, no bx')4979 endif !if ((il. eq.1636).and.(i.eq.9)) then4980 endif !if (iso_HDO.gt.0) then4950 endif !if (iso_HDO.gt.0) THEN 4951 IF ((iso_HDO.gt.0).AND.(iso_O18.gt.0).AND. & 4952 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 4953 CALL iso_verif_O18_aberrant( & 4954 (xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), & 4955 (xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i))/(rr(il,i)+delt*fr(il,i)), & 4956 'cv30_yield 5029,O18, evap') 4957 IF ((il.EQ.1636).AND.(i.EQ.9)) THEN 4958 WRITE(*,*) 'cv30_yield 5057: ici, on verifie deltaD_nobx' 4959 WRITE(*,*) 'il,i=',il,i 4960 WRITE(*,*) 'fr(il,i),bx,fr(il,i)-bx=',fr(il,i),bx,fr(il,i)-bx 4961 WRITE(*,*) 'q,q+=',rr(il,i),rr(il,i)+delt*(fr(il,i)-bx) 4962 WRITE(*,*) 'deltaD,deltaD+=',deltaD(xt(iso_HDO,il,inb(il))/rr(il,inb(il))), & 4963 deltaD( (xt(iso_HDO,il,i)+delt*(fxt(iso_HDO,il,i)-xtbx(iso_HDO)))/(rr(il,i)+delt*(fr(il,i)-bx))) 4964 WRITE(*,*) 'deltaO18,deltaO18+=',deltaO(xt(iso_O18,il,inb(il))/rr(il,inb(il))), & 4965 deltaO( (xt(iso_O18,il,i)+delt*(fxt(iso_O18,il,i)-xtbx(iso_O18)))/(rr(il,i)+delt*(fr(il,i)-bx))) 4966 CALL iso_verif_O18_aberrant( & 4967 (xt(iso_HDO,il,i)+delt*(fxt(iso_HDO,il,i)-xtbx(iso_HDO))) & 4968 /(rr(il,i)+delt*(fr(il,i)-bx)), & 4969 (xt(iso_O18,il,i)+delt*(fxt(iso_O18,il,i)-xtbx(iso_O18))) & 4970 /(rr(il,i)+delt*(fr(il,i)-bx)), & 4971 'cv30_yield 5029_nobx,O18, evap, no bx') 4972 endif !if ((il.EQ.1636).AND.(i.EQ.9)) THEN 4973 endif !if (iso_HDO.gt.0) THEN 4981 4974 #endif 4982 4975 4983 4976 #ifdef ISOTRAC 4984 if ((option_traceurs.ne.6).and.(option_traceurs.ne.19)) then 4985 4977 IF ((option_traceurs.NE.6).AND.(option_traceurs.NE.19)) THEN 4986 4978 ! facile: on fait comme l'eau 4987 doixt = 1+niso,ntraciso4979 DO ixt = 1+niso,ntraciso 4988 4980 fxt(ixt,il,i)=fxt(ixt,il,i) & 4989 &+0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1)) &4990 &+0.01*grav*(mp(il,i+1)*(xtp(ixt,il,i+1)-xt(ixt,il,i)) &4991 &-mp(il,i)*(xtp(ixt,il,i)-xt(ixt,il,i-1)))*dpinv4992 enddo !do ixt = 1+niso,ntraciso 4981 +0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1)) & 4982 +0.01*grav*(mp(il,i+1)*(xtp(ixt,il,i+1)-xt(ixt,il,i)) & 4983 -mp(il,i)*(xtp(ixt,il,i)-xt(ixt,il,i-1)))*dpinv 4984 enddo !do ixt = 1+niso,ntraciso 4993 4985 4994 4986 else ! taggage des ddfts: … … 5002 4994 ! fxt(ixt_ddft,il,i)=fxt(ixt_ddft,il,i)+conversion(iiso) 5003 4995 ! fxt(ixt_poubelle,il,i)=fxt(ixt_poubelle,il,i) 5004 ! : -conversion(iiso) 4996 ! : -conversion(iiso) 5005 4997 5006 4998 ! Pb: quand on discretise, dqp/dt n'est pas verifee numeriquement. … … 5010 5002 ! Solution alternative: Dans le cas entrainant, Ye ne varie que par 5011 5003 ! ascendance compensatoire des ddfts et par perte de Ye vers le ddft. On 5012 ! calcule donc ce terme directement avec schema amont: 5004 ! calcule donc ce terme directement avec schema amont: 5013 5005 5014 5006 ! ajout deja de l'evap 5015 doixt = 1+niso,ntraciso5007 DO ixt = 1+niso,ntraciso 5016 5008 fxt(ixt,il,i)=fxt(ixt,il,i) & 5017 &+0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1))5009 +0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1)) 5018 5010 enddo !do ixt = 1+niso,ntraciso 5019 5011 5020 5012 ! ajout du terme des ddfts sensi stricto 5021 ! write(*,*) 'tmp cv3_yield 4165: i,il=',i,il5022 ! 5023 if (option_traceurs.eq.6) then5024 doiiso = 1, niso5025 5026 ixt_ddft=itZonIso(izone_ddft,iiso) 5027 if (mp(il,i).gt.mp(il,i+1)) then5013 ! WRITE(*,*) 'tmp cv3_yield 4165: i,il=',i,il 5014 5015 IF (option_traceurs.EQ.6) THEN 5016 DO iiso = 1, niso 5017 5018 ixt_ddft=itZonIso(izone_ddft,iiso) 5019 IF (mp(il,i).gt.mp(il,i+1)) THEN 5028 5020 fxtYe(iiso)=0.01*grav*dpinv*mp(il,i) & 5029 &*(xt(ixt_ddft,il,i-1)-xt(ixt_ddft,il,i))5030 else !if (mp(il,i).gt.mp(il,i+1)) then5021 *(xt(ixt_ddft,il,i-1)-xt(ixt_ddft,il,i)) 5022 else !if (mp(il,i).gt.mp(il,i+1)) THEN 5031 5023 fxtYe(iiso)=0.01*grav*dpinv*(mp(il,i) & 5032 &*xt(ixt_ddft,il,i-1)-mp(il,i+1)*xt(ixt_ddft,il,i) &5033 & +(mp(il,i+1)-mp(il,i))*xtp(ixt_ddft,il,i))5034 endif !if (mp(il,i).gt.mp(il,i+1)) then5024 *xt(ixt_ddft,il,i-1)-mp(il,i+1)*xt(ixt_ddft,il,i) & 5025 +(mp(il,i+1)-mp(il,i))*xtp(ixt_ddft,il,i)) 5026 endif !if (mp(il,i).gt.mp(il,i+1)) THEN 5035 5027 fxtqe(iiso)=0.01*grav*dpinv* & 5036 &(mp(il,i+1)*(xtp(iiso,il,i+1)-xt(iiso,il,i)) &5037 & -mp(il,i)*(xtp(iiso,il,i)-xt(iiso,il,i-1)))5038 5028 (mp(il,i+1)*(xtp(iiso,il,i+1)-xt(iiso,il,i)) & 5029 -mp(il,i)*(xtp(iiso,il,i)-xt(iiso,il,i-1))) 5030 5039 5031 ixt_poubelle=itZonIso(izone_poubelle,iiso) 5040 5032 fxt(ixt_ddft,il,i)=fxt(ixt_ddft,il,i)+fxtYe(iiso) 5041 5033 fxt(ixt_poubelle,il,i)=fxt(ixt_poubelle,il,i) & 5042 &+fxtqe(iiso)-fxtYe(iiso)5034 +fxtqe(iiso)-fxtYe(iiso) 5043 5035 enddo !do iiso = 1, niso 5044 5036 5045 else !if (option_traceurs.eq.6) then 5046 5047 5048 if (mp(il,i).gt.mp(il,i+1)) then 5037 else !if (option_traceurs.EQ.6) THEN 5038 IF (mp(il,i).gt.mp(il,i+1)) THEN 5049 5039 ! cas entrainant: faire attention 5050 5051 doiiso = 1, niso5040 5041 DO iiso = 1, niso 5052 5042 fxtqe(iiso)=0.01*grav*dpinv* & 5053 &(mp(il,i+1)*(xtp(iiso,il,i+1)-xt(iiso,il,i)) &5054 &-mp(il,i)*(xtp(iiso,il,i)-xt(iiso,il,i-1)))5055 5056 ixt_ddft=itZonIso(izone_ddft,iiso) 5043 (mp(il,i+1)*(xtp(iiso,il,i+1)-xt(iiso,il,i)) & 5044 -mp(il,i)*(xtp(iiso,il,i)-xt(iiso,il,i-1))) 5045 5046 ixt_ddft=itZonIso(izone_ddft,iiso) 5057 5047 fxtYe(iiso)=0.01*grav*dpinv*mp(il,i) & 5058 &*(xt(ixt_ddft,il,i-1)-xt(ixt_ddft,il,i))5059 fxt(ixt_ddft,il,i)=fxt(ixt_ddft,il,i)+fxtYe(iiso) 5060 5061 ixt_revap=itZonIso(izone_revap,iiso) 5048 *(xt(ixt_ddft,il,i-1)-xt(ixt_ddft,il,i)) 5049 fxt(ixt_ddft,il,i)=fxt(ixt_ddft,il,i)+fxtYe(iiso) 5050 5051 ixt_revap=itZonIso(izone_revap,iiso) 5062 5052 fxt_revap(iiso)=0.01*grav*dpinv*(mp(il,i+1)* & 5063 &(xtp(ixt_revap,il,i+1)-xt(ixt_revap,il,i)) &5064 & -mp(il,i)*(xtp(ixt_revap,il,i)-xt(ixt_revap,il,i-1)))5053 (xtp(ixt_revap,il,i+1)-xt(ixt_revap,il,i)) & 5054 -mp(il,i)*(xtp(ixt_revap,il,i)-xt(ixt_revap,il,i-1))) 5065 5055 fxt(ixt_revap,il,i)=fxt(ixt_revap,il,i) & 5066 &+fxt_revap(iiso)5056 +fxt_revap(iiso) 5067 5057 5068 5058 fxtXe(iiso)=fxtqe(iiso)-fxtYe(iiso)-fxt_revap(iiso) 5069 5059 Xe(iiso)=xt(iiso,il,i) & 5070 &-xt(ixt_ddft,il,i)-xt(ixt_revap,il,i)5071 if (Xe(iiso).gt.ridicule) then5072 doizone=1,nzone5073 if ((izone.ne.izone_revap).and. &5074 & (izone.ne.izone_ddft)) then5075 ixt=itZonIso(izone,iiso) 5060 -xt(ixt_ddft,il,i)-xt(ixt_revap,il,i) 5061 IF (Xe(iiso).gt.ridicule) THEN 5062 DO izone=1,nzone 5063 IF ((izone.NE.izone_revap).AND. & 5064 (izone.NE.izone_ddft)) THEN 5065 ixt=itZonIso(izone,iiso) 5076 5066 fxt(ixt,il,i)=fxt(ixt,il,i) & 5077 &+xt(ixt,il,i)/Xe(iiso)*fxtXe(iiso)5078 endif !if ((izone. ne.izone_revap).and.5079 enddo !do izone=1,nzone 5080 #ifdef ISOVERIF 5081 ! write(*,*) 'iiso=',iiso5082 ! write(*,*) 'fxtqe=',fxtqe(iiso)5083 ! write(*,*) 'fxtYe=',fxtYe(iiso)5084 ! write(*,*) 'fxt_revap=',fxt_revap(iiso)5085 ! write(*,*) 'fxtXe=',fxtXe(iiso)5086 ! write(*,*) 'Xe=',Xe(iiso)5087 ! write(*,*) 'xt=',xt(:,il,i)5088 calliso_verif_traceur_justmass(fxt(1,il,i), &5089 & 'cv30_routine 4646')5090 #endif 5091 else !if (abs(dXe).gt.ridicule) then5067 +xt(ixt,il,i)/Xe(iiso)*fxtXe(iiso) 5068 endif !if ((izone.NE.izone_revap).AND. 5069 enddo !do izone=1,nzone 5070 #ifdef ISOVERIF 5071 ! WRITE(*,*) 'iiso=',iiso 5072 ! WRITE(*,*) 'fxtqe=',fxtqe(iiso) 5073 ! WRITE(*,*) 'fxtYe=',fxtYe(iiso) 5074 ! WRITE(*,*) 'fxt_revap=',fxt_revap(iiso) 5075 ! WRITE(*,*) 'fxtXe=',fxtXe(iiso) 5076 ! WRITE(*,*) 'Xe=',Xe(iiso) 5077 ! WRITE(*,*) 'xt=',xt(:,il,i) 5078 CALL iso_verif_traceur_justmass(fxt(1,il,i), & 5079 'cv30_routine 4646') 5080 #endif 5081 else !if (abs(dXe).gt.ridicule) THEN 5092 5082 ! dans ce cas, fxtXe doit etre faible 5093 5094 #ifdef ISOVERIF 5095 if (delt*fxtXe(iiso).gt.ridicule) then5096 write(*,*) 'cv30_routines 6563: delt*fxtXe(iiso)=', &5097 &delt*fxtXe(iiso)5083 5084 #ifdef ISOVERIF 5085 IF (delt*fxtXe(iiso).gt.ridicule) THEN 5086 WRITE(*,*) 'cv30_routines 6563: delt*fxtXe(iiso)=', & 5087 delt*fxtXe(iiso) 5098 5088 stop 5099 5089 endif 5100 #endif 5101 doizone=1,nzone5102 if ((izone.ne.izone_revap).and. &5103 & (izone.ne.izone_ddft)) then5104 ixt=itZonIso(izone,iiso) 5105 if (izone.eq.izone_poubelle) then5090 #endif 5091 DO izone=1,nzone 5092 IF ((izone.NE.izone_revap).AND. & 5093 (izone.NE.izone_ddft)) THEN 5094 ixt=itZonIso(izone,iiso) 5095 IF (izone.EQ.izone_poubelle) THEN 5106 5096 fxt(ixt,il,i)=fxt(ixt,il,i)+fxtXe(iiso) 5107 else !if (izone. eq.izone_poubelle) then5097 else !if (izone.EQ.izone_poubelle) THEN 5108 5098 ! pas de tendance pour ce tag la 5109 endif !if (izone. eq.izone_poubelle) then5110 endif !if ((izone. ne.izone_revap).and.5099 endif !if (izone.EQ.izone_poubelle) THEN 5100 endif !if ((izone.NE.izone_revap).AND. 5111 5101 enddo !do izone=1,nzone 5112 5102 #ifdef ISOVERIF 5113 call iso_verif_traceur_justmass(fxt(1,il,i), & 5114 & 'cv30_routine 4671') 5115 #endif 5116 5117 endif !if (abs(dXe).gt.ridicule) then 5118 5103 CALL iso_verif_traceur_justmass(fxt(1,il,i), & 5104 'cv30_routine 4671') 5105 #endif 5106 5107 endif !if (abs(dXe).gt.ridicule) THEN 5119 5108 enddo !do iiso = 1, niso 5120 5121 else !if (mp(il,i).gt.mp(il,i+1)) then5109 5110 else !if (mp(il,i).gt.mp(il,i+1)) THEN 5122 5111 ! cas detrainant: pas de problemes 5123 doixt=1+niso,ntraciso5112 DO ixt=1+niso,ntraciso 5124 5113 fxt(ixt,il,i)=fxt(ixt,il,i) & 5125 &+0.01*grav*(mp(il,i+1)*(xtp(ixt,il,i+1)-xt(ixt,il,i)) &5126 &-mp(il,i)*(xtp(ixt,il,i)-xt(ixt,il,i-1)))*dpinv5114 +0.01*grav*(mp(il,i+1)*(xtp(ixt,il,i+1)-xt(ixt,il,i)) & 5115 -mp(il,i)*(xtp(ixt,il,i)-xt(ixt,il,i-1)))*dpinv 5127 5116 enddo !do ixt=1+niso,ntraciso 5128 5117 #ifdef ISOVERIF 5129 call iso_verif_traceur_justmass(fxt(1,il,i), & 5130 & 'cv30_routine 4685') 5131 #endif 5132 endif !if (mp(il,i).gt.mp(il,i+1)) then 5133 5134 endif !if (option_traceurs.eq.6) then 5135 5136 ! write(*,*) 'delt*conversion=',delt*conversion(iso_eau) 5137 ! write(*,*) 'delt*fxtYe=',delt*fxtYe(iso_eau) 5138 ! write(*,*) 'delt*fxtqe=',delt*fxtqe(iso_eau) 5139 5140 endif ! if ((option_traceurs.ne.6).and.(option_traceurs.ne.19)) then 5141 #endif 5142 5118 CALL iso_verif_traceur_justmass(fxt(1,il,i), & 5119 'cv30_routine 4685') 5120 #endif 5121 endif !if (mp(il,i).gt.mp(il,i+1)) THEN 5122 endif !if (option_traceurs.EQ.6) THEN 5123 ! WRITE(*,*) 'delt*conversion=',delt*conversion(iso_eau) 5124 ! WRITE(*,*) 'delt*fxtYe=',delt*fxtYe(iso_eau) 5125 ! WRITE(*,*) 'delt*fxtqe=',delt*fxtqe(iso_eau) 5126 5127 endif ! if ((option_traceurs.NE.6).AND.(option_traceurs.NE.19)) THEN 5128 #endif 5129 5143 5130 ! cam verif 5144 5131 #ifdef ISOVERIF 5145 doixt=1,niso5146 calliso_verif_noNAN(fxt(ixt,il,i),'cv30_routines 3496')5132 DO ixt=1,niso 5133 CALL iso_verif_noNAN(fxt(ixt,il,i),'cv30_routines 3496') 5147 5134 enddo 5148 5135 #endif 5149 5136 #ifdef ISOVERIF 5150 if (iso_eau.gt.0) then5151 calliso_verif_egalite_choix(fxt(iso_eau,il,i), &5152 &fr(il,i),'cv30_routines 3493',errmax,errmaxrel)5153 endif !if (iso_eau.gt.0) then5154 if (1.eq.0) then5155 if ((iso_HDO.gt.0).and.(delt*fr(il,i).gt.ridicule)) then5156 if(iso_verif_aberrant_enc_nostop( &5157 &fxt(iso_HDO,il,i)/fr(il,i), &5158 & 'cv30_yield 3662').eq.1) then5159 write(*,*) 'il,i,icb(il),inb(il)=',il,i,icb(il),inb(il)5160 write(*,*) 'fr(il,i),delt=',fr(il,i),delt5161 #ifdef DIAGISO 5162 if (fq_ddft(il,i).ne.0.0) then5163 write(*,*) 'fq_ddft,deltaD=',fq_ddft(il,i),deltaD( &5164 &fxt_ddft(iso_HDO,il,i)/fq_ddft(il,i))5165 endif !if (fq_ddft(il,i). ne.0.0) then5166 if (fq_evapprecip(il,i).ne.0.0) then5167 write(*,*) 'fq_evapprecip,deltaD=',fq_evapprecip(il,i), &5168 &deltaD(fxt_evapprecip(iso_HDO,il,i) &5169 &/fq_evapprecip(il,i))5170 endif !if (fq_evapprecip(il,i). ne.0.0) then5171 #endif 5137 IF (iso_eau.gt.0) THEN 5138 CALL iso_verif_egalite_choix(fxt(iso_eau,il,i), & 5139 fr(il,i),'cv30_routines 3493',errmax,errmaxrel) 5140 endif !if (iso_eau.gt.0) THEN 5141 IF (1.EQ.0) THEN 5142 IF ((iso_HDO.gt.0).AND.(delt*fr(il,i).gt.ridicule)) THEN 5143 IF (iso_verif_aberrant_enc_nostop( & 5144 fxt(iso_HDO,il,i)/fr(il,i), & 5145 'cv30_yield 3662').EQ.1) THEN 5146 WRITE(*,*) 'il,i,icb(il),inb(il)=',il,i,icb(il),inb(il) 5147 WRITE(*,*) 'fr(il,i),delt=',fr(il,i),delt 5148 #ifdef DIAGISO 5149 IF (fq_ddft(il,i).NE.0.0) THEN 5150 WRITE(*,*) 'fq_ddft,deltaD=',fq_ddft(il,i),deltaD( & 5151 fxt_ddft(iso_HDO,il,i)/fq_ddft(il,i)) 5152 endif !if (fq_ddft(il,i).NE.0.0) THEN 5153 IF (fq_evapprecip(il,i).NE.0.0) THEN 5154 WRITE(*,*) 'fq_evapprecip,deltaD=',fq_evapprecip(il,i), & 5155 deltaD(fxt_evapprecip(iso_HDO,il,i) & 5156 /fq_evapprecip(il,i)) 5157 endif !if (fq_evapprecip(il,i).NE.0.0) THEN 5158 #endif 5172 5159 endif !if (iso_verif_aberrant_enc_nostop( 5173 endif !if (iso_HDO.gt.0) then5174 endif !if (1. eq.0) then5175 if ((iso_HDO.gt.0).and. &5176 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then5177 if(iso_verif_aberrant_enc_nostop((xt(iso_HDO,il,i) &5178 &+delt*fxt(iso_HDO,il,i)) &5179 &/(rr(il,i)+delt*fr(il,i)),'cv30_yield 3757, ddfts') &5180 & .eq.1) then5181 write(*,*) 'i,il,q,deltaD=',i,il,rr(il,i),deltaD( &5182 &xt(iso_HDO,il,i)/rr(il,i))5183 write(*,*) 'i,il,fr,deltaD=',i,il,fr(il,i),deltaD( &5184 &fxt(iso_HDO,il,i)/fr(il,i))5160 endif !if (iso_HDO.gt.0) THEN 5161 endif !if (1.EQ.0) THEN 5162 IF ((iso_HDO.gt.0).AND. & 5163 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 5164 IF (iso_verif_aberrant_enc_nostop((xt(iso_HDO,il,i) & 5165 +delt*fxt(iso_HDO,il,i)) & 5166 /(rr(il,i)+delt*fr(il,i)),'cv30_yield 3757, ddfts') & 5167 .EQ.1) THEN 5168 WRITE(*,*) 'i,il,q,deltaD=',i,il,rr(il,i),deltaD( & 5169 xt(iso_HDO,il,i)/rr(il,i)) 5170 WRITE(*,*) 'i,il,fr,deltaD=',i,il,fr(il,i),deltaD( & 5171 fxt(iso_HDO,il,i)/fr(il,i)) 5185 5172 stop 5186 5173 endif ! if (iso_verif_aberrant_enc_nostop 5187 endif !if (iso_HDO.gt.0) then 5188 5189 if ((iso_HDO.gt.0).and.(iso_O18.gt.0).and. & 5190 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then 5191 call iso_verif_O18_aberrant( & 5192 & (xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), & 5193 & (xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i))/(rr(il,i)+delt*fr(il,i)), & 5194 & 'cv30_yield 5250,O18, ddfts') 5195 endif !if (iso_HDO.gt.0) then 5196 5174 endif !if (iso_HDO.gt.0) THEN 5175 IF ((iso_HDO.gt.0).AND.(iso_O18.gt.0).AND. & 5176 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 5177 CALL iso_verif_O18_aberrant( & 5178 (xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), & 5179 (xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i))/(rr(il,i)+delt*fr(il,i)), & 5180 'cv30_yield 5250,O18, ddfts') 5181 endif !if (iso_HDO.gt.0) THEN 5197 5182 #ifdef ISOTRAC 5198 ! write(*,*) 'tmp cv3_yield 4224: i,il=',i,il5199 calliso_verif_traceur_justmass(fxt(1,il,i),'cv30_routine 4107')5200 doixt=1,ntraciso5183 ! WRITE(*,*) 'tmp cv3_yield 4224: i,il=',i,il 5184 CALL iso_verif_traceur_justmass(fxt(1,il,i),'cv30_routine 4107') 5185 DO ixt=1,ntraciso 5201 5186 xtnew(ixt)=xt(ixt,il,i)+delt*fxt(ixt,il,i) 5202 5187 enddo 5203 if(iso_verif_tracpos_choix_nostop(xtnew, &5204 & 'cv30_yield 4221',1e-5).eq.1) then5205 write(*,*) 'delt*fxt(,il,i)=',delt*fxt(1:ntraciso:2,il,i)5206 write(*,*) 'delt*fxt(,il,i)=',delt*fxt(:,il,i)5207 write(*,*) 'xt(,il,i)=',xt(:,il,i)5208 write(*,*) 'delt,sigd,grav,dpinv=',delt,sigd,grav,dpinv5209 write(*,*) 'xtevap(,il,i)=',xtevap(:,il,i)5210 write(*,*) 'xtevap(,il,i+1)=',xtevap(:,il,i+1)5211 write(*,*) 'mp(il,i+1),mp(il,i)=',mp(il,i+1),mp(il,i)5212 write(*,*) 'xtp(,il,i)=',xtp(:,il,i)5213 write(*,*) 'xtp(,il,i+1)=',xtp(:,il,i+1)5214 write(*,*) 'xt(,il,i)=',xt(:,il,i)5215 write(*,*) 'xt(,il,i-1)=',xt(:,il,i-1)5188 IF (iso_verif_tracpos_choix_nostop(xtnew, & 5189 'cv30_yield 4221',1e-5).EQ.1) THEN 5190 WRITE(*,*) 'delt*fxt(,il,i)=',delt*fxt(1:ntraciso:2,il,i) 5191 WRITE(*,*) 'delt*fxt(,il,i)=',delt*fxt(:,il,i) 5192 WRITE(*,*) 'xt(,il,i)=',xt(:,il,i) 5193 WRITE(*,*) 'delt,sigd,grav,dpinv=',delt,sigd,grav,dpinv 5194 WRITE(*,*) 'xtevap(,il,i)=',xtevap(:,il,i) 5195 WRITE(*,*) 'xtevap(,il,i+1)=',xtevap(:,il,i+1) 5196 WRITE(*,*) 'mp(il,i+1),mp(il,i)=',mp(il,i+1),mp(il,i) 5197 WRITE(*,*) 'xtp(,il,i)=',xtp(:,il,i) 5198 WRITE(*,*) 'xtp(,il,i+1)=',xtp(:,il,i+1) 5199 WRITE(*,*) 'xt(,il,i)=',xt(:,il,i) 5200 WRITE(*,*) 'xt(,il,i-1)=',xt(:,il,i-1) 5216 5201 ! rappel: fxt(ixt,il,i)=fxt(ixt,il,i) 5217 5202 ! 0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1)) … … 5220 5205 ! stop 5221 5206 endif 5222 #endif 5207 #endif 5223 5208 #endif 5224 5209 #endif … … 5232 5217 i))-mp(il,i)*(vp(il,i)-v(il,i-1)))*dpinv 5233 5218 #ifdef ISO 5234 doixt = 1, ntraciso5219 DO ixt = 1, ntraciso 5235 5220 fxt(ixt,il,i)=fxt(ixt,il,i) & 5236 &+0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1)) &5237 &+0.1*(mp(il,i+1)*(xtp(ixt,il,i+1)-xt(ixt,il,i)) &5238 &-mp(il,i)*(xtp(ixt,il,i)-xt(ixt,il,i-1)))*dpinv5221 +0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1)) & 5222 +0.1*(mp(il,i+1)*(xtp(ixt,il,i+1)-xt(ixt,il,i)) & 5223 -mp(il,i)*(xtp(ixt,il,i)-xt(ixt,il,i-1)))*dpinv 5239 5224 enddo ! ixt=1,niso 5240 5225 5241 #ifdef ISOTRAC 5242 if (option_traceurs.ne.6) then 5243 5226 #ifdef ISOTRAC 5227 IF (option_traceurs.NE.6) THEN 5244 5228 ! facile: on fait comme l'eau 5245 doixt = 1+niso,ntraciso5229 DO ixt = 1+niso,ntraciso 5246 5230 fxt(ixt,il,i)=fxt(ixt,il,i) & 5247 &+0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1)) &5248 &+0.01*grav*(mp(il,i+1)*(xtp(ixt,il,i+1)-xt(ixt,il,i)) &5249 &-mp(il,i)*(xtp(ixt,il,i)-xt(ixt,il,i-1)))*dpinv5231 +0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1)) & 5232 +0.01*grav*(mp(il,i+1)*(xtp(ixt,il,i+1)-xt(ixt,il,i)) & 5233 -mp(il,i)*(xtp(ixt,il,i)-xt(ixt,il,i-1)))*dpinv 5250 5234 enddo !do ixt = 1+niso,ntraciso 5251 5235 5252 else !if (option_traceurs.ne.6) then 5253 5236 else !if (option_traceurs.NE.6) THEN 5254 5237 ! taggage des ddfts: voir blabla + haut 5255 doixt = 1+niso,ntraciso5238 DO ixt = 1+niso,ntraciso 5256 5239 fxt(ixt,il,i)=fxt(ixt,il,i) & 5257 &+0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1))5240 +0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1)) 5258 5241 enddo !do ixt = 1+niso,ntraciso 5259 ! write(*,*) 'tmp cv3_yield 4165: i,il=',i,il5242 ! WRITE(*,*) 'tmp cv3_yield 4165: i,il=',i,il 5260 5243 ! ixt_poubelle=itZonIso(izone_poubelle,iso_eau) 5261 5244 ! ixt_ddft=itZonIso(izone_ddft,iso_eau) 5262 ! write(*,*) 'delt*fxt(ixt_poubelle,il,i)=',5245 ! WRITE(*,*) 'delt*fxt(ixt_poubelle,il,i)=', 5263 5246 ! : delt*fxt(ixt_poubelle,il,i) 5264 ! write(*,*) 'delt*fxt(ixt_ddft,il,i)=',delt*fxt(ixt_ddft,il,i)5265 ! write(*,*) 'xt(iso_eau,il,i)=',xt(iso_eau,il,i)5266 doiiso = 1, niso5247 ! WRITE(*,*) 'delt*fxt(ixt_ddft,il,i)=',delt*fxt(ixt_ddft,il,i) 5248 ! WRITE(*,*) 'xt(iso_eau,il,i)=',xt(iso_eau,il,i) 5249 DO iiso = 1, niso 5267 5250 ixt_poubelle=itZonIso(izone_poubelle,iiso) 5268 ixt_ddft=itZonIso(izone_ddft,iiso) 5269 if (mp(il,i).gt.mp(il,i+1)) then5251 ixt_ddft=itZonIso(izone_ddft,iiso) 5252 IF (mp(il,i).gt.mp(il,i+1)) THEN 5270 5253 fxtYe(iiso)=0.01*grav*dpinv*mp(il,i) & 5271 &*(xt(ixt_ddft,il,i-1)-xt(ixt_ddft,il,i))5272 else !if (mp(il,i).gt.mp(il,i+1)) then5254 *(xt(ixt_ddft,il,i-1)-xt(ixt_ddft,il,i)) 5255 else !if (mp(il,i).gt.mp(il,i+1)) THEN 5273 5256 fxtYe(iiso)=0.01*grav*dpinv*(mp(il,i) & 5274 &*xt(ixt_ddft,il,i-1)-mp(il,i+1)*xt(ixt_ddft,il,i) &5275 & +(mp(il,i+1)-mp(il,i))*xtp(ixt_ddft,il,i))5276 endif !if (mp(il,i).gt.mp(il,i+1)) then5257 *xt(ixt_ddft,il,i-1)-mp(il,i+1)*xt(ixt_ddft,il,i) & 5258 +(mp(il,i+1)-mp(il,i))*xtp(ixt_ddft,il,i)) 5259 endif !if (mp(il,i).gt.mp(il,i+1)) THEN 5277 5260 fxtqe(iiso)=0.01*grav*dpinv* & 5278 &(mp(il,i+1)*(xtp(iiso,il,i+1)-xt(iiso,il,i)) &5279 &-mp(il,i)*(xtp(iiso,il,i)-xt(iiso,il,i-1)))5261 (mp(il,i+1)*(xtp(iiso,il,i+1)-xt(iiso,il,i)) & 5262 -mp(il,i)*(xtp(iiso,il,i)-xt(iiso,il,i-1))) 5280 5263 fxt(ixt_ddft,il,i)=fxt(ixt_ddft,il,i)+fxtYe(iiso) 5281 5264 fxt(ixt_poubelle,il,i)=fxt(ixt_poubelle,il,i) & 5282 &+fxtqe(iiso)-fxtYe(iiso)5265 +fxtqe(iiso)-fxtYe(iiso) 5283 5266 enddo !do iiso = 1, niso 5284 ! write(*,*) 'delt*conversion=',delt*conversion(iso_eau)5285 ! write(*,*) 'delt*fxtYe=',delt*fxtYe(iso_eau)5286 ! write(*,*) 'delt*fxtqe=',delt*fxtqe(iso_eau)5287 endif !if (option_traceurs. eq.6) then5288 #endif 5267 ! WRITE(*,*) 'delt*conversion=',delt*conversion(iso_eau) 5268 ! WRITE(*,*) 'delt*fxtYe=',delt*fxtYe(iso_eau) 5269 ! WRITE(*,*) 'delt*fxtqe=',delt*fxtqe(iso_eau) 5270 endif !if (option_traceurs.EQ.6) THEN 5271 #endif 5289 5272 5290 5273 #ifdef DIAGISO 5291 5274 fq_evapprecip(il,i)=fq_evapprecip(il,i) & 5292 &+0.5*sigd*(evap(il,i)+evap(il,i+1))5275 +0.5*sigd*(evap(il,i)+evap(il,i+1)) 5293 5276 fq_ddft(il,i)=fq_ddft(il,i) & 5294 &+0.1*(mp(il,i+1)*(rp(il,i+1)-rr(il,i))-mp(il,i) &5295 &*(rp(il,i)-rr(il,i-1)))*dpinv5296 do ixt = 1, niso5277 +0.1*(mp(il,i+1)*(rp(il,i+1)-rr(il,i))-mp(il,i) & 5278 *(rp(il,i)-rr(il,i-1)))*dpinv 5279 DO ixt = 1, niso 5297 5280 fxt_evapprecip(ixt,il,i)=fxt_evapprecip(ixt,il,i) & 5298 &+0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1))5281 +0.5*sigd*(xtevap(ixt,il,i)+xtevap(ixt,il,i+1)) 5299 5282 fxt_ddft(ixt,il,i)=fxt_ddft(ixt,il,i) & 5300 &+0.1*(mp(il,i+1)*(xtp(ixt,il,i+1)-xt(ixt,il,i)) &5301 &-mp(il,i)*(xtp(ixt,il,i)-xt(ixt,il,i-1)))*dpinv5302 enddo ! ixt=1,niso 5303 #endif 5283 +0.1*(mp(il,i+1)*(xtp(ixt,il,i+1)-xt(ixt,il,i)) & 5284 -mp(il,i)*(xtp(ixt,il,i)-xt(ixt,il,i-1)))*dpinv 5285 enddo ! ixt=1,niso 5286 #endif 5304 5287 5305 5288 ! cam verif 5306 5289 5307 5290 #ifdef ISOVERIF 5308 doixt=1,niso5309 calliso_verif_noNaN(fxt(ixt,il,i),'cv30_yield 5083')5291 DO ixt=1,niso 5292 CALL iso_verif_noNaN(fxt(ixt,il,i),'cv30_yield 5083') 5310 5293 enddo 5311 #endif 5312 #ifdef ISOVERIF 5313 if (iso_eau.gt.0) then5314 calliso_verif_egalite_choix(fxt(iso_eau,il,i), &5315 &fr(il,i),'cv30_routines 3522',errmax,errmaxrel)5316 endif !if (iso_eau.gt.0) then5317 if ((iso_HDO.gt.0).and.(delt*fr(il,i).gt.ridicule)) then5318 if(iso_verif_aberrant_enc_nostop( &5319 &fxt(iso_HDO,il,i)/fr(il,i), &5320 & 'cv30_yield 3690').eq.1) then5321 write(*,*) 'i,icb(il),inb(il)=',i,icb(il),inb(il)5294 #endif 5295 #ifdef ISOVERIF 5296 IF (iso_eau.gt.0) THEN 5297 CALL iso_verif_egalite_choix(fxt(iso_eau,il,i), & 5298 fr(il,i),'cv30_routines 3522',errmax,errmaxrel) 5299 endif !if (iso_eau.gt.0) THEN 5300 IF ((iso_HDO.gt.0).AND.(delt*fr(il,i).gt.ridicule)) THEN 5301 IF (iso_verif_aberrant_enc_nostop( & 5302 fxt(iso_HDO,il,i)/fr(il,i), & 5303 'cv30_yield 3690').EQ.1) THEN 5304 WRITE(*,*) 'i,icb(il),inb(il)=',i,icb(il),inb(il) 5322 5305 stop 5323 5306 endif 5324 endif !if (iso_HDO.gt.0) then5325 if ((iso_HDO.gt.0).and. &5326 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then5327 calliso_verif_aberrant_encadre((xt(iso_HDO,il,i) &5328 &+delt*fxt(iso_HDO,il,i)) &5329 &/(rr(il,i)+delt*fr(il,i)),'cv30_yield 3757b, ddfts')5330 endif !if (iso_HDO.gt.0) then5331 if ((iso_HDO.gt.0).and.(iso_O18.gt.0).and. &5332 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then5333 calliso_verif_O18_aberrant( &5334 &(xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), &5335 &(xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i))/(rr(il,i)+delt*fr(il,i)), &5336 &'cv30_yield 3757b,O18, ddfts')5337 endif !if (iso_HDO.gt.0) then5307 endif !if (iso_HDO.gt.0) THEN 5308 IF ((iso_HDO.gt.0).AND. & 5309 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 5310 CALL iso_verif_aberrant_encadre((xt(iso_HDO,il,i) & 5311 +delt*fxt(iso_HDO,il,i)) & 5312 /(rr(il,i)+delt*fr(il,i)),'cv30_yield 3757b, ddfts') 5313 endif !if (iso_HDO.gt.0) THEN 5314 IF ((iso_HDO.gt.0).AND.(iso_O18.gt.0).AND. & 5315 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 5316 CALL iso_verif_O18_aberrant( & 5317 (xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), & 5318 (xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i))/(rr(il,i)+delt*fr(il,i)), & 5319 'cv30_yield 3757b,O18, ddfts') 5320 endif !if (iso_HDO.gt.0) THEN 5338 5321 #ifdef ISOTRAC 5339 calliso_verif_traceur_justmass(fxt(1,il,i),'cv30_routine 4172')5340 doixt=1,ntraciso5322 CALL iso_verif_traceur_justmass(fxt(1,il,i),'cv30_routine 4172') 5323 DO ixt=1,ntraciso 5341 5324 xtnew(ixt)=xt(ixt,il,1)+delt*fxt(ixt,il,1) 5342 5325 enddo 5343 if(iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 4295',1e-5) &5344 & .eq.1) then5345 write(*,*) 'il,i=',il,i5326 IF (iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 4295',1e-5) & 5327 .EQ.1) THEN 5328 WRITE(*,*) 'il,i=',il,i 5346 5329 endif 5347 ! calliso_verif_tracpos_choix(xtnew,'cv30_yield 4295',1e-5)5348 #endif 5349 #endif 5350 ! end cam verif 5330 ! CALL iso_verif_tracpos_choix(xtnew,'cv30_yield 4295',1e-5) 5331 #endif 5332 #endif 5333 ! end cam verif 5351 5334 #endif 5352 5335 … … 5384 5367 ! do j=1,ntra 5385 5368 ! do il=1,ncum 5386 ! if (i.le.inb(il)) then5369 ! if (i.le.inb(il)) THEN 5387 5370 ! dpinv=1.0/(ph(il,i)-ph(il,i+1)) 5388 5371 ! cpinv=1.0/cpn(il,i) 5389 5372 5390 ! if (cvflag_grav) then5373 ! if (cvflag_grav) THEN 5391 5374 ! ftra(il,i,j)=ftra(il,i,j)+0.01*grav*dpinv 5392 5375 ! : *(mp(il,i+1)*(trap(il,i+1,j)-tra(il,i,j)) … … 5396 5379 ! : *(mp(il,i+1)*(trap(il,i+1,j)-tra(il,i,j)) 5397 5380 ! : -mp(il,i)*(trap(il,i,j)-tra(il,i-1,j))) 5398 ! endif5399 ! endif! i5381 ! END IF 5382 ! END IF ! i 5400 5383 ! enddo 5401 5384 ! enddo … … 5411 5394 5412 5395 ! attention, on corrige un probleme C Risi 5413 IF (cvflag_grav) then 5414 5396 IF (cvflag_grav) THEN 5415 5397 ax = 0.01*grav*ment(il, inb(il), inb(il))*(hp(il,inb(il))-h(il,inb(il))+t(il, & 5416 5398 inb(il))*(cpv-cpd)*(rr(il,inb(il))-qent(il,inb(il), & … … 5439 5421 1))/(ph(il,inb(il)-1)-ph(il,inb(il))) 5440 5422 5441 5442 #ifdef ISO 5443 doixt = 1, ntraciso5423 5424 #ifdef ISO 5425 DO ixt = 1, ntraciso 5444 5426 xtbx(ixt)=0.01*grav*ment(il,inb(il),inb(il)) & 5445 &*(xtent(ixt,il,inb(il),inb(il)) &5446 &-xt(ixt,il,inb(il)))/(ph(il,inb(il))-ph(il,inb(il)+1))5427 *(xtent(ixt,il,inb(il),inb(il)) & 5428 -xt(ixt,il,inb(il)))/(ph(il,inb(il))-ph(il,inb(il)+1)) 5447 5429 fxt(ixt,il,inb(il))=fxt(ixt,il,inb(il))-xtbx(ixt) 5448 5430 fxt(ixt,il,inb(il)-1)=fxt(ixt,il,inb(il)-1) & 5449 &+xtbx(ixt)*(ph(il,inb(il))-ph(il,inb(il)+1)) &5450 &/(ph(il,inb(il)-1)-ph(il,inb(il)))5431 +xtbx(ixt)*(ph(il,inb(il))-ph(il,inb(il)+1)) & 5432 /(ph(il,inb(il)-1)-ph(il,inb(il))) 5451 5433 enddo !do ixt = 1, niso 5452 #endif 5434 #endif 5453 5435 5454 5436 else !IF (cvflag_grav) … … 5480 5462 5481 5463 5482 5483 #ifdef ISO 5484 doixt = 1, ntraciso5464 5465 #ifdef ISO 5466 DO ixt = 1, ntraciso 5485 5467 xtbx(ixt)=0.1*ment(il,inb(il),inb(il)) & 5486 &*(xtent(ixt,il,inb(il),inb(il)) &5487 &-xt(ixt,il,inb(il)))/(ph(il,inb(il))-ph(il,inb(il)+1))5468 *(xtent(ixt,il,inb(il),inb(il)) & 5469 -xt(ixt,il,inb(il)))/(ph(il,inb(il))-ph(il,inb(il)+1)) 5488 5470 fxt(ixt,il,inb(il))=fxt(ixt,il,inb(il))-xtbx(ixt) 5489 5471 fxt(ixt,il,inb(il)-1)=fxt(ixt,il,inb(il)-1) & 5490 &+xtbx(ixt)*(ph(il,inb(il))-ph(il,inb(il)+1)) &5491 &/(ph(il,inb(il)-1)-ph(il,inb(il)))5472 +xtbx(ixt)*(ph(il,inb(il))-ph(il,inb(il)+1)) & 5473 /(ph(il,inb(il)-1)-ph(il,inb(il))) 5492 5474 enddo !do ixt = 1, niso 5493 #endif 5475 #endif 5494 5476 5495 5477 endif !IF (cvflag_grav) … … 5500 5482 fq_detrainement(il,inb(il))=fq_detrainement(il,inb(il))-bx 5501 5483 fq_detrainement(il,inb(il)-1)=fq_detrainement(il,inb(il)-1) & 5502 &+bx*(ph(il,inb(il))-ph(il,inb(il)+1)) &5503 & /(ph(il,inb(il)-1)-ph(il,inb(il)))5504 doixt = 1, niso5484 +bx*(ph(il,inb(il))-ph(il,inb(il)+1)) & 5485 /(ph(il,inb(il)-1)-ph(il,inb(il))) 5486 DO ixt = 1, niso 5505 5487 fxt_detrainement(ixt,il,inb(il))= & 5506 &fxt_detrainement(ixt,il,inb(il))-xtbx(ixt)5488 fxt_detrainement(ixt,il,inb(il))-xtbx(ixt) 5507 5489 fxt_detrainement(ixt,il,inb(il)-1)= & 5508 &fxt_detrainement(ixt,il,inb(il)-1) &5509 &+xtbx(ixt)*(ph(il,inb(il))-ph(il,inb(il)+1)) &5510 & /(ph(il,inb(il)-1)-ph(il,inb(il)))5490 fxt_detrainement(ixt,il,inb(il)-1) & 5491 +xtbx(ixt)*(ph(il,inb(il))-ph(il,inb(il)+1)) & 5492 /(ph(il,inb(il)-1)-ph(il,inb(il))) 5511 5493 enddo 5512 5494 #endif 5513 5495 ! cam verif 5514 5496 #ifdef ISOVERIF 5515 doixt=1,niso5516 calliso_verif_noNaN(fxt(ixt,il,inb(il)),'cv30_yield 5083')5497 DO ixt=1,niso 5498 CALL iso_verif_noNaN(fxt(ixt,il,inb(il)),'cv30_yield 5083') 5517 5499 enddo 5518 if (iso_eau.gt.0) then5519 calliso_verif_egalite_choix(fxt(iso_eau,il,inb(il)), &5520 &fr(il,inb(il)),'cv30_routines 3638',errmax,errmaxrel)5521 calliso_verif_egalite_choix(fxt(iso_eau,il,inb(il)-1), &5522 &fr(il,inb(il)-1),'cv30_routines 3640',errmax,errmaxrel)5523 endif !if (iso_eau.gt.0) then5524 if ((iso_HDO.gt.0).and. &5525 & (rr(il,inb(il))+delt*fr(il,inb(il)).gt.ridicule)) then5526 calliso_verif_aberrant_encadre( &5527 &(xt(iso_HDO,il,inb(il))+delt*fxt(iso_HDO,il,inb(il))) &5528 &/(rr(il,inb(il))+delt*fr(il,inb(il))), &5529 &'cv30_yield 3921, en inb')5530 if (iso_O18.gt.0) then5531 if(iso_verif_O18_aberrant_nostop( &5532 &(xt(iso_HDO,il,inb(il))+delt*fxt(iso_HDO,il,inb(il))) &5533 &/(rr(il,inb(il))+delt*fr(il,inb(il))), &5534 &(xt(iso_O18,il,inb(il))+delt*fxt(iso_O18,il,inb(il))) &5535 &/(rr(il,inb(il))+delt*fr(il,inb(il))), &5536 & 'cv30_yield 3921O18, en inb').eq.1) then5537 write(*,*) 'il,inb(il)=',il,inb(il)5500 IF (iso_eau.gt.0) THEN 5501 CALL iso_verif_egalite_choix(fxt(iso_eau,il,inb(il)), & 5502 fr(il,inb(il)),'cv30_routines 3638',errmax,errmaxrel) 5503 CALL iso_verif_egalite_choix(fxt(iso_eau,il,inb(il)-1), & 5504 fr(il,inb(il)-1),'cv30_routines 3640',errmax,errmaxrel) 5505 endif !if (iso_eau.gt.0) THEN 5506 IF ((iso_HDO.gt.0).AND. & 5507 (rr(il,inb(il))+delt*fr(il,inb(il)).gt.ridicule)) THEN 5508 CALL iso_verif_aberrant_encadre( & 5509 (xt(iso_HDO,il,inb(il))+delt*fxt(iso_HDO,il,inb(il))) & 5510 /(rr(il,inb(il))+delt*fr(il,inb(il))), & 5511 'cv30_yield 3921, en inb') 5512 IF (iso_O18.gt.0) THEN 5513 IF (iso_verif_O18_aberrant_nostop( & 5514 (xt(iso_HDO,il,inb(il))+delt*fxt(iso_HDO,il,inb(il))) & 5515 /(rr(il,inb(il))+delt*fr(il,inb(il))), & 5516 (xt(iso_O18,il,inb(il))+delt*fxt(iso_O18,il,inb(il))) & 5517 /(rr(il,inb(il))+delt*fr(il,inb(il))), & 5518 'cv30_yield 3921O18, en inb').EQ.1) THEN 5519 WRITE(*,*) 'il,inb(il)=',il,inb(il) 5538 5520 k_tmp=0.1*ment(il,inb(il),inb(il))/(ph(il,inb(il))-ph(il,inb(il)+1)) 5539 write(*,*) 'fr,frprec=',fr(il,inb(il)),fr(il,inb(il))+bx5540 write(*,*) 'M,dt,k_tmp*dt=',k_tmp,delt,k_tmp*delt5541 write(*,*) 'q,qe=',rr(il,inb(il)),qent(il,inb(il),inb(il))5542 write(*,*) 'r=',k_tmp*delt*qent(il,inb(il),inb(il))/rr(il,inb(il))5543 write(*,*) 'deltaDR,Re=',deltaD(xt(iso_HDO,il,inb(il))/rr(il,inb(il))), &5544 & deltaD(xtent(iso_HDO,il,inb(il),inb(il))/qent(il,inb(il),inb(il)))5545 write(*,*) 'deltaO18R,Re=',deltaO(xt(iso_O18,il,inb(il))/rr(il,inb(il))), &5546 & deltaO(xtent(iso_O18,il,inb(il),inb(il))/qent(il,inb(il),inb(il)))5521 WRITE(*,*) 'fr,frprec=',fr(il,inb(il)),fr(il,inb(il))+bx 5522 WRITE(*,*) 'M,dt,k_tmp*dt=',k_tmp,delt,k_tmp*delt 5523 WRITE(*,*) 'q,qe=',rr(il,inb(il)),qent(il,inb(il),inb(il)) 5524 WRITE(*,*) 'r=',k_tmp*delt*qent(il,inb(il),inb(il))/rr(il,inb(il)) 5525 WRITE(*,*) 'deltaDR,Re=',deltaD(xt(iso_HDO,il,inb(il))/rr(il,inb(il))), & 5526 deltaD(xtent(iso_HDO,il,inb(il),inb(il))/qent(il,inb(il),inb(il))) 5527 WRITE(*,*) 'deltaO18R,Re=',deltaO(xt(iso_O18,il,inb(il))/rr(il,inb(il))), & 5528 deltaO(xtent(iso_O18,il,inb(il),inb(il))/qent(il,inb(il),inb(il))) 5547 5529 stop 5548 5530 endif !if (iso_verif_O18_aberrant_nostop 5549 endif !if (iso_O18.gt.0) then5550 endif !if (iso_HDO.gt.0) then5551 if ((iso_HDO.gt.0).and. &5552 & (rr(il,inb(il)-1)+delt*fr(il,inb(il)-1).gt.ridicule)) then5553 calliso_verif_aberrant_encadre( &5554 &(xt(iso_HDO,il,inb(il)-1) &5555 &+delt*fxt(iso_HDO,il,inb(il)-1)) &5556 &/(rr(il,inb(il)-1)+delt*fr(il,inb(il)-1)), &5557 &'cv30_yield 3921b, en inb-1')5558 if (iso_O18.gt.0) then5559 calliso_verif_O18_aberrant( &5560 &(xt(iso_HDO,il,inb(il)-1)+delt*fxt(iso_HDO,il,inb(il)-1)) &5561 &/(rr(il,inb(il)-1)+delt*fr(il,inb(il)-1)), &5562 &(xt(iso_O18,il,inb(il)-1)+delt*fxt(iso_O18,il,inb(il)-1)) &5563 &/(rr(il,inb(il)-1)+delt*fr(il,inb(il)-1)), &5564 &'cv30_yield 3921cO18, en inb-1')5531 endif !if (iso_O18.gt.0) THEN 5532 endif !if (iso_HDO.gt.0) THEN 5533 IF ((iso_HDO.gt.0).AND. & 5534 (rr(il,inb(il)-1)+delt*fr(il,inb(il)-1).gt.ridicule)) THEN 5535 CALL iso_verif_aberrant_encadre( & 5536 (xt(iso_HDO,il,inb(il)-1) & 5537 +delt*fxt(iso_HDO,il,inb(il)-1)) & 5538 /(rr(il,inb(il)-1)+delt*fr(il,inb(il)-1)), & 5539 'cv30_yield 3921b, en inb-1') 5540 IF (iso_O18.gt.0) THEN 5541 CALL iso_verif_O18_aberrant( & 5542 (xt(iso_HDO,il,inb(il)-1)+delt*fxt(iso_HDO,il,inb(il)-1)) & 5543 /(rr(il,inb(il)-1)+delt*fr(il,inb(il)-1)), & 5544 (xt(iso_O18,il,inb(il)-1)+delt*fxt(iso_O18,il,inb(il)-1)) & 5545 /(rr(il,inb(il)-1)+delt*fr(il,inb(il)-1)), & 5546 'cv30_yield 3921cO18, en inb-1') 5565 5547 endif 5566 endif !if (iso_HDO.gt.0) then5548 endif !if (iso_HDO.gt.0) THEN 5567 5549 #ifdef ISOTRAC 5568 calliso_verif_traceur_justmass(fxt(1,il,inb(il)-1), &5569 &'cv30_routine 4364')5570 calliso_verif_traceur_justmass(fxt(1,il,inb(il)), &5571 &'cv30_routine 4364b')5572 doixt=1,ntraciso5550 CALL iso_verif_traceur_justmass(fxt(1,il,inb(il)-1), & 5551 'cv30_routine 4364') 5552 CALL iso_verif_traceur_justmass(fxt(1,il,inb(il)), & 5553 'cv30_routine 4364b') 5554 DO ixt=1,ntraciso 5573 5555 xtnew(ixt)=xt(ixt,il,inb(il))+delt*fxt(ixt,il,inb(il)) 5574 5556 enddo 5575 if(iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 4492',1e-5) &5576 & .eq.1) then5577 write(*,*) 'il,i=',il,i5557 IF (iso_verif_tracpos_choix_nostop(xtnew,'cv30_yield 4492',1e-5) & 5558 .EQ.1) THEN 5559 WRITE(*,*) 'il,i=',il,i 5578 5560 endif 5579 ! calliso_verif_tracpos_choix(xtnew,'cv30_yield 4492',1e-5)5580 #endif 5581 #endif 5582 ! end cam verif 5561 ! CALL iso_verif_tracpos_choix(xtnew,'cv30_yield 4492',1e-5) 5562 #endif 5563 #endif 5564 ! end cam verif 5583 5565 #endif 5584 5566 … … 5608 5590 #ifdef ISO 5609 5591 frsum(il)=0.0 5610 doixt=1,ntraciso5592 DO ixt=1,ntraciso 5611 5593 fxtsum(ixt,il)=0.0 5612 5594 bxtsum(ixt,il)=0.0 … … 5625 5607 dsum(il) = dsum(il) + t(il, i)*(ph(il,i)-ph(il,i+1))/th(il, i) 5626 5608 #ifdef ISO 5627 5609 5628 5610 frsum(il)=frsum(il)+fr(il,i) 5629 doixt=1,ntraciso5611 DO ixt=1,ntraciso 5630 5612 fxtsum(ixt,il)=fxtsum(ixt,il)+fxt(ixt,il,i) 5631 5613 bxtsum(ixt,il)=bxtsum(ixt,il)+fxt(ixt,il,i) & 5632 &*(lv(il,i)+(cl-cpd)*(t(il,i)-t(il,1))) &5633 &*(ph(il,i)-ph(il,i+1))5634 enddo 5614 *(lv(il,i)+(cl-cpd)*(t(il,i)-t(il,1))) & 5615 *(ph(il,i)-ph(il,i+1)) 5616 enddo 5635 5617 #endif 5636 5618 END IF … … 5645 5627 fr(il, i) = bsum(il)/csum(il) 5646 5628 #ifdef ISO 5647 if (abs(csum(il)).gt.0.0) then5648 doixt=1,ntraciso5649 fxt(ixt,il,i)=bxtsum(ixt,il)/csum(il) 5629 IF (abs(csum(il)).gt.0.0) THEN 5630 DO ixt=1,ntraciso 5631 fxt(ixt,il,i)=bxtsum(ixt,il)/csum(il) 5650 5632 enddo 5651 else !if (frsum(il).gt.ridicule) then5652 if (abs(frsum(il)).gt.0.0) then5653 doixt=1,ntraciso5654 fxt(ixt,il,i)=fr(il,i)*fxtsum(ixt,il)/frsum(il) 5655 enddo 5656 else !if (abs(frsum(il)).gt.0.0) then5657 if (abs(fr(il,i))*delt.gt.ridicule) then5658 write(*,*) 'cv30_yield 4048: fr(il,i)=',fr(il,i)5659 stop 5660 else !if (abs(fr(il,i))*delt.gt.ridicule) then5661 doixt=1,ntraciso5633 else !if (frsum(il).gt.ridicule) THEN 5634 IF (abs(frsum(il)).gt.0.0) THEN 5635 DO ixt=1,ntraciso 5636 fxt(ixt,il,i)=fr(il,i)*fxtsum(ixt,il)/frsum(il) 5637 enddo 5638 else !if (abs(frsum(il)).gt.0.0) THEN 5639 IF (abs(fr(il,i))*delt.gt.ridicule) THEN 5640 WRITE(*,*) 'cv30_yield 4048: fr(il,i)=',fr(il,i) 5641 stop 5642 else !if (abs(fr(il,i))*delt.gt.ridicule) THEN 5643 DO ixt=1,ntraciso 5662 5644 fxt(ixt,il,i)=0.0 5663 5645 enddo 5664 if (iso_eau.gt.0) then5646 IF (iso_eau.gt.0) THEN 5665 5647 fxt(iso_eau,il,i)=1.0 5666 5648 endif 5667 endif !if (abs(fr(il,i))*delt.gt.ridicule) then5668 endif !if (abs(frsum(il)).gt.0.0) then5669 endif !if (frsum(il).gt.0) then5649 endif !if (abs(fr(il,i))*delt.gt.ridicule) THEN 5650 endif !if (abs(frsum(il)).gt.0.0) THEN 5651 endif !if (frsum(il).gt.0) THEN 5670 5652 #endif 5671 5653 END IF … … 5676 5658 #ifdef ISO 5677 5659 #ifdef ISOVERIF 5678 doi=1,nl5679 doil=1,ncum5680 doixt=1,ntraciso5681 call iso_verif_noNAN(fxt(ixt,il,i),'cv30_yield 3826')5660 DO i=1,nl 5661 DO il=1,ncum 5662 DO ixt=1,ntraciso 5663 CALL iso_verif_noNAN(fxt(ixt,il,i),'cv30_yield 3826') 5682 5664 enddo 5683 5665 enddo 5684 5666 enddo 5685 #endif 5686 #ifdef ISOVERIF 5687 doi=1,nl5688 ! write(*,*) 'cv30_routines temp 3967: i=',i5689 doil=1,ncum5690 ! write(*,*) 'cv30_routines 3969: il=',il5691 ! write(*,*) 'cv30_routines temp 3967: il,i,inb(il),ncum=',5667 #endif 5668 #ifdef ISOVERIF 5669 DO i=1,nl 5670 ! WRITE(*,*) 'cv30_routines temp 3967: i=',i 5671 DO il=1,ncum 5672 ! WRITE(*,*) 'cv30_routines 3969: il=',il 5673 ! WRITE(*,*) 'cv30_routines temp 3967: il,i,inb(il),ncum=', 5692 5674 ! : il,i,inb(il),ncum 5693 ! write(*,*) 'cv30_routines 3974'5694 if (iso_eau.gt.0) then5695 calliso_verif_egalite_choix(fxt(iso_eau,il,i), &5696 & fr(il,i),'cv30_yield 3830',errmax,errmaxrel)5697 endif !if (iso_eau.gt.0) then5698 ! write(*,*) 'cv30_routines 3979'5699 if ((iso_HDO.gt.0).and. &5700 & (delt*fr(il,i).gt.ridicule)) then5701 if(iso_verif_aberrant_enc_nostop( &5702 &fxt(iso_HDO,il,i)/fr(il,i), &5703 & 'cv30_yield 3834').eq.1) then5704 if (fr(il,i).gt.ridicule*1e5) then5705 write(*,*) 'il,i,icb(il)=',il,i,icb(il)5706 write(*,*) 'frsum(il)=',frsum(il)5707 write(*,*) 'fr(il,i)=',fr(il,i)5708 write(*,*) 'csum(il)=',csum(il)5709 write(*,*) &5710 &'deltaD(bxtsum(iso_HDO,il)/csum(il))=', &5711 & deltaD(bxtsum(iso_HDO,il)/csum(il))5675 ! WRITE(*,*) 'cv30_routines 3974' 5676 IF (iso_eau.gt.0) THEN 5677 CALL iso_verif_egalite_choix(fxt(iso_eau,il,i), & 5678 fr(il,i),'cv30_yield 3830',errmax,errmaxrel) 5679 endif !if (iso_eau.gt.0) THEN 5680 ! WRITE(*,*) 'cv30_routines 3979' 5681 IF ((iso_HDO.gt.0).AND. & 5682 (delt*fr(il,i).gt.ridicule)) THEN 5683 IF (iso_verif_aberrant_enc_nostop( & 5684 fxt(iso_HDO,il,i)/fr(il,i), & 5685 'cv30_yield 3834').EQ.1) THEN 5686 IF (fr(il,i).gt.ridicule*1e5) THEN 5687 WRITE(*,*) 'il,i,icb(il)=',il,i,icb(il) 5688 WRITE(*,*) 'frsum(il)=',frsum(il) 5689 WRITE(*,*) 'fr(il,i)=',fr(il,i) 5690 WRITE(*,*) 'csum(il)=',csum(il) 5691 WRITE(*,*) & 5692 'deltaD(bxtsum(iso_HDO,il)/csum(il))=', & 5693 deltaD(bxtsum(iso_HDO,il)/csum(il)) 5712 5694 ! stop 5713 5695 endif 5714 ! write(*,*) 'cv30_routines 3986: temporaire'5715 endif !if (iso_verif_aberrant_enc_nostop 5716 endif !if (iso_HDO.gt.0) then5717 if ((iso_HDO.gt.0).and. &5718 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then5719 if(iso_verif_aberrant_enc_nostop( &5720 &(xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i)) &5721 &/(rr(il,i)+delt*fr(il,i)),'cv30_yield 3921c, dans la CL') &5722 & .eq.1) then5723 write(*,*) 'il,i,icb(il)=',il,i,icb(il)5724 write(*,*) 'frsum(il)=',frsum(il)5725 write(*,*) 'fr(il,i)=',fr(il,i)5696 ! WRITE(*,*) 'cv30_routines 3986: temporaire' 5697 endif !if (iso_verif_aberrant_enc_nostop 5698 endif !if (iso_HDO.gt.0) THEN 5699 IF ((iso_HDO.gt.0).AND. & 5700 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 5701 IF (iso_verif_aberrant_enc_nostop( & 5702 (xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i)) & 5703 /(rr(il,i)+delt*fr(il,i)),'cv30_yield 3921c, dans la CL') & 5704 .EQ.1) THEN 5705 WRITE(*,*) 'il,i,icb(il)=',il,i,icb(il) 5706 WRITE(*,*) 'frsum(il)=',frsum(il) 5707 WRITE(*,*) 'fr(il,i)=',fr(il,i) 5726 5708 stop 5727 5709 endif 5728 endif !if (iso_HDO.gt.0) then 5729 5730 if ((iso_HDO.gt.0).and.(iso_O18.gt.0).and. & 5731 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then 5732 call iso_verif_O18_aberrant( & 5733 & (xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), & 5734 & (xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i))/(rr(il,i)+delt*fr(il,i)), & 5735 & 'cv30_yield 3921d, dans la CL') 5736 endif !if (iso_HDO.gt.0) then 5710 endif !if (iso_HDO.gt.0) THEN 5711 IF ((iso_HDO.gt.0).AND.(iso_O18.gt.0).AND. & 5712 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 5713 CALL iso_verif_O18_aberrant( & 5714 (xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), & 5715 (xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i))/(rr(il,i)+delt*fr(il,i)), & 5716 'cv30_yield 3921d, dans la CL') 5717 endif !if (iso_HDO.gt.0) THEN 5737 5718 #ifdef ISOTRAC 5738 calliso_verif_traceur_justmass(fxt(1,il,i), &5739 &'cv30_routine 4523')5740 #endif 5741 ! write(*,*) 'cv30_routines 3994'5719 CALL iso_verif_traceur_justmass(fxt(1,il,i), & 5720 'cv30_routine 4523') 5721 #endif 5722 ! WRITE(*,*) 'cv30_routines 3994' 5742 5723 enddo !do il=1,ncum 5743 ! write(*,*) 'cv30_routine 3990: fin des il pour i=',i5724 ! WRITE(*,*) 'cv30_routine 3990: fin des il pour i=',i 5744 5725 enddo !do i=1,nl 5745 ! write(*,*) 'cv30_routine 3990: fin des verifs sur homogen'5726 ! WRITE(*,*) 'cv30_routine 3990: fin des verifs sur homogen' 5746 5727 #endif 5747 5728 5748 5729 #ifdef ISOVERIF 5749 5730 ! verif finale des tendances: 5750 doi=1,nl5751 doil=1,ncum5752 if (iso_eau.gt.0) then5753 calliso_verif_egalite_choix(fxt(iso_eau,il,i), &5754 & fr(il,i),'cv30_yield 3830',errmax,errmaxrel)5755 endif !if (iso_eau.gt.0) then5756 if ((iso_HDO.gt.0).and. &5757 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then5758 calliso_verif_aberrant_encadre((xt(iso_HDO,il,i) &5759 &+delt*fxt(iso_HDO,il,i)) &5760 &/(rr(il,i)+delt*fr(il,i)), &5761 &'cv30_yield 5710a, final')5762 endif !if (iso_HDO.gt.0) then5763 if ((iso_HDO.gt.0).and.(iso_O18.gt.0).and. &5764 & (rr(il,i)+delt*fr(il,i).gt.ridicule)) then5765 calliso_verif_O18_aberrant( &5766 &(xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), &5767 &(xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i))/(rr(il,i)+delt*fr(il,i)), &5768 &'cv30_yield 5710b, final')5769 endif !if (iso_HDO.gt.0) then5731 DO i=1,nl 5732 DO il=1,ncum 5733 IF (iso_eau.gt.0) THEN 5734 CALL iso_verif_egalite_choix(fxt(iso_eau,il,i), & 5735 fr(il,i),'cv30_yield 3830',errmax,errmaxrel) 5736 endif !if (iso_eau.gt.0) THEN 5737 IF ((iso_HDO.gt.0).AND. & 5738 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 5739 CALL iso_verif_aberrant_encadre((xt(iso_HDO,il,i) & 5740 +delt*fxt(iso_HDO,il,i)) & 5741 /(rr(il,i)+delt*fr(il,i)), & 5742 'cv30_yield 5710a, final') 5743 endif !if (iso_HDO.gt.0) THEN 5744 IF ((iso_HDO.gt.0).AND.(iso_O18.gt.0).AND. & 5745 (rr(il,i)+delt*fr(il,i).gt.ridicule)) THEN 5746 CALL iso_verif_O18_aberrant( & 5747 (xt(iso_HDO,il,i)+delt*fxt(iso_HDO,il,i))/(rr(il,i)+delt*fr(il,i)), & 5748 (xt(iso_O18,il,i)+delt*fxt(iso_O18,il,i))/(rr(il,i)+delt*fr(il,i)), & 5749 'cv30_yield 5710b, final') 5750 endif !if (iso_HDO.gt.0) THEN 5770 5751 enddo !do il=1,ncum 5771 5752 enddo !do i=1,nl … … 5835 5816 DO k = i, nl 5836 5817 DO il = 1, ncum 5837 ! test if (i.ge.icb(il). and.i.le.inb(il).and.k.le.inb(il))5838 ! then5818 ! test if (i.ge.icb(il).AND.i.le.inb(il).AND.k.le.inb(il)) 5819 ! THEN 5839 5820 IF (i<=inb(il) .AND. k<=inb(il)) THEN 5840 5821 upwd(il, i) = upwd(il, i) + m(il, k) + up1(il, k, i) … … 5933 5914 ! *** diagnose the in-cloud mixing ratio *** ! cld 5934 5915 ! *** of condensed water *** ! cld 5935 ! !cld5916 ! cld 5936 5917 5937 5918 DO i = 1, nd ! cld … … 5992 5973 END DO ! cld 5993 5974 5994 RETURN 5975 5995 5976 END SUBROUTINE cv30_yield 5996 5977 5997 ! !RomP >>>5978 !RomP >>> 5998 5979 SUBROUTINE cv30_tracer(nloc, len, ncum, nd, na, ment, sij, da, phi, phi2, & 5999 5980 d1a, dam, ep, vprecip, elij, clw, epmlmmm, eplamm, icb, inb) 6000 5981 IMPLICIT NONE 6001 5982 6002 include "cv30param.h" 5983 6003 5984 6004 5985 ! inputs: … … 6053 6034 DO i = 1, ncum 6054 6035 IF (k>=icb(i) .AND. k<=inb(i) .AND. j<=inb(i)) THEN 6055 ! !jyg epm(i,j,k)=1.-(1.-ep(i,j))*clw(i,j)/elij(i,k,j)6036 !jyg epm(i,j,k)=1.-(1.-ep(i,j))*clw(i,j)/elij(i,k,j) 6056 6037 epm(i, j, k) = 1. - (1.-ep(i,j))*clw(i, j)/max(elij(i,k,j), 1.E-16) 6057 ! ! 6038 6058 6039 epm(i, j, k) = max(epm(i,j,k), 0.0) 6059 6040 END IF … … 6104 6085 END DO 6105 6086 6106 RETURN 6087 6107 6088 END SUBROUTINE cv30_tracer 6108 6089 ! RomP <<< … … 6116 6097 elij1, clw1, epmlmmm1, eplamm1, wdtraina1, wdtrainm1,epmax_diag1 & ! epmax_cape 6117 6098 #ifdef ISO 6118 &,xtprecip,fxt,xtVPrecip,xtevap,xtclw,xtwdtraina &6119 &,xtprecip1,fxt1,xtVPrecip1,xtevap1,xtclw1,xtwdtraina1 &6099 ,xtprecip,fxt,xtVPrecip,xtevap,xtclw,xtwdtraina & 6100 ,xtprecip1,fxt1,xtVPrecip1,xtevap1,xtclw1,xtwdtraina1 & 6120 6101 #ifdef DIAGISO 6121 &, water,xtwater,qp,xtp &6122 &, fq_detrainement,fq_ddft,fq_fluxmasse,fq_evapprecip &6123 &, fxt_detrainement,fxt_ddft,fxt_fluxmasse, fxt_evapprecip &6124 &, f_detrainement,q_detrainement,xt_detrainement &6125 &, water1,xtwater1,qp1,xtp1 &6126 &, fq_detrainement1,fq_ddft1,fq_fluxmasse1,fq_evapprecip1 &6127 &, fxt_detrainement1,fxt_ddft1,fxt_fluxmasse1, fxt_evapprecip1 &6128 &, f_detrainement1,q_detrainement1,xt_detrainement1 &6129 #endif 6130 #endif 6131 &)6132 6133 #ifdef ISO 6134 useinfotrac_phy, ONLY: ntraciso=>ntiso6135 #ifdef ISOVERIF 6136 useisotopes_verif_mod, ONLY: Tmin_verif,iso_verif_aberrant, &6102 , water,xtwater,qp,xtp & 6103 , fq_detrainement,fq_ddft,fq_fluxmasse,fq_evapprecip & 6104 , fxt_detrainement,fxt_ddft,fxt_fluxmasse, fxt_evapprecip & 6105 , f_detrainement,q_detrainement,xt_detrainement & 6106 , water1,xtwater1,qp1,xtp1 & 6107 , fq_detrainement1,fq_ddft1,fq_fluxmasse1,fq_evapprecip1 & 6108 , fxt_detrainement1,fxt_ddft1,fxt_fluxmasse1, fxt_evapprecip1 & 6109 , f_detrainement1,q_detrainement1,xt_detrainement1 & 6110 #endif 6111 #endif 6112 ) 6113 6114 #ifdef ISO 6115 USE infotrac_phy, ONLY: ntraciso=>ntiso 6116 #ifdef ISOVERIF 6117 USE isotopes_verif_mod, ONLY: Tmin_verif,iso_verif_aberrant, & 6137 6118 iso_verif_egalite,iso_verif_egalite_choix_nostop,iso_verif_positif_nostop, & 6138 6119 iso_verif_egalite_nostop,iso_verif_aberrant_nostop,deltaD,iso_verif_noNaN_nostop, & … … 6142 6123 IMPLICIT NONE 6143 6124 6144 include "cv30param.h" 6125 6145 6126 6146 6127 ! inputs: … … 6172 6153 REAL xtprecip(ntraciso,nloc) 6173 6154 REAL xtvprecip(ntraciso,nloc, nd+1), xtevap(ntraciso,nloc, nd) 6174 realfxt(ntraciso,nloc,nd)6175 realxtclw(ntraciso,nloc,nd)6155 REAL fxt(ntraciso,nloc,nd) 6156 REAL xtclw(ntraciso,nloc,nd) 6176 6157 REAL xtwdtraina(ntraciso,nloc, nd) 6177 6158 #endif … … 6201 6182 ! RomP <<< 6202 6183 #ifdef ISO 6203 realxtprecip1(ntraciso,len)6204 realfxt1(ntraciso,len,nd)6205 realxtVPrecip1(ntraciso,len,nd+1),xtevap1(ntraciso,len, nd)6184 REAL xtprecip1(ntraciso,len) 6185 REAL fxt1(ntraciso,len,nd) 6186 REAL xtVPrecip1(ntraciso,len,nd+1),xtevap1(ntraciso,len, nd) 6206 6187 REAL xtwdtraina1(ntraciso,len, nd) 6207 6188 REAL xtclw1(ntraciso,len, nd) … … 6211 6192 INTEGER i, k, j 6212 6193 #ifdef ISO 6213 integerixt6194 INTEGER ixt 6214 6195 #endif 6215 6196 6216 6197 #ifdef DIAGISO 6217 realwater(nloc,nd)6218 realxtwater(ntraciso,nloc,nd)6219 realqp(nloc,nd),xtp(ntraciso,nloc,nd)6220 realfq_detrainement(nloc,nd)6221 realf_detrainement(nloc,nd)6222 realq_detrainement(nloc,nd)6223 realfq_ddft(nloc,nd)6224 realfq_fluxmasse(nloc,nd)6225 realfq_evapprecip(nloc,nd)6226 realfxt_detrainement(ntraciso,nloc,nd)6227 realxt_detrainement(ntraciso,nloc,nd)6228 realfxt_ddft(ntraciso,nloc,nd)6229 realfxt_fluxmasse(ntraciso,nloc,nd)6230 realfxt_evapprecip(ntraciso,nloc,nd)6231 6232 realwater1(len,nd)6233 realxtwater1(ntraciso,len,nd)6234 realqp1(len,nd),xtp1(ntraciso,len,nd)6235 realfq_detrainement1(len,nd)6236 realf_detrainement1(len,nd)6237 realq_detrainement1(len,nd)6238 realfq_ddft1(len,nd)6239 realfq_fluxmasse1(len,nd)6240 realfq_evapprecip1(len,nd)6241 realfxt_detrainement1(ntraciso,len,nd)6242 realxt_detrainement1(ntraciso,len,nd)6243 realfxt_ddft1(ntraciso,len,nd)6244 realfxt_fluxmasse1(ntraciso,len,nd)6245 realfxt_evapprecip1(ntraciso,len,nd)6246 #endif 6247 6248 #ifdef ISOVERIF 6249 write(*,*) 'cv30_routines 4293: entree dans cv3_uncompress'6198 REAL water(nloc,nd) 6199 REAL xtwater(ntraciso,nloc,nd) 6200 REAL qp(nloc,nd),xtp(ntraciso,nloc,nd) 6201 REAL fq_detrainement(nloc,nd) 6202 REAL f_detrainement(nloc,nd) 6203 REAL q_detrainement(nloc,nd) 6204 REAL fq_ddft(nloc,nd) 6205 REAL fq_fluxmasse(nloc,nd) 6206 REAL fq_evapprecip(nloc,nd) 6207 REAL fxt_detrainement(ntraciso,nloc,nd) 6208 REAL xt_detrainement(ntraciso,nloc,nd) 6209 REAL fxt_ddft(ntraciso,nloc,nd) 6210 REAL fxt_fluxmasse(ntraciso,nloc,nd) 6211 REAL fxt_evapprecip(ntraciso,nloc,nd) 6212 6213 REAL water1(len,nd) 6214 REAL xtwater1(ntraciso,len,nd) 6215 REAL qp1(len,nd),xtp1(ntraciso,len,nd) 6216 REAL fq_detrainement1(len,nd) 6217 REAL f_detrainement1(len,nd) 6218 REAL q_detrainement1(len,nd) 6219 REAL fq_ddft1(len,nd) 6220 REAL fq_fluxmasse1(len,nd) 6221 REAL fq_evapprecip1(len,nd) 6222 REAL fxt_detrainement1(ntraciso,len,nd) 6223 REAL xt_detrainement1(ntraciso,len,nd) 6224 REAL fxt_ddft1(ntraciso,len,nd) 6225 REAL fxt_fluxmasse1(ntraciso,len,nd) 6226 REAL fxt_evapprecip1(ntraciso,len,nd) 6227 #endif 6228 6229 #ifdef ISOVERIF 6230 WRITE(*,*) 'cv30_routines 4293: entree dans cv3_uncompress' 6250 6231 #endif 6251 6232 DO i = 1, ncum … … 6257 6238 epmax_diag1(idcum(i))=epmax_diag(i) ! epmax_cape 6258 6239 #ifdef ISO 6259 doixt = 1, ntraciso6240 DO ixt = 1, ntraciso 6260 6241 xtprecip1(ixt,idcum(i))=xtprecip(ixt,i) 6261 6242 enddo … … 6290 6271 ! RomP <<< 6291 6272 #ifdef ISO 6292 doixt = 1, ntraciso6273 DO ixt = 1, ntraciso 6293 6274 fxt1(ixt,idcum(i),k)=fxt(ixt,i,k) 6294 6275 xtVPrecip1(ixt,idcum(i),k)=xtVPrecip(ixt,i,k) … … 6309 6290 6310 6291 #ifdef ISO 6311 #ifdef DIAGISO 6312 dok=1,nl6313 do i=1,ncum6292 #ifdef DIAGISO 6293 DO k=1,nl 6294 DO i=1,ncum 6314 6295 water1(idcum(i),k)=water(i,k) 6315 6296 qp1(idcum(i),k)=qp(i,k) … … 6321 6302 fq_evapprecip1(idcum(i),k)=fq_evapprecip(i,k) 6322 6303 fq_fluxmasse1(idcum(i),k)=fq_fluxmasse(i,k) 6323 doixt = 1, ntraciso6304 DO ixt = 1, ntraciso 6324 6305 xtwater1(ixt,idcum(i),k)=xtwater(ixt,i,k) 6325 6306 xtp1(ixt,idcum(i),k)=xtp(ixt,i,k) … … 6332 6313 enddo 6333 6314 enddo 6334 do i=1,ncum6315 DO i=1,ncum 6335 6316 epmax_diag1(idcum(i))=epmax_diag(i) 6336 6317 enddo … … 6358 6339 END DO 6359 6340 6360 RETURN 6341 6361 6342 END SUBROUTINE cv30_uncompress 6362 6343 6363 subroutinecv30_epmax_fn_cape(nloc,ncum,nd &6344 SUBROUTINE cv30_epmax_fn_cape(nloc,ncum,nd & 6364 6345 ,cape,ep,hp,icb,inb,clw,nk,t,h,lv & 6365 6346 ,epmax_diag) 6366 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 6367 , clmci, eps, epsi, epsim1, ginv, hrd, grav 6368 implicit none 6347 USE conema3_mod_h 6348 USE cvthermo_mod_h 6349 6350 IMPLICIT NONE 6369 6351 6370 6352 ! On fait varier epmax en fn de la cape … … 6373 6355 ! Toutes les autres variables fn de ep sont calculees plus bas. 6374 6356 6375 INCLUDE "cv30param.h"6376 INCLUDE "conema3.h"6377 6378 6357 ! inputs: 6379 integerncum, nd, nloc6380 integericb(nloc), inb(nloc)6381 realcape(nloc)6382 realclw(nloc,nd),lv(nloc,nd),t(nloc,nd),h(nloc,nd)6383 integernk(nloc)6358 INTEGER ncum, nd, nloc 6359 INTEGER icb(nloc), inb(nloc) 6360 REAL cape(nloc) 6361 REAL clw(nloc,nd),lv(nloc,nd),t(nloc,nd),h(nloc,nd) 6362 INTEGER nk(nloc) 6384 6363 ! inouts: 6385 realep(nloc,nd)6386 realhp(nloc,nd)6364 REAL ep(nloc,nd) 6365 REAL hp(nloc,nd) 6387 6366 ! outputs ou local 6388 realepmax_diag(nloc)6367 REAL epmax_diag(nloc) 6389 6368 ! locals 6390 integer i,k6391 realhp_bak(nloc,nd)6369 INTEGER i,k 6370 REAL hp_bak(nloc,nd) 6392 6371 CHARACTER (LEN=20) :: modname='cv30_epmax_fn_cape' 6393 6372 CHARACTER (LEN=80) :: abort_message 6394 6373 6395 6374 ! on recalcule ep et hp 6396 6397 if (coef_epmax_cape.gt.1e-12) then6398 doi=1,ncum6375 6376 IF (coef_epmax_cape.gt.1e-12) THEN 6377 DO i=1,ncum 6399 6378 epmax_diag(i)=epmax-coef_epmax_cape*sqrt(cape(i)) 6400 dok=1,nl6379 DO k=1,nl 6401 6380 ep(i,k)=ep(i,k)/epmax*epmax_diag(i) 6402 6381 ep(i,k)=amax1(ep(i,k),0.0) … … 6406 6385 6407 6386 ! On recalcule hp: 6408 dok=1,nl6409 doi=1,ncum6410 6411 6387 DO k=1,nl 6388 DO i=1,ncum 6389 hp_bak(i,k)=hp(i,k) 6390 enddo 6412 6391 enddo 6413 dok=1,nlp6414 doi=1,ncum6415 6416 6392 DO k=1,nlp 6393 DO i=1,ncum 6394 hp(i,k)=h(i,k) 6395 enddo 6417 6396 enddo 6418 dok=minorig+1,nl6419 doi=1,ncum6420 if((k.ge.icb(i)).and.(k.le.inb(i)))then6397 DO k=minorig+1,nl 6398 DO i=1,ncum 6399 IF((k.ge.icb(i)).AND.(k.le.inb(i)))THEN 6421 6400 hp(i,k)=h(i,nk(i))+(lv(i,k)+(cpd-cpv)*t(i,k))*ep(i,k)*clw(i,k) 6422 6401 endif 6423 6402 enddo 6424 6403 enddo !do k=minorig+1,n 6425 ! write(*,*) 'cv30_routines 6218: hp(1,20)=',hp(1,20)6426 do i=1,ncum6427 dok=1,nl6428 if (abs(hp_bak(i,k)-hp(i,k)).gt.0.01) then6429 write(*,*) 'i,k=',i,k6430 write(*,*) 'coef_epmax_cape=',coef_epmax_cape6431 write(*,*) 'epmax_diag(i)=',epmax_diag(i)6432 write(*,*) 'ep(i,k)=',ep(i,k)6433 write(*,*) 'hp(i,k)=',hp(i,k)6434 write(*,*) 'hp_bak(i,k)=',hp_bak(i,k)6435 write(*,*) 'h(i,k)=',h(i,k)6436 write(*,*) 'nk(i)=',nk(i)6437 write(*,*) 'h(i,nk(i))=',h(i,nk(i))6438 write(*,*) 'lv(i,k)=',lv(i,k)6439 write(*,*) 't(i,k)=',t(i,k)6440 write(*,*) 'clw(i,k)=',clw(i,k)6441 write(*,*) 'cpd,cpv=',cpd,cpv6404 ! WRITE(*,*) 'cv30_routines 6218: hp(1,20)=',hp(1,20) 6405 DO i=1,ncum 6406 DO k=1,nl 6407 IF (abs(hp_bak(i,k)-hp(i,k)).gt.0.01) THEN 6408 WRITE(*,*) 'i,k=',i,k 6409 WRITE(*,*) 'coef_epmax_cape=',coef_epmax_cape 6410 WRITE(*,*) 'epmax_diag(i)=',epmax_diag(i) 6411 WRITE(*,*) 'ep(i,k)=',ep(i,k) 6412 WRITE(*,*) 'hp(i,k)=',hp(i,k) 6413 WRITE(*,*) 'hp_bak(i,k)=',hp_bak(i,k) 6414 WRITE(*,*) 'h(i,k)=',h(i,k) 6415 WRITE(*,*) 'nk(i)=',nk(i) 6416 WRITE(*,*) 'h(i,nk(i))=',h(i,nk(i)) 6417 WRITE(*,*) 'lv(i,k)=',lv(i,k) 6418 WRITE(*,*) 't(i,k)=',t(i,k) 6419 WRITE(*,*) 'clw(i,k)=',clw(i,k) 6420 WRITE(*,*) 'cpd,cpv=',cpd,cpv 6442 6421 CALL abort_physic(modname,abort_message,0) 6443 6422 endif 6444 6423 enddo !do k=1,nl 6445 enddo !do i=1,ncum 6446 endif !if (coef_epmax_cape.gt.1e-12) then 6447 6448 return 6449 end subroutine cv30_epmax_fn_cape 6450 6451 6424 enddo !do i=1,ncum 6425 endif !if (coef_epmax_cape.gt.1e-12) THEN 6426 END SUBROUTINE cv30_epmax_fn_cape 6427 6428 6429 6430 6431 6432 6433 END MODULE cv30_routines_mod 6434 6435 -
LMDZ6/trunk/libf/phylmdiso/cv3_routines.F90
r5276 r5283 11 11 USE ioipsl_getin_p_mod, ONLY : getin_p 12 12 use mod_phys_lmdz_para 13 13 USE conema3_mod_h 14 14 IMPLICIT NONE 15 15 … … 38 38 39 39 include "cv3param.h" 40 include "conema3.h"41 40 42 41 INTEGER, INTENT(IN) :: nd … … 1493 1492 USE cvflag_mod_h, ONLY: icvflag_Tpa, cvflag_grav, cvflag_ice, ok_optim_yield, ok_entrain, ok_homo_tend, & 1494 1493 ok_convstop, ok_intermittent, cvflag_prec_eject, qsat_depends_on_qt, adiab_ascent_mass_flux_depends_on_ejectliq, keepbug_ice_frac 1494 USE conema3_mod_h 1495 1495 IMPLICIT NONE 1496 1496 … … 1514 1514 1515 1515 include "cv3param.h" 1516 include "conema3.h"1517 1516 include "YOMCST2.h" 1518 1517 … … 4734 4733 #endif 4735 4734 #endif 4736 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 4735 USE conema3_mod_h 4736 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 4737 4737 , clmci, eps, epsi, epsim1, ginv, hrd, grav 4738 4738 USE cvflag_mod_h, ONLY: icvflag_Tpa, cvflag_grav, cvflag_ice, ok_optim_yield, ok_entrain, ok_homo_tend, & … … 4741 4741 4742 4742 include "cv3param.h" 4743 include "conema3.h"4744 4743 4745 4744 !inputs: … … 7625 7624 , pbase, p, ph, tv, buoy, sig, w0,iflag & 7626 7625 , epmax_diag) 7627 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 7626 USE conema3_mod_h 7627 USE cvthermo_mod_h, ONLY: cpd, cpv, cl, ci, rrv, rrd, lv0, lf0, g, rowl, t0, clmcpv, clmcpd, cpdmcp, cpvmcpd, cpvmcl & 7628 7628 , clmci, eps, epsi, epsim1, ginv, hrd, grav 7629 7629 USE cvflag_mod_h, ONLY: icvflag_Tpa, cvflag_grav, cvflag_ice, ok_optim_yield, ok_entrain, ok_homo_tend, & … … 7637 7637 7638 7638 include "cv3param.h" 7639 include "conema3.h"7640 7639 7641 7640 ! inputs: -
LMDZ6/trunk/libf/phylmdiso/cv_driver.F90
r5276 r5283 42 42 #endif 43 43 #endif 44 USE cv30_routines_mod, ONLY: cv30_param, cv30_prelim, cv30_feed, cv30_undilute1, cv30_trigger, cv30_compress, cv30_undilute2, & 45 cv30_closure, cv30_epmax_fn_cape, cv30_mixing, cv30_unsat, cv30_yield, cv30_tracer, cv30_uncompress 44 46 IMPLICIT NONE 45 47 -
LMDZ6/trunk/libf/phylmdiso/physiq_mod.F90
r5282 r5283 444 444 , RALPD, RBETD, RGAMD 445 445 USE clesphys_mod_h 446 USE conema3_mod_h 446 447 447 448 IMPLICIT NONE … … 1295 1296 include "FCTTRE.h" 1296 1297 !IM 100106 BEG : pouvoir sortir les ctes de la physique 1297 include "conema3.h"1298 1298 include "nuage.h" 1299 1299 include "compbl.h"
Note: See TracChangeset
for help on using the changeset viewer.