source: LMDZ6/trunk/libf/phylmd/create_etat0_limit_unstruct_mod.F90 @ 5260

Last change on this file since 5260 was 4938, checked in by Laurent Fairhead, 7 months ago

Fix to remove spurrious error messages when creating ICOLMDZ start files.
Needs work so that proper termination of the code is handled by icosa_lmdz rather than LMDZ physics

File size: 4.0 KB
Line 
1MODULE etat0_limit_unstruct_mod
2
3  LOGICAL, SAVE  :: create_etat0_limit
4!$OMP THREADPRIVATE(create_etat0_limit)
5
6
7
8
9CONTAINS
10 
11  SUBROUTINE init_etat0_limit_unstruct
12  USE lmdz_xios, ONLY: xios_set_axis_attr, xios_set_fieldgroup_attr, &
13                  xios_set_filegroup_attr, xios_set_file_attr
14  USE mod_phys_lmdz_para, ONLY: is_omp_master
15  USE mod_grid_phy_lmdz, ONLY: grid_type, unstructured
16  USE ioipsl, ONLY : ioget_year_len
17  USE ioipsl_getin_p_mod, ONLY: getin_p
18  USE time_phylmdz_mod, ONLY : annee_ref
19  USE create_etat0_unstruct_mod, ONLY: init_create_etat0_unstruct
20  IMPLICIT NONE
21 
22    INTEGER :: iflag_phys,i
23    INTEGER :: ndays
24    REAL,ALLOCATABLE :: value(:)
25   
26      IF (grid_type==unstructured) THEN
27        CALL getin_p("iflag_phys",iflag_phys)
28       
29        CALL getin_p('create_etat0_limit',create_etat0_limit)
30       
31        ndays=ioget_year_len(annee_ref)
32        ALLOCATE(value(ndays))
33        DO i=1,ndays
34          value(i)=i-1
35        ENDDO
36       
37        IF (is_omp_master) CALL xios_set_axis_attr("time_year",n_glo=ndays,value=value)
38       
39        IF (create_etat0_limit) THEN
40          IF (iflag_phys<100) THEN
41            IF (is_omp_master) CALL xios_set_fieldgroup_attr("etat0_limit_read",read_access=.TRUE.,enabled=.TRUE.)
42            IF (is_omp_master) CALL xios_set_filegroup_attr("etat0_limit_read",enabled=.TRUE.)
43          ENDIF
44          IF (is_omp_master) CALL xios_set_file_attr("limit_write",enabled=.TRUE.)
45          CALL init_create_etat0_unstruct
46        ENDIF
47     
48      ENDIF 
49
50  END SUBROUTINE init_etat0_limit_unstruct
51 
52  SUBROUTINE create_etat0_limit_unstruct
53  USE mod_grid_phy_lmdz, ONLY: grid_type, unstructured
54  USE create_etat0_unstruct_mod, ONLY: create_etat0_unstruct
55  USE create_limit_unstruct_mod, ONLY: create_limit_unstruct
56  USE phyaqua_mod, ONLY: iniaqua
57  USE phys_cal_mod, only: year_len
58  USE mod_phys_lmdz_para, ONLY: is_omp_master
59  USE ioipsl_getin_p_mod, ONLY: getin_p
60  USE dimphy, ONLY: klon
61  USE lmdz_xios, ONLY: xios_context_finalize, xios_set_current_context, &
62                  xios_finalize
63  USE print_control_mod, ONLY: lunout
64  IMPLICIT NONE
65      INTEGER :: iflag_phys
66      INTEGER :: ierr
67      CHARACTER (LEN=20) :: modname='create_etat0_limit_unstruct'
68      CHARACTER (LEN=80) :: abort_message
69     
70      IF (grid_type==unstructured) THEN
71 
72        CALL getin_p("iflag_phys",iflag_phys)
73
74        IF (iflag_phys<100) THEN
75          IF ( create_etat0_limit) THEN
76              CALL create_etat0_unstruct
77              CALL create_limit_unstruct
78              IF (is_omp_master)  THEN
79                CALL xios_context_finalize()
80                CALL xios_set_current_context("icosagcm")   ! very bad, need to find an other solution
81                CALL xios_context_finalize()
82                CALL xios_finalize()
83                CALL MPI_Finalize(ierr)
84                abort_message='create_etat0_limit_unstruct, Initial state file are created, all is fine'
85                write(lunout,*) abort_message
86                STOP 0
87!                CALL abort_physic(modname,abort_message,0)
88              ENDIF
89!$OMP BARRIER
90              abort_message='create_etat0_limit_unstruct, Initial state file are created, all is fine'
91              CALL abort_physic(modname,abort_message,0)
92          ENDIF
93        ELSE
94          IF (create_etat0_limit) THEN
95            CALL iniaqua(klon,year_len,iflag_phys)
96              IF (is_omp_master)  THEN
97                CALL xios_context_finalize()
98                CALL xios_set_current_context("icosagcm")   ! very bad, need to find an other solution
99                CALL xios_context_finalize()
100                CALL xios_finalize()
101                CALL MPI_Finalize(ierr)
102              ENDIF
103!$OMP BARRIER
104              abort_message='create_etat0_limit_unstruct, Initial state file are created, all is fine'
105              CALL abort_physic(modname,abort_message,0)
106          ENDIF
107        ENDIF
108      ENDIF
109       
110  END SUBROUTINE create_etat0_limit_unstruct
111 
112END MODULE etat0_limit_unstruct_mod
113
Note: See TracBrowser for help on using the repository browser.