source: LMDZ5/branches/LMDZ5V1.0-dev/libf/phylmd/initphysto.F90 @ 4778

Last change on this file since 4778 was 1447, checked in by jghattas, 14 years ago
  • Added variables written to file phystokenc.nc by option offline.
  • initphysto and phystokenc rewritten in F90
  • ener.h modified to be compatible with F77 and F90 syntax
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.6 KB
Line 
1!
2! $Id: initphysto.F90 1447 2010-10-22 16:18:27Z fhourdin $
3!
4SUBROUTINE initphysto(infile,tstep,t_ops,t_wrt,fileid)
5 
6  USE dimphy
7  USE mod_phys_lmdz_para
8  USE IOIPSL
9  USE iophy
10  USE control_mod
11 
12  IMPLICIT NONE
13
14!
15!   Routine d'initialisation des ecritures des fichiers histoires LMDZ
16!   au format IOIPSL
17!
18!   Appels succesifs des routines: histbeg
19!                                  histhori
20!                                  histver
21!                                  histdef
22!                                  histend
23!
24!   Entree:
25!
26!      infile: nom du fichier histoire a creer
27!      day0,anne0: date de reference
28!      tstep: duree du pas de temps en seconde
29!      t_ops: frequence de l'operation pour IOIPSL
30!      t_wrt: frequence d'ecriture sur le fichier
31!
32!   Sortie:
33!      fileid: ID du fichier netcdf cree
34!
35!   L. Fairhead, LMD, 03/99
36!
37! =====================================================================
38!
39!   Declarations
40  INCLUDE "dimensions.h"
41  INCLUDE "paramet.h"
42  INCLUDE "comconst.h"
43  INCLUDE "comgeom.h"
44  INCLUDE "temps.h"
45  INCLUDE "logic.h"
46  INCLUDE "description.h"
47  INCLUDE "serre.h"
48  INCLUDE "indicesol.h"
49
50!   Arguments
51  CHARACTER(len=*), INTENT(IN) :: infile
52  REAL, INTENT(IN)             :: tstep
53  REAL, INTENT(IN)             :: t_ops
54  REAL, INTENT(IN)             :: t_wrt
55  INTEGER, INTENT(OUT)         :: fileid
56
57! Variables locales
58  INTEGER nhoriid, i
59  INTEGER l,k
60  REAL nivsigs(llm)
61  INTEGER tau0
62  REAL zjulian
63  INTEGER iq
64  INTEGER uhoriid, vhoriid, thoriid, zvertiid
65  INTEGER ii,jj
66  INTEGER zan, idayref
67  LOGICAL ok_sync
68  REAL zx_lon(iim,jjm+1), zx_lat(iim,jjm+1)
69  CHARACTER(len=12) :: nvar
70
71!  Initialisations
72!
73  pi = 4. * ATAN (1.)
74  ok_sync= .TRUE.
75!
76!  Appel a histbeg: creation du fichier netcdf et initialisations diverses
77!         
78
79  zan = annee_ref
80  idayref = day_ref
81  CALL ymds2ju(zan, 1, idayref, 0.0, zjulian)
82  tau0 = 0
83 
84  CALL histbeg_phy(infile,tau0, zjulian, tstep, &
85       nhoriid, fileid)
86
87!$OMP MASTER   
88!  Appel a histvert pour la grille verticale
89!
90  DO l=1,llm
91     nivsigs(l)=REAL(l)
92  ENDDO
93 
94  CALL histvert(fileid, 'sig_s', 'Niveaux sigma', &
95       'sigma_level', &
96       llm, nivsigs, zvertiid)
97!
98!  Appels a histdef pour la definition des variables a sauvegarder
99!
100  CALL histdef(fileid, "phis", "Surface geop. height", "-", &
101       iim,jj_nb,nhoriid, 1,1,1, -99, 32, &
102       "once", t_ops, t_wrt)
103 
104  CALL histdef(fileid, "aire", "Grid area", "-", &
105       iim,jj_nb,nhoriid, 1,1,1, -99, 32, &
106       "once", t_ops, t_wrt)
107
108  CALL histdef(fileid, "longitudes", "longitudes", "-", &
109       iim,jj_nb,nhoriid, 1,1,1, -99, 32, &
110       "once", t_ops, t_wrt)
111
112  CALL histdef(fileid, "latitudes", "latitudes", "-", &
113       iim,jj_nb,nhoriid, 1,1,1, -99, 32, &
114       "once", t_ops, t_wrt)
115! T
116  CALL histdef(fileid, 't', 'Temperature', 'K', iim, jj_nb, nhoriid, &
117       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
118! mfu
119  CALL histdef(fileid, 'mfu', 'flx m. pan. mt', 'kg m/s',iim, jj_nb, nhoriid, &
120       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
121! mfd
122  CALL histdef(fileid, 'mfd', 'flx m. pan. des', 'kg m/s',iim, jj_nb, nhoriid, &
123       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
124! en_u
125  CALL histdef(fileid, 'en_u', 'flx ent pan mt', 'kg m/s', iim, jj_nb, nhoriid, &
126       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
127! de_u
128  CALL histdef(fileid, 'de_u', 'flx det pan mt', 'kg m/s',iim, jj_nb, nhoriid, &
129       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
130! en_d
131  CALL histdef(fileid, 'en_d', 'flx ent pan dt', 'kg m/s', iim, jj_nb, nhoriid, &
132       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
133! de_d
134  CALL histdef(fileid, 'de_d', 'flx det pan dt', 'kg m/s', iim, jj_nb, nhoriid, &
135       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
136! coefh
137  CALL histdef(fileid, "coefh", " ", " ", iim, jj_nb, nhoriid, &
138       llm, 1, llm, zvertiid,32, "inst(X)", t_ops, t_wrt)
139! fm_th
140  CALL histdef(fileid, "fm_th", " ", " ",iim, jj_nb, nhoriid, &
141       llm, 1, llm, zvertiid,32, "inst(X)", t_ops, t_wrt)
142! en_th
143  CALL histdef(fileid, "en_th", " ", " ",iim, jj_nb, nhoriid, &
144       llm, 1, llm, zvertiid,32, "inst(X)", t_ops, t_wrt)
145! frac_impa
146  CALL histdef(fileid, 'frac_impa', ' ', ' ',iim, jj_nb, nhoriid, &
147       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
148! frac_nucl
149  CALL histdef(fileid, 'frac_nucl', ' ', ' ',iim, jj_nb, nhoriid, &
150       llm, 1, llm, zvertiid,32, 'inst(X)', t_ops, t_wrt)
151! pyu1
152  CALL histdef(fileid, "pyu1", " ", " ", iim,jj_nb,nhoriid, &
153       1,1,1, -99, 32, "inst(X)", t_ops, t_wrt)
154! pyv1
155  CALL histdef(fileid, "pyv1", " ", " ", iim,jj_nb,nhoriid, &
156       1,1,1, -99, 32,"inst(X)", t_ops, t_wrt)   
157! ftsol1
158  CALL histdef(fileid, "ftsol1", " ", " ",iim, jj_nb, nhoriid, &
159       1, 1,1, -99,32, "inst(X)", t_ops, t_wrt)
160! ftsol2
161  CALL histdef(fileid, "ftsol2", " ", " ",iim, jj_nb, nhoriid, &
162       1, 1,1, -99,32, "inst(X)", t_ops, t_wrt)
163! ftsol3
164  CALL histdef(fileid, "ftsol3", " ", " ", iim, jj_nb, nhoriid, &
165       1, 1,1, -99,32, "inst(X)", t_ops, t_wrt)
166! ftsol4
167  CALL histdef(fileid, "ftsol4", " ", " ",iim, jj_nb, nhoriid, &
168       1, 1,1, -99, 32, "inst(X)", t_ops, t_wrt)
169! psrf1
170  CALL histdef(fileid, "psrf1", " ", " ",iim, jj_nb, nhoriid, &
171       1, 1, 1, -99,32, "inst(X)", t_ops, t_wrt)
172! psrf2
173  CALL histdef(fileid, "psrf2", " ", " ",iim, jj_nb, nhoriid, &
174       1, 1, 1, -99, 32, "inst(X)", t_ops, t_wrt)
175! psrf3
176  CALL histdef(fileid, "psrf3", " ", " ",iim, jj_nb, nhoriid, &
177       1, 1, 1, -99, 32, "inst(X)", t_ops, t_wrt)
178! psrf4
179  CALL histdef(fileid, "psrf4", " ", " ", iim, jj_nb, nhoriid, &
180       1, 1, 1, -99,32, "inst(X)", t_ops, t_wrt)
181! sh
182  CALL histdef(fileid, 'sh', '', '', iim, jj_nb, nhoriid, &
183       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
184! da
185  CALL histdef(fileid, 'da', '', '', iim, jj_nb, nhoriid, &
186       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
187! mp
188  CALL histdef(fileid, 'mp', '', '', iim, jj_nb, nhoriid, &
189       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
190! upwd
191  CALL histdef(fileid, 'upwd', '', '', iim, jj_nb, nhoriid, &
192       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
193! dnwd
194  CALL histdef(fileid, 'dnwd', '', '', iim, jj_nb, nhoriid, &
195       llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
196
197! phi
198  DO k=1,llm
199     IF (k<10) THEN
200        WRITE(nvar,'(i1)') k
201     ELSE IF (k<100) THEN
202        WRITE(nvar,'(i2)') k
203     ELSE
204        WRITE(nvar,'(i3)') k
205     END IF
206     nvar='phi_lev'//trim(nvar)
207     
208     CALL histdef(fileid, nvar, '', '', iim, jj_nb, nhoriid, &
209          llm, 1, llm, zvertiid, 32, 'inst(X)', t_ops, t_wrt)
210  END DO
211
212  CALL histend(fileid)
213  IF (ok_sync) CALL histsync
214!$OMP END MASTER
215       
216END SUBROUTINE initphysto
Note: See TracBrowser for help on using the repository browser.