source: LMDZ6/branches/Amaury_dev/libf/phylmd/create_etat0_limit_unstruct_mod.F90

Last change on this file was 5116, checked in by abarral, 4 months ago

rename modules properly lmdz_*
move ismin, ismax, minmax into new lmdz_libmath.f90
(lint) uppercase fortran keywords

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 lmdz_phys_para, ONLY: is_omp_master
15  USE lmdz_grid_phy, ONLY: grid_type, unstructured
16  USE ioipsl, ONLY: ioget_year_len
17  USE lmdz_ioipsl_getin_p, 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 lmdz_grid_phy, 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 lmdz_phys_para, ONLY: is_omp_master
59  USE lmdz_ioipsl_getin_p, 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 lmdz_print_control, ONLY: lunout
64  USE lmdz_abort_physic, ONLY: abort_physic
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        CALL getin_p("iflag_phys",iflag_phys)
74
75        IF (iflag_phys<100) THEN
76          IF ( create_etat0_limit) THEN
77              CALL create_etat0_unstruct
78              CALL create_limit_unstruct
79              IF (is_omp_master)  THEN
80                CALL xios_context_finalize()
81                CALL xios_set_current_context("icosagcm")   ! very bad, need to find an other solution
82                CALL xios_context_finalize()
83                CALL xios_finalize()
84                CALL MPI_Finalize(ierr)
85                abort_message='create_etat0_limit_unstruct, Initial state file are created, all is fine'
86                WRITE(lunout,*) abort_message
87                STOP 0
88!                CALL abort_physic(modname,abort_message,0)
89              ENDIF
90!$OMP BARRIER
91              abort_message='create_etat0_limit_unstruct, Initial state file are created, all is fine'
92              CALL abort_physic(modname,abort_message,0)
93          ENDIF
94        ELSE
95          IF (create_etat0_limit) THEN
96            CALL iniaqua(klon,year_len,iflag_phys)
97              IF (is_omp_master)  THEN
98                CALL xios_context_finalize()
99                CALL xios_set_current_context("icosagcm")   ! very bad, need to find an other solution
100                CALL xios_context_finalize()
101                CALL xios_finalize()
102                CALL MPI_Finalize(ierr)
103              ENDIF
104!$OMP BARRIER
105              abort_message='create_etat0_limit_unstruct, Initial state file are created, all is fine'
106              CALL abort_physic(modname,abort_message,0)
107          ENDIF
108        ENDIF
109      ENDIF
110       
111  END SUBROUTINE create_etat0_limit_unstruct
112 
113END MODULE etat0_limit_unstruct_mod
114
Note: See TracBrowser for help on using the repository browser.