Ignore:
Timestamp:
May 12, 2014, 10:54:58 AM (11 years ago)
Author:
aslmd
Message:

LMDZ.COMMON LMDZ.GENERIC oops defs should be with each physics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/phystd/watercommon_h.F90

    r1123 r1254  
    4949! JL12 variables for tetens formula
    5050         real,parameter :: Pref_solid_liquid=611.14
    51          real,parameter :: Trefvaporization=35.86
    52          real,parameter :: Trefsublimation=7.66
     51         real,parameter :: Trefvap=35.86
     52         real,parameter :: Trefsub=7.66
    5353         real,parameter :: Tmin=8.
    54          real,parameter :: r3vaporization=17.269
    55          real,parameter :: r3sublimation=21.875
     54         real,parameter :: r3vap=17.269
     55         real,parameter :: r3sub=21.875
    5656
    5757! checked vs. old watersat data 14/05/2012 by JL.
    5858
    5959         if (T.gt.T_h2O_ice_liq) then
    60             psat = Pref_solid_liquid*Exp(r3vaporization*(T-T_h2O_ice_liq)/(T-Trefvaporization)) ! liquid / vapour
    61          else if (T.lt.Tmin) then
    62             print*, "careful, T<Tmin in psat water"
    63           !  psat = Pref_solid_liquid*Exp(r3sublimation*(Tmin-T_h2O_ice_liq)/(Tmin-Trefsublimation)) ! min psat 
    64          ! Ehouarn: gfortran says: Error: Result of EXP underflows its kind,
    65          !          so set psat to the smallest possible value instead
     60            psat = Pref_solid_liquid*Exp(r3vap*(T-T_h2O_ice_liq)/(T-Trefvap)) ! liquid / vapour
     61         else if (T.lt.Tmin) then
     62            print*, "careful, T<Tmin in psat water"
     63            !  psat = Pref_solid_liquid*Exp(r3sub*(Tmin-T_h2O_ice_liq)/(Tmin-Trefsub)) ! min psat 
     64            ! Ehouarn: gfortran says: Error: Result of EXP underflows its kind,
     65            !          so set psat to the smallest possible value instead
    6666            psat=tiny(psat)
    6767         else                 
    68             psat = Pref_solid_liquid*Exp(r3sublimation*(T-T_h2O_ice_liq)/(T-Trefsublimation)) ! solid / vapour
     68            psat = Pref_solid_liquid*Exp(r3sub*(T-T_h2O_ice_liq)/(T-Trefsub)) ! solid / vapour
    6969         endif
    7070         if(psat.gt.p) then
     
    105105! JL12 variables for tetens formula
    106106         real,parameter :: Pref_solid_liquid=611.14
    107          real,parameter :: Trefvaporization=35.86
     107         real,parameter :: Trefvap=35.86
    108108         real,parameter :: Tmin=8.
    109          real,parameter :: Trefsublimation=7.66
    110          real,parameter :: r3vaporization=17.269
    111          real,parameter :: r3sublimation=21.875
     109         real,parameter :: Trefsub=7.66
     110         real,parameter :: r3vap=17.269
     111         real,parameter :: r3sub=21.875
    112112
    113113         real :: dummy
    114114
    115115         if (psat.gt.p) then
    116             dqsat=0.
    117             return
    118         endif
     116            dqsat=0.
     117            return
     118        endif
    119119
    120120         if (T.gt.T_h2O_ice_liq) then
    121             dummy = r3vaporization*(T_h2O_ice_liq-Trefvaporization)/(T-Trefvaporization)**2  ! liquid / vapour
    122          else if (T.lt.Tmin) then
    123             print*, "careful, T<Tmin in Lcp psat water"
    124             dummy = r3sublimation*(T_h2O_ice_liq-Trefsublimation)/(Tmin-Trefsublimation)**2  ! solid / vapour
     121            dummy = r3vap*(T_h2O_ice_liq-Trefvap)/(T-Trefvap)**2  ! liquid / vapour
     122         else if (T.lt.Tmin) then
     123            print*, "careful, T<Tmin in Lcp psat water"
     124            dummy = r3sub*(T_h2O_ice_liq-Trefsub)/(Tmin-Trefsub)**2  ! solid / vapour
    125125         else               
    126             dummy = r3sublimation*(T_h2O_ice_liq-Trefsublimation)/(T-Trefsublimation)**2  ! solid / vapour
     126            dummy = r3sub*(T_h2O_ice_liq-Trefsub)/(T-Trefsub)**2  ! solid / vapour
    127127         endif
    128128
    129129         dqsat=RLVTT/RCPD*qsat*(p/(p-(1.-epsi)*psat))*dummy
    130         dlnpsat=RLVTT/RCPD*dummy
     130        dlnpsat=RLVTT/RCPD*dummy
    131131         return
    132132      end subroutine Lcpdqsat_water
     
    155155!        input
    156156         real p
     157         real ra
    157158 
    158159!        output
     
    161162! JL12 variables for tetens formula
    162163         real,parameter :: Pref_solid_liquid=611.14
    163          real,parameter :: Trefvaporization=35.86
    164          real,parameter :: Trefsublimation=7.66
    165          real,parameter :: r3vaporization=17.269
    166          real,parameter :: r3sublimation=21.875
     164         real,parameter :: Trefvap=35.86
     165         real,parameter :: Trefsub=7.66
     166         real,parameter :: r3vap=17.269
     167         real,parameter :: r3sub=21.875
     168
     169         ra = p/Pref_solid_liquid
    167170
    168171         if (p.lt.Pref_solid_liquid) then ! solid / vapour
    169             Tsat =(T_h2O_ice_liq*r3sublimation- Trefsublimation*Log(p/Pref_solid_liquid))/(r3sublimation-Log(p/Pref_solid_liquid))
     172            Tsat =(T_h2O_ice_liq*r3sub-Trefsub*Log(ra))/(r3sub-Log(ra))
    170173         else                 ! liquid / vapour
    171             Tsat =(T_h2O_ice_liq*r3vaporization- Trefvaporization*Log(p/Pref_solid_liquid))/(r3vaporization-Log(p/Pref_solid_liquid))
     174            Tsat =(T_h2O_ice_liq*r3vap-Trefvap*Log(ra))/(r3vap-Log(ra))
    172175         endif
    173176
     
    202205! JL12 variables for tetens formula
    203206         double precision,parameter :: Pref_solid_liquid=611.14d0
    204          double precision,parameter :: Trefvaporization=35.86D0
    205          double precision,parameter :: Trefsublimation=7.66d0
     207         double precision,parameter :: Trefvap=35.86D0
     208         double precision,parameter :: Trefsub=7.66d0
    206209         double precision,parameter :: Tmin=8.d0
    207          double precision,parameter :: r3vaporization=17.269d0
    208          double precision,parameter :: r3sublimation=21.875d0
     210         double precision,parameter :: r3vap=17.269d0
     211         double precision,parameter :: r3sub=21.875d0
    209212
    210213! checked vs. old watersat data 14/05/2012 by JL.
    211214
    212215         if (T.gt.T_h2O_ice_liq) then
    213             psat = Pref_solid_liquid*Exp(r3vaporization*(T-T_h2O_ice_liq)/(T-Trefvaporization)) ! liquid / vapour
    214          else if (T.lt.Tmin) then
    215             print*, "careful, T<Tmin in psat water"
     216            psat = Pref_solid_liquid*Exp(r3vap*(T-T_h2O_ice_liq)/(T-Trefvap)) ! liquid / vapour
     217         else if (T.lt.Tmin) then
     218            print*, "careful, T<Tmin in psat water"
    216219         !   psat = Pref_solid_liquid*Exp(r3sublimation*(Tmin-T_h2O_ice_liq)/(Tmin-Trefsublimation)) ! min psat 
    217220         ! Ehouarn: gfortran says: Error: Result of EXP underflows its kind,
     
    219222            psat=tiny(psat)
    220223         else                 
    221             psat = Pref_solid_liquid*Exp(r3sublimation*(T-T_h2O_ice_liq)/(T-Trefsublimation)) ! solid / vapour
     224            psat = Pref_solid_liquid*Exp(r3sub*(T-T_h2O_ice_liq)/(T-Trefsub)) ! solid / vapour
    222225         endif
    223226         if(psat.gt.p) then
     
    258261! JL12 variables for tetens formula
    259262         double precision,parameter :: Pref_solid_liquid=611.14d0
    260          double precision,parameter :: Trefvaporization=35.86d0
     263         double precision,parameter :: Trefvap=35.86d0
    261264         double precision,parameter :: Tmin=8.d0
    262          double precision,parameter :: Trefsublimation=7.66d0
    263          double precision,parameter :: r3vaporization=17.269d0
    264          double precision,parameter :: r3sublimation=21.875d0
     265         double precision,parameter :: Trefsub=7.66d0
     266         double precision,parameter :: r3vap=17.269d0
     267         double precision,parameter :: r3sub=21.875d0
    265268
    266269         double precision :: dummy
    267270
    268271         if (psat.gt.p) then
    269             dqsat=0.d0
    270             return
    271         endif
     272            dqsat=0.d0
     273            return
     274        endif
    272275
    273276         if (T.gt.T_h2O_ice_liq) then
    274             dummy = r3vaporization*(T_h2O_ice_liq-Trefvaporization)/(T-Trefvaporization)**2  ! liquid / vapour
    275          else if (T.lt.Tmin) then
    276             print*, "careful, T<Tmin in Lcp psat water"
    277             dummy = r3sublimation*(T_h2O_ice_liq-Trefsublimation)/(Tmin-Trefsublimation)**2  ! solid / vapour
     277            dummy = r3vap*(T_h2O_ice_liq-Trefvap)/(T-Trefvap)**2  ! liquid / vapour
     278         else if (T.lt.Tmin) then
     279            print*, "careful, T<Tmin in Lcp psat water"
     280            dummy = r3sub*(T_h2O_ice_liq-Trefsub)/(Tmin-Trefsub)**2  ! solid / vapour
    278281         else               
    279             dummy = r3sublimation*(T_h2O_ice_liq-Trefsublimation)/(T-Trefsublimation)**2  ! solid / vapour
     282            dummy = r3sub*(T_h2O_ice_liq-Trefsub)/(T-Trefsub)**2  ! solid / vapour
    280283         endif
    281284
    282285         dqsat=RLVTT/RCPD*qsat*(p/(p-(1.d0-epsi)*psat))*dummy
    283         dlnpsat=RLVTT/RCPD*dummy
     286        dlnpsat=RLVTT/RCPD*dummy
    284287         return
    285288      end subroutine Lcpdqsat_waterDP
Note: See TracChangeset for help on using the changeset viewer.