Ignore:
Timestamp:
Feb 8, 2024, 11:42:00 AM (11 months ago)
Author:
jbclement
Message:

PEM:
Cleanings of unused variables/arguments and bad type conversions.
JBC

Location:
trunk/LMDZ.COMMON/libf/evolution
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/adsorption_mod.F90

    r3130 r3206  
    8888!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    8989
    90       use comsoil_h_PEM, only: layer_PEM, mlayer_PEM,index_breccia,index_bedrock
    91       use comslope_mod, only : subslope_dist,def_slope_mean
    92       use vertical_layers_mod, ONLY: ap,bp
    93       use constants_marspem_mod,only: alpha_clap_h2o,beta_clap_h2o, &
    94                                       m_h2o,m_co2,m_noco2, &
    95                                       rho_regolith
     90use comsoil_h_PEM,         only: layer_PEM, index_breccia
     91use comslope_mod,          only: subslope_dist, def_slope_mean
     92use vertical_layers_mod,   only: ap,bp
     93use constants_marspem_mod, only: alpha_clap_h2o, beta_clap_h2o, m_h2o, m_co2,m_noco2, rho_regolith
     94
    9695#ifndef CPP_STD
    9796    use comcstfi_h,   only: pi
     
    102101 implicit none
    103102! inputs
    104  INTEGER,INTENT(IN) :: ngrid, nslope, nsoil_PEM,timelen ! size dimension
    105  REAL,INTENT(IN) :: tend_h2oglaciers(ngrid,nslope),tend_co2glaciers(ngrid,nslope) !tendancies on the glaciers ()
    106  REAL,INTENT(IN) :: waterice(ngrid,nslope)              ! water ice at the surface [kg/m^2]
    107  REAL,INTENT(IN) :: co2ice(ngrid,nslope)                ! co2 ice at the surface [kg/m^2]
    108  REAL,INTENT(IN) :: ps(ngrid,timelen)                   ! surface pressure (Pa)         
     103 INTEGER,INTENT(IN) :: ngrid, nslope, nsoil_PEM,timelen ! Size dimension
     104 REAL,INTENT(IN) :: tend_h2oglaciers(ngrid,nslope),tend_co2glaciers(ngrid,nslope) ! Tendencies on the glaciers ()
     105 REAL,INTENT(IN) :: waterice(ngrid,nslope)              ! Water ice at the surface [kg/m^2]
     106 REAL,INTENT(IN) :: co2ice(ngrid,nslope)                ! CO2 ice at the surface [kg/m^2]
     107 REAL,INTENT(IN) :: ps(ngrid,timelen)                   ! Surface pressure (Pa)         
    109108 REAL,INTENT(IN) :: q_co2(ngrid,timelen)                ! Mass mixing ratio of co2 in the first layer (kg/kg)
    110109 REAL,INTENT(IN) :: q_h2o(ngrid,timelen)                ! Mass mixing ratio of H2o in the first layer (kg/kg)
     
    114113! outputs
    115114 REAL,INTENT(INOUT) :: m_h2o_completesoil(ngrid,nsoil_PEM,nslope) ! Density of h2o adsorbed (kg/m^3)(ngrid,nsoil_PEM,nslope)     
    116  REAL,INTENT(OUT) :: theta_h2o_adsorbded(ngrid,nsoil_PEM,nslope) ! Fraction of the pores occupied by H2O molecules
    117  REAL,INTENT(OUT) :: delta_mreg(ngrid)                         ! Difference density of h2o adsorbed (kg/m^3)
     115 REAL,INTENT(OUT) :: theta_h2o_adsorbded(ngrid,nsoil_PEM,nslope)  ! Fraction of the pores occupied by H2O molecules
     116 REAL,INTENT(OUT) :: delta_mreg(ngrid)                            ! Difference density of h2o adsorbed (kg/m^3)
    118117
    119118! constants
     
    124123! real :: as = 18.9e3             ! Specific area, Buhler & Piqueux 2021
    125124 real :: as = 9.48e4              ! Specific area, Zent
    126  real :: as_breccia = 1.7e4       ! Specific area of basalt, Zent
    127125 real ::  inertie_thresold = 800. ! TI > 800 means cementation
    128126
    129127 ! local variables
    130  REAL :: deltam_reg_complete(ngrid,index_breccia,nslope)         ! Difference in the mass per slope and soil layer (kg/m^3)
     128 REAL :: deltam_reg_complete(ngrid,index_breccia,nslope) ! Difference in the mass per slope and soil layer (kg/m^3)
    131129 real :: K                        ! Used to compute theta
    132  integer ig,iloop, islope,isoil,it   ! for loops
    133  INTEGER :: ispermanent_co2glaciers(ngrid,nslope)        ! Check if the co2 glacier is permanent
    134  INTEGER :: ispermanent_h2oglaciers(ngrid,nslope)        ! Check if the h2o glacier is permanent
    135  REAL :: deltam_reg_slope(ngrid,nslope)  ! Difference density of h2o adsorbed per slope (kg/m^3)
    136  REAL :: dm_h2o_regolith_slope(ngrid,nsoil_PEM,nslope)   ! elementary h2o mass adsorded per mesh per slope
    137  real :: A,B                                                   ! Used to compute the mean mass above the surface
    138  real :: p_sat                                                 ! saturated vapor pressure of ice
    139  real,allocatable :: mass_mean(:,:)                            ! mean mass above the surface
    140  real,allocatable :: zplev_mean(:,:)                           ! pressure above the surface
    141  real,allocatable :: pvapor(:,:)                               ! partial pressure above the surface
    142  real, allocatable :: pvapor_avg(:)                            ! yearly
     130 integer ig, iloop, islope, it    ! For loops
     131 INTEGER :: ispermanent_co2glaciers(ngrid,nslope)      ! Check if the co2 glacier is permanent
     132 INTEGER :: ispermanent_h2oglaciers(ngrid,nslope)      ! Check if the h2o glacier is permanent
     133 REAL :: deltam_reg_slope(ngrid,nslope)                ! Difference density of h2o adsorbed per slope (kg/m^3)
     134 REAL :: dm_h2o_regolith_slope(ngrid,nsoil_PEM,nslope) ! Elementary h2o mass adsorded per mesh per slope
     135 real :: A,B                                           ! Used to compute the mean mass above the surface
     136 real :: p_sat                                         ! Saturated vapor pressure of ice
     137 real,allocatable :: mass_mean(:,:)                    ! Mean mass above the surface
     138 real,allocatable :: zplev_mean(:,:)                   ! Pressure above the surface
     139 real,allocatable :: pvapor(:,:)                       ! Partial pressure above the surface
     140 real, allocatable :: pvapor_avg(:)                    ! Yearly averaged
    143141
    144142! 0. Some initializations
     
    248246                                   tsoil_PEM,TI_PEM,m_co2_completesoil,delta_mreg)
    249247
    250       use comsoil_h_PEM, only: layer_PEM, mlayer_PEM,index_breccia,index_bedrock,index_breccia
    251       use comslope_mod, only : subslope_dist,def_slope_mean
    252       use vertical_layers_mod, ONLY: ap,bp
    253       use constants_marspem_mod, only: m_co2, m_noco2,rho_regolith
     248use comsoil_h_PEM,         only: layer_PEM, index_breccia, index_breccia
     249use comslope_mod,          only: subslope_dist, def_slope_mean
     250use vertical_layers_mod,   only: ap, bp
     251use constants_marspem_mod, only: m_co2, m_noco2, rho_regolith
     252
    254253#ifndef CPP_STD
    255254    use comcstfi_h,   only: pi
     
    260259      IMPLICIT NONE
    261260! Inputs: 
    262  INTEGER,INTENT(IN) :: ngrid, nslope, nsoil_PEM,timelen             ! size dimension
     261 INTEGER,INTENT(IN) :: ngrid, nslope, nsoil_PEM,timelen             ! Size dimension
    263262 REAL,INTENT(IN) :: ps(ngrid,timelen)                               ! Average surface pressure [Pa]
    264263 REAL,INTENT(IN) :: tsoil_PEM(ngrid,nsoil_PEM,nslope)               ! Mean Soil Temperature [K]
    265264 REAL,INTENT(IN) :: TI_PEM(ngrid,nsoil_PEM,nslope)                  ! Mean Thermal Inertia [USI]
    266  REAL,INTENT(IN) :: tend_h2oglaciers(ngrid,nslope),tend_co2glaciers(ngrid,nslope) !tendancies on the glaciers ()
     265 REAL,INTENT(IN) :: tend_h2oglaciers(ngrid,nslope),tend_co2glaciers(ngrid,nslope) ! Tendencies on the glaciers ()
    267266 REAL,INTENT(IN) :: q_co2(ngrid,timelen),q_h2o(ngrid,timelen)       ! Mass mixing ratio of co2 and h2o in the first layer (kg/kg)
    268  REAL,INTENT(IN) :: waterice(ngrid,nslope)                          ! water ice at the surface [kg/m^2]
    269  REAL,INTENT(IN) :: co2ice(ngrid,nslope)                            ! co2 ice at the surface [kg/m^2]
     267 REAL,INTENT(IN) :: waterice(ngrid,nslope)                          ! Water ice at the surface [kg/m^2]
     268 REAL,INTENT(IN) :: co2ice(ngrid,nslope)                            ! CO2 ice at the surface [kg/m^2]
    270269
    271270! Outputs:
     
    275274! Constants:
    276275
    277  REAL :: alpha = 7.512e-6 ! Zent & Quinn 1995
    278  REAL :: beta =  -1541.5  ! Zent & Quinn 1995
     276 REAL :: alpha = 7.512e-6         ! Zent & Quinn 1995
     277 REAL :: beta =  -1541.5          ! Zent & Quinn 1995
    279278 REAL ::  inertie_thresold = 800. ! TI > 800 means cementation
    280  real :: m_theta = 4.27e-7     ! Mass of co2 per m^2 absorbed
    281 ! real :: as = 18.9e3              ! Specific area, Buhler & Piqueux 2021
    282  real :: as = 9.48e4           ! same as previous but from zent
    283  real :: as_breccia = 1.7e4       ! Specific area of basalt, Zent 1997
     279 real :: m_theta = 4.27e-7        ! Mass of co2 per m^2 absorbed
     280! real :: as = 18.9e3             ! Specific area, Buhler & Piqueux 2021
     281 real :: as = 9.48e4              ! Same as previous but from zent
    284282! Local         
    285283 real :: A,B                                             ! Used to compute the mean mass above the surface
    286  INTEGER :: ig,islope,iloop,it                           ! for loops
    287  REAL :: dm_co2_regolith_slope(ngrid,nsoil_PEM,nslope)   ! elementary mass adsorded per mesh per slope
     284 INTEGER :: ig,islope,iloop,it                           ! For loops
     285 REAL :: dm_co2_regolith_slope(ngrid,nsoil_PEM,nslope)   ! Elementary mass adsorded per mesh per slope
    288286 INTEGER :: ispermanent_co2glaciers(ngrid,nslope)        ! Check if the co2 glacier is permanent
    289287 INTEGER :: ispermanent_h2oglaciers(ngrid,nslope)        ! Check if the h2o glacier is permanent
    290  REAL :: deltam_reg_complete(ngrid,index_breccia,nslope)         ! Difference in the mass per slope and soil layer (kg/m^3)
     288 REAL :: deltam_reg_complete(ngrid,index_breccia,nslope) ! Difference in the mass per slope and soil layer (kg/m^3)
    291289 REAL :: deltam_reg_slope(ngrid,nslope)                  ! Difference in the mass per slope  (kg/m^3)
    292290 REAL :: m_h2o_adsorbed(ngrid,nsoil_PEM,nslope)          ! Density of CO2 adsorbed (kg/m^3)
    293  REAL :: theta_h2o_adsorbed(ngrid,nsoil_PEM,nslope)     ! Fraction of the pores occupied by H2O molecules
    294  REAL :: delta_mh2o(ngrid)                              ! Difference density of h2o adsorbed (kg/m^3)
     291 REAL :: theta_h2o_adsorbed(ngrid,nsoil_PEM,nslope)      ! Fraction of the pores occupied by H2O molecules
     292 REAL :: delta_mh2o(ngrid)                               ! Difference density of h2o adsorbed (kg/m^3)
    295293!timelen array are allocated because heavy ...
    296  real,allocatable :: mass_mean(:,:)                            ! mean mass above the surface
    297  real,allocatable :: zplev_mean(:,:)                           ! pressure above the surface
    298  real,allocatable :: pco2(:,:)                                  ! partial pressure above the surface
    299  real, allocatable :: pco2_avg(:)                              ! yearly averaged
     294 real,allocatable :: mass_mean(:,:)                      ! Mean mass above the surface
     295 real,allocatable :: zplev_mean(:,:)                     ! Pressure above the surface
     296 real,allocatable :: pco2(:,:)                           ! Partial pressure above the surface
     297 real, allocatable :: pco2_avg(:)                        ! Yearly averaged
    300298
    301299! 0. Some initializations
  • trunk/LMDZ.COMMON/libf/evolution/changelog.txt

    r3202 r3206  
    230230Some cleaning in the routine update_soilproperties
    231231
     232== 08/02/2024 == JBC
     233Cleanings of unused variables/arguments and bad type conversions.
  • trunk/LMDZ.COMMON/libf/evolution/conf_pem.F90

    r3161 r3206  
    6363year_bp_ini = 0.
    6464call getin('year_earth_bp_ini',year_earth_bp_ini)
    65 year_bp_ini = year_earth_bp_ini/convert_years
     65year_bp_ini = integer(year_earth_bp_ini/convert_years)
    6666
    6767var_obl = .true.
  • trunk/LMDZ.COMMON/libf/evolution/evol_ice_mod.F90

    r3152 r3206  
    7676!   local:
    7777!   ------
    78 integer                       :: i, j, islope                                        ! Loop variables
     78integer                       :: i, islope                                           ! Loop variables
    7979real                          :: pos_tend, neg_tend, real_coefficient, negative_part ! Variable to conserve h2o
    8080real, dimension(ngrid,nslope) :: new_tendencies                                      ! Tendencies computed in order to conserve h2o ice on the surface, only exchange between surface are done
  • trunk/LMDZ.COMMON/libf/evolution/ice_table_mod.F90

    r3082 r3206  
    6767!   Local
    6868! -----------
    69     real :: z1,z2                                                  ! intermediate variables used when doing a linear interpolation between two depths to find the root
    7069    integer ig, islope,isoil,isoilend                              ! loop variables
    7170    real :: diff_rho(nsoil_PEM)                                    ! difference of water vapor density between the surface and at depth [kg/m^3]
     
    259258integer :: index_firstice ! first index where ice appears (i.e., f > 0)
    260259real :: dz_eta(nsoilmx_PEM) ! \partial z \eta
    261 real :: dz_eta_low ! same but evaluated at the interface for ice
    262260real :: dzz_psat(nsoilmx_PEM) ! \partial \partial psat
    263261real :: massfillabove,massfillafter ! h2O mass above and after index_geothermal
  • trunk/LMDZ.COMMON/libf/evolution/iostart_PEM.F90

    r3149 r3206  
    680680  INTEGER                        :: ierr
    681681  INTEGER                        :: nvarid
    682   INTEGER                        :: idim
    683682   
    684683    CALL gather(field,field_glo)
  • trunk/LMDZ.COMMON/libf/evolution/nb_time_step_PCM_mod.F90

    r3149 r3206  
    3131!=======================================================================
    3232!   Local Variables
    33 integer        :: iq, fID, vID, idecal, ierr
     33integer        :: fID, vID, ierr
    3434integer        :: timelen ! number of times stored in the file
    3535!-----------------------------------------------------------------------
  • trunk/LMDZ.COMMON/libf/evolution/orbit_param_criterion_mod.F90

    r3203 r3206  
    5454real    :: min_obl, min_ecc, min_lsp                      ! Minimum value of orbit param given the admissible change
    5555integer :: max_obl_iter, max_ecc_iter, max_lsp_iter       ! Maximum year iteration before reaching an inadmissible value of orbit param
    56 integer :: ilask, iylask                                  ! Loop variables
     56integer :: ilask                                          ! Loop variable
    5757real    :: xa, xb, ya, yb                                 ! Variables for interpolation
    5858logical :: found_obl, found_ecc, found_lsp                ! Flag variables for orbital parameters
  • trunk/LMDZ.COMMON/libf/evolution/pem.F90

    r3203 r3206  
    3232use netcdf,                     only: nf90_open, NF90_NOWRITE, nf90_get_var, nf90_inq_varid, nf90_close
    3333use turb_mod,                   only: q2, wstar
    34 use comslope_mod,               only: nslope, def_slope, def_slope_mean, subslope_dist, iflat, major_slope, ini_comslope_h
     34use comslope_mod,               only: nslope, def_slope, def_slope_mean, subslope_dist, iflat, ini_comslope_h
    3535use logic_mod,                  only: iflag_phys
    3636use mod_const_mpi,              only: COMM_LMDZ
     
    4545use evol_ice_mod,               only: evol_co2_ice, evol_h2o_ice
    4646use comsoil_h_PEM,              only: soil_pem, ini_comsoil_h_PEM, end_comsoil_h_PEM, nsoilmx_PEM, &
    47                                       TI_PEM, inertiedat_PEM,           & ! soil thermal inertia
    48                                       tsoil_PEM, mlayer_PEM, layer_PEM, & ! Soil temp, number of subsurface layers, soil mid layer depths
     47                                      TI_PEM,                           & ! soil thermal inertia
     48                                      tsoil_PEM, layer_PEM, & ! Soil temp, number of subsurface layers, soil mid layer depths
    4949                                      fluxgeo                             ! Geothermal flux for the PEM and PCM
    5050use adsorption_mod,             only: regolith_adsorption, adsorption_pem,        & ! Bool to check if adsorption, main subroutine
     
    5757                                      ini_ice_table_porefilling, icetable_equilibrium, computeice_table_equilibrium,compute_massh2o_exchange_ssi
    5858use soil_thermalproperties_mod, only: update_soil_thermalproperties
    59 use time_phylmdz_mod,           only: daysec, dtphys, day_end
     59use time_phylmdz_mod,           only: daysec, dtphys
    6060use abort_pem_mod,              only: abort_pem
    6161use soil_settings_PEM_mod,      only: soil_settings_PEM
     
    7171
    7272#ifndef CPP_STD
    73     use comsoil_h,          only: tsoil, nsoilmx, ini_comsoil_h, inertiedat, mlayer, volcapa, inertiesoil, flux_geo, nqsoil, qsoil
     73    use comsoil_h,          only: tsoil, nsoilmx, ini_comsoil_h, inertiedat, mlayer, inertiesoil, flux_geo, nqsoil, qsoil
    7474    use surfdat_h,          only: tsurf, emis, qsurf, watercap, ini_surfdat_h, &
    7575                                  albedodat, zmea, zstd, zsig, zgam, zthe,     &
    76                                   hmons, summit, base,albedo_h2o_frost,        &
    77                                   frost_albedo_threshold, emissiv, watercaptag, perennial_co2ice, emisice, albedice
     76                                  albedo_h2o_frost,frost_albedo_threshold,     &
     77                                  emissiv, watercaptag, perennial_co2ice, emisice, albedice
    7878    use dimradmars_mod,     only: totcloudfrac, albedo
    7979    use dust_param_mod,     only: tauscaling
     
    8181    use mod_phys_lmdz_para, only: is_parallel, is_sequential, is_mpi_root, is_omp_root, is_master
    8282    use planete_h,          only: aphelie, periheli, year_day, peri_day, obliquit, iniorbit
    83     use paleoclimate_mod,   only: albedo_perennialco2, paleoclimate
    84     use comcstfi_h,         only: pi, rad, g, cpp, mugaz, r
     83    use comcstfi_h,         only: pi, rad, g, mugaz, r
    8584    use surfini_mod,        only: surfini
    8685#else
     
    9190    use aerosol_mod,        only: iniaerosol
    9291    use planete_mod,        only: apoastr, periastr, year_day, peri_day, obliquit
    93     use comcstfi_mod,       only: pi, rad, g, cpp, mugaz, r
     92    use comcstfi_mod,       only: pi, rad, g, mugaz, r
    9493#endif
    9594
     
    147146character(*), parameter :: startfi_name = "startfi_evol.nc" ! Name of the file used to initialize the PEM
    148147character(2)            :: str2
    149 integer                 :: ncid, varid, status                      ! Variable for handling opening of files
    150 integer                 :: phydimid, subdimid, nlayerdimid, nqdimid ! Variable ID for Netcdf files
    151 integer                 :: lonvarid, latvarid, areavarid, sdvarid   ! Variable ID for Netcdf files
    152 integer                 :: apvarid, bpvarid                         ! Variable ID for Netcdf files
     148integer                 :: ncid, status                           ! Variable for handling opening of files
     149integer                 :: lonvarid, latvarid, areavarid, sdvarid ! Variable ID for Netcdf files
     150integer                 :: apvarid, bpvarid                       ! Variable ID for Netcdf files
    153151
    154152! Variables to read starfi.nc and write restartfi.nc
     
    160158! Variables for h2o_ice evolution
    161159real, dimension(:,:),   allocatable :: h2o_ice              ! h2o ice in the PEM
    162 real, dimension(:,:),   allocatable :: h2o_ice_ini          ! Initial amount of h2o ice in the PEM
    163160real, dimension(:,:,:), allocatable :: min_h2o_ice          ! Minima of h2o ice at each point for the PCM years [kg/m^2]
    164161real                                :: h2o_surf_ini         ! Initial surface of sublimating h2o ice
     
    189186! Variables for slopes
    190187real, dimension(:,:,:), allocatable :: co2_ice_PCM        ! Physics x NSLOPE x Times field: co2 ice given by the PCM [kg/m^2]
    191 real, dimension(:,:),   allocatable :: co2_ice_ini_sublim ! physical point field: Logical array indicating sublimating point of co2 ice
    192 real, dimension(:,:),   allocatable :: initial_h2o_ice    ! physical point field: Logical array indicating if there is h2o ice at initial state
    193188real, dimension(:,:),   allocatable :: tend_co2_ice       ! physical point x slope field: Tendency of evolution of perennial co2 ice over a year
    194189real, dimension(:,:),   allocatable :: tend_co2_ice_ini   ! physical point x slope field x nslope: Tendency of evolution of perennial co2 ice over a year in the PCM
     
    252247    integer            :: nsplit_phys
    253248    integer, parameter :: jjm_value = jjm - 1
    254     integer            :: ierr
    255249
    256250    ! Dummy variables to use the subroutine 'init_testphys1d'
     
    269263
    270264! Loop variables
    271 integer :: i, j, ig0, l, ig, nnq, t, islope, ig_loop, islope_loop, iloop, isoil, icap
     265integer :: i, l, ig, nnq, t, islope, ig_loop, islope_loop, isoil, icap
    272266
    273267! Parallel variables
     
    10871081!    III_c Write the "restartpem.nc"
    10881082!------------------------
    1089 call pemdem0("restartpem.nc",longitude,latitude,cell_area,nsoilmx_PEM,ngrid, &
    1090              float(day_ini),0.,nslope,def_slope,subslope_dist)
     1083call pemdem0("restartpem.nc",longitude,latitude,cell_area,ngrid,nslope,def_slope,subslope_dist)
    10911084call pemdem1("restartpem.nc",i_myear,nsoilmx_PEM,ngrid,nslope,tsoil_PEM, &
    10921085             TI_PEM, porefillingice_depth,porefillingice_thickness,      &
  • trunk/LMDZ.COMMON/libf/evolution/pemetat0.F90

    r3203 r3206  
    7373real                                    :: delta                        ! Depth of the interface regolith-breccia, breccia -bedrock [m]
    7474character(2)                            :: num                          ! intermediate string to read PEM start sloped variables
    75 real, dimension(ngrid,nsoil_PEM)        :: tsoil_saved                  ! saved soil temperature [K]
    7675real, dimension(ngrid,nsoil_PEM,nslope) :: tsoil_tmp_yr1                ! intermediate soil temperature during yr 1 [K]
    7776real, dimension(ngrid,nsoil_PEM,nslope) :: tsoil_tmp_yr2                ! intermediate soil temperature during yr 2 [K]
    78 real, dimension(ngrid,nsoil_PEM - 1)    :: alph_tmp                     ! Intermediate for tsoil computation []
    79 real, dimension(ngrid,nsoil_PEM - 1)    :: beta_tmp                     ! Intermediate for tsoil computatio []
    8077logical                                 :: startpem_file                ! boolean to check if we read the startfile or not
    8178
  • trunk/LMDZ.COMMON/libf/evolution/pemredem.F90

    r3172 r3206  
    1616!=======================================================================
    1717
    18 SUBROUTINE pemdem0(filename,lonfi,latfi,cell_area,nsoil_PEM,ngrid,day_ini,time,nslope,def_slope,subslope_dist)
     18SUBROUTINE pemdem0(filename,lonfi,latfi,cell_area,ngrid,nslope,def_slope,subslope_dist)
    1919
    2020! create physics restart file and write time-independent variables
    21 use comsoil_h_PEM,     only: soil_pem,mlayer_PEM,inertiedat_PEM
    22 use iostart_PEM,       only: open_restartphy, close_restartphy, put_var, put_field, length
    23 use mod_grid_phy_lmdz, only: klon_glo
    24 use time_phylmdz_mod,  only: daysec
    25 
    26 #ifndef CPP_STD
    27     use planete_h,    only: aphelie, emin_turb, lmixmin, obliquit, peri_day, periheli, year_day
    28     use comcstfi_h,   only: g, mugaz, omeg, rad, rcp
    29 #else
    30     use planete_mod,  only: apoastr, emin_turb, lmixmin, obliquit, peri_day, periastr, year_day
    31     use comcstfi_mod, only: g, mugaz, omeg, rad, rcp
    32 #endif
     21use comsoil_h_PEM, only: mlayer_PEM
     22use iostart_PEM,   only: open_restartphy, close_restartphy, put_var, put_field, length
    3323
    3424implicit none
    3525
    3626character(*),                  intent(in) :: filename
    37 integer,                       intent(in) :: nsoil_PEM, ngrid, nslope
     27integer,                       intent(in) :: ngrid, nslope
    3828real, dimension(ngrid),        intent(in) :: lonfi, latfi
    39 real,                          intent(in) :: day_ini, time
    4029real, dimension(ngrid),        intent(in) :: cell_area     ! boundaries for bining of the slopes
    4130real, dimension(ngrid + 1),    intent(in) :: def_slope     ! boundaries for bining of the slopes
     
    7362! write time-dependent variable to restart file
    7463use iostart_PEM,   only: open_restartphy, close_restartphy, put_var, put_field
    75 use comsoil_h_PEM, only: mlayer_PEM, inertiedat_PEM, soil_pem
     64use comsoil_h_PEM, only: inertiedat_PEM, soil_pem
    7665use time_evol_mod, only: year_bp_ini, convert_years
    7766
     
    9382integer       :: islope
    9483character(2)  :: num
    95 integer       :: iq
    96 character(30) :: txt  ! To store some text
    9784real          :: Year ! Year of the simulation
    9885
  • trunk/LMDZ.COMMON/libf/evolution/read_data_PCM_mod.F90

    r3181 r3206  
    5555!=======================================================================
    5656! Local Variables
    57 character(12)                   :: start_file_type = "earth" ! default start file type
    58 real, dimension(:), allocatable :: time      ! times stored in start
    59 integer                         :: indextime ! index of selected time
    60 integer                         :: edges(4), corner(4)
    61 integer                         :: i, j, l, t          ! loop variables
    62 real                            :: A, B, mmean         ! Molar Mass of co2 and no co2, A;B intermediate variables to compute the mean molar mass of the layer
    63 integer                         :: islope              ! loop for variables
    64 character(2)                    :: num                 ! for reading sloped variables
     57integer                         :: i, j, t                                                       ! loop variables
     58real                            :: A, B, mmean                                                   ! Molar Mass of co2 and no co2, A;B intermediate variables to compute the mean molar mass of the layer
     59integer                         :: islope                                                        ! loop for variables
     60character(2)                    :: num                                                           ! for reading sloped variables
    6561real, dimension(iim_input + 1,jjm_input + 1,nslope,timelen)         :: h2o_ice_s_dyn             ! h2o ice per slope of the concatenated file [kg/m^2]
    6662real, dimension(iim_input + 1,jjm_input + 1,nslope,timelen)         :: watercap
     
    8076real, dimension(iim_input + 1,jjm_input + 1,nslope)                 :: watersurf_density_dyn_avg ! Water density at the surface, dynamic grid, yearly averaged [kg/m^3]
    8177real, dimension(iim_input + 1,jjm_input + 1,nsoilmx,nslope,timelen) :: watersoil_density_dyn     ! Water density in the soil layer, time series [kg/m^3]
    82 real, dimension(ngrid,nslope,timelen)                               :: watersurf_density         ! Water density at the surface, physical grid, time series [kg/m^3]
    8378!-----------------------------------------------------------------------
    8479! Open the NetCDF file
  • trunk/LMDZ.COMMON/libf/evolution/recomp_orb_param_mod.F90

    r3082 r3206  
    1515SUBROUTINE recomp_orb_param(i_myear,year_iter)
    1616
    17 use time_evol_mod, only: year_bp_ini, var_obl, var_ecc, var_lsp, convert_years
     17use time_evol_mod, only: year_bp_ini, var_obl, var_ecc, var_lsp
    1818use lask_param_mod, only: yearlask, obllask, ecclask, lsplask, end_lask_param_mod, last_ilask
    1919#ifndef CPP_STD
  • trunk/LMDZ.COMMON/libf/evolution/soil_settings_PEM_mod.F90

    r3149 r3206  
    99SUBROUTINE soil_settings_PEM(ngrid,nslope,nsoil_PEM,nsoil_PCM,TI_PCM,TI_PEM)
    1010
    11 !      use netcdf
    12 use comsoil_h_PEM, only: layer_PEM, mlayer_PEM, depth_breccia, depth_bedrock, index_breccia, index_bedrock
    13 use comsoil_h,     only: inertiedat, layer, mlayer, volcapa
    14 
    15 use iostart, only: inquire_field_ndims, get_var, get_field, inquire_field, inquire_dimension_length
     11use comsoil_h_PEM, only: layer_PEM, mlayer_pem, depth_breccia, depth_bedrock, index_breccia, index_bedrock
     12use iostart,       only: inquire_field_ndims, get_var, get_field, inquire_field, inquire_dimension_length
    1613
    1714implicit none
     
    4643! local variables:
    4744integer :: ig, iloop, islope ! loop counters
    48 logical :: found
    49 real    :: alpha,lay1 ! coefficients for building layers
    50 real    :: xmin, xmax ! to display min and max of a field
    51 real    :: index_powerlaw ! coefficient to match the power low grid with the exponential one
     45real    :: alpha, lay1       ! coefficients for building layers
     46real    :: index_powerlaw    ! coefficient to match the power low grid with the exponential one
    5247!=======================================================================
    5348! 1. Depth coordinate
  • trunk/LMDZ.COMMON/libf/evolution/soil_thermalproperties_mod.F90

    r3202 r3206  
    1 module soil_thermalproperties_mod
    2 
    3   implicit none
     1MODULE soil_thermalproperties_mod
     2
     3implicit none
    44
    55!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    1010!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1111
    12  contains
    13 
    14  subroutine ice_thermal_properties(ispureice,pore_filling,surf_thermalinertia,ice_thermalinertia)
    15 
    16          
    17 
     12!=======================================================================
     13contains
     14!=======================================================================
     15
     16SUBROUTINE ice_thermal_properties(ispureice,pore_filling,surf_thermalinertia,ice_thermalinertia)
    1817!=======================================================================
    1918!   subject: Compute ice thermal properties
     
    2120!
    2221!   author: LL, 04/2023
    23 !   ------
     22!   -------
    2423!         
    2524!=======================================================================
    2625
    27  USE constants_marspem_mod,only: porosity
    28 
    29       IMPLICIT NONE
     26use constants_marspem_mod, only: porosity
     27
     28implicit none
    3029
    3130!-----------------------------------------------------------------------
     
    3635!    Input/Output
    3736!    ------------
    38      LOGICAL,INTENT(IN) :: ispureice                       ! Boolean to check if ice is massive or just pore filling
    39      REAL,INTENT(IN) ::    pore_filling                    ! ice pore filling in each layer (1)
    40      REAL,INTENT(IN) ::    surf_thermalinertia            ! surface thermal inertia (J/m^2/K/s^1/2) 
    41      REAL,INTENT(OUT) ::   ice_thermalinertia              ! Thermal inertia of ice when present in the pore (J/m^2/K/s^1/2)
     37logical, intent(in) :: ispureice           ! Boolean to check if ice is massive or just pore filling
     38real,    intent(in) :: pore_filling        ! ice pore filling in each layer (1)
     39real,    intent(in) :: surf_thermalinertia ! surface thermal inertia (J/m^2/K/s^1/2) 
     40real,    intent(out) :: ice_thermalinertia ! Thermal inertia of ice when present in the pore (J/m^2/K/s^1/2)
    4241
    4342!    Local Variables
    4443!    --------------
    45      REAL :: inertie_purewaterice = 2100 ! 2050 is better according to my computations with the formula from Siegler et al., 2012, but let's follow Mellon et al. (2004)
     44REAL :: inertie_purewaterice = 2100 ! 2050 is better according to my computations with the formula from Siegler et al., 2012, but let's follow Mellon et al. (2004)
    4645!=======================================================================
    4746!   Beginning of the code
    4847!=======================================================================
    4948
    50    if(ispureice) then
    51            ice_thermalinertia = inertie_purewaterice
    52    else
    53            ice_thermalinertia = sqrt(surf_thermalinertia**2 + porosity*pore_filling*inertie_purewaterice**2)  ! Siegler et al.,2012
    54    endif
    55 
    56  end subroutine
    57 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    58 
    59   SUBROUTINE update_soil_thermalproperties(ngrid,nslope,nsoil_PEM,tendencies_waterice,waterice,p_avg_new,ice_depth,ice_thickness,TI_PEM)
    60 
    61  USE comsoil_h, only:  inertiedat, volcapa
    62  USE comsoil_h_PEM, only: layer_PEM,inertiedat_PEM,depth_breccia,depth_bedrock,index_breccia,index_bedrock,reg_thprop_dependp
    63  USE vertical_layers_mod, ONLY: ap,bp
    64  USE constants_marspem_mod,only: TI_breccia,TI_bedrock, TI_regolith_avg
    65  implicit none
     49if (ispureice) then
     50    ice_thermalinertia = inertie_purewaterice
     51else
     52    ice_thermalinertia = sqrt(surf_thermalinertia**2 + porosity*pore_filling*inertie_purewaterice**2)  ! Siegler et al., 2012
     53endif
     54
     55END SUBROUTINE
     56!=======================================================================
     57
     58SUBROUTINE update_soil_thermalproperties(ngrid,nslope,nsoil_PEM,tendencies_waterice,waterice,p_avg_new,ice_depth,ice_thickness,TI_PEM)
     59
     60use comsoil_h,             only: volcapa
     61use comsoil_h_PEM,         only: layer_PEM, inertiedat_PEM, depth_breccia, depth_bedrock, index_breccia, index_bedrock, reg_thprop_dependp
     62use constants_marspem_mod, only: TI_breccia, TI_bedrock, TI_regolith_avg
     63
     64implicit none
     65
    6666! Input:
    67  INTEGER,INTENT(IN) ::  ngrid, nslope, nsoil_PEM           ! Shape of the arrays: physical grid, number of sub-grid slopes, number of layer in the soil
    68  REAL,INTENT(IN) :: p_avg_new                              ! Global average surface pressure [Pa]
    69  REAL,INTENT(IN) :: tendencies_waterice(ngrid,nslope)      ! Tendencies on the water ice [kg/m^2/year]
    70  REAL,INTENT(IN) :: waterice(ngrid,nslope)                 ! Surface Water ice [kg/m^2]
    71  REAL,INTENT(in) :: ice_depth(ngrid,nslope)                ! Ice table depth [m]
    72  REAL,INTENT(in) :: ice_thickness(ngrid,nslope)            ! Ice table thickness [m]
     67integer, intent(in) ::  ngrid, nslope, nsoil_PEM      ! Shape of the arrays: physical grid, number of sub-grid slopes, number of layer in the soil
     68real, intent(in) :: p_avg_new                         ! Global average surface pressure [Pa]
     69real, intent(in) :: tendencies_waterice(ngrid,nslope) ! Tendencies on the water ice [kg/m^2/year]
     70real, intent(in) :: waterice(ngrid,nslope)            ! Surface Water ice [kg/m^2]
     71real, intent(in) :: ice_depth(ngrid,nslope)           ! Ice table depth [m]
     72real, intent(in) :: ice_thickness(ngrid,nslope)       ! Ice table thickness [m]
    7373! Outputs:
    7474
    75  REAL,INTENT(INOUT) :: TI_PEM(ngrid,nsoil_PEM,nslope)      ! Soil Thermal Inertia [J/m^2/K/s^1/2]
     75real, intent(inout) :: TI_PEM(ngrid,nsoil_PEM,nslope) ! Soil Thermal Inertia [J/m^2/K/s^1/2]
    7676 
    7777! Constants:
     
    234234   enddo !ig
    235235
    236 !=======================================================================
    237       RETURN
    238       END subroutine update_soil_thermalproperties
    239 
    240 end module soil_thermalproperties_mod
    241 
     236END SUBROUTINE update_soil_thermalproperties
     237
     238END MODULE soil_thermalproperties_mod
  • trunk/LMDZ.COMMON/libf/evolution/stopping_crit_mod.F90

    r3159 r3206  
    129129endif
    130130
    131 if (abs(surf_ini) < 1.e-5) stopPEM = .false.
     131if (abs(surf_ini) < 1.e-5) stopPEM = 0
    132132
    133133if (global_avg_press_new < global_avg_press_PCM*(1. - ps_criterion)) then
Note: See TracChangeset for help on using the changeset viewer.