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

Last change on this file since 3498 was 3498, checked in by jbclement, 2 weeks ago

PEM:

  • Correction of the variable name for the ice table depth in "pemetat0.F90". So it is now got as intended from the "startpem.nc" file;
  • Renaming of the tendencies in the PEM with the prefix 'd_' instead of 'tend_';
  • Modification of the PEM time step type from integer to real. As a consequence, all time variables are now of real type. This change adds the possibility to consider fractions of year as time step.

JBC

File size: 2.4 KB
Line 
1MODULE info_PEM_mod
2
3implicit none
4
5integer :: iPCM, iPEM, nPCM, nPCM_ini ! Data about the chained simulation of PCM/PEM runs
6
7!=======================================================================
8contains
9!=======================================================================
10
11SUBROUTINE info_PEM(i_myear_leg,stopPEM,i_myear,n_myear)
12
13!=======================================================================
14!
15! Purpose: Update the first line of "info_PEM.txt" to count the number of simulated Martian years
16!          Write in "info_PEM.txt" the reason why the PEM stopped and the number of simulated years
17!
18! Author: RV, JBC
19!=======================================================================
20
21use time_evol_mod, only: convert_years, year_bp_ini
22
23implicit none
24
25!----- Arguments
26integer, intent(in) :: stopPEM          ! Reason to stop
27real,    intent(in) :: i_myear_leg      ! # of years
28real,    intent(in) :: i_myear, n_myear ! Current simulated Martian year and maximum number of Martian years to be simulated
29
30!----- Local variables
31logical       :: ok
32integer       :: cstat
33character(10) :: ich1, ich2, ich3, ich4, ich5, ich6, fch
34
35!----- Code
36inquire(file = 'info_PEM.txt',exist = ok)
37if (ok) then
38    write(ich1,'(f0.4)') i_myear
39    write(ich2,'(f0.4)') n_myear
40    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"
41    write(ich3,'(i0)') iPCM
42    write(ich4,'(i0)') iPEM + 1
43    write(ich5,'(i0)') nPCM
44    write(ich6,'(i0)') nPCM_ini
45    call execute_command_line('sed -i "1s/.*/'//trim(ich1)//' '//trim(ich2)//' '//trim(fch)//' '//trim(ich3)//' '//trim(ich4)//' '//trim(ich5)//' '//trim(ich6)//'/" info_PEM.txt',cmdstat = cstat)
46    if (cstat > 0) then
47        error stop 'info_PEM: command execution failed!'
48    else if (cstat < 0) then
49        error stop 'info_PEM: command execution not supported!'
50    endif
51    open(1,file = 'info_PEM.txt',status = "old",position = "append",action = "write")
52    ! Martian date, Number of Martians years done by the PEM run, Number of Martians years done by the chainded simulation, Code of the stopping criterion
53    ! The conversion ratio from Planetary years to Earth years is given in the header of the file
54    write(1,*) year_bp_ini + i_myear, i_myear_leg, i_myear, stopPEM
55    close(1)
56else
57    error stop 'The file ''info_PEM.txt'' does not exist and cannot be updated!'
58endif
59
60END SUBROUTINE info_PEM
61
62END MODULE info_PEM_mod
Note: See TracBrowser for help on using the repository browser.