15 #include "inc_openmp.h"    50   public :: atmos_saturation_alpha
    52   public :: atmos_saturation_psat_all
    53   public :: atmos_saturation_psat_liq
    54   public :: atmos_saturation_psat_ice
    56   public :: atmos_saturation_pres2qsat_all
    57   public :: atmos_saturation_pres2qsat_liq
    58   public :: atmos_saturation_pres2qsat_ice
    60   public :: atmos_saturation_dens2qsat_all
    61   public :: atmos_saturation_dens2qsat_liq
    62   public :: atmos_saturation_dens2qsat_ice
    64   public :: atmos_saturation_dalphadt
    71   interface atmos_saturation_alpha
    73      module procedure atmos_saturation_alpha_1d
    74      module procedure atmos_saturation_alpha_3d
    75   end interface atmos_saturation_alpha
    77   interface atmos_saturation_psat_all
    78      module procedure atmos_saturation_psat_all_0d
    79      module procedure atmos_saturation_psat_all_1d
    80      module procedure atmos_saturation_psat_all_3d
    81   end interface atmos_saturation_psat_all
    82   interface atmos_saturation_psat_liq
    83      module procedure atmos_saturation_psat_liq_0d
    84      module procedure atmos_saturation_psat_liq_1d
    85      module procedure atmos_saturation_psat_liq_3d
    86   end interface atmos_saturation_psat_liq
    87   interface atmos_saturation_psat_ice
    88      module procedure atmos_saturation_psat_ice_0d
    89      module procedure atmos_saturation_psat_ice_1d
    90      module procedure atmos_saturation_psat_ice_3d
    91   end interface atmos_saturation_psat_ice
    93   interface atmos_saturation_pres2qsat_all
    94      module procedure atmos_saturation_pres2qsat_all_0d
    95      module procedure atmos_saturation_pres2qsat_all_1d
    96      module procedure atmos_saturation_pres2qsat_all_2d
    97      module procedure atmos_saturation_pres2qsat_all_3d
    98      module procedure atmos_saturation_pres2qsat_all_3d_k
    99   end interface atmos_saturation_pres2qsat_all
   100   interface atmos_saturation_pres2qsat_liq
   101      module procedure atmos_saturation_pres2qsat_liq_0d
   102      module procedure atmos_saturation_pres2qsat_liq_1d
   103      module procedure atmos_saturation_pres2qsat_liq_3d
   104   end interface atmos_saturation_pres2qsat_liq
   105   interface atmos_saturation_pres2qsat_ice
   106      module procedure atmos_saturation_pres2qsat_ice_0d
   107      module procedure atmos_saturation_pres2qsat_ice_1d
   108      module procedure atmos_saturation_pres2qsat_ice_3d
   109   end interface atmos_saturation_pres2qsat_ice
   111   interface atmos_saturation_dens2qsat_all
   112      module procedure atmos_saturation_dens2qsat_all_0d
   113      module procedure atmos_saturation_dens2qsat_all_1d
   114      module procedure atmos_saturation_dens2qsat_all_3d
   115   end interface atmos_saturation_dens2qsat_all
   116   interface atmos_saturation_dens2qsat_liq
   117      module procedure atmos_saturation_dens2qsat_liq_0d
   118      module procedure atmos_saturation_dens2qsat_liq_1d
   119      module procedure atmos_saturation_dens2qsat_liq_3d
   120   end interface atmos_saturation_dens2qsat_liq
   121   interface atmos_saturation_dens2qsat_ice
   122      module procedure atmos_saturation_dens2qsat_ice_0d
   123      module procedure atmos_saturation_dens2qsat_ice_1d
   124      module procedure atmos_saturation_dens2qsat_ice_3d
   125   end interface atmos_saturation_dens2qsat_ice
   127   interface atmos_saturation_dalphadt
   128      module procedure atmos_saturation_dalphadt_0d
   129      module procedure atmos_saturation_dalphadt_1d
   130      module procedure atmos_saturation_dalphadt_3d
   131   end interface atmos_saturation_dalphadt
   152   real(RP), 
private, 
parameter :: tem_min   = 10.0_rp 
   154   real(RP), 
private,      
save :: atmos_saturation_ulimit_temp = 273.15_rp 
   155   real(RP), 
private,      
save :: atmos_saturation_llimit_temp = 233.15_rp 
   157   real(RP), 
private,      
save :: rtem00
   158   real(RP), 
