Changeset 2045 for LMDZ5/trunk/libf/dyn3d_common
- Timestamp:
- May 18, 2014, 2:25:39 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/trunk/libf/dyn3d_common/disvert.F90
r2040 r2045 43 43 INTEGER l, unit 44 44 REAL dsigmin 45 REAL vert_scale,vert_dzmin,vert_dzlow,vert_z0low,vert_dzmid,vert_z0mid,vert_h_mid,vert_dzhig,vert_z0hig,vert_h_hig 46 45 47 REAL alpha, beta, deltaz 46 48 REAL x … … 154 156 ap(1)=0. 155 157 ap(2: llm + 1) = pa * (sig(2: llm + 1) - bp(2: llm + 1)) 156 CASE("strato_custom") 158 case("strato_correct") 159 !================================================================== 160 ! Fredho 2014/05/18, Saint-Louis du Senegal 161 ! Cette version de la discretisation strato est corrige au niveau 162 ! du passage des sig aux ap, bp 163 ! la version precedente donne un coude dans l'epaisseur des couches 164 ! vers la tropopause 165 !================================================================== 166 167 168 DO l = 1, llm 169 x = 2*asin(1.) * (l - 0.5) / (llm + 1) 170 dsig(l) =(dsigmin + 7. * SIN(x)**2) & 171 *(0.5*(1.-tanh(1.*(x-asin(1.))/asin(1.))))**2 172 ENDDO 173 dsig = dsig / sum(dsig) 174 sig0(llm+1) = 0. 175 DO l = llm, 1, -1 176 sig0(l) = sig0(l+1) + dsig(l) 177 ENDDO 178 sig=racinesig(sig0) 179 180 bp(1)=1. 181 bp(2:llm)=EXP(1.-1./sig(2: llm)**2) 182 bp(llmp1)=0. 183 184 ap(1)=0. 185 ap(2:llm)=pa*(sig(2:llm)-bp(2:llm)) 186 ap(llm+1)=0. 187 188 CASE("strato_custom0") 189 !======================================================= 190 ! Version Transitoire 157 191 ! custumize strato distribution with specific alpha & beta values and function 158 192 ! depending on llm (experimental and temporary)! … … 198 232 ENDIF ! of IF (llm==55.OR.llm==63) ... 199 233 234 200 235 ! Build sigma distribution 201 236 sig0=EXP(-zz(:)/scaleheight) 202 237 sig0(llm+1)=0. 203 sig=ridders(sig0) 238 ! sig=ridders(sig0) 239 sig=racinesig(sig0) 204 240 205 241 ! Compute ap() and bp() 242 bp(1)=1. 243 bp(2:llm)=EXP(1.-1./sig(2:llm)**2) 244 bp(llm+1)=0. 245 ap=pa*(sig-bp) 246 247 CASE("strato_custom") 248 !=================================================================== 249 ! David Cugnet, François Lott, Lionel Guez, Ehouoarn Millour, Fredho 250 ! 2014/05 251 ! custumize strato distribution 252 ! Al the parameter are given in km assuming a given scalehigh 253 vert_scale=7. ! scale hight 254 vert_dzmin=0.02 ! width of first layer 255 vert_dzlow=1. ! dz in the low atmosphere 256 vert_z0low=8. ! height at which resolution recches dzlow 257 vert_dzmid=3. ! dz in the mid atmsophere 258 vert_z0mid=70. ! height at which resolution recches dzmid 259 vert_h_mid=20. ! width of the transition 260 vert_dzhig=11. ! dz in the high atmsophere 261 vert_z0hig=80. ! height at which resolution recches dz 262 vert_h_hig=20. ! width of the transition 263 !=================================================================== 264 265 call getin('vert_scale',vert_scale) 266 call getin('vert_dzmin',vert_dzmin) 267 call getin('vert_dzlow',vert_dzlow) 268 call getin('vert_z0low',vert_z0low) 269 CALL getin('vert_dzmid',vert_dzmid) 270 CALL getin('vert_z0mid',vert_z0mid) 271 call getin('vert_h_mid',vert_h_mid) 272 call getin('vert_dzhig',vert_dzhig) 273 call getin('vert_z0hig',vert_z0hig) 274 call getin('vert_h_hig',vert_h_hig) 275 276 scaleheight=vert_scale ! for consistency with further computations 277 ! Build geometrical distribution 278 zz(1)=0. 279 DO l=1,llm 280 z=zz(l) 281 zz(l+1)=zz(l)+vert_dzmin+vert_dzlow*TANH(z/vert_z0low)+ & 282 & (vert_dzmid-vert_dzlow)* & 283 & (TANH((z-vert_z0mid)/vert_h_mid)-TANH((-vert_z0mid)/vert_h_mid)) & 284 & +(vert_dzhig-vert_dzmid-vert_dzlow)* & 285 & (TANH((z-vert_z0hig)/vert_h_hig)-TANH((-vert_z0hig)/vert_h_hig)) 286 ENDDO 287 288 289 !=================================================================== 290 ! Comment added Fredho 2014/05/18, Saint-Louis, Senegal 291 ! From approximate z to ap, bp, so that p=ap+bp*p0 and p/p0=exp(-z/H) 292 ! sig0 is p/p0 293 ! sig is an intermediate distribution introduce to estimate bp 294 ! 1. sig0=exp(-z/H) 295 ! 2. inversion of sig0=(1-pa/p0)*sig+(1-pa/p0)*exp(1-1/sig**2) 296 ! 3. bp=exp(1-1/sig**2) 297 ! 4. ap deduced from the combination of 2 and 3 so that sig0=ap/p0+bp 298 !=================================================================== 299 300 sig0=EXP(-zz(:)/vert_scale) 301 sig0(llm+1)=0. 302 sig=racinesig(sig0) 206 303 bp(1)=1. 207 304 bp(2:llm)=EXP(1.-1./sig(2:llm)**2) … … 304 401 END FUNCTION ridders 305 402 403 FUNCTION racinesig(sig) RESULT(sg) 404 ! 405 !------------------------------------------------------------------------------- 406 IMPLICIT NONE 407 !------------------------------------------------------------------------------- 408 ! Fredho 2014/05/18 409 ! Purpose: Search for s solving (Pa/Preff)*sg+(1-Pa/Preff)*EXP(1-1./sg**2)=s 410 ! Notes: Uses Newton Raphson search 411 !------------------------------------------------------------------------------- 412 ! Arguments: 413 REAL, INTENT(IN) :: sig(:) 414 REAL :: sg(SIZE(sig)) 415 !------------------------------------------------------------------------------- 416 ! Local variables: 417 INTEGER :: it, ns, maxit 418 REAL :: c1, c2, x1, x2, x3, x4, f1, f2, f3, f4, s, xx, distrib 419 !------------------------------------------------------------------------------- 420 ns=SIZE(sig); maxit=100 421 c1=Pa/Preff; c2=1.-c1 422 DO l=2,ns-1 423 sg(l)=sig(l) 424 DO it=1,maxit 425 f1=exp(1-1./sg(l)**2)*(1.-c1) 426 sg(l)=sg(l)-(c1*sg(l)+f1-sig(l))/(c1+2*f1*sg(l)**(-3)) 427 ENDDO 428 ! print*,'SSSSIG ',sig(l),sg(l),c1*sg(l)+exp(1-1./sg(l)**2)*(1.-c1) 429 ENDDO 430 sg(1)=1.; sg(ns)=0. 431 432 END FUNCTION racinesig 433 434 435 436 306 437 END SUBROUTINE disvert 307 438
Note: See TracChangeset
for help on using the changeset viewer.