source: LMDZ6/trunk/libf/phylmd/create_etat0_limit_unstruct_mod.f90

Last change on this file was 5268, checked in by abarral, 2 months ago

.f90 <-> .F90 depending on cpp key use

File size: 4.0 KB
RevLine 
[3435]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
[4619]12  USE lmdz_xios, ONLY: xios_set_axis_attr, xios_set_fieldgroup_attr, &
[3585]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
[3435]18  USE time_phylmdz_mod, ONLY : annee_ref
[3585]19  USE create_etat0_unstruct_mod, ONLY: init_create_etat0_unstruct
[3435]20  IMPLICIT NONE
21 
22    INTEGER :: iflag_phys,i
23    INTEGER :: ndays
24    REAL,ALLOCATABLE :: value(:)
25   
26      IF (grid_type==unstructured) THEN
[3585]27        CALL getin_p("iflag_phys",iflag_phys)
[3435]28       
[3585]29        CALL getin_p('create_etat0_limit',create_etat0_limit)
[3435]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.)
[3465]45          CALL init_create_etat0_unstruct
[3435]46        ENDIF
47     
48      ENDIF 
49
50  END SUBROUTINE init_etat0_limit_unstruct
51 
52  SUBROUTINE create_etat0_limit_unstruct
[3585]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
[4619]61  USE lmdz_xios, ONLY: xios_context_finalize, xios_set_current_context, &
[3585]62                  xios_finalize
[3470]63  USE print_control_mod, ONLY: lunout
[3435]64  IMPLICIT NONE
65      INTEGER :: iflag_phys
[3531]66      INTEGER :: ierr
67      CHARACTER (LEN=20) :: modname='create_etat0_limit_unstruct'
68      CHARACTER (LEN=80) :: abort_message
69     
[3435]70      IF (grid_type==unstructured) THEN
71 
[3585]72        CALL getin_p("iflag_phys",iflag_phys)
[3435]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()
[3470]83                CALL MPI_Finalize(ierr)
[3531]84                abort_message='create_etat0_limit_unstruct, Initial state file are created, all is fine'
[4938]85                write(lunout,*) abort_message
86                STOP 0
87!                CALL abort_physic(modname,abort_message,0)
[3435]88              ENDIF
89!$OMP BARRIER
[3532]90              abort_message='create_etat0_limit_unstruct, Initial state file are created, all is fine'
91              CALL abort_physic(modname,abort_message,0)
[3435]92          ENDIF
93        ELSE
94          IF (create_etat0_limit) THEN
[3585]95            CALL iniaqua(klon,year_len,iflag_phys)
[3435]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()
[3470]101                CALL MPI_Finalize(ierr)
[3435]102              ENDIF
103!$OMP BARRIER
[3531]104              abort_message='create_etat0_limit_unstruct, Initial state file are created, all is fine'
105              CALL abort_physic(modname,abort_message,0)
[3435]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.