private,      
save :: dalphadt_const
   171     namelist / param_atmos_saturation / &
   172        atmos_saturation_ulimit_temp, &
   173        atmos_saturation_llimit_temp
   179     if( 
io_l ) 
write(
io_fid_log,*) 
'++++++ Module[SATURATION] / Categ[ATMOS SHARE] / Origin[SCALElib]'   183     read(
io_fid_conf,nml=param_atmos_saturation,iostat=ierr)
   185        if( 
io_l ) 
write(
io_fid_log,*) 
'*** Not found namelist. Default used.'   186     elseif( ierr > 0 ) 
then    187        write(*,*) 
'xxx Not appropriate names in namelist PARAM_ATMOS_SATURATION. Check!'   192     rtem00 = 1.0_rp / tem00
   209     dalphadt_const = 1.0_rp / ( atmos_saturation_ulimit_temp - atmos_saturation_llimit_temp )
   212     if( 
io_l ) 
write(
io_fid_log,
'(1x,A,F7.2,A,F7.2)') 
'*** Temperature range for ice : ', &
   213                                                       atmos_saturation_llimit_temp, 
' - ', &
   214                                                       atmos_saturation_ulimit_temp
   226     real(RP), 
intent(out) :: alpha
   227     real(RP), 
intent(in)  :: temp
   230     alpha = ( temp                         - atmos_saturation_llimit_temp ) &
   231           / ( atmos_saturation_ulimit_temp - atmos_saturation_llimit_temp )
   233     alpha = min( max( alpha, 0.0_rp ), 1.0_rp )
   240   subroutine atmos_saturation_alpha_1d( &
   245     real(RP), 
intent(out) :: alpha(
ka)
   246     real(RP), 
intent(in)  :: temp (
ka)
   253        alpha(k) = ( temp(k)                      - atmos_saturation_llimit_temp ) &
   254                 / ( atmos_saturation_ulimit_temp - atmos_saturation_llimit_temp )
   255        alpha(k) = min( max( alpha(k), 0.0_rp ), 1.0_rp )
   260   end subroutine atmos_saturation_alpha_1d
   264   subroutine atmos_saturation_alpha_3d( &
   269     real(RP), 
intent(out) :: alpha(
ka,
ia,
ja)
   270     real(RP), 
intent(in)  :: temp (
ka,
ia,
ja)
   280        alpha(k,i,j) = ( temp(k,i,j)                  - atmos_saturation_llimit_temp ) &
   281                     / ( atmos_saturation_ulimit_temp - atmos_saturation_llimit_temp )
   282        alpha(k,i,j) = min( max( alpha(k,i,j), 0.0_rp ), 1.0_rp )
   289   end subroutine atmos_saturation_alpha_3d
   293   subroutine atmos_saturation_psat_all_0d( &
   298     real(RP), 
intent(out) :: psat
   299     real(RP), 
intent(in)  :: temp
   301     real(RP) :: alpha, psatl, psati
   305     call atmos_saturation_psat_liq_0d( psatl, temp )
   306     call atmos_saturation_psat_ice_0d( psati, temp )
   308     psat = psatl * (          alpha ) &
   309          + psati * ( 1.0_rp - alpha )
   312   end subroutine atmos_saturation_psat_all_0d
   316   subroutine atmos_saturation_psat_all_1d( &
   321     real(RP), 
intent(out) :: psat(
ka)
   322     real(RP), 
intent(in)  :: temp(
ka)
   324     real(RP) :: alpha, psatl, psati
   331        alpha = ( temp(k)                      - atmos_saturation_llimit_temp ) &
   332              / ( atmos_saturation_ulimit_temp - atmos_saturation_llimit_temp )
   333        alpha = min( max( alpha, 0.0_rp ), 1.0_rp )
   335        psatl = psat0 * ( temp(k) * rtem00 )**
cpovr_liq             &
   336                      * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp(k) ) )
   338        psati = psat0 * ( temp(k) * rtem00 )**
cpovr_ice             &
   339                      * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp(k) ) )
   341        psat(k) = psatl * (          alpha ) &
   342                + psati * ( 1.0_rp - alpha )
   346   end subroutine atmos_saturation_psat_all_1d
   350   subroutine atmos_saturation_psat_all_3d( &
   355     real(RP), 
intent(out) :: psat(
ka,
ia,
ja)
   356     real(RP), 
intent(in)  :: temp(
ka,
ia,
ja)
   358     real(RP) :: alpha, psatl, psati
   368        alpha = ( temp(k,i,j)                  - atmos_saturation_llimit_temp ) &
   369              / ( atmos_saturation_ulimit_temp - atmos_saturation_llimit_temp )
   370        alpha = min( max( alpha, 0.0_rp ), 1.0_rp )
   372        psatl = psat0 * ( temp(k,i,j) * rtem00 )**
cpovr_liq             &
   373                      * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp(k,i,j) ) )
   375        psati = psat0 * ( temp(k,i,j) * rtem00 )**
