Changeset 430


Ignore:
Timestamp:
2011-08-31T12:17:34+02:00 (13 years ago)
Author:
didier.solyga
Message:

Replace 0.0 by zero and the physical constants by the values used in constantes.f90

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ORCHIDEE_EXT/ORCHIDEE_OL/weather.f90

    r424 r430  
    103103!  
    104104  REAL,PARAMETER :: pir = pi/180. 
    105  
     105  REAL,PARAMETER ::  rair = 287. 
    106106!- 
    107107! Parametres orbitaux: 
     
    217217! daily average temperature (K) 
    218218  REAL :: td(npoi) 
    219   REAL,PARAMETER ::  rair = 287. 
     219!!$  REAL,PARAMETER ::  rair = 287. 
    220220!>> The two following parameters are replaced by the values used by ORCHIDEE in constantes.f90 
    221221  ! grav by cte_grav= 9.80665 
     
    288288      STOP  
    289289    ENDIF 
    290     xstore(:,:) = 0. 
     290    xstore(:,:) = zero 
    291291    npoi0 = npoi 
    292292  ELSE IF (npoi /= npoi0) THEN 
     
    432432!------ initialize daily precipitation to zero 
    433433!------- 
    434         precip(i) = 0.0 
     434        precip(i) = zero 
    435435!------- 
    436436        IF (xinprec(i,imonth) > 1.e-6) THEN 
     
    509509      CALL bcast(count_not_ok_g) 
    510510!- 
    511       z(:)=0.0 
     511      z(:) = zero 
    512512      DO WHILE (count_not_ok_g > 0) 
    513513        IF (is_root_prc) THEN 
     
    520520        DO i=1,npoi 
    521521          IF ((iwet(i) == 1).AND.(not_ok(i) == 1)) then 
    522             IF ( (rn1-tr1(i)) <= 0. ) THEN 
    523               s1 = 0.0 
     522            IF ( (rn1-tr1(i)) <= zero ) THEN 
     523              s1 = zero 
    524524            ELSE 
    525525              s1 = rn1**aa(i) 
    526526            ENDIF 
    527527!----------- 
    528             IF ((rn2-tr2(i)) <= 0.) THEN 
    529               s2 = 0.0 
     528            IF ((rn2-tr2(i)) <= zero) THEN 
     529              s2 = zero 
    530530            ELSE 
    531531              s2 = rn2**ab(i) 
     
    533533!----------- 
    534534            s12 = s1+s2 
    535             IF ((s12-1.0) <= 0.) THEN 
     535            IF ((s12-1.0) <= zero) THEN 
    536536              z(i) = s1/s12 
    537537              not_ok(i) = 0 
     
    616616 &                   /REAL(NINT(MAX(1.,xinwet(i,imonth)))) 
    617617        ELSE 
    618           precip(i) = 0. 
     618          precip(i) = zero 
    619619        ENDIF 
    620620      ENDDO 
     
    638638!---- modify maximum temperatures for wet and dry days 
    639639!----- 
    640       IF (pwet(i) /= 0.0) THEN 
     640      IF (pwet(i) /= zero) THEN 
    641641        tmaxd = tmaxm+pwet(i)*omtmax*trngm 
    642642        tmaxw = tmaxd-        omtmax*trngm 
     
    707707!---- following logic of the EPIC weather generator code 
    708708!----- 
    709       IF (pwet(i) /= 0.0) THEN 
    710         cloudd = (cloudm-pwet(i)*omcloud)/(1.0-pwet(i)*omcloud) 
    711         cloudd = MIN(1.0,MAX(0.0,cloudd)) 
    712         cloudw = (cloudm-(1.0-pwet(i))*cloudd)/pwet(i) 
     709      IF (pwet(i) /= zero) THEN 
     710        cloudd = (cloudm-pwet(i)*omcloud)/(un-pwet(i)*omcloud) 
     711        cloudd = MIN(un,MAX(zero,cloudd)) 
     712        cloudw = (cloudm-(un-pwet(i))*cloudd)/pwet(i) 
    713713      ELSE 
    714714        cloudd = cloudm 
     
    758758!-- zero out vectors 
    759759!--- 
    760     r(1:3)  = 0.0 
    761     rr(1:npoi,1:3) = 0.0 
     760    r(1:3)  = zero 
     761    rr(1:npoi,1:3) = zero 
    762762!--- 
    763763!-- update working vectors 
     
    804804      cloud(i) = cloude(i)+clouds(i)*xstore(i,3) 
    805805!---- constrain cloud cover to be between 0 and 100% 
    806       cloud(i) = MAX(0.0,MIN(1.0,cloud(i))) 
     806      cloud(i) = MAX(zero,MIN(un,cloud(i))) 
    807807    enddo 
    808808!--- 
     
    844844!---- following logic of the EPIC weather generator code 
    845845!----- 
    846       if (pwet(i) /= 0.0) then 
    847         qdd(i) = (qdm(i)-pwet(i)*omqd)/(1.0-pwet(i)*omqd) 
     846      if (pwet(i) /= zero) then 
     847        qdd(i) = (qdm(i)-pwet(i)*omqd)/(un-pwet(i)*omqd) 
    848848        if (qdd(i) < 0.2) then 
    849849          qdd(i) = 0.2 
    850850          if (qdd(i) > qdm(i)) qdm(i) = qdd(i) 
    851851        ENDIF 
    852         qdd(i) = MIN(1.0,qdd(i)) 
    853         qdw(i) = (qdm(i)-(1.0-pwet(i))*qdd(i))/pwet(i) 
     852        qdd(i) = MIN(un,qdd(i)) 
     853        qdw(i) = (qdm(i)-(un-pwet(i))*qdd(i))/pwet(i) 
    854854      ELSE 
    855855        qdd(i) = qdm(i) 
     
    864864!----- 
    865865      xx = exp(qde(i)) 
    866       qdup(i)  = qde(i)+(1.0-qde(i))*xx/e 
    867       qdlow(i) = qde(i)*(1.0-1./xx) 
     866      qdup(i)  = qde(i)+(un-qde(i))*xx/e 
     867      qdlow(i) = qde(i)*(un-1./xx) 
    868868!----- 
    869869!---- randomlly select humidity from triangular distribution function 
     
    11511151!-- calculate the cosine of the solar zenith angle 
    11521152!--- 
    1153     coszen(i) = MAX(0.0, (sin(xlat)*sin(xdecl) & 
     1153    coszen(i) = MAX(zero, (sin(xlat)*sin(xdecl) & 
    11541154 &                      + cos(xlat)*cos(xdecl)*cos(angle))) 
    11551155!--- 
     
    13421342!-- the surface air temperature 
    13431343!--- 
    1344     dtair   = 0.0 
    1345     dtcloud = 0.0 
     1344    dtair   = zero 
     1345    dtcloud = zero 
    13461346!--- 
    13471347!-- total downward ir is equal to the sum of: 
     
    13601360!-- reset snow and rain to zero 
    13611361!--- 
    1362     snowa(i) = 0.0 
    1363     raina(i) = 0.0 
     1362    snowa(i) = zero 
     1363    raina(i) = zero 
    13641364!--- 
    13651365!-- if precipitation event then calculate 
     
    22232223    CALL restget (rest_id, var_name, iim_g, jjm_g, 1, itau, .TRUE., xchamp_g) 
    22242224    IF (ALL(xchamp_g(:) == val_exp)) THEN 
    2225       xchamp_g(:) = 0. 
     2225      xchamp_g(:) = zero 
    22262226    ENDIF 
    22272227  ENDIF 
     
    23782378  qair(:,:)=val_exp 
    23792379  pb(:,:)=val_exp 
    2380   xx = 9.81/287./0.0065 
     2380!!$  xx = 9.81/287./0.0065 
     2381  xx = cte_grav/rair/0.0065 
    23812382  DO ij=1,nbindex 
    23822383     j = ((kindex(ij)-1)/iim) + 1 
     
    27572758  swdown(:,:) = solad(:,:)+solai(:,:) 
    27582759!- 
    2759   v(:) = 0. 
     2760  v(:) = zero 
    27602761!- 
    27612762! 5. Store date 
     
    31723173      STOP  
    31733174    ENDIF 
    3174     outside(:) = 0. 
     3175    outside(:) = zero 
    31753176    nb_outside = 0 
    31763177    DO i=1,iimjjm 
     
    32773278  REAL            :: tsat 
    32783279!--------------------------------------------------------------------- 
    3279   tsat = MIN(100.,MAX(t-zero_t,0.)) 
     3280  tsat = MIN(100.,MAX(t-zero_t,zero)) 
    32803281!----------------- 
    32813282END FUNCTION tsatl 
     
    32923293  REAL            :: tsat 
    32933294!--------------------------------------------------------------------- 
    3294   tsat = MAX(-60.,MIN(t-zero_t,0.)) 
     3295  tsat = MAX(-60.,MIN(t-zero_t,zero)) 
    32953296!----------------- 
    32963297END FUNCTION tsati 
     
    33803381  ENDWHERE 
    33813382!- 
    3382   tl(:) = MIN(100.,MAX(t(:)-zero_t,0.)) 
    3383   ti(:) = MAX(-60.,MIN(t(:)-zero_t,0.)) 
     3383  tl(:) = MIN(100.,MAX(t(:)-zero_t,zero)) 
     3384  ti(:) = MAX(-60.,MIN(t(:)-zero_t,zero)) 
    33843385!- 
    33853386  e(:) =  100.* & 
Note: See TracChangeset for help on using the changeset viewer.