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

Last change on this file since 4686 was 4620, checked in by fhourdin, 17 months ago

Identite nom de "module=fichier" (pour makelmdz)

File size: 3.9 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                CALL abort_physic(modname,abort_message,0)
86              ENDIF
87!$OMP BARRIER
88              abort_message='create_etat0_limit_unstruct, Initial state file are created, all is fine'
89              CALL abort_physic(modname,abort_message,0)
90          ENDIF
91        ELSE
92          IF (create_etat0_limit) THEN
93            CALL iniaqua(klon,year_len,iflag_phys)
94              IF (is_omp_master)  THEN
95                CALL xios_context_finalize()
96                CALL xios_set_current_context("icosagcm")   ! very bad, need to find an other solution
97                CALL xios_context_finalize()
98                CALL xios_finalize()
99                CALL MPI_Finalize(ierr)
100              ENDIF
101!$OMP BARRIER
102              abort_message='create_etat0_limit_unstruct, Initial state file are created, all is fine'
103              CALL abort_physic(modname,abort_message,0)
104          ENDIF
105        ENDIF
106      ENDIF
107       
108  END SUBROUTINE create_etat0_limit_unstruct
109 
110END MODULE etat0_limit_unstruct_mod
111
Note: See TracBrowser for help on using the repository browser.