cpovr_ice             &
   376                      * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp(k,i,j) ) )
   378        psat(k,i,j) = psatl * (          alpha ) &
   379                    + psati * ( 1.0_rp - alpha )
   385   end subroutine atmos_saturation_psat_all_3d
   389   subroutine atmos_saturation_psat_liq_0d( &
   394     real(RP), 
intent(out) :: psat
   395     real(RP), 
intent(in)  :: temp
   398     psat = psat0 * ( temp * rtem00 )**
cpovr_liq     &
   399          * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp ) )
   402   end subroutine atmos_saturation_psat_liq_0d
   406   subroutine atmos_saturation_psat_liq_1d( &
   411     real(RP), 
intent(out) :: psat(
ka)
   412     real(RP), 
intent(in)  :: temp(
ka)
   418        psat(k) = psat0 * ( temp(k) * rtem00 )**
cpovr_liq     &
   419                * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp(k) ) )
   423   end subroutine atmos_saturation_psat_liq_1d
   427   subroutine atmos_saturation_psat_liq_3d( &
   432     real(RP), 
intent(out) :: psat(
ka,
ia,
ja)
   433     real(RP), 
intent(in)  :: temp(
ka,
ia,
ja)
   442        psat(k,i,j) = psat0 * ( temp(k,i,j) * rtem00 )**
cpovr_liq     &
   443                    * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp(k,i,j) ) )
   449   end subroutine atmos_saturation_psat_liq_3d
   453   subroutine atmos_saturation_psat_ice_0d( &
   458     real(RP), 
intent(out) :: psat
   459     real(RP), 
intent(in)  :: temp
   462     psat = psat0 * ( temp * rtem00 )**
cpovr_ice     &
   463          * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp ) )
   466   end subroutine atmos_saturation_psat_ice_0d
   470   subroutine atmos_saturation_psat_ice_1d( &
   475     real(RP), 
intent(out) :: psat(
ka)
   476     real(RP), 
intent(in)  :: temp(
ka)
   482        psat(k) = psat0 * ( temp(k) * rtem00 )**
cpovr_ice     &
   483                * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp(k) ) )
   487   end subroutine atmos_saturation_psat_ice_1d
   491   subroutine atmos_saturation_psat_ice_3d( &
   496     real(RP), 
intent(out) :: psat(
ka,
ia,
ja)
   497     real(RP), 
intent(in)  :: temp(
ka,
ia,
ja)
   506        psat(k,i,j) = psat0 * ( temp(k,i,j) * rtem00 )**
cpovr_ice     &
   507                    * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp(k,i,j) ) )
   513   end subroutine atmos_saturation_psat_ice_3d
   517   subroutine atmos_saturation_pres2qsat_all_0d( &
   523     real(RP), 
intent(out) :: qsat
   524     real(RP), 
intent(in)  :: temp
   525     real(RP), 
intent(in)  :: pres
   527     real(RP) :: alpha, psatl, psati
   532     call atmos_saturation_psat_liq_0d( psatl, temp )
   533     call atmos_saturation_psat_ice_0d( psati, temp )
   535     psat = psatl * (          alpha ) &
   536          + psati * ( 1.0_rp - alpha )
   538     qsat = epsvap * psat / ( pres - ( 1.0_rp-epsvap ) * psat )
   541   end subroutine atmos_saturation_pres2qsat_all_0d
   545   subroutine atmos_saturation_pres2qsat_all_1d( &
   551     real(RP), 
intent(out) :: qsat(
ka)
   552     real(RP), 
intent(in)  :: temp(
ka)
   553     real(RP), 
intent(in)  :: pres(
ka)
   555     real(RP) :: alpha, psatl, psati
   563        alpha = ( temp(k)                      - atmos_saturation_llimit_temp ) &
   564              / ( atmos_saturation_ulimit_temp - atmos_saturation_llimit_temp )
   565        alpha = min( max( alpha, 0.0_rp ), 1.0_rp )
   567        psatl = psat0 * ( temp(k) * rtem00 )**
cpovr_liq             &
   568                      * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp(k) ) )
   570        psati = psat0 * ( temp(k) * rtem00 )**
