Ignore:
Timestamp:
Jun 11, 2024, 5:15:20 PM (6 months ago)
Author:
jbclement
Message:

PEM:
Removal of useless condition and variable + some updates.
JBC

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

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.COMMON/libf/evolution/changelog.txt

    r3366 r3367  
    349349Some features might not work very well yet since not every stituation has not been tested.
    350350
     351== 10/06/2024 == JBC
     352- The PEM can now stop itself cleanly before the SLURM time limit for the job is reached and it continues the simulation with a new cycle.
     353- Update of "jobPEM.slurm" in the deftank to guarantee enough memory space to run the job.
     354- Few minor cleanings.
     355
     356== 10/06/2024 == JBC
     357Correction of an error in "lib_launchPEM.sh" due to a miscalculated condition + Improvement of the relaunch which now cleans the unnecessary files.
     358
    351359== 11/06/2024 == LL
    352360Fixing bug in the initial computation of ice tendencies (a negative tendancies was computed when a glacier was disapearing at the end of the second year of the PCM).
    353361Fixing a bug in the update of the tendencies of CO2 to ensure mass conservation
    354362
    355 ~               
     363== 11/06/2024 == JBC
     364Removal of useless condition and variable + some updates.
  • trunk/LMDZ.COMMON/libf/evolution/compute_tend_mod.F90

    r3366 r3367  
    1313!=======================================================================
    1414!
    15 ! Compute the initial tendencies of the evolution ice based on the PCM data
     15! Compute the initial tendencies of the ice evolution based on the PCM data
    1616!
    1717!=======================================================================
     
    3333where (abs(tendencies_ice) < 1.e-10) tendencies_ice = 0.
    3434
    35 ! If the minimum over the last year is 0 then we have no perennial ice
     35! If the minimum over the last year is 0, then we have no perennial ice
    3636where (abs(min_ice(:,:,2)) < 1.e-10) tendencies_ice = 0.
     37
    3738END SUBROUTINE compute_tend
    3839
  • trunk/LMDZ.COMMON/libf/evolution/deftank/lib_launchPEM.sh

    r3365 r3367  
    253253        i_myear=$irelaunch
    254254        sed -i "1s/.*/$i_myear $n_myear $convert_years $iPCM $iPEM $nPCM $nPCM_ini/" info_PEM.txt
     255        rm -f startpem.nc
    255256        if [ $irelaunch -eq $(($nPCM_ini - 1)) ]; then
    256257            cp diags/data2reshape${irelaunch}.nc data2reshape_Y1.nc
  • trunk/LMDZ.COMMON/libf/evolution/evol_ice_mod.F90

    r3366 r3367  
    2929!   local:
    3030!   ------
    31 real, dimension(ngrid,nslope) ::                co2_ice_tmp  ! Evolution of perennial ice over one year
     31real, dimension(ngrid,nslope), intent(inout) :: co2_ice_old ! Old density of CO2 ice
    3232!=======================================================================
    3333! Evolution of CO2 ice for each physical point
    3434write(*,*) 'Evolution of co2 ice'
    35 co2_ice_tmp = co2_ice + tend_co2_ice*dt_pem
    36 where (co2_ice_tmp < 0.)
    37     co2_ice_tmp = 0.
    38     tend_co2_ice = -co2_ice/dt_pem
     35
     36co2_ice_old = co2_ice
     37co2_ice = co2_ice + tend_co2_ice*dt_pem
     38where (co2_ice < 0.)
     39    co2_ice = 0.
     40    tend_co2_ice = -co2_ice_old/dt_pem
    3941end where
    40 co2_ice = co2_ice_tmp
     42
    4143END SUBROUTINE evol_co2_ice
    4244
  • trunk/LMDZ.COMMON/libf/evolution/pem.F90

    r3365 r3367  
    193193
    194194! Variables for slopes
    195 real, dimension(:,:,:), allocatable :: co2_ice_PCM        ! Physics x slope x Times field: co2 ice given by the PCM [kg/m^2]
    196195real, dimension(:,:),   allocatable :: tend_co2_ice       ! physical point x slope field: Tendency of evolution of perennial co2 ice over a year
    197196real, dimension(:,:),   allocatable :: tend_co2_ice_ini   ! physical point x slope field: Tendency of evolution of perennial co2 ice over a year in the PCM
     
    203202
    204203! Variables for surface and soil
    205 real, dimension(:,:),     allocatable :: tsurf_ave                          ! Physic x SLOPE field: Averaged Surface Temperature [K]
    206 real, dimension(:,:,:),   allocatable :: tsoil_ave                          ! Physic x SOIL x SLOPE field: Averaged Soil Temperature [K]
     204real, dimension(:,:),     allocatable :: tsurf_avg                          ! Physic x SLOPE field: Averaged Surface Temperature [K]
     205real, dimension(:,:,:),   allocatable :: tsoil_avg                          ! Physic x SOIL x SLOPE field: Averaged Soil Temperature [K]
    207206real, dimension(:,:,:),   allocatable :: tsoil_anom                         ! Amplitude between instataneous and yearly average soil temperature [K]
    208207real, dimension(:,:,:),   allocatable :: tsurf_PCM_timeseries               ! ngrid x SLOPE x TIMES field: Surface Temperature in timeseries [K]
     
    214213real, dimension(:),       allocatable :: Tsurf_locslope                     ! Physic x Soil: Intermediate surface temperature to compute Tsoil [K]
    215214real, dimension(:,:,:,:), allocatable :: watersoil_density_timeseries       ! Physic x Soil x Slope x Times water soil density, time series [kg /m^3]
    216 real, dimension(:,:),     allocatable :: watersurf_density_ave              ! Physic x Slope, water surface density, yearly averaged [kg/m^3]
     215real, dimension(:,:),     allocatable :: watersurf_density_avg              ! Physic x Slope, water surface density, yearly averaged [kg/m^3]
    217216real, dimension(:,:,:,:), allocatable :: watersoil_density_PEM_timeseries   ! Physic x Soil x Slope x Times, water soil density, time series [kg/m^3]
    218 real, dimension(:,:,:),   allocatable :: watersoil_density_PEM_ave          ! Physic x Soil x Slopes, water soil density, yearly averaged [kg/m^3]
     217real, dimension(:,:,:),   allocatable :: watersoil_density_PEM_avg          ! Physic x Soil x Slopes, water soil density, yearly averaged [kg/m^3]
    219218real, dimension(:,:),     allocatable :: Tsurfavg_before_saved              ! Surface temperature saved from previous time step [K]
    220219real, dimension(:),       allocatable :: delta_co2_adsorbded                ! Physics: quantity of CO2 that is exchanged because of adsorption / desorption [kg/m^2]
     
    521520call nb_time_step_PCM("data_PCM_Y1.nc",timelen)
    522521
    523 allocate(tsoil_ave(ngrid,nsoilmx,nslope))
    524 allocate(watersoil_density_PEM_ave(ngrid,nsoilmx_PEM,nslope))
     522allocate(tsoil_avg(ngrid,nsoilmx,nslope))
     523allocate(watersoil_density_PEM_avg(ngrid,nsoilmx_PEM,nslope))
    525524allocate(vmr_co2_PCM(ngrid,timelen))
    526525allocate(ps_timeseries(ngrid,timelen))
     
    528527allocate(min_h2o_ice(ngrid,nslope,2))
    529528allocate(tsurf_avg_yr1(ngrid,nslope))
    530 allocate(tsurf_ave(ngrid,nslope))
     529allocate(tsurf_avg(ngrid,nslope))
    531530allocate(tsurf_PCM_timeseries(ngrid,nslope,timelen))
    532531allocate(tsoil_PCM_timeseries(ngrid,nsoilmx,nslope,timelen))
    533532allocate(q_co2_PEM_phys(ngrid,timelen))
    534533allocate(q_h2o_PEM_phys(ngrid,timelen))
    535 allocate(co2_ice_PCM(ngrid,nslope,timelen))
    536 allocate(watersurf_density_ave(ngrid,nslope))
     534allocate(watersurf_density_avg(ngrid,nslope))
    537535allocate(watersoil_density_timeseries(ngrid,nsoilmx,nslope,timelen))
    538536allocate(Tsurfavg_before_saved(ngrid,nslope))
     
    548546write(*,*) "Downloading data Y1..."
    549547call read_data_PCM("data_PCM_Y1.nc",timelen,iim,jjm_value,ngrid,nslope,vmr_co2_PCM,ps_timeseries,min_co2_ice(:,:,1),min_h2o_ice(:,:,1), &
    550                    tsurf_avg_yr1,tsoil_ave,tsurf_PCM_timeseries,tsoil_PCM_timeseries,q_co2_PEM_phys,q_h2o_PEM_phys,                     &
    551                    co2_ice_PCM,watersurf_density_ave,watersoil_density_timeseries)
     548                   tsurf_avg_yr1,tsoil_avg,tsurf_PCM_timeseries,tsoil_PCM_timeseries,q_co2_PEM_phys,q_h2o_PEM_phys,                     &
     549                   watersurf_density_avg,watersoil_density_timeseries)
    552550write(*,*) "Downloading data Y1 done!"
    553551
     
    555553write(*,*) "Downloading data Y2..."
    556554call read_data_PCM("data_PCM_Y2.nc",timelen,iim,jjm_value,ngrid,nslope,vmr_co2_PCM,ps_timeseries,min_co2_ice(:,:,2),min_h2o_ice(:,:,2), &
    557                    tsurf_ave,tsoil_ave,tsurf_PCM_timeseries,tsoil_PCM_timeseries,q_co2_PEM_phys,q_h2o_PEM_phys,                         &
    558                    co2_ice_PCM,watersurf_density_ave,watersoil_density_timeseries)
     555                   tsurf_avg,tsoil_avg,tsurf_PCM_timeseries,tsoil_PCM_timeseries,q_co2_PEM_phys,q_h2o_PEM_phys,                         &
     556                   watersurf_density_avg,watersoil_density_timeseries)
    559557write(*,*) "Downloading data Y2 done!"
    560558
     
    572570if (soil_pem) then
    573571    allocate(tsoil_anom(ngrid,nsoilmx,nslope))
    574     tsoil_anom = tsoil - tsoil_ave ! compute anomaly between Tsoil(t) in the startfi - <Tsoil> to recompute properly tsoil in the restart
     572    tsoil_anom = tsoil - tsoil_avg ! compute anomaly between Tsoil(t) in the startfi - <Tsoil> to recompute properly tsoil in the restart
    575573    call soil_settings_PEM(ngrid,nslope,nsoilmx_PEM,nsoilmx,inertiesoil,TI_PEM)
    576     tsoil_PEM(:,1:nsoilmx,:) = tsoil_ave
     574    tsoil_PEM(:,1:nsoilmx,:) = tsoil_avg
    577575    tsoil_phys_PEM_timeseries(:,1:nsoilmx,:,:) = tsoil_PCM_timeseries
    578576    watersoil_density_PEM_timeseries(:,1:nsoilmx,:,:) = watersoil_density_timeseries
    579577    do l = nsoilmx + 1,nsoilmx_PEM
    580         tsoil_PEM(:,l,:) = tsoil_ave(:,nsoilmx,:)
     578        tsoil_PEM(:,l,:) = tsoil_avg(:,nsoilmx,:)
    581579        watersoil_density_PEM_timeseries(:,l,:,:) = watersoil_density_timeseries(:,nsoilmx,:,:)
    582580    enddo
    583     watersoil_density_PEM_ave = sum(watersoil_density_PEM_timeseries,4)/timelen
     581    watersoil_density_PEM_avg = sum(watersoil_density_PEM_timeseries,4)/timelen
    584582endif !soil_pem
    585 deallocate(tsoil_ave,tsoil_PCM_timeseries)
     583deallocate(tsoil_avg,tsoil_PCM_timeseries)
    586584
    587585!------------------------
     
    614612
    615613call pemetat0("startpem.nc",ngrid,nsoilmx,nsoilmx_PEM,nslope,timelen,timestep,TI_PEM,tsoil_PEM,porefillingice_depth, &
    616               porefillingice_thickness,tsurf_avg_yr1,tsurf_ave,q_co2_PEM_phys,q_h2o_PEM_phys,ps_timeseries,          &
     614              porefillingice_thickness,tsurf_avg_yr1,tsurf_avg,q_co2_PEM_phys,q_h2o_PEM_phys,ps_timeseries,          &
    617615              tsoil_phys_PEM_timeseries,tend_h2o_ice,tend_co2_ice,co2_ice,h2o_ice,global_avg_press_PCM,              &
    618               watersurf_density_ave,watersoil_density_PEM_ave,co2_adsorbded_phys,delta_co2_adsorbded,                &
     616              watersurf_density_avg,watersoil_density_PEM_avg,co2_adsorbded_phys,delta_co2_adsorbded,                &
    619617              h2o_adsorbded_phys,delta_h2o_adsorbded,stratif)
    620618
     
    822820    if (co2ice_flow .and. nslope > 1) call flow_co2glaciers(timelen,ngrid,nslope,iflat,subslope_dist,def_slope_mean,vmr_co2_PEM_phys,ps_timeseries, &
    823821                                            global_avg_press_PCM,global_avg_press_new,co2_ice,flag_co2flow,flag_co2flow_mesh)
    824     if (h2oice_flow .and. nslope > 1) call flow_h2oglaciers(timelen,ngrid,nslope,iflat,subslope_dist,def_slope_mean,tsurf_ave,h2o_ice,flag_h2oflow,flag_h2oflow_mesh)
     822    if (h2oice_flow .and. nslope > 1) call flow_h2oglaciers(timelen,ngrid,nslope,iflat,subslope_dist,def_slope_mean,tsurf_avg,h2o_ice,flag_h2oflow,flag_h2oflow_mesh)
    825823
    826824!------------------------
     
    831829    write(*,*) "Updating the new Tsurf"
    832830    bool_sublim = .false.
    833     Tsurfavg_before_saved = tsurf_ave
     831    Tsurfavg_before_saved = tsurf_avg
    834832    do ig = 1,ngrid
    835833        do islope = 1,nslope
     
    840838                        do islope_loop = islope,iflat,-1
    841839                            if (.not. is_co2ice_ini(ig_loop,islope_loop) .and. co2_ice(ig_loop,islope_loop) < 1.e-10) then
    842                                 tsurf_ave(ig,islope) = tsurf_ave(ig_loop,islope_loop)
     840                                tsurf_avg(ig,islope) = tsurf_avg(ig_loop,islope_loop)
    843841                                bool_sublim = .true.
    844842                                exit
     
    851849                        do islope_loop = islope,iflat
    852850                            if (.not. is_co2ice_ini(ig_loop,islope_loop) .and. co2_ice(ig_loop,islope_loop) < 1.e-10) then
    853                                 tsurf_ave(ig,islope) = tsurf_ave(ig_loop,islope_loop)
     851                                tsurf_avg(ig,islope) = tsurf_avg(ig_loop,islope_loop)
    854852                                bool_sublim = .true.
    855853                                exit
     
    870868                ave = 0.
    871869                do t = 1,timelen
    872                     if (co2_ice_PCM(ig,islope,t) > 1.e-3) then
    873                         ave = ave + beta_clap_co2/(alpha_clap_co2 - log(vmr_co2_PEM_phys(ig,t)*ps_timeseries(ig,t)/100.))
    874                     else
    875                         ave = ave + tsurf_PCM_timeseries(ig,islope,t)
    876                     endif
     870                    ave = ave + beta_clap_co2/(alpha_clap_co2 - log(vmr_co2_PEM_phys(ig,t)*ps_timeseries(ig,t)/100.))
    877871                enddo
    878                 tsurf_ave(ig,islope) = ave/timelen
     872                tsurf_avg(ig,islope) = ave/timelen
    879873            endif
    880874        enddo
     
    882876
    883877    do t = 1,timelen
    884         tsurf_PCM_timeseries(:,:,t) = tsurf_PCM_timeseries(:,:,t) + tsurf_ave - Tsurfavg_before_saved
     878        tsurf_PCM_timeseries(:,:,t) = tsurf_PCM_timeseries(:,:,t) + tsurf_avg - Tsurfavg_before_saved
    885879    enddo
    886880    ! for the start
    887881    do ig = 1,ngrid
    888882        do islope = 1,nslope
    889             tsurf(ig,islope) =  tsurf(ig,islope) - (Tsurfavg_before_saved(ig,islope) - tsurf_ave(ig,islope))
     883            tsurf(ig,islope) =  tsurf(ig,islope) - (Tsurfavg_before_saved(ig,islope) - tsurf_avg(ig,islope))
    890884        enddo
    891885    enddo
     
    917911        enddo
    918912        tsoil_PEM = sum(tsoil_phys_PEM_timeseries,4)/timelen
    919         watersoil_density_PEM_ave = sum(watersoil_density_PEM_timeseries,4)/timelen
     913        watersoil_density_PEM_avg = sum(watersoil_density_PEM_timeseries,4)/timelen
    920914
    921915        write(*,*) "Update of soil temperature done"
     
    927921            write(*,*) "Compute ice table"
    928922            porefillingice_thickness_prev_iter = porefillingice_thickness
    929             call computeice_table_equilibrium(ngrid,nslope,nsoilmx_PEM,watercaptag,watersurf_density_ave,watersoil_density_PEM_ave,TI_PEM(:,1,:),porefillingice_depth,porefillingice_thickness)
    930             call compute_massh2o_exchange_ssi(ngrid,nslope,nsoilmx_PEM,porefillingice_thickness_prev_iter,porefillingice_thickness,porefillingice_depth,tsurf_ave, tsoil_PEM,delta_h2o_icetablesublim) ! Mass of H2O exchange between the ssi and the atmosphere
     923            call computeice_table_equilibrium(ngrid,nslope,nsoilmx_PEM,watercaptag,watersurf_density_avg,watersoil_density_PEM_avg,TI_PEM(:,1,:),porefillingice_depth,porefillingice_thickness)
     924            call compute_massh2o_exchange_ssi(ngrid,nslope,nsoilmx_PEM,porefillingice_thickness_prev_iter,porefillingice_thickness,porefillingice_depth,tsurf_avg, tsoil_PEM,delta_h2o_icetablesublim) ! Mass of H2O exchange between the ssi and the atmosphere
    931925        endif
    932926! II_d.4 Update the soil thermal properties
     
    967961!    II_e Outputs
    968962!------------------------
    969     call writediagpem(ngrid,'ps_ave','Global average pressure','Pa',0,(/global_avg_press_new/))
     963    call writediagpem(ngrid,'ps_avg','Global average pressure','Pa',0,(/global_avg_press_new/))
    970964    do islope = 1,nslope
    971965        write(str2(1:2),'(i2.2)') islope
     
    12021196endif
    12031197deallocate(vmr_co2_PCM,ps_timeseries,tsurf_PCM_timeseries,q_co2_PEM_phys,q_h2o_PEM_phys)
    1204 deallocate(co2_ice_PCM,watersurf_density_ave,watersoil_density_timeseries,Tsurfavg_before_saved)
    1205 deallocate(tsoil_phys_PEM_timeseries,watersoil_density_PEM_timeseries,watersoil_density_PEM_ave)
     1198deallocate(watersurf_density_avg,watersoil_density_timeseries,Tsurfavg_before_saved)
     1199deallocate(tsoil_phys_PEM_timeseries,watersoil_density_PEM_timeseries,watersoil_density_PEM_avg)
    12061200deallocate(delta_co2_adsorbded,delta_h2o_adsorbded,vmr_co2_PEM_phys,delta_h2o_icetablesublim,porefillingice_thickness_prev_iter)
    12071201deallocate(is_co2ice_ini,co2ice_disappeared,ini_co2ice_sublim,ini_h2oice_sublim,stratif)
  • trunk/LMDZ.COMMON/libf/evolution/read_data_PCM_mod.F90

    r3363 r3367  
    1515!=======================================================================
    1616
    17 SUBROUTINE read_data_PCM(filename,timelen,iim_input,jjm_input,ngrid,nslope,vmr_co2_PCM_phys,ps_timeseries,          &
    18                          min_co2_ice,min_h2o_ice,tsurf_avg,tsoil_avg,tsurf_PCM,tsoil_PCM,q_co2,q_h2o,co2_ice_slope, &
     17SUBROUTINE read_data_PCM(filename,timelen,iim_input,jjm_input,ngrid,nslope,vmr_co2_PCM_phys,ps_timeseries, &
     18                         min_co2_ice,min_h2o_ice,tsurf_avg,tsoil_avg,tsurf_PCM,tsoil_PCM,q_co2,q_h2o,      &
    1919                         watersurf_density_avg,watersoil_density)
    2020use comsoil_h,             only: nsoilmx
     
    4545real, dimension(ngrid,timelen),        intent(out) :: q_co2            ! CO2 mass mixing ratio in the first layer [kg/m^3]
    4646real, dimension(ngrid,timelen),        intent(out) :: q_h2o            ! H2O mass mixing ratio in the first layer [kg/m^3]
    47 real, dimension(ngrid,nslope,timelen), intent(out) :: co2_ice_slope    ! co2 ice amount per slope of the year [kg/m^2]
    4847!SOIL
    4948real, dimension(ngrid,nslope),                 intent(out) :: tsurf_avg             ! Average surface temperature of the concatenated file [K]
     
    7271real, dimension(iim_input + 1,jjm_input + 1,timelen)                :: q_co2_dyn                 ! CO2 mass mixing ratio in the first layer [kg/m^3]
    7372real, dimension(iim_input + 1,jjm_input + 1,timelen)                :: q_h2o_dyn                 ! H2O mass mixing ratio in the first layer [kg/m^3]
    74 real, dimension(iim_input + 1,jjm_input + 1,nslope,timelen)         :: co2_ice_slope_dyn         ! co2 ice amount per  slope of the year [kg/m^2]
     73real, dimension(iim_input + 1,jjm_input + 1,nslope,timelen)         :: co2_ice_slope_dyn         ! co2 ice amount per slope of the year [kg/m^2]
    7574real, dimension(iim_input + 1,jjm_input + 1,nslope,timelen)         :: watersurf_density_dyn     ! Water density at the surface, time series [kg/m^3]
    7675real, dimension(iim_input + 1,jjm_input + 1,nslope)                 :: watersurf_density_dyn_avg ! Water density at the surface, dynamic grid, yearly averaged [kg/m^3]
     
    239238        do t = 1,timelen
    240239            call gr_dyn_fi(1,iim_input + 1,jjm_input + 1,ngrid,tsurf_PCM_dyn(:,:,islope,t),tsurf_PCM(:,islope,t))
    241             call gr_dyn_fi(1,iim_input + 1,jjm_input + 1,ngrid,co2_ice_slope_dyn(:,:,islope,t),co2_ice_slope(:,islope,t))
    242240        enddo
    243241    enddo
     
    258256    endif ! soil_pem
    259257    tsurf_PCM(1,:,:) = tsurf_PCM_dyn(1,1,:,:)
    260     co2_ice_slope(1,:,:) = co2_ice_slope_dyn(1,1,:,:)
    261258    tsurf_avg(1,:) = tsurf_avg_dyn(1,1,:)
    262259#endif
Note: See TracChangeset for help on using the changeset viewer.