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

Last change on this file since 3345 was 3297, checked in by jbclement, 8 months ago

PEM:
Integration of the module "layering_mod.F90" with the rest of the PEM:

  • The linked list data structure representative of layered deposits is converted into an array which can be outputed in the "restratpem.nc" files. This array has dimensions (ngrid,nslope,nb_str_max,6) where 'nb_str_max' is the maximum number of 'stratum' through the layerings and '6' is the number of properties of 'stratum';
  • this structure can also be read from "startpem.nc" files to initialize PEM runs;
  • The layering algorithm is now used in the main PEM loop to make the layerings evolve.

JBC

File size: 2.1 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, year_bp_ini
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 execution 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    ! 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
46    ! The conversion ratio from Planetary years to Earth years is given in the header of the file
47    write(1,*) year_bp_ini + i_myear, year_iter, i_myear, stopPEM
48    close(1)
49else
50    error stop 'The file ''info_PEM.txt'' does not exist and cannot be updated!'
51endif
52
53END SUBROUTINE info_PEM
54
55END MODULE info_PEM_mod
Note: See TracBrowser for help on using the repository browser.