cpovr_ice             &
   571                      * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp(k) ) )
   573        psat = psatl * (          alpha ) &
   574             + psati * ( 1.0_rp - alpha )
   576        qsat(k) = epsvap * psat / ( pres(k) - ( 1.0_rp-epsvap ) * psat )
   581   end subroutine atmos_saturation_pres2qsat_all_1d
   585   subroutine atmos_saturation_pres2qsat_all_2d( &
   591     real(RP), 
intent(out) :: qsat(
ia,
ja)
   592     real(RP), 
intent(in)  :: temp(
ia,
ja)
   593     real(RP), 
intent(in)  :: pres(
ia,
ja)
   595     real(RP) :: alpha, psatl, psati
   605        alpha = ( temp(i,j)                    - atmos_saturation_llimit_temp ) &
   606              / ( atmos_saturation_ulimit_temp - atmos_saturation_llimit_temp )
   607        alpha = min( max( alpha, 0.0_rp ), 1.0_rp )
   609        psatl = psat0 * ( temp(i,j) * rtem00 )**
cpovr_liq             &
   610                      * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp(i,j) ) )
   612        psati = psat0 * ( temp(i,j) * rtem00 )**
cpovr_ice             &
   613                      * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp(i,j) ) )
   615        psat = psatl * (          alpha ) &
   616             + psati * ( 1.0_rp - alpha )
   618        qsat(i,j) = epsvap * psat / ( pres(i,j) - ( 1.0_rp-epsvap ) * psat )
   624   end subroutine atmos_saturation_pres2qsat_all_2d
   628   subroutine atmos_saturation_pres2qsat_all_3d( &
   634     real(RP), 
intent(out) :: qsat(
ka,
ia,
ja)
   635     real(RP), 
intent(in)  :: temp(
ka,
ia,
ja)
   636     real(RP), 
intent(in)  :: pres(
ka,
ia,
ja)
   638     real(RP) :: alpha, psatl, psati
   649        alpha = ( temp(k,i,j)                  - atmos_saturation_llimit_temp ) &
   650              / ( atmos_saturation_ulimit_temp - atmos_saturation_llimit_temp )
   651        alpha = min( max( alpha, 0.0_rp ), 1.0_rp )
   653        psatl = psat0 * ( temp(k,i,j) * rtem00 )**
cpovr_liq             &
   654                      * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp(k,i,j) ) )
   656        psati = psat0 * ( temp(k,i,j) * rtem00 )**
cpovr_ice             &
   657                      * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp(k,i,j) ) )
   659        psat = psatl * (          alpha ) &
   660             + psati * ( 1.0_rp - alpha )
   662        qsat(k,i,j) = epsvap * psat / ( pres(k,i,j) - ( 1.0_rp-epsvap ) * psat )
   669   end subroutine atmos_saturation_pres2qsat_all_3d
   671   subroutine atmos_saturation_pres2qsat_all_3d_k( &
   678     integer,  
intent(in)  :: knum
   679     real(RP), 
intent(out) :: qsat(knum,
ia,
ja)
   680     real(RP), 
intent(in)  :: temp(knum,
ia,
ja)
   681     real(RP), 
intent(in)  :: pres(knum,
ia,
ja)
   683     real(RP) :: alpha, psatl, psati
   694        alpha = ( temp(k,i,j)                  - atmos_saturation_llimit_temp ) &
   695              / ( atmos_saturation_ulimit_temp - atmos_saturation_llimit_temp )
   696        alpha = min( max( alpha, 0.0_rp ), 1.0_rp )
   698        psatl = psat0 * ( temp(k,i,j) * rtem00 )**
cpovr_liq             &
   699                      * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp(k,i,j) ) )
   701        psati = psat0 * ( temp(k,i,j) * rtem00 )**
