Changeset 3330 for trunk/LMDZ.COMMON


Ignore:
Timestamp:
May 16, 2024, 11:38:21 AM (6 months ago)
Author:
jbclement
Message:

PEM:
Improvement of a flag-like variable (more robust as a logical) to know where co2 ice was at the beginning.
JBC

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

Legend:

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

    r3328 r3330  
    313313- Cleaning the previous cleaning commit.
    314314
     315== 16/05/2024 == JBC
     316Improvement of a flag-like variable (more robust as a logical) to know where co2 ice was at the beginning.
  • trunk/LMDZ.COMMON/libf/evolution/pem.F90

    r3328 r3330  
    77!    I_e Initialization of the PEM variable and soil
    88!    I_f Compute tendencies
    9 !    I_g Save initial PCM situation
    10 !    I_h Read the "startpem.nc"
     9!    I_g Read the "startpem.nc"
     10!    I_h Save the initial situation
    1111!    I_i Compute orbit criterion
    1212
     
    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,                           & ! soil thermal inertia
    48                                       tsoil_PEM, layer_PEM, &             ! Soil temp, number of subsurface layers, soil mid layer depths
    49                                       fluxgeo                             ! Geothermal flux for the PEM and PCM
     47                                      TI_PEM,               & ! soil thermal inertia
     48                                      tsoil_PEM, layer_PEM, & ! Soil temp, number of subsurface layers, soil mid layer depths
     49                                      fluxgeo                 ! Geothermal flux for the PEM and PCM
    5050use adsorption_mod,             only: regolith_adsorption, adsorption_pem,        & ! Bool to check if adsorption, main subroutine
    5151                                      ini_adsorption_h_PEM, end_adsorption_h_PEM, & ! Allocate arrays
     
    178178
    179179! Variables for co2_ice evolution
    180 real,  dimension(:,:),  allocatable :: co2_ice           ! co2 ice in the PEM
    181 real,  dimension(:,:),   allocatable :: co2_ice_ini       ! Initial amount of co2 ice in the PEM
     180real,    dimension(:,:), allocatable :: co2_ice           ! co2 ice in the PEM
     181logical, dimension(:,:), allocatable :: is_co2ice_ini     ! Was there co2 ice initially in the PEM?
    182182real,  dimension(:,:,:), allocatable :: min_co2_ice       ! Minimum of co2 ice at each point for the first year [kg/m^2]
    183183real                                 :: co2ice_ini_surf   ! Initial surface of sublimating co2 ice
    184184logical, dimension(:,:), allocatable :: ini_co2ice_sublim ! Logical array to know if co2 ice is sublimating
    185 real,   dimension(:,:), allocatable :: vmr_co2_PCM       ! Physics x Times co2 volume mixing ratio retrieve from the PCM [m^3/m^3]
    186 real,   dimension(:,:), allocatable :: vmr_co2_PEM_phys  ! Physics x Times co2 volume mixing ratio used in the PEM
    187 real,   dimension(:,:), allocatable :: q_co2_PEM_phys    ! Physics x Times co2 mass mixing ratio in the first layer computed in the PEM, first value comes from PCM [kg/kg]
     185real,    dimension(:,:), allocatable :: vmr_co2_PCM       ! Physics x Times co2 volume mixing ratio retrieve from the PCM [m^3/m^3]
     186real,    dimension(:,:), allocatable :: vmr_co2_PEM_phys  ! Physics x Times co2 volume mixing ratio used in the PEM
     187real,    dimension(:,:), allocatable :: q_co2_PEM_phys    ! Physics x Times co2 mass mixing ratio in the first layer computed in the PEM, first value comes from PCM [kg/kg]
    188188
    189189! Variables for stratification (layering) evolution
     
    223223real                                  :: totmassh2o_adsorbded               ! Total mass of H2O that is exchanged because of adsorption / desoprtion over the planets [kg]
    224224logical                               :: bool_sublim                        ! logical to check if there is sublimation or not
    225 logical, dimension(:,:),  allocatable :: co2ice_has_disappeared             ! logical to check if a co2ice reservoir has already disappeared at a previous timestep
     225logical, dimension(:,:),  allocatable :: co2ice_disappeared                 ! logical to check if a co2 ice reservoir already disappeared at a previous timestep
    226226real, dimension(:,:),     allocatable :: porefillingice_thickness_prev_iter ! ngrid x nslope: Thickness of the ice table at the previous iteration [m]
    227227real, dimension(:),       allocatable :: delta_h2o_icetablesublim           ! ngrid x Total mass of the H2O that has sublimated / condenses from the ice table [kg]
     
    497497allocate(watersoil_density_PEM_timeseries(ngrid,nsoilmx_PEM,nslope,timelen))
    498498allocate(delta_co2_adsorbded(ngrid))
    499 allocate(co2ice_has_disappeared(ngrid,nslope))
     499allocate(co2ice_disappeared(ngrid,nslope))
    500500allocate(porefillingice_thickness_prev_iter(ngrid,nslope))
    501501allocate(delta_h2o_icetablesublim(ngrid))
     
    556556!------------------------
    557557! I   Initialization
    558 !    I_g Save initial PCM situation
    559 !------------------------
    560 ! We save the places where h2o ice is sublimating
    561 ! We compute the surface of h2o ice sublimating
    562 allocate(ini_co2ice_sublim(ngrid,nslope),ini_h2oice_sublim(ngrid,nslope))
    563 co2ice_ini_surf = 0.
    564 h2oice_ini_surf = 0.
    565 Total_surface = 0.
    566 ini_co2ice_sublim = .false.
    567 ini_h2oice_sublim = .false.
    568 co2ice_has_disappeared(:,:) = .false.
    569 do i = 1,ngrid
    570     Total_surface = Total_surface + cell_area(i)
    571     do islope = 1,nslope
    572         if (tend_co2_ice(i,islope) < 0.) then
    573             ini_co2ice_sublim(i,islope) = .true.
    574             co2ice_ini_surf = co2ice_ini_surf + cell_area(i)*subslope_dist(i,islope)
    575         endif
    576         if (tend_h2o_ice(i,islope) < 0.) then
    577             ini_h2oice_sublim(i,islope) = .true.
    578             h2oice_ini_surf = h2oice_ini_surf + cell_area(i)*subslope_dist(i,islope)
    579         endif
    580     enddo
    581 enddo
    582 
    583 write(*,*) "Total initial surface of co2 ice sublimating (slope) =", co2ice_ini_surf
    584 write(*,*) "Total initial surface of h2o ice sublimating (slope) =", h2oice_ini_surf
    585 write(*,*) "Total surface of the planet =", Total_surface
    586 allocate(zplev_PCM(ngrid,nlayer + 1))
    587 
    588 do ig = 1,ngrid
    589     zplev_PCM(ig,:) = ap + bp*ps_start_PCM(ig)
    590 enddo
    591 
    592 global_avg_press_old = sum(cell_area*ps_start_PCM)/Total_surface
    593 global_avg_press_PCM = global_avg_press_old
    594 global_avg_press_new = global_avg_press_old
    595 write(*,*) "Initial global average pressure =", global_avg_press_PCM
    596 
    597 !------------------------
    598 ! I   Initialization
    599 !    I_h Read the "startpem.nc"
     558!    I_g Read the "startpem.nc"
    600559!------------------------
    601560allocate(co2_ice(ngrid,nslope),h2o_ice(ngrid,nslope))
     
    616575              watersurf_density_ave,watersoil_density_PEM_ave,co2_adsorbded_phys,delta_co2_adsorbded,                &
    617576              h2o_adsorbded_phys,delta_h2o_adsorbded,stratif)
    618 
    619 allocate(co2_ice_ini(ngrid,nslope))
    620 co2_ice_ini = co2_ice
    621577
    622578delta_h2o_icetablesublim = 0.
     
    649605!------------------------
    650606! I   Initialization
     607!    I_h Save the initial situation
     608!------------------------
     609! We save the places where h2o ice is sublimating
     610! We compute the surface of h2o ice sublimating
     611allocate(ini_co2ice_sublim(ngrid,nslope),ini_h2oice_sublim(ngrid,nslope),is_co2ice_ini(ngrid,nslope))
     612co2ice_ini_surf = 0.
     613h2oice_ini_surf = 0.
     614Total_surface = 0.
     615ini_co2ice_sublim = .false.
     616ini_h2oice_sublim = .false.
     617is_co2ice_ini = .false.
     618co2ice_disappeared = .false.
     619do i = 1,ngrid
     620    Total_surface = Total_surface + cell_area(i)
     621    do islope = 1,nslope
     622        if (co2_ice(i,islope) > 0.) is_co2ice_ini(i,islope) = .true.
     623        if (tend_co2_ice(i,islope) < 0.) then
     624            ini_co2ice_sublim(i,islope) = .true.
     625            co2ice_ini_surf = co2ice_ini_surf + cell_area(i)*subslope_dist(i,islope)
     626        endif
     627        if (tend_h2o_ice(i,islope) < 0.) then
     628            ini_h2oice_sublim(i,islope) = .true.
     629            h2oice_ini_surf = h2oice_ini_surf + cell_area(i)*subslope_dist(i,islope)
     630        endif
     631    enddo
     632enddo
     633
     634write(*,*) "Total initial surface of co2 ice sublimating (slope) =", co2ice_ini_surf
     635write(*,*) "Total initial surface of h2o ice sublimating (slope) =", h2oice_ini_surf
     636write(*,*) "Total surface of the planet =", Total_surface
     637allocate(zplev_PCM(ngrid,nlayer + 1))
     638
     639do ig = 1,ngrid
     640    zplev_PCM(ig,:) = ap + bp*ps_start_PCM(ig)
     641enddo
     642
     643global_avg_press_old = sum(cell_area*ps_start_PCM)/Total_surface
     644global_avg_press_PCM = global_avg_press_old
     645global_avg_press_new = global_avg_press_old
     646write(*,*) "Initial global average pressure =", global_avg_press_PCM
     647
     648!------------------------
     649! I   Initialization
    651650!    I_i Compute orbit criterion
    652651!------------------------
     
    792791    do ig = 1,ngrid
    793792        do islope = 1,nslope
    794             if (co2_ice_ini(ig,islope) > 0. .and. co2_ice(ig,islope) < 1.e-10 .and. (.not.(co2ice_has_disappeared(ig,islope)))) then ! co2 ice disappeared, look for closest point without co2ice
    795                 co2ice_has_disappeared(ig,islope) = .true.
     793            if (is_co2ice_ini(ig,islope) .and. co2_ice(ig,islope) < 1.e-10 .and. .not. co2ice_disappeared(ig,islope)) then ! co2 ice disappeared, look for closest point without co2ice
     794                co2ice_disappeared = .true.
    796795                if (latitude_deg(ig) > 0) then
    797796                    do ig_loop = ig,ngrid
    798797                        do islope_loop = islope,iflat,-1
    799                             if (co2_ice_ini(ig_loop,islope_loop) < 1.e-10 .and. co2_ice(ig_loop,islope_loop) < 1.e-10) then
     798                            if (.not. is_co2ice_ini(ig_loop,islope_loop) .and. co2_ice(ig_loop,islope_loop) < 1.e-10) then
    800799                                tsurf_ave(ig,islope) = tsurf_ave(ig_loop,islope_loop)
    801800                                bool_sublim = .true.
     
    808807                    do ig_loop = ig,1,-1
    809808                        do islope_loop = islope,iflat
    810                             if (co2_ice_ini(ig_loop,islope_loop) < 1.e-10 .and. co2_ice(ig_loop,islope_loop) < 1.e-10) then
     809                            if (.not. is_co2ice_ini(ig_loop,islope_loop) .and. co2_ice(ig_loop,islope_loop) < 1.e-10) then
    811810                                tsurf_ave(ig,islope) = tsurf_ave(ig_loop,islope_loop)
    812811                                bool_sublim = .true.
     
    817816                    enddo
    818817                endif
     818                is_co2ice_ini(ig,islope) = .false.
    819819                if ((co2_ice(ig,islope) < 1.e-10) .and. (h2o_ice(ig,islope) > frost_albedo_threshold)) then
    820820                    albedo(ig,1,islope) = albedo_h2o_frost
     
    11591159deallocate(tsoil_phys_PEM_timeseries,watersoil_density_PEM_timeseries,watersoil_density_PEM_ave)
    11601160deallocate(delta_co2_adsorbded,delta_h2o_adsorbded,vmr_co2_PEM_phys,delta_h2o_icetablesublim,porefillingice_thickness_prev_iter)
    1161 deallocate(co2_ice_ini,ini_co2ice_sublim,ini_h2oice_sublim,stratif)
     1161deallocate(is_co2ice_ini,co2ice_disappeared,ini_co2ice_sublim,ini_h2oice_sublim,stratif)
    11621162!----------------------------- END OUTPUT ------------------------------
    11631163
Note: See TracChangeset for help on using the changeset viewer.