source: LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/create_etat0_limit_unstruct.F90 @ 3603

Last change on this file since 3603 was 3323, checked in by Laurent Fairhead, 7 years ago

Adding some new routines mainly dealing with unstructured grids to the physics

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