source: trunk/LMDZ.COMMON/libf/evolution/info_PEM_mod.F90 @ 3149

Last change on this file since 3149 was 3149, checked in by jbclement, 2 years ago

PEM:

  • Simplification of the algorithm managing the stopping criteria;
  • Complete rework of the ice management in the PEM (H2O & CO2);

    Subroutines to evolve the H2O and CO2 ice are now in the same module "evol_ice_mod.F90".
    Tendencies are computed from the variation of "ice + frost" between the 2 PCM runs.
    Evolving ice in the PEM is now called 'h2o_ice' or 'co2_ice' (not anymore in 'qsurf' and free of 'water_reservoir').
    Default value 'ini_h2o_bigreservoir' (= 10 m) initializes the H2O ice of the first PEM run where there is 'watercap'. For the next PEM runs, initialization is done with the value kept in "startpem.nc". CO2 ice is taken from 'perennial_co2ice' of the PCM (paleoclimate flag must be true).
    Simplification of the condition to compute the surface ice cover needed for the stopping criteria.
    Frost ('qsurf') is not evolved by the PEM and given back to the PCM.
    New default threshold value 'inf_h2oice_threshold' (= 2 m) to decide at the end of the PEM run if the H2O ice should be 'watercap' or not for the next PCM runs. If H2O ice cannot be 'watercap', then the remaining H2O ice is transferred to the frost ('qsurf').

  • Renaming of variables/subroutines for clarity;
  • Some cleanings throughout the code;
  • Small updates in files of the deftank.

JBC

File size: 1.8 KB
Line 
1MODULE info_PEM_mod
2
3implicit none
4
5!=======================================================================
6contains
7!=======================================================================
8
9SUBROUTINE info_PEM(year_iter,stopPEM,i_myear,n_myear)
10
11!=======================================================================
12!
13! Purpose: Update the first line of "info_PEM.txt" to count the number of simulated Martian years
14!          Write in "info_PEM.txt" the reason why the PEM stopped and the number of simulated years
15!
16! Author: RV, JBC
17!=======================================================================
18
19use time_evol_mod, only: convert_years
20
21implicit none
22
23!----- Arguments
24integer, intent(in) :: year_iter, stopPEM ! # of year and reason to stop
25integer, intent(in) :: i_myear, n_myear          ! Current simulated Martian year and maximum number of Martian years to be simulated
26
27!----- Local variables
28logical       :: ok
29integer       :: cstat
30character(10) :: ich1, ich2, fch
31
32!----- Code
33inquire(file = 'info_PEM.txt', exist = ok)
34if (ok) then
35    write(ich1,'(i0)') i_myear
36    write(ich2,'(i0)') n_myear
37    write(fch,'(f0.4)') convert_years ! 4 digits to the right of the decimal point to respect the precision of Martian year in "launch_pem.sh"
38    call execute_command_line('sed -i "1s/.*/'//trim(ich1)//' '//trim(ich2)//' '//trim(fch)//'/" info_PEM.txt',cmdstat = cstat)
39    if (cstat > 0) then
40        error stop 'info_PEM: command exection failed!'
41    else if (cstat < 0) then
42        error stop 'info_PEM: command execution not supported!'
43    endif
44    open(1,file = 'info_PEM.txt',status = "old",position = "append",action = "write")
45    write(1,*) year_iter, i_myear, stopPEM
46    close(1)
47else
48    error stop 'The file ''info_PEM.txt'' does not exist and cannot be updated!'
49endif
50
51END SUBROUTINE info_PEM
52
53END MODULE info_PEM_mod
Note: See TracBrowser for help on using the repository browser.