Ignore:
Timestamp:
Jan 4, 2024, 11:37:33 AM (11 months ago)
Author:
llange
Message:

Mars PEM
Fixing a small bug: the subroutine compute_icetable was always called, even if tthe option 'icetable_equilibrium' was set to false in the run_PEM.def. It is now fixed by adding a flag before the call.
LL

File:
1 edited

Legend:

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

    r3161 r3170  
    1616use comsoil_h,                  only: volcapa, inertiedat
    1717use adsorption_mod,             only: regolith_adsorption, adsorption_pem
    18 use ice_table_mod,              only: computeice_table_equilibrium
     18use ice_table_mod,              only: computeice_table_equilibrium, icetable_equilibrium
    1919use constants_marspem_mod,      only: alpha_clap_h2o, beta_clap_h2o, TI_breccia, TI_bedrock
    2020use soil_thermalproperties_mod, only: update_soil_thermalproperties
     
    102102!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    103103
    104 !0. Check if the start_PEM exist.
     104!0.1 Check if the start_PEM exist.
    105105
    106106inquire(file = filename,exist = startpem_file)
     
    108108write(*,*)'Is start PEM?',startpem_file
    109109
     110!0.2 Set to default values
     111ice_table = -1.  ! by default, no ice table
     112ice_table_thickness = -1.
    110113!1. Run
    111114if (startpem_file) then
     
    272275!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    273276!3. Ice Table
    274         call get_field("ice_table",ice_table,found)
    275         if (.not. found) then
    276             write(*,*)'PEM settings: failed loading <ice_table>'
    277             write(*,*)'will reconstruct the values of the ice table given the current state'
    278             ice_table = -1  ! by default, no ice table
    279             ice_table_thickness = -1  ! by default, no ice table
    280             call computeice_table_equilibrium(ngrid,nslope,nsoil_PEM,watercaptag,watersurf_avg,watersoil_avg, TI_PEM(:,1,:),ice_table,ice_table_thickness)
    281             call update_soil_thermalproperties(ngrid,nslope,nsoil_PEM,tend_h2o_ice,h2o_ice,global_avg_pressure,ice_table,ice_table_thickness,TI_PEM)
    282             do islope = 1,nslope
    283                 call soil_pem_ini(ngrid,nsoil_PEM,TI_PEM(:,:,islope),tsurf_avg_yr2(:,islope),tsoil_PEM(:,:,islope))
    284             enddo
     277        if(icetable_equilibrium) then
     278            call get_field("ice_table",ice_table,found)
     279            if (.not. found) then
     280                write(*,*)'PEM settings: failed loading <ice_table>'
     281                write(*,*)'will reconstruct the values of the ice table given the current state'
     282                call computeice_table_equilibrium(ngrid,nslope,nsoil_PEM,watercaptag,watersurf_avg,watersoil_avg, TI_PEM(:,1,:),ice_table,ice_table_thickness)
     283                call update_soil_thermalproperties(ngrid,nslope,nsoil_PEM,tend_h2o_ice,h2o_ice,global_avg_pressure,ice_table,ice_table_thickness,TI_PEM)
     284                do islope = 1,nslope
     285                    call soil_pem_ini(ngrid,nsoil_PEM,TI_PEM(:,:,islope),tsurf_avg_yr2(:,islope),tsoil_PEM(:,:,islope))
     286                enddo
     287            endif
     288            write(*,*) 'PEMETAT0: ICE TABLE done'
    285289        endif
    286 
    287         write(*,*) 'PEMETAT0: ICE TABLE done'
    288290
    289291!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    442444!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    443445!c) Ice table
    444         ice_table = -1.  ! by default, no ice table
    445         ice_table_thickness = -1.
    446         call computeice_table_equilibrium(ngrid,nslope,nsoil_PEM,watercaptag,watersurf_avg,watersoil_avg,TI_PEM(:,1,:),ice_table,ice_table_thickness)
    447         call update_soil_thermalproperties(ngrid,nslope,nsoil_PEM,tend_h2o_ice,h2o_ice,global_avg_pressure,ice_table,ice_table_thickness,TI_PEM)
    448         do islope = 1,nslope
    449             call soil_pem_ini(ngrid,nsoil_PEM,TI_PEM(:,:,islope),tsurf_avg_yr2(:,islope),tsoil_PEM(:,:,islope))
    450         enddo
    451         write(*,*) 'PEMETAT0: Ice table done'
    452 
     446        if(icetable_equilibrium) then
     447            call computeice_table_equilibrium(ngrid,nslope,nsoil_PEM,watercaptag,watersurf_avg,watersoil_avg,TI_PEM(:,1,:),ice_table,ice_table_thickness)
     448            call update_soil_thermalproperties(ngrid,nslope,nsoil_PEM,tend_h2o_ice,h2o_ice,global_avg_pressure,ice_table,ice_table_thickness,TI_PEM)
     449            do islope = 1,nslope
     450                call soil_pem_ini(ngrid,nsoil_PEM,TI_PEM(:,:,islope),tsurf_avg_yr2(:,islope),tsoil_PEM(:,:,islope))
     451            enddo
     452            write(*,*) 'PEMETAT0: Ice table done'
     453        endif
     454       
    453455!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    454456!d) Regolith adsorbed
Note: See TracChangeset for help on using the changeset viewer.