Changeset 2842


Ignore:
Timestamp:
Dec 7, 2022, 5:53:27 PM (3 years ago)
Author:
romain.vande
Message:

Mars PEM:
PEM is now adapted to run with XIOS diurnal averages (when they will work properly)
RV

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

Legend:

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

    r2835 r2842  
    11   SUBROUTINE regolith_co2adsorption_old(ngrid,nslope,nsoil_PEM,ps,tsoil_PEM,TI_PEM,tend_h2oglaciers,tend_co2glaciers,co2ice,waterice,m_co2_completesoil,delta_mreg)
     2#ifndef CPP_STD
    23      use comsoil_h_PEM, only: layer_PEM, mlayer_PEM,n_1km
    34      USE comcstfi_h, only: r, cpp, mugaz, g, rcp, pi, rad
     
    9192
    9293!=======================================================================
     94#endif
    9395      RETURN
    9496      END
  • trunk/LMDZ.COMMON/libf/evolution/adsorption_mod.F90

    r2835 r2842  
    44
    55  subroutine regolith_h2oadsorption(ngrid,nslope,nsoil_PEM,timelen, ps,q_co2,q_h2o,tsoil_PEM,TI_PEM, theta_h2o_adsorbded,m_h2o_adsorbed)
    6 
     6#ifndef CPP_STD
    77 use vertical_layers_mod, ONLY: ap,bp
    88 use comsoil_h_PEM, only: n_1km
     9#endif
    910
    1011 implicit none
     
    5253     allocate(pvapor_avg(ngrid))
    5354
     55
     56
    5457      m_h2o_adsorbed(:,:,:) = 0.
    5558      theta_h2o_adsorbded(:,:,:) = 0.
    5659      A =(1/m_co2 - 1/m_noco2)
    5760      B=1/m_noco2
     61#ifndef CPP_STD
    5862! 1. Compute rho surface yearly averaged
    5963
     
    98102
    99103 RETURN
     104#endif
    100105  end subroutine
    101106
    102107  SUBROUTINE regolith_co2adsorption(ngrid,nslope,nsoil_PEM,timelen,ps,tsoil_PEM,TI_PEM,tend_h2oglaciers,tend_co2glaciers,co2ice,waterice,q_co2,q_h2o,m_co2_completesoil,delta_mreg)
     108#ifndef CPP_STD
    103109      use comsoil_h_PEM, only: layer_PEM, mlayer_PEM,n_1km
    104110      USE comcstfi_h, only: r, cpp, mugaz, g, rcp, pi, rad
    105111      use comslope_mod, only : subslope_dist,def_slope_mean
    106112      use vertical_layers_mod, ONLY: ap,bp
     113#endif
    107114
    108115      IMPLICIT NONE
     
    138145 INTEGER :: ispermanent_co2glaciers(ngrid,nslope)        ! Check if the glacier is permanent
    139146 INTEGER :: ispermanent_h2oglaciers(ngrid,nslope)        ! Check if the glacier is permanent
     147#ifndef CPP_STD
    140148 REAL :: deltam_reg_complete(ngrid,n_1km,nslope)         ! Difference in the mass per slope and soil layer (kg/m^3)
     149#endif
    141150 REAL :: deltam_reg_slope(ngrid,nslope)                  ! Difference in the mass per slope  (kg/m^3)
    142151 REAL :: m_h2o_adsorbed(ngrid,nsoil_PEM,nslope)          ! Density of CO2 adsorbed (kg/m^3)
     
    154163     allocate(pco2(ngrid,timelen))
    155164     allocate(pco2_avg(ngrid))
     165
     166#ifndef CPP_STD
    156167 
    157168      m_h2o_adsorbed(:,:,:) = 0.
     
    246257!=======================================================================
    247258      RETURN
     259#endif
    248260      END
    249261
  • trunk/LMDZ.COMMON/libf/evolution/computeice_table.F90

    r2835 r2842  
    11   SUBROUTINE computeice_table(timelen,ngrid,nslope,nsoil_GCM,nsoil_PEM,tsoil,tsurf,q_co2,q_h2o,ps,ice_table)
     2#ifndef CPP_STD
    23    USE comsoil_h, only:  inertiedat, volcapa
    34    USE vertical_layers_mod, ONLY: ap,bp
     
    141142      RETURN
    142143
    143 
     144#endif
    144145      END
  • trunk/LMDZ.COMMON/libf/evolution/evol_co2_ice_s_mod_slope.F90

    r2835 r2842  
    3232
    3333  INTEGER :: i,j,ig0,islope                                  ! loop variable
    34 !  REAL :: not_budget, budget
    35   REAL :: pos_tend, neg_tend, real_coefficient,negative_part
    36   REAL ::  new_tendencies(ngrid)
    3734
    3835  STOPPING=.false.
    39 
    4036
    4137! Evolution of the water ice for each physical point
     
    5046  enddo
    5147
    52 
    5348END SUBROUTINE evol_co2_ice_s_slope
  • trunk/LMDZ.COMMON/libf/evolution/ini_soil_mod.F90

    r2835 r2842  
    88               therm_i, timestep,tsurf_ave,tsoil_ave,tsurf_inst, tsoil_inst,q_co2,q_h2o,ps,ice_table)
    99
     10#ifndef CPP_STD
     11
    1012      use vertical_layers_mod, only: ap,bp
    1113      use comsoil_h_PEM, only:  fluxgeo,layer_PEM,inertiedat_PEM
    1214      use comsoil_h,only: volcapa, nsoilmx
     15#endif
    1316
    1417   implicit none
     
    8689
    8790    real,allocatable :: diff_rho(:)                    ! difference of vapor content
     91
     92#ifndef CPP_STD
    8893
    8994    A =(1/m_co2 - 1/m_noco2)
     
    227232     countloop = 0
    228233   enddo
     234
     235#endif
    229236 
    230237      END SUBROUTINE ini_icetable
     
    232239               therm_i,                          &
    233240               timestep,tsurf,tsoil,alph,beta)
    234 
     241#ifndef CPP_STD
    235242      use comsoil_h_PEM, only: layer_PEM, mlayer_PEM,  &
    236243                           mu_PEM,fluxgeo
    237244      use comsoil_h,only: volcapa
     245#endif
    238246      implicit none
    239247
     
    275283      real :: coefq_PEM(0:nsoil-1)
    276284
     285#ifndef CPP_STD
     286
    277287! 0. Initialisations and preprocessing step
    278288 if (firstcall) then
     
    347357                       +coefd_PEM(ik))
    348358      enddo
    349 
     359#endif
    350360      end
    351361
  • trunk/LMDZ.COMMON/libf/evolution/iostart_PEM.F90

    r2794 r2842  
    466466  USE mod_grid_phy_lmdz, only: klon_glo
    467467  USE dimphy, only: klev, klevp1
     468#ifndef CPP_STD
    468469  USE tracer_mod, only: nqmx
     470#else
     471  use tracer_h, only:   nqtot
     472#endif
    469473  USE comsoil_h_PEM, only:  nsoilmx_PEM
    470474  USE comslope_mod, only: nslope
     
    473477    INTEGER                     :: ierr
    474478    LOGICAL,SAVE :: already_created=.false.
     479
     480#ifdef CPP_STD
     481    INTEGER :: nqmx
     482    nqmx=nqtot
     483#endif
    475484   
    476485    IF (is_master) THEN
  • trunk/LMDZ.COMMON/libf/evolution/orbit_param_criterion_mod.F90

    r2835 r2842  
    88
    99      USE temps_mod_evol, ONLY: year_bp_ini, year_PEM
     10#ifndef CPP_STD
    1011      USE planete_h, ONLY: e_elips, obliquit, timeperi
    11       USE comcstfi_h, only: pi
     12#else
     13      use planete_mod, only: e_elips, obliquit, timeperi
     14#endif
     15      USE comconst_mod, ONLY: pi
    1216      USE lask_param_mod, only: yearlask,oblask,exlask,lsplask, &
    1317                                ini_lask_param_mod,last_ilask
  • trunk/LMDZ.COMMON/libf/evolution/pem.F90

    r2835 r2842  
    3131
    3232!module needed for INITIALISATION
    33       use phyetat0_mod, only: phyetat0
     33#ifndef CPP_STD
    3434      use comsoil_h, only: tsoil, nsoilmx, ini_comsoil_h,inertiedat, mlayer,volcapa
    3535      use surfdat_h, only: tsurf, co2ice, emis,&
    36       &                    qsurf,watercap, ini_surfdat_h, &
     36                           qsurf,watercap, ini_surfdat_h, &
    3737                           albedodat, zmea, zstd, zsig, zgam, zthe, &
    3838                           hmons, summit, base,albedo_h2o_frost, &
    39                           frost_albedo_threshold,emissiv
     39                           frost_albedo_threshold,emissiv
    4040      use dimradmars_mod, only: totcloudfrac, albedo
     41      use dust_param_mod, only: tauscaling
     42      use tracer_mod, only: noms,igcm_h2o_ice ! tracer names
     43#else
     44      use comsoil_h, only: nsoilmx, ini_comsoil_h,inertiedat, mlayer,volcapa
     45      use surfdat_h, only: albedodat, zmea, zstd, zsig, zgam, zthe, &
     46                           emissiv
     47      use tracer_h, only: noms,igcm_h2o_ice,igcm_co2_ice ! tracer names
     48      use phys_state_var_mod
     49#endif
     50      use phyetat0_mod, only: phyetat0
     51      use phyredem, only: physdem0, physdem1
    4152      use turb_mod, only: q2, wstar
    42       use dust_param_mod, only: tauscaling
    4353      use netcdf, only: nf90_open,NF90_NOWRITE,nf90_noerr,nf90_strerror, &
    4454                        nf90_get_var, nf90_inq_varid, nf90_inq_dimid, &
    4555                        nf90_inquire_dimension,nf90_close
    46       use phyredem, only: physdem0, physdem1
    47       use tracer_mod, only: noms,igcm_h2o_ice ! tracer names
    4856
    4957! For phyredem :
    5058      USE control_mod, ONLY: iphysiq, day_step,nsplit_phys
    51       use time_phylmdz_mod, only: daysec
     59      USE iniphysiq_mod, ONLY: iniphysiq
     60      USE logic_mod, ONLY: iflag_phys
     61#ifndef CPP_STD
    5262      use mod_phys_lmdz_para, only: is_parallel, is_sequential, &
    5363                                   is_mpi_root, is_omp_root,    &
    5464                                   is_master
    55       use time_phylmdz_mod, only: dtphys
     65      use planete_h, only: aphelie, periheli, year_day, peri_day, &
     66                          obliquit
     67#else
     68!      USE comcstfi_mod, ONLY: rad,g,r,cpp,pi
     69!      USE inifis_mod, ONLY: inifis
     70      use planete_mod, only: apoastr, periastr, year_day, peri_day, &
     71                          obliquit
     72#endif
    5673      USE mod_const_mpi, ONLY: COMM_LMDZ
    57       USE comconst_mod, ONLY: rad,g,r,cpp
    58       USE logic_mod, ONLY: iflag_phys
    59       USE iniphysiq_mod, ONLY: iniphysiq
    60       USE infotrac
    61       USE comcstfi_h, only: pi
    62 
    6374      USE comslope_mod, ONLY: nslope,def_slope,def_slope_mean, &
    6475                           subslope_dist,co2ice_slope, &
     
    6778                           co2iceflow, beta_slope, capcal_slope,&
    6879                           albedo_slope,emiss_slope,qsurf_slope,&
    69                            iflat
    70 
     80                           iflat,ini_comslope_h
     81      use time_phylmdz_mod, only: daysec,dtphys
     82      USE comconst_mod, ONLY: rad,g,r,cpp,pi
     83      USE infotrac
    7184      USE geometry_mod, only: latitude_deg
    7285
     
    8396!!! For orbit parameters
    8497      USE temps_mod_evol, ONLY: dt_pem, evol_orbit_pem, Max_iter_pem
    85       use planete_h, only: aphelie, periheli, year_day, peri_day, &
    86                           obliquit
    8798      use orbit_param_criterion_mod, only : orbit_param_criterion
    8899      use recomp_orb_param_mod, only: recomp_orb_param
     
    266277     REAL :: totmass_adsorbded
    267278
     279#ifdef CPP_STD
     280!     INTEGER :: nsplit_phys=1
     281!     LOGICAL :: iflag_phys=.true.
     282     REAL :: frost_albedo_threshold=0.05
     283     REAL :: albedo_h2o_frost
     284     REAL,ALLOCATABLE :: co2ice(:)
     285#endif
     286
    268287!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    269288
     
    274293     REAL :: alpha = 23.3494
    275294 
     295#ifndef CPP_STD
    276296! Parallel variables
    277297      is_sequential=.true.
     
    280300      is_omp_root=.true.
    281301      is_master=.true.
     302#endif
    282303
    283304      day_ini=0    !test
     
    369390          iflag_phys)
    370391
    371      DO nnq=1,nqtot
    372        if(noms(nnq).eq."h2o_ice") igcm_h2o_ice = nnq
    373      ENDDO
    374 
    375392!----------------------------READ startfi.nc ---------------------
    376393
     
    381398      allocate(inertiesoil(ngrid,nsoilmx))
    382399
     400#ifndef CPP_STD
    383401      CALL phyetat0 (FILE_NAME,0,0, &
    384402              nsoilmx,ngrid,nlayer,nq,   &
     
    405423       enddo
    406424     enddo
     425
     426#else
     427         call phys_state_var_init(nq)
     428         IF (.NOT.ALLOCATED(noms)) ALLOCATE(noms(nq)) ! (because noms is an argument of physdem1 whether or not tracer is on)
     429         call initracer(ngrid,nq)
     430         call iniaerosol()
     431         call phyetat0(.true.,                                 &
     432                       ngrid,nlayer,FILE_NAME,0,0,nsoilmx,nq,      &
     433                       day_ini,time_phys,tsurf,tsoil,emis,q2,qsurf,   &
     434                       cloudfrac,totcloudfrac,hice,                   &
     435                       rnat,pctsrf_sic,tslab, tsea_ice,sea_ice)
     436         call surfini(ngrid,nq,qsurf,albedo,albedo_bareground,albedo_snow_SPECTV,albedo_co2_ice_SPECTV)
     437
     438         call ini_comslope_h(ngrid,nsoilmx,nq)
     439
     440         allocate(co2ice(ngrid))
     441         co2ice(:)=qsurf(:,igcm_co2_ice)
     442         co2ice_slope(:,1)=co2ice(:)
     443         tsurf_slope(:,1)=tsurf(:)
     444
     445if (nslope.eq.1) then
     446def_slope(1) = 0
     447def_slope(2) = 0
     448def_slope_mean=0
     449subslope_dist(:,1) = 1.
     450endif
     451
     452! Remove unphysical values of surface tracer
     453     DO i=1,ngrid
     454       DO nnq=1,nqtot
     455         qsurf_slope(i,nnq,1)=qsurf(i,nnq)
     456         if(qsurf(i,nnq).LT.0) then
     457           qsurf(i,nnq)=0.
     458         endif
     459       enddo
     460     enddo
     461#endif
     462
     463     DO nnq=1,nqtot
     464       if(noms(nnq).eq."h2o_ice") igcm_h2o_ice = nnq
     465     ENDDO
    407466
    408467!------------------------
     
    440499         co2_hmax(5) = co2_hmax(3)
    441500         co2_hmax(4) = 1000000.
    442        endif
     501     elseif(nslope.eq.1) then
     502         co2_hmax(1) = 1000000.
     503     else
     504         print *, "Nslope must be=to 1 or 7 for now!!"
     505     endif
    443506
    444507     allocate(flag_co2flow(ngrid,nslope))
     
    447510       flag_co2flow(:,:) = 0.     
    448511       flag_co2flow_mesh(:) = 0.
     512
    449513
    450514!---------------------------- READ GCM data ---------------------
     
    729793      tendencies_h2o_ice_phys_slope,tendencies_co2_ice_phys_slope,co2ice_slope,qsurf_slope(:,igcm_h2o_ice,:), co2_adsorbded_phys,delta_co2_adsorbded)
    730794
    731 
    732795    if(soil_pem) then
    733796     totmass_adsorbded = 0.
     
    761824!    I_h Read the PEMstar
    762825!    I_i Compute orbit criterion
    763 
     826#ifndef CPP_STD
    764827     CALL iniorbit(aphelie,periheli,year_day,peri_day,obliquit)
     828#else
     829     CALL iniorbit(apoastr, periastr, year_day, peri_day,obliquit)
     830#endif
    765831
    766832     if(evol_orbit_pem) then
     
    11301196                      cos(pi*def_slope_mean(islope)/180.)
    11311197        ENDDO
     1198#ifdef CPP_STD
     1199        qsurf(ig,igcm_co2_ice)=co2ice(ig)
     1200#endif
    11321201      ENDDO ! of DO ig=1,ngrid
    11331202! H2o ice
     
    11581227      ENDDO ! of DO ig=1,ngrid
    11591228
     1229#ifndef CPP_STD
    11601230      DO ig = 1,ngrid
    11611231        DO iloop = 1,nsoilmx
     
    11901260      ENDDO
    11911261    ENDDO
     1262#endif
    11921263
    11931264! III_a.4 Pressure (for start)
     
    12741345
    12751346! III_b.2 WRITE restartfi.nc
    1276      
     1347#ifndef CPP_STD
    12771348      call physdem0("restartfi_evol.nc",longitude,latitude, &
    12781349                        nsoilmx,ngrid,nlayer,nq,              &
     
    12891360                     tsurf_slope,tsoil_slope, albedo_slope,      &
    12901361                     emiss_slope,qsurf_slope,watercap_slope, TI_GCM_phys)
     1362#else
     1363     call physdem0("restartfi_evol.nc",longitude,latitude,nsoilmx,ngrid,nlayer,nq, &
     1364                         ptimestep,pday,time_phys,cell_area,          &
     1365                         albedo_bareground,inertiedat,zmea,zstd,zsig,zgam,zthe)
     1366
     1367     call physdem1("restartfi_evol.nc",nsoilmx,ngrid,nlayer,nq, &
     1368                          ptimestep,ztime_fin,                    &
     1369                          tsurf,tsoil,emis,q2,qsurf,         &
     1370                          cloudfrac,totcloudfrac,hice,            &
     1371                          rnat,pctsrf_sic,tslab,tsea_ice,sea_ice)
     1372#endif
    12911373
    12921374      print *, "restartfi_evol.nc has been written"
  • trunk/LMDZ.COMMON/libf/evolution/pemredem.F90

    r2835 r2842  
    1212                      put_var, put_field, length
    1313  use mod_grid_phy_lmdz, only : klon_glo
     14#ifndef CPP_STD
    1415  use planete_h, only: aphelie, emin_turb, lmixmin, obliquit, &
    1516                       peri_day, periheli, year_day
    1617  use comcstfi_h, only: g, mugaz, omeg, rad, rcp
     18#else
     19  use planete_mod, only: apoastr, emin_turb, lmixmin, obliquit, &
     20                       peri_day, periastr, year_day
     21  USE comconst_mod, ONLY: g, omeg, rad
     22  use comcstfi_mod, only: mugaz, rcp
     23#endif
    1724  use time_phylmdz_mod, only: daysec
    1825  implicit none
     
    6875  implicit none
    6976 
     77#ifndef CPP_STD
    7078  include "callkeys.h"
     79#endif
    7180 
    7281  character(len=*),intent(in) :: filename
  • trunk/LMDZ.COMMON/libf/evolution/read_data_GCM.F90

    r2835 r2842  
    118118     print *, "Downloading data for co2ice_slope ..."
    119119
     120if(nslope.gt.1) then
     121
    120122DO islope=1,nslope
    121123  write(num,fmt='(i2.2)') islope
     
    160162     print *, "Downloading data for inertiesoil_slope done"
    161163
    162   endif
     164  endif !soil_pem
     165
     166  else !nslope=1 no slope, we copy all the values
     167    co2_ice_slope(:,:,1,:)=co2_ice_s(:,:,:)
     168    h2o_ice_s_slope(:,:,1,:)=h2o_ice_s(:,:,:)
     169    call get_var3("tsurf",tsurf_gcm(:,:,1,:))
     170    if(soil_pem) then
     171      call get_var4("tsoil",tsoil_gcm(:,:,:,1,:))
     172      call get_var4("inertiesoil",TI_gcm(:,:,:,1,:))
     173    endif !soil_pem
     174  endif !nslope=1
    163175
    164176! Compute the minimum over the year for each point
  • trunk/LMDZ.COMMON/libf/evolution/recomp_orb_param_mod.F90

    r2835 r2842  
    88
    99      USE temps_mod_evol, ONLY: year_bp_ini, year_PEM
     10#ifndef CPP_STD
    1011      USE planete_h, ONLY: e_elips, obliquit, timeperi
    11       USE comcstfi_h, only: pi
     12#else
     13      use planete_mod, only: e_elips, obliquit, timeperi
     14#endif
     15      USE comcstfi_mod, only: pi
    1216      USE lask_param_mod, only: yearlask,oblask,exlask,lsplask, &
    1317                                end_lask_param_mod,last_ilask
  • trunk/LMDZ.COMMON/libf/evolution/update_soil.F90

    r2835 r2842  
    11   SUBROUTINE update_soil(ngrid,nslope,nsoil_PEM,tend_h2oglaciers,tend_co2glaciers,co2ice,waterice,p_avg_new,&
    22                          ice_depth,TI_PEM)
    3 
     3#ifndef CPP_STD
    44 USE comsoil_h, only:  inertiedat, volcapa
    55 USE comsoil_h_PEM, only: layer_PEM,n_1km,inertiedat_PEM
     
    138138!=======================================================================
    139139      RETURN
     140#endif
    140141      END
Note: See TracChangeset for help on using the changeset viewer.