Changeset 3616


Ignore:
Timestamp:
Feb 10, 2025, 2:28:11 PM (5 months ago)
Author:
jbclement
Message:

PEM:

  • Improvement of the loops to update surface temperature in case of CO2 ice is disappearing.
  • Improvement of messages printed on the terminal.

JBC

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

Legend:

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

    r3612 r3616  
    584584    - missing initialization for slope number (r3609);
    585585    - taking into account that there may be no "startfi.nc" at the beginning of the PEM simulation.
     586
     587== 10/02/2025 == JBC
     588- Improvement of the loops to update surface temperature in case of CO2 ice is disappearing.
     589- Improvement of messages printed on the terminal.
  • trunk/LMDZ.COMMON/libf/evolution/pem.F90

    r3611 r3616  
    231231
    232232! Some variables for the PEM run
    233 real, parameter   :: year_step = 1   ! Timestep for the pem
    234 real              :: i_myear_leg     ! Number of iteration
    235 real              :: n_myear_leg     ! Maximum number of iterations before stopping
    236 real              :: i_myear         ! Global number of Martian years of the chained simulations
    237 real              :: n_myear         ! Maximum number of Martian years of the chained simulations
    238 real              :: timestep        ! Timestep [s]
    239 character(100)    :: arg             ! To read command-line arguments program was invoked
    240 logical           :: timewall        ! Flag to use the time limit stopping criterion in case of a PEM job
    241 integer(kind = 8) :: cr              ! Number of clock ticks per second (count rate)
    242 integer(kind = 8) :: c1, c2          ! Counts of processor clock
    243 character(100)    :: chtimelimit     ! Time limit for the PEM job outputted by the SLURM command
    244 real              :: timelimit       ! Time limit for the PEM job in seconds
    245 real, parameter   :: antetime = 1200 ! Anticipation time to prevent reaching the time limit: 1200 s = 20 min by default
    246 integer           :: cstat, days, hours, minutes, seconds
    247 character(1)      :: sep
     233real, parameter       :: year_step = 1   ! Timestep for the pem
     234real                  :: i_myear_leg     ! Number of iteration
     235real                  :: n_myear_leg     ! Maximum number of iterations before stopping
     236real                  :: i_myear         ! Global number of Martian years of the chained simulations
     237real                  :: n_myear         ! Maximum number of Martian years of the chained simulations
     238real                  :: timestep        ! Timestep [s]
     239character(100)        :: arg             ! To read command-line arguments program was invoked
     240logical               :: timewall        ! Flag to use the time limit stopping criterion in case of a PEM job
     241integer(kind = 8)     :: cr              ! Number of clock ticks per second (count rate)
     242integer(kind = 8)     :: c1, c2          ! Counts of processor clock
     243character(100)        :: chtimelimit     ! Time limit for the PEM job outputted by the SLURM command
     244real                  :: timelimit       ! Time limit for the PEM job in seconds
     245real, parameter       :: antetime = 1200 ! Anticipation time to prevent reaching the time limit: 1200 s = 20 min by default
     246integer               :: cstat, days, hours, minutes, seconds
     247character(1)          :: sep
     248character(8)          :: date
     249character(10)         :: time
     250character(5)          :: zone
     251integer, dimension(8) :: values
     252character(128)        :: dir = ' '
     253character(32)         :: logname = ' '
     254character(32)         :: hostname = ' '
    248255
    249256#ifdef CPP_STD
     
    358365endif
    359366
     367! Some user info
     368call date_and_time(date,time,zone,values)
     369call getcwd(dir)      ! Current directory
     370call getlog(logname)  ! User name
     371call hostnm(hostname) ! Machine/station name
     372write(*,*)
     373write(*,*) '######### PEM information #########'
     374write(*,*) '+ User     : '//trim(logname)
     375write(*,*) '+ Machine  : '//trim(hostname)
     376write(*,*) '+ Directory: '//trim(dir)
     377write(*,'(a,i2,a,i2,a,i4)') ' + Date     : ',values(3),'/',values(2),'/',values(1)
     378write(*,'(a,i2,a,i2,a,i2,a)') ' + Time     : ',values(5),':',values(6),':',values(7)
     379
    360380! Parallel variables
    361381#ifndef CPP_STD
     
    382402!    I_a Read the "run.def"
    383403!------------------------
     404write(*,*)
     405write(*,*) '######### PEM initialization #########'
    384406write(*,*) '> Reading "run.def" (PEM)'
    385407#ifndef CPP_1D
     
    706728!    II_a Update pressure, ice and tracers
    707729!------------------------
     730write(*,*)
     731write(*,*) '######### PEM cycle #########'
    708732i_myear_leg = 0
    709733stopPEM = 0
     
    723747do while (i_myear_leg < n_myear_leg .and. i_myear < n_myear)
    724748! II.a.1. Compute updated global pressure
     749    write(*,'(a,f10.2)') ' #### Iteration of the PEM leg (Martian years): ', i_myear_leg + 1
    725750    write(*,*) "> Updating the surface pressure"
    726751    ps_avg_global_old = ps_avg_global_new
     
    826851            if (is_co2ice_ini(ig,islope) .and. co2_ice(ig,islope) < 1.e-10 .and. .not. co2ice_disappeared(ig,islope)) then
    827852                co2ice_disappeared(ig,islope) = .true.
    828                 if (latitude_deg(ig) > 0.) then
    829                     outer1: do ig_loop = ig,ngrid
    830                         do islope_loop = islope,iflat,-1
     853                if (latitude_deg(ig) > 0.) then ! North hemisphere
     854                    outer1: do ig_loop = ig,ngrid ! Go towards equator
     855                        do islope_loop = islope - 1,1,-1 ! Go over the slopes (backward numbering - should be equator-ward)
     856                            if (.not. is_co2ice_ini(ig_loop,islope_loop) .and. co2_ice(ig_loop,islope_loop) < 1.e-10) then
     857                                tsurf_avg(ig,islope) = tsurf_avg(ig_loop,islope_loop)
     858                                exit outer1
     859                            endif
     860                        enddo
     861                        do islope_loop = islope + 1,nslope ! Go over the slopes (forward numbering - should be pole-ward)
    831862                            if (.not. is_co2ice_ini(ig_loop,islope_loop) .and. co2_ice(ig_loop,islope_loop) < 1.e-10) then
    832863                                tsurf_avg(ig,islope) = tsurf_avg(ig_loop,islope_loop)
     
    835866                        enddo
    836867                    enddo outer1
    837                 else
    838                     outer2: do ig_loop = ig,1,-1
    839                         do islope_loop = islope,iflat
     868                else ! South hemisphere
     869                    outer2: do ig_loop = ig,1,-1 ! Go towards equator
     870                        do islope_loop = islope + 1,nslope ! Go over the slopes (forward numbering - should be equator-ward)
     871                            if (.not. is_co2ice_ini(ig_loop,islope_loop) .and. co2_ice(ig_loop,islope_loop) < 1.e-10) then
     872                                tsurf_avg(ig,islope) = tsurf_avg(ig_loop,islope_loop)
     873                                exit outer2
     874                            endif
     875                        enddo
     876                        do islope_loop = islope - 1,1,-1 ! Go over the slopes (backward numbering - should be pole-ward)
    840877                            if (.not. is_co2ice_ini(ig_loop,islope_loop) .and. co2_ice(ig_loop,islope_loop) < 1.e-10) then
    841878                                tsurf_avg(ig,islope) = tsurf_avg(ig_loop,islope_loop)
     
    845882                    enddo outer2
    846883                endif
    847             else if (co2_ice(ig,islope) > 1.e-10 .and. d_co2ice(ig,islope) > 1.e-10) then ! Put tsurf as tcond CO2
     884            else if (co2_ice(ig,islope) > 1.e-10 .and. d_co2ice(ig,islope) > 1.e-10) then ! Put tsurf as Tcond CO2
    848885                call computeTcondCO2(timelen,ngrid,nslope,vmr_co2_PEM_phys,ps_timeseries,ps_avg_global_ini,ps_avg_global_new,tsurf_avg)
    849886            endif
     
    9761013!------------------------
    9771014    call recomp_tend_co2(ngrid,nslope,timelen,d_co2ice,d_co2ice_ini,co2_ice,emis,vmr_co2_PCM,vmr_co2_PEM_phys,ps_timeseries,ps_avg_global_old,ps_avg_global_new)
     1015   
    9781016    do ig = 1,ngrid
    9791017        do islope = 1,nslope
     
    9991037        select case (stopPEM)
    10001038            case(1)
    1001                 write(*,*) "STOPPING because surface of h2o ice sublimating is too low:", stopPEM, "See message above."
     1039                write(*,'(a,i0,a)') " #### STOPPING because surface of h2o ice sublimating is too low:", stopPEM, "See message above."
    10021040            case(2)
    1003                 write(*,*) "STOPPING because tendencies on h2o ice = 0:", stopPEM, "See message above."
     1041                write(*,'(a,i0,a)') " #### STOPPING because tendencies on h2o ice = 0:", stopPEM, "See message above."
    10041042            case(3)
    1005                 write(*,*) "STOPPING because surface of co2 ice sublimating is too low:", stopPEM, "See message above."
     1043                write(*,'(a,i0,a)') " #### STOPPING because surface of co2 ice sublimating is too low:", stopPEM, "See message above."
    10061044            case(4)
    1007                 write(*,*) "STOPPING because surface global pressure changed too much:", stopPEM, "See message above."
     1045                write(*,'(a,i0,a)') " #### STOPPING because surface global pressure changed too much:", stopPEM, "See message above."
    10081046            case(5)
    1009                 write(*,*) "STOPPING because maximum number of iterations is reached (possibly due to orbital parameters):", stopPEM
     1047                write(*,'(a,i0)') " #### STOPPING because maximum number of iterations is reached (possibly due to orbital parameters):", stopPEM
    10101048            case(6)
    1011                 write(*,*) "STOPPING because maximum number of Martian years to be simulated is reached:", stopPEM
     1049                write(*,'(a,i0)') " #### STOPPING because maximum number of Martian years to be simulated is reached:", stopPEM
    10121050            case(7)
    1013                 write(*,*) "STOPPING because the time limit for the PEM job will be reached soon:", stopPEM
     1051                write(*,'(a,i0)') " #### STOPPING because the time limit for the PEM job will be reached soon:", stopPEM
    10141052            case(8)
    1015                 write(*,*) "STOPPING because the layering algorithm met an hasty end:", stopPEM
     1053                write(*,'(a,i0)') " #### STOPPING because the layering algorithm met an hasty end:", stopPEM
    10161054            case default
    1017                 write(*,*) "STOPPING with unknown stopping criterion code:", stopPEM
     1055                write(*,'(a,i0)') " #### STOPPING with unknown stopping criterion code:", stopPEM
    10181056        end select
    10191057        exit
    10201058    else
    1021         write(*,*) "The PEM can continue!"
    1022         write(*,*) "Number of iterations of the PEM  : i_myear_leg =", i_myear_leg
    1023         write(*,*) "Number of simulated Martian years: i_myear     =", i_myear
     1059        write(*,'(a,f10.2,a)') ' #### The chained simulation has run for ',i_myear,' Martian years.'
     1060        write(*,*) '#### The PEM can continue!'
     1061        write(*,*) '####'
    10241062    endif
    10251063enddo ! big time iteration loop of the pem
     
    10461084!------------------------
    10471085! III_a.1 Ice update for start file
     1086write(*,*)
     1087write(*,*) '######### PEM finalization #########'
    10481088write(*,*) '> Reconstructing perennial ice and frost for the PCM'
    10491089watercap = 0.
     
    12511291call info_PEM(i_myear_leg,stopPEM,i_myear,n_myear)
    12521292
    1253 write(*,*) '************************************************************************'
    1254 write(*,*) "> The PEM has run for", i_myear_leg, "Martian years."
    1255 write(*,*) "> The chained simulation has run for", i_myear, "Martian years =", i_myear*convert_years, "Earth years."
    1256 write(*,*) "> The reached date is now", (year_bp_ini + i_myear)*convert_years, "Earth years."
    1257 write(*,*) "> PEM: so far, so good!"
    1258 write(*,*) '************************************************************************'
     1293write(*,*)
     1294write(*,*) '######### PEM finalization #########'
     1295write(*,'(a,f10.2,a)') " + The PEM leg has run for ", i_myear_leg, " Martian years."
     1296write(*,'(a,f10.2,a,f10.2,a)') " + The chained simulation has run for ", i_myear, " Martian years =", i_myear*convert_years, "Earth years."
     1297write(*,'(a,f10.2,a)') " + The reached date is now ", (year_bp_ini + i_myear)*convert_years, " Earth years."
     1298write(*,*) "+ PEM: so far, so good!"
     1299write(*,*) '####################################'
    12591300
    12601301if (layering_algo) then
  • trunk/LMDZ.COMMON/libf/evolution/read_data_PCM_mod.F90

    r3611 r3616  
    304304! Close the NetCDF file
    305305call error_msg(nf90_close(fID),"close",filename2)
    306 write(*,*) '"> '//filename2//'" processed!'
     306write(*,*) '> "'//filename2//'" processed!'
    307307
    308308END SUBROUTINE read_data_PCM
Note: See TracChangeset for help on using the changeset viewer.