cpovr_ice             &
   702                      * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp(k,i,j) ) )
   704        psat = psatl * (          alpha ) &
   705             + psati * ( 1.0_rp - alpha )
   707        qsat(k,i,j) = epsvap * psat / ( pres(k,i,j) - ( 1.0_rp-epsvap ) * psat )
   714   end subroutine atmos_saturation_pres2qsat_all_3d_k
   718   subroutine atmos_saturation_pres2qsat_liq_0d( &
   724     real(RP), 
intent(out) :: qsat
   725     real(RP), 
intent(in)  :: temp
   726     real(RP), 
intent(in)  :: pres
   731     call atmos_saturation_psat_liq_0d( psat, temp )
   733     qsat = epsvap * psat / ( pres - ( 1.0_rp-epsvap ) * psat )
   736   end subroutine atmos_saturation_pres2qsat_liq_0d
   740   subroutine atmos_saturation_pres2qsat_liq_1d( &
   746     real(RP), 
intent(out) :: qsat(
ka)
   747     real(RP), 
intent(in)  :: temp(
ka)
   748     real(RP), 
intent(in)  :: pres(
ka)
   756        psat = psat0 * ( temp(k) * rtem00 )**
cpovr_liq     &
   757             * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp(k) ) )
   759        qsat(k) = epsvap * psat / ( pres(k) - ( 1.0_rp-epsvap ) * psat )
   763   end subroutine atmos_saturation_pres2qsat_liq_1d
   767   subroutine atmos_saturation_pres2qsat_liq_3d( &
   773     real(RP), 
intent(out) :: qsat(
ka,
ia,
ja)
   774     real(RP), 
intent(in)  :: temp(
ka,
ia,
ja)
   775     real(RP), 
intent(in)  :: pres(
ka,
ia,
ja)
   786        psat = psat0 * ( temp(k,i,j) * rtem00 )**
cpovr_liq     &
   787             * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp(k,i,j) ) )
   789        qsat(k,i,j) = epsvap * psat / ( pres(k,i,j) - ( 1.0_rp-epsvap ) * psat )
   795   end subroutine atmos_saturation_pres2qsat_liq_3d
   799   subroutine atmos_saturation_pres2qsat_ice_0d( &
   805     real(RP), 
intent(out) :: qsat
   806     real(RP), 
intent(in)  :: temp
   807     real(RP), 
intent(in)  :: pres
   812     call atmos_saturation_psat_liq_0d( psat, temp )
   814     qsat = epsvap * psat / ( pres - ( 1.0_rp-epsvap ) * psat )
   817   end subroutine atmos_saturation_pres2qsat_ice_0d
   821   subroutine atmos_saturation_pres2qsat_ice_1d( &
   827     real(RP), 
intent(out) :: qsat(
ka)
   828     real(RP), 
intent(in)  :: temp(
ka)
   829     real(RP), 
intent(in)  :: pres(
ka)
   837        psat = psat0 * ( temp(k) * rtem00 )**
cpovr_ice     &
   838             * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp(k) ) )
   840        qsat(k) = epsvap * psat / ( pres(k) - ( 1.0_rp-epsvap ) * psat )
   844   end subroutine atmos_saturation_pres2qsat_ice_1d
   848   subroutine atmos_saturation_pres2qsat_ice_3d( &
   854     real(RP), 
intent(out) :: qsat(
ka,
ia,
ja)
   855     real(RP), 
intent(in)  :: temp(
ka,
ia,
ja)
   856     real(RP), 
intent(in)  :: pres(
ka,
ia,
ja)
   867        psat = psat0 * ( temp(k,i,j) * rtem00 )**
cpovr_ice     &
   868             * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp(k,i,j) ) )
   870        qsat(k,i,j) = epsvap * psat / ( pres(k,i,j) - ( 1.0_rp-epsvap ) * psat )
   876   end subroutine atmos_saturation_pres2qsat_ice_3d
   880   subroutine atmos_saturation_dens2qsat_all_0d( &
   886     real(RP), 
intent(out) :: qsat
   887     real(RP), 
intent(in)  :: temp
   888     real(RP), 
intent(in)  :: dens
   890     real(RP) :: alpha, psatl, psati
   895     call atmos_saturation_psat_liq_0d( psatl, temp )
   896     call atmos_saturation_psat_ice_0d( psati, temp )
   898     psat = psatl * (          alpha ) &
   899          + psati * ( 1.0_rp - alpha )
   901     qsat = psat / ( dens * rvap * temp )
   904   end subroutine atmos_saturation_dens2qsat_all_0d
   908   subroutine atmos_saturation_dens2qsat_all_1d( &
   914     real(RP), 
intent(out) :: qsat(
ka)
   915     real(RP), 
intent(in)  :: temp(
ka)
   916     real(RP), 
intent(in)  :: dens(
ka)
   918     real(RP) :: alpha, psatl, psati
   926        alpha = ( temp(k)                      - atmos_saturation_llimit_temp ) &
   927              / ( atmos_saturation_ulimit_temp - atmos_saturation_llimit_temp )
   928        alpha = min( max( alpha, 0.0_rp ), 1.0_rp )
   930        psatl = psat0 * ( temp(k) * rtem00 )**
cpovr_liq             &
   931                      * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp(k) ) )
   933        psati = psat0 * ( temp(k) * rtem00 )**
