Changeset 4168


Ignore:
Timestamp:
Apr 2, 2026, 3:46:30 PM (9 days ago)
Author:
emillour
Message:

Generic PCM:
Clean up module thermcell_mod.F90 : make module variables private and remove
unused module variables.
While at it, put all thermcell_*.F90 routines in modules.
EM

Location:
trunk/LMDZ.GENERIC
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/changelog.txt

    r4164 r4168  
    22522252Some fixes will be added as the model is tested in various configurations.
    22532253
    2254 == 02/04/2026 ==
     2254== 02/04/2026 == EM
    22552255Some changes following the "thermodynamics update":
    22562256- bug fix on the size of pplev
     
    22602260- some optimizations in "thermodynamics_update" : in the 'thermo_uni_ideal'
    22612261  case seting r(),cpp() and rcp() can be done at first call only.
     2262
     2263== 02/04/2026 == EM
     2264Clean up module thermcell_mod.F90 : make module variables private and remove
     2265unused module variables.
     2266While at it, put all thermcell_*.F90 routines in modules.
  • trunk/LMDZ.GENERIC/libf/phygeneric/physiq_mod.F90

    r4164 r4168  
    2121      use generic_cloud_common_h, only : epsi_generic, Psat_generic
    2222      use thermcell_mod, only: init_thermcell_mod
     23      use thermcell_main_mod, only: thermcell_main
    2324      use gases_h, only: gnom, gfrac, ngasmx
    2425      use radcommon_h, only: sigma, glat, grav, BWNV, WNOI, DWNI, DWNV, WNOV
     
    796797!        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    797798         if (calltherm) then
    798             CALL init_thermcell_mod(g, rcp_ref, rd_ref, pi, T_h2o_ice_liq, RW)
     799            CALL init_thermcell_mod(g, rcp_ref, rd_ref, pi)
    799800         endif
    800801
  • trunk/LMDZ.GENERIC/libf/phygeneric/thermcell_closure.F90

    r2177 r4168  
    1 !
    2 !
    3 !
     1MODULE thermcell_closure_mod
     2
     3IMPLICIT NONE
     4
     5CONTAINS
     6
    47SUBROUTINE thermcell_closure(ngrid,nlay,ptimestep,rho,zlev,                   &
    58                             lmax,alim_star,zmin,zmax,wmax,f)
     
    107110     
    108111     
    109 RETURN
    110 END
     112END SUBROUTINE thermcell_closure
     113
     114END MODULE thermcell_closure_mod
  • trunk/LMDZ.GENERIC/libf/phygeneric/thermcell_dq.F90

    r3893 r4168  
    1 !
    2 !
    3 !
     1MODULE thermcell_dq_mod
     2
     3IMPLICIT NONE
     4
     5CONTAINS
     6
    47SUBROUTINE thermcell_dq(ngrid,nlay,ptimestep,fm,entr,detr,masse,              &
    58                        q,dq,qa)
     
    159162     
    160163     
    161 RETURN
    162 END
     164END SUBROUTINE thermcell_dq
     165
     166END MODULE thermcell_dq_mod
  • trunk/LMDZ.GENERIC/libf/phygeneric/thermcell_dv2.F90

    r2231 r4168  
    1 !
    2 !
    3 !
     1MODULE thermcell_dv2_mod
     2
     3IMPLICIT NONE
     4
     5CONTAINS
     6
    47SUBROUTINE thermcell_dv2(ngrid,nlay,ptimestep,fm,entr,detr,masse,fraca,       &
    58                         zmax,zmin,u,v,du,dv,ua,va)
     
    192195     
    193196     
    194 RETURN
    195 END
     197END SUBROUTINE thermcell_dv2
     198
     199END MODULE thermcell_dv2_mod
  • trunk/LMDZ.GENERIC/libf/phygeneric/thermcell_env.F90

    r4146 r4168  
    1 !
    2 !
     1MODULE thermcell_env_mod
     2
     3IMPLICIT NONE
     4
     5CONTAINS
    36!
    47SUBROUTINE thermcell_env(ngrid,nlay,nq,pq,pt,pu,pv,pplay,pplev,               &
     
    153156     
    154157     
    155 RETURN
    156 END
     158END SUBROUTINE thermcell_env
     159
     160END MODULE thermcell_env_mod
  • trunk/LMDZ.GENERIC/libf/phygeneric/thermcell_flux.F90

    r3893 r4168  
    1 !
    2 !
    3 !
     1MODULE thermcell_flux_mod
     2
     3IMPLICIT NONE
     4
     5CONTAINS
     6
    47SUBROUTINE thermcell_flux(ngrid,nlay,ptimestep,masse,                         &
    58                          lmin,lmax,entr_star,detr_star,                      &
     
    400403     
    401404     
    402 RETURN
    403 END
     405END SUBROUTINE thermcell_flux
     406
     407END MODULE thermcell_flux_mod
  • trunk/LMDZ.GENERIC/libf/phygeneric/thermcell_height.F90

    r3893 r4168  
    1 !
    2 !
    3 !
     1MODULE thermcell_height_mod
     2
     3IMPLICIT NONE
     4
     5CONTAINS
     6
    47SUBROUTINE thermcell_height(ngrid,nlay,lmin,lmix,lmax,                        &
    58                            zlev,zmin,zmix,zmax,zw2,wmax,f_star)
     
    195198     
    196199     
    197 RETURN
    198 END
     200END SUBROUTINE thermcell_height
     201
     202END MODULE thermcell_height_mod
  • trunk/LMDZ.GENERIC/libf/phygeneric/thermcell_main.F90

    r3893 r4168  
    1 !
    2 !
     1MODULE thermcell_main_mod
     2
     3IMPLICIT NONE
     4
     5CONTAINS
    36!
    47SUBROUTINE thermcell_main(ngrid,nlay,nq,ptimestep,firstcall,                  &
     
    4548!===============================================================================
    4649     
    47       USE thermcell_mod
     50      USE thermcell_mod, ONLY: RD, RG, dvimpl, linf
    4851      USE print_control_mod, ONLY: prt_level
     52      USE thermcell_env_mod, ONLY: thermcell_env
     53      USE thermcell_plume_mod, ONLY: thermcell_plume
     54      USE thermcell_height_mod, ONLY: thermcell_height
     55      USE thermcell_closure_mod, ONLY: thermcell_closure
     56      USE thermcell_flux_mod, ONLY: thermcell_flux
     57      USE thermcell_dq_mod, ONLY: thermcell_dq
     58      USE thermcell_dv2_mod, ONLY: thermcell_dv2
    4959     
    5060      IMPLICIT NONE
     
    421431     
    422432     
    423 RETURN
    424 END
     433END SUBROUTINE thermcell_main
     434
     435END MODULE thermcell_main_mod
  • trunk/LMDZ.GENERIC/libf/phygeneric/thermcell_mod.F90

    r3655 r4168  
    66! Flags for computations
    77                                                 !  default
    8       LOGICAL,SAVE :: dqimpl                     !  .true.   Flag for thermcell_dq version (True : implicit scheme || False : explicit scheme)
    9       LOGICAL,SAVE :: dvimpl                     !  .false.  Flag for specific u, v mixing (True : thermcell_dv2 || False : thermcell_dq)
    10      
     8      LOGICAL,SAVE,PROTECTED :: dqimpl                     !  .true.   Flag for thermcell_dq version (True : implicit scheme || False : explicit scheme)
     9      LOGICAL,SAVE,PROTECTED :: dvimpl                     !  .false.  Flag for specific u, v mixing (True : thermcell_dv2 || False : thermcell_dq)
     10!$OMP THREADPRIVATE(dqimpl,dvimpl)
     11
    1112! Physical parameters
    1213     
    13       REAL,SAVE :: r_aspect_thermals             !  1.0      Aspect ratio of the thermals (width / height)
    14       REAL,SAVE :: tau_thermals                  !  0.       Relaxation time
    15       REAL,SAVE :: betalpha                      !  0.9      - between 0 (e=d=0) and 1 (rho*fraca=cst)
    16       REAL,SAVE :: afact                         !  2./3.    - buoyancy acceleration efficiency, between 0 and 1
    17       REAL,SAVE :: fact_epsilon                  !  2.e-3    - turbulence and friction deceleration
    18       REAL,SAVE :: nu                            !  0.       Geometrical contributions to entrainment and detrainment
    19       REAL,SAVE :: alpha_max                     !  0.7      Maximal permitted updraft fraction
    20       REAL,SAVE :: fomass_max                    !  0.5      Maximal permitted outgoing layer mass fraction
    21       REAL,SAVE :: pres_limit                    !  1.e5     -
     14      REAL,SAVE,PROTECTED :: r_aspect_thermals             !  1.0      Aspect ratio of the thermals (width / height)
     15      REAL,SAVE,PROTECTED :: tau_thermals                  !  0.       Relaxation time
     16      REAL,SAVE,PROTECTED :: betalpha                      !  0.9      - between 0 (e=d=0) and 1 (rho*fraca=cst)
     17!$OMP THREADPRIVATE(r_aspect_thermals,tau_thermals,betalpha)
     18      REAL,SAVE,PROTECTED :: afact                         !  2./3.    - buoyancy acceleration efficiency, between 0 and 1
     19      REAL,SAVE,PROTECTED :: fact_epsilon                  !  2.e-3    - turbulence and friction deceleration
     20      REAL,SAVE,PROTECTED :: nu                            !  0.       Geometrical contributions to entrainment and detrainment
     21!$OMP THREADPRIVATE(afact,fact_epsilon,nu)
     22      REAL,SAVE,PROTECTED :: alpha_max                     !  0.7      Maximal permitted updraft fraction
     23      REAL,SAVE,PROTECTED :: fomass_max                    !  0.5      Maximal permitted outgoing layer mass fraction
     24      REAL,SAVE,PROTECTED :: pres_limit                    !  1.e5     -
     25!$OMP THREADPRIVATE(alpha_max,fomass_max,pres_limit)
    2226     
    2327!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    3034!      ngrid.
    3135!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    32       INTEGER,SAVE :: linf                       !     1
     36      INTEGER,SAVE,PROTECTED :: linf                       !     1
     37!$OMP THREADPRIVATE(linf)
    3338     
    3439!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    3742!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3843      REAL,SAVE :: d_temp                        !     0.
    39      
     44!$OMP THREADPRIVATE(d_temp)
     45
    4046! Physical constants
    4147     
    42       REAL,SAVE :: RTT
    43       REAL,SAVE :: RG
    44       REAL,SAVE :: RKAPPA
    45       REAL,SAVE :: RPI
    46       REAL,SAVE :: RD
     48      REAL,SAVE,PROTECTED :: RG
     49      REAL,SAVE,PROTECTED :: RKAPPA
     50      REAL,SAVE,PROTECTED :: RPI
     51      REAL,SAVE,PROTECTED :: RD
    4752     
    48 !$OMP THREADPRIVATE(RTT, RG, RKAPPA, RPI, RD)
     53!$OMP THREADPRIVATE(RG, RKAPPA, RPI, RD)
    4954     
    5055     
    5156      CONTAINS
    5257     
    53       SUBROUTINE init_thermcell_mod(g, rcp, r, pi, T_h2o_ice_liq, RW)
     58      SUBROUTINE init_thermcell_mod(g, rcp, r, pi)
    5459         
    5560         USE ioipsl_getin_p_mod, ONLY: getin_p
     
    5762         IMPLICIT NONE
    5863         
    59          REAL g
    60          REAL rcp
    61          REAL r
    62          REAL pi
    63          REAL T_h2o_ice_liq
    64          REAL RW
     64         REAL,INTENT(IN) :: g
     65         REAL,INTENT(IN) :: rcp
     66         REAL,INTENT(IN) :: r
     67         REAL,INTENT(IN) :: pi
    6568         
    66          RTT = T_h2o_ice_liq
    6769         RG = g
    6870         RKAPPA = rcp
     
    135137         print *, 'd_temp = ', d_temp
    136138         
    137          RETURN
    138139      END SUBROUTINE init_thermcell_mod
    139140     
  • trunk/LMDZ.GENERIC/libf/phygeneric/thermcell_plume.F90

    r4146 r4168  
    1 !
    2 !
    3 !
     1MODULE thermcell_plume_mod
     2
     3IMPLICIT NONE
     4
     5CONTAINS
     6
    47SUBROUTINE thermcell_plume(ngrid,nlay,nq,ptimestep,                           &
    58                           ztv,zhl,zqt,zql,zlev,pplev,zpopsk,                 &
     
    315318     
    316319     
    317 RETURN
    318 END
     320
     321END SUBROUTINE thermcell_plume
     322
     323END MODULE thermcell_plume_mod
Note: See TracChangeset for help on using the changeset viewer.