source: LMDZ6/trunk/libf/phylmd/create_etat0_limit_unstruct.F90 @ 3532

Last change on this file since 3532 was 3532, checked in by Laurent Fairhead, 5 years ago

Forgot a return

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