cpovr_ice             &
   934                      * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp(k) ) )
   936        psat = psatl * (          alpha ) &
   937             + psati * ( 1.0_rp - alpha )
   939        qsat(k) = psat / ( dens(k) * rvap * temp(k) )
   944   end subroutine atmos_saturation_dens2qsat_all_1d
   948   subroutine atmos_saturation_dens2qsat_all_3d( &
   954     real(RP), 
intent(out) :: qsat(
ka,
ia,
ja)
   955     real(RP), 
intent(in)  :: temp(
ka,
ia,
ja)
   956     real(RP), 
intent(in)  :: dens(
ka,
ia,
ja)
   958     real(RP) :: alpha, psatl, psati
   969        alpha = ( temp(k,i,j)                  - atmos_saturation_llimit_temp ) &
   970              / ( atmos_saturation_ulimit_temp - atmos_saturation_llimit_temp )
   971        alpha = min( max( alpha, 0.0_rp ), 1.0_rp )
   973        psatl = psat0 * ( temp(k,i,j) * rtem00 )**
cpovr_liq             &
   974                      * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp(k,i,j) ) )
   976        psati = psat0 * ( temp(k,i,j) * rtem00 )**
cpovr_ice             &
   977                      * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp(k,i,j) ) )
   979        psat = psatl * (          alpha ) &
   980             + psati * ( 1.0_rp - alpha )
   982        qsat(k,i,j) = psat / ( dens(k,i,j) * rvap * temp(k,i,j) )
   989   end subroutine atmos_saturation_dens2qsat_all_3d
   993   subroutine atmos_saturation_dens2qsat_liq_0d( &
   999     real(RP), 
intent(out) :: qsat
  1000     real(RP), 
intent(in)  :: temp
  1001     real(RP), 
intent(in)  :: dens
  1006     call atmos_saturation_psat_liq_0d( psat, temp )
  1008     qsat = psat / ( dens * rvap * temp )
  1011   end subroutine atmos_saturation_dens2qsat_liq_0d
  1015   subroutine atmos_saturation_dens2qsat_liq_1d( &
  1021     real(RP), 
intent(out) :: qsat(
ka)
  1022     real(RP), 
intent(in)  :: temp(
ka)
  1023     real(RP), 
intent(in)  :: dens(
ka)
  1031        psat = psat0 * ( temp(k) * rtem00 )**
cpovr_liq     &
  1032             * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp(k) ) )
  1034        qsat(k) = psat / ( dens(k) * rvap * temp(k) )
  1038   end subroutine atmos_saturation_dens2qsat_liq_1d
  1042   subroutine atmos_saturation_dens2qsat_liq_3d( &
  1048     real(RP), 
intent(out) :: qsat(
ka,
ia,
ja)
  1049     real(RP), 
intent(in)  :: temp(
ka,
ia,
ja)
  1050     real(RP), 
intent(in)  :: dens(
ka,
ia,
ja)
  1061        psat = psat0 * ( temp(k,i,j) * rtem00 )**
cpovr_liq     &
  1062             * exp( 
lovr_liq * ( rtem00 - 1.0_rp/temp(k,i,j) ) )
  1064        qsat(k,i,j) = psat / ( dens(k,i,j) * rvap * temp(k,i,j) )
  1070   end subroutine atmos_saturation_dens2qsat_liq_3d
  1074   subroutine atmos_saturation_dens2qsat_ice_0d( &
  1080     real(RP), 
intent(out) :: qsat
  1081     real(RP), 
intent(in)  :: temp
  1082     real(RP), 
intent(in)  :: dens
  1087     call atmos_saturation_psat_ice_0d( psat, temp )
  1089     qsat = psat / ( dens * rvap * temp )
  1092   end subroutine atmos_saturation_dens2qsat_ice_0d
  1096   subroutine atmos_saturation_dens2qsat_ice_1d( &
  1102     real(RP), 
intent(out) :: qsat(
ka)
  1103     real(RP), 
intent(in)  :: temp(
ka)
  1104     real(RP), 
intent(in)  :: dens(
ka)
  1112        psat = psat0 * ( temp(k) * rtem00 )**
cpovr_ice     &
  1113             * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp(k) ) )
  1115        qsat(k) = psat / ( dens(k) * rvap * temp(k) )
  1119   end subroutine atmos_saturation_dens2qsat_ice_1d
  1123   subroutine atmos_saturation_dens2qsat_ice_3d( &
  1129     real(RP), 
intent(out) :: qsat(
ka,
ia,
ja)
  1130     real(RP), 
intent(in)  :: temp(
ka,
ia,
ja)
  1131     real(RP), 
intent(in)  :: dens(
ka,
ia,
ja)
  1142        psat = psat0 * ( temp(k,i,j) * rtem00 )**
cpovr_ice     &
  1143             * exp( 
lovr_ice * ( rtem00 - 1.0_rp/temp(k,i,j) ) )
  1145        qsat(k,i,j) = psat / ( dens(k,i,j) * rvap * temp(k,i,j) )
  1151   end subroutine atmos_saturation_dens2qsat_ice_3d
  1155   subroutine atmos_saturation_dalphadt_0d( &
  1160     real(RP), 
intent(out) :: dalpha_dT
  1161     real(RP), 
intent(in)  :: temp
  1163     real(RP) :: lim1, lim2
  1167     lim1 = 0.5_rp + sign( 0.5_rp, atmos_saturation_ulimit_temp - temp )
  1169     lim2 = 0.5_rp + sign( 0.5_rp, temp - atmos_saturation_llimit_temp )
  1171     dalpha_dt = dalphadt_const * lim1 * lim2
  1174   end subroutine atmos_saturation_dalphadt_0d
  1178   subroutine atmos_saturation_dalphadt_1d( &
  1183     real(RP), 
intent(out) :: dalpha_dT(
ka)
  1184     real(RP), 
intent(in)  :: temp     (
ka)
  1186     real(RP) :: lim1, lim2
  1194        lim1 = 0.5_rp + sign( 0.5_rp, atmos_saturation_ulimit_temp - temp(k) )
  1196        lim2 = 0.5_rp + sign( 0.5_rp, temp(k) - atmos_saturation_llimit_temp )
  1198        dalpha_dt(k) = dalphadt_const * lim1 * lim2
  1203   end subroutine atmos_saturation_dalphadt_1d
  1207   subroutine atmos_saturation_dalphadt_3d( &
  1212     real(RP), 
intent(out) :: dalpha_dT(
ka,
ia,
ja)
  1213     real(RP), 
intent(in)  :: temp     (
ka,
ia,
ja)
  1215     real(RP) :: lim1, lim2
  1226        lim1 = 0.5_rp + sign( 0.5_rp, atmos_saturation_ulimit_temp - temp(k,i,j) )
  1228        lim2 = 0.5_rp + sign( 0.5_rp, temp(k,i,j) - atmos_saturation_llimit_temp )
  1230        dalpha_dt(k,i,j) = dalphadt_const * lim1 * lim2
  1237   end subroutine atmos_saturation_dalphadt_3d
  1246     real(RP), 
intent(out) :: dqsdtem(
ka,
ia,
ja)
  1247     real(RP), 
intent(in)  :: temp   (
ka,
ia,
ja)
  1248     real(RP), 
intent(in)  :: dens   (
ka,
ia,
ja)
  1253     real(RP) :: RTEM00, TEM
  1258     rtem00 = 1.0_rp / tem00
  1264        tem = max( temp(k,i,j), tem_min )
  1268             * exp( 
lovr_liq * ( rtem00 - 1.0_rp/tem ) )
  1270        lhv = lhv0 + ( cpvap-cl ) * ( temp(k,i,j)-tem00 )
  1272        dqsdtem(k,i,j) = psat / ( dens(k,i,j) * rvap * temp(k,i,j) * temp(k,i,j) ) &
  1273                       * ( lhv / ( rvap * temp(k,i,j) ) - 1.0_rp )
  1289     real(RP), 
intent(out) :: dqsdtem(
ka,
ia,
ja)
  1290     real(RP), 
intent(in)  :: temp   (
ka,
ia,
ja)
  1291     real(RP), 
intent(in)  :: dens   (
ka,
ia,
ja)
  1296     real(RP) :: RTEM00, TEM
  1301     rtem00   = 1.0_rp / tem00
  1307        tem = max( temp(k,i,j), tem_min )
  1311             * exp( 
lovr_ice * ( rtem00 - 1.0_rp/tem ) )
  1312        lhv = lhs0 + ( cpvap-ci ) * ( temp(k,i,j)-tem00 )
  1314        dqsdtem(k,i,j) = psat / ( dens(k,i,j) * rvap * temp(k,i,j) * temp(k,i,j) ) &
  1315                       * ( lhv / ( rvap * temp(k,i,j) ) - 1.0_rp )
  1331     real(RP), 
intent(out) :: dqsdtem(
ka,
ia,
ja)
  1332     real(RP), 
intent(out) :: dqsdpre(
ka,
ia,
ja)
  1333     real(RP), 
intent(in)  :: temp   (
ka,
ia,
ja)
  1334     real(RP), 
intent(in)  :: pres   (
ka,
ia,
ja)
  1339     real(RP) :: den1, den2 
  1340     real(RP) :: RTEM00, TEM
  1345     rtem00   = 1.0_rp / tem00
  1351        tem = max( temp(k,i,j), tem_min )
  1355             * exp( 
lovr_liq * ( rtem00 - 1.0_rp/tem ) )
  1357        den1 = ( pres(k,i,j) - (1.0_rp-epsvap) * psat ) &
  1358             * ( pres(k,i,j) - (1.0_rp-epsvap) * psat )
  1359        den2 = den1 * rvap * temp(k,i,j) * temp(k,i,j)
  1360        lhv  = lhv0 + ( cpvap-cl ) * ( temp(k,i,j)-tem00 )
  1362        dqsdpre(k,i,j) = - epsvap * psat / den1
  1363        dqsdtem(k,i,j) =   epsvap * psat / den2 * lhv * pres(k,i,j)
  1379     real(RP), 
intent(out) :: dqsdtem(
ka,
ia,
ja)
  1380     real(RP), 
intent(out) :: dqsdpre(
ka,
ia,
ja)
  1381     real(RP), 
intent(in)  :: temp   (
ka,
ia,
ja)
  1382     real(RP), 
intent(in)  :: pres   (
ka,
ia,
ja)
  1387     real(RP) :: den1, den2 
  1388     real(RP) :: RTEM00, TEM
  1393     rtem00   = 1.0_rp / tem00
  1399        tem = max( temp(k,i,j), tem_min )
  1403             * exp( 
lovr_ice * ( rtem00 - 1.0_rp/tem ) )
  1405        den1 = ( pres(k,i,j) - (1.0_rp-epsvap) * psat ) &
  1406             * ( pres(k,i,j) - (1.0_rp-epsvap) * psat )
  1407        den2 = den1 * rvap * temp(k,i,j) * temp(k,i,j)
  1408        lhv  = lhs0 + ( cpvap-ci ) * ( temp(k,i,j)-tem00 )
  1410        dqsdpre(k,i,j) = - epsvap * psat / den1
  1411        dqsdtem(k,i,j) =   epsvap * psat / den2 * lhv * pres(k,i,j)
 real(rp), public const_lhs
latent heat of sublimation for use 
 
real(rp), public const_cvdry
specific heat (dry air,constant volume) [J/kg/K] 
 
real(rp), parameter, public const_psat0
saturate pressure of water vapor at 0C [Pa] 
 
real(rp), public const_cpdry
specific heat (dry air,constant pressure) [J/kg/K] 
 
module ATMOSPHERE / Saturation adjustment 
 
subroutine, public prc_mpistop
Abort MPI. 
 
subroutine, public atmos_saturation_setup
Setup. 
 
real(rp), parameter, public const_ci
specific heat (ice) [J/kg/K] 
 
real(rp), public cvovr_liq
 
logical, public io_l
output log or not? (this process) 
 
real(rp), public cpovr_liq
 
real(rp), parameter, public const_cl
specific heat (liquid water) [J/kg/K] 
 
real(rp), public cvovr_ice
 
integer, public ke
end point of inner domain: z, local 
 
real(rp), parameter, public const_tem00
temperature reference (0C) [K] 
 
real(rp), public const_cvvap
specific heat (water vapor, constant volume) [J/kg/K] 
 
subroutine, public atmos_saturation_dqsw_dtem_rho(dqsdtem, temp, dens)
 
subroutine, public atmos_saturation_dqsw_dtem_dpre(dqsdtem, dqsdpre, temp, pres)
 
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K] 
 
real(rp), parameter, public const_lhs0
latent heat of sublimation at 0C [J/kg] 
 
subroutine, public atmos_saturation_dqsi_dtem_rho(dqsdtem, temp, dens)
 
integer, public ia
of x whole cells (local, with HALO)
 
integer, public ka
of z whole cells (local, with HALO)
 
real(rp), parameter, public const_lhv0
latent heat of vaporizaion at 0C [J/kg] 
 
subroutine atmos_saturation_alpha_0d(alpha, temp)
calc liquid/ice separation factor (0D) 
 
real(rp), public const_epsvap
Rdry / Rvap. 
 
real(rp), public lovr_ice
 
real(rp), public const_lhv
latent heat of vaporizaion for use 
 
real(rp), parameter, public const_rvap
specific gas constant (water vapor) [J/kg/K] 
 
subroutine, public atmos_saturation_dqsi_dtem_dpre(dqsdtem, dqsdpre, temp, pres)
 
integer, public ks
start point of inner domain: z, local 
 
real(rp), public lovr_liq
 
logical, public io_lnml
output log or not? (for namelist, this process) 
 
integer, public io_fid_conf
Config file ID. 
 
integer, public io_fid_log
Log file ID. 
 
real(rp), parameter, public const_cpvap
specific heat (water vapor, constant pressure) [J/kg/K] 
 
character(len=h_short), public const_thermodyn_type
internal energy type 
 
real(rp), public cpovr_ice
 
integer, public ja
of y whole cells (local, with HALO)