source: LMDZ5/trunk/libf/dyn3dpar/inithist_p.F @ 2600

Last change on this file since 2600 was 2600, checked in by Ehouarn Millour, 8 years ago

Cleanup in the dynamics: turn comvert.h into module comvert_mod.F90
EM

  • Property copyright set to
    Name of program: LMDZ
    Creation date: 1984
    Version: LMDZ5
    License: CeCILL version 2
    Holder: Laboratoire de m\'et\'eorologie dynamique, CNRS, UMR 8539
    See the license file in the root directory
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.5 KB
Line 
1!
2! $Id: inithist_p.F 2600 2016-07-23 05:45:38Z emillour $
3!
4      subroutine inithist_p(infile,day0,anne0,tstep,t_ops,t_wrt,
5     .                      fileid,filevid)
6
7#ifdef CPP_IOIPSL
8! This routine needs IOIPSL
9       USE IOIPSL
10#endif
11       USE parallel_lmdz
12       use Write_field
13       use misc_mod
14       USE infotrac
15       USE comconst_mod, ONLY: pi
16       USE comvert_mod, ONLY: nivsigs
17
18      implicit none
19
20C
21C   Routine d'initialisation des ecritures des fichiers histoires LMDZ
22C   au format IOIPSL
23C
24C   Appels succesifs des routines: histbeg
25C                                  histhori
26C                                  histver
27C                                  histdef
28C                                  histend
29C
30C   Entree:
31C
32C      infile: nom du fichier histoire a creer
33C      day0,anne0: date de reference
34C      tstep: duree du pas de temps en seconde
35C      t_ops: frequence de l'operation pour IOIPSL
36C      t_wrt: frequence d'ecriture sur le fichier
37C
38C   Sortie:
39C      fileid: ID du fichier netcdf cree
40C      filevid:ID du fichier netcdf pour la grille v
41C
42C   L. Fairhead, LMD, 03/99
43C
44C =====================================================================
45C
46C   Declarations
47#include "dimensions.h"
48#include "paramet.h"
49#include "comgeom.h"
50#include "temps.h"
51#include "ener.h"
52#include "logic.h"
53#include "description.h"
54#include "iniprint.h"
55
56C   Arguments
57C
58      character*(*) infile
59      integer*4 day0, anne0
60      real tstep, t_ops, t_wrt
61      integer fileid, filevid
62
63#ifdef CPP_IOIPSL
64! This routine needs IOIPSL
65C   Variables locales
66C
67      integer tau0
68      real zjulian
69      integer iq
70      real rlong(iip1,jjp1), rlat(iip1,jjp1)
71      integer uhoriid, vhoriid, thoriid, zvertiid
72      integer ii,jj
73      integer zan, dayref
74      integer :: jjb,jje,jjn
75
76! definition du domaine d'ecriture pour le rebuild
77
78      INTEGER,DIMENSION(2) :: ddid
79      INTEGER,DIMENSION(2) :: dsg
80      INTEGER,DIMENSION(2) :: dsl
81      INTEGER,DIMENSION(2) :: dpf
82      INTEGER,DIMENSION(2) :: dpl
83      INTEGER,DIMENSION(2) :: dhs
84      INTEGER,DIMENSION(2) :: dhe
85     
86      INTEGER :: dynu_domain_id
87      INTEGER :: dynv_domain_id
88
89C
90C  Initialisations
91C
92      if (adjust) return
93       
94      pi = 4. * atan (1.)
95C
96C  Appel a histbeg: creation du fichier netcdf et initialisations diverses
97C         
98
99      zan = anne0
100      dayref = day0
101      CALL ymds2ju(zan, 1, dayref, 0.0, zjulian)
102      tau0 = itau_dyn
103     
104      do jj = 1, jjp1
105        do ii = 1, iip1
106          rlong(ii,jj) = rlonu(ii) * 180. / pi
107          rlat(ii,jj) = rlatu(jj) * 180. / pi
108        enddo
109      enddo
110     
111      jjb=jj_begin
112      jje=jj_end
113      jjn=jj_nb
114
115
116      ddid=(/ 1,2 /)
117      dsg=(/ iip1,jjp1 /)
118      dsl=(/ iip1,jjn /)
119      dpf=(/ 1,jjb /)
120      dpl=(/ iip1,jje /)
121      dhs=(/ 0,0 /)
122      dhe=(/ 0,0 /)
123
124      call flio_dom_set(mpi_size,mpi_rank,ddid,dsg,dsl,dpf,dpl,dhs,dhe,
125     .                 'box',dynu_domain_id)
126     
127       call histbeg(trim(infile),iip1, rlong(:,1), jjn,
128     .              rlat(1,jjb:jje), 1, iip1, 1, jjn, tau0,
129     .              zjulian, tstep, uhoriid, fileid,dynu_domain_id)
130C
131C  Creation du fichier histoire pour la grille en V (oblige pour l'instant,
132C  IOIPSL ne permet pas de grilles avec des nombres de point differents dans
133C  un meme fichier)
134
135      do jj = 1, jjm
136        do ii = 1, iip1
137          rlong(ii,jj) = rlonv(ii) * 180. / pi
138          rlat(ii,jj) = rlatv(jj) * 180. / pi
139        enddo
140      enddo
141
142      jjb=jj_begin
143      jje=jj_end
144      jjn=jj_nb
145      if (pole_sud) jje=jj_end-1
146      if (pole_sud) jjn=jj_nb-1
147
148      ddid=(/ 1,2 /)
149      dsg=(/ iip1,jjm /)
150      dsl=(/ iip1,jjn /)
151      dpf=(/ 1,jjb /)
152      dpl=(/ iip1,jje /)
153      dhs=(/ 0,0 /)
154      dhe=(/ 0,0 /)
155
156      call flio_dom_set(mpi_size,mpi_rank,ddid,dsg,dsl,dpf,dpl,dhs,dhe,
157     .                 'box',dynv_domain_id)
158     
159      call histbeg('dyn_histv', iip1, rlong(:,1), jjn, rlat(1,jjb:jje),
160     .             1, iip1, 1, jjn, tau0, zjulian, tstep, vhoriid,
161     .             filevid,dynv_domain_id)
162C
163C  Appel a histhori pour rajouter les autres grilles horizontales
164C
165     
166      do jj = 1, jjp1
167        do ii = 1, iip1
168          rlong(ii,jj) = rlonv(ii) * 180. / pi
169          rlat(ii,jj) = rlatu(jj) * 180. / pi
170        enddo
171      enddo
172
173      jjb=jj_begin
174      jje=jj_end
175      jjn=jj_nb
176
177      call histhori(fileid, iip1, rlong(:,jjb:jje),jjn,rlat(:,jjb:jje),
178     .              'scalar','Grille points scalaires', thoriid)
179C
180C  Appel a histvert pour la grille verticale
181C
182      call histvert(fileid, 'sig_s', 'Niveaux sigma','-',
183     .              llm, nivsigs, zvertiid)
184C Pour le fichier V
185      call histvert(filevid, 'sig_s', 'Niveaux sigma','-',
186     .              llm, nivsigs, zvertiid)
187C
188C  Appels a histdef pour la definition des variables a sauvegarder
189C
190C  Vents U
191C
192      jjn=jj_nb
193
194      call histdef(fileid, 'ucov', 'vents u covariants', 'm/s',
195     .             iip1, jjn, uhoriid, llm, 1, llm, zvertiid,
196     .             32, 'inst(X)', t_ops, t_wrt)
197C
198C  Vents V
199C
200      if (pole_sud) jjn=jj_nb-1
201     
202      call histdef(filevid, 'vcov', 'vents v covariants', 'm/s',
203     .             iip1, jjn, vhoriid, llm, 1, llm, zvertiid,
204     .             32, 'inst(X)', t_ops, t_wrt)
205
206C
207C  Temperature potentielle
208C
209      jjn=jj_nb
210     
211      call histdef(fileid, 'teta', 'temperature potentielle', '-',
212     .             iip1, jjn, thoriid, llm, 1, llm, zvertiid,
213     .             32, 'inst(X)', t_ops, t_wrt)
214C
215C  Geopotentiel
216C
217      call histdef(fileid, 'phi', 'geopotentiel instantane', '-',
218     .             iip1, jjn, thoriid, llm, 1, llm, zvertiid,
219     .             32, 'inst(X)', t_ops, t_wrt)
220C
221C  Traceurs
222C
223        DO iq=1,nqtot
224          call histdef(fileid, ttext(iq),  ttext(iq), '-',
225     .             iip1, jjn, thoriid, llm, 1, llm, zvertiid,
226     .             32, 'inst(X)', t_ops, t_wrt)
227        enddo
228C
229C  Masse
230C
231      call histdef(fileid, 'masse', 'masse', 'kg',
232     .             iip1, jjn, thoriid, 1, 1, 1, -99,
233     .             32, 'inst(X)', t_ops, t_wrt)
234C
235C  Pression au sol
236C
237      call histdef(fileid, 'ps', 'pression naturelle au sol', 'Pa',
238     .             iip1, jjn, thoriid, 1, 1, 1, -99,
239     .             32, 'inst(X)', t_ops, t_wrt)
240C
241C  Pression au sol
242C
243      call histdef(fileid, 'phis', 'geopotentiel au sol', '-',
244     .             iip1, jjn, thoriid, 1, 1, 1, -99,
245     .             32, 'inst(X)', t_ops, t_wrt)
246C
247C  Fin
248C
249      call histend(fileid)
250      call histend(filevid)
251#else
252      write(lunout,*)'inithist_p: Needs IOIPSL to function'
253#endif
254! #endif of #ifdef CPP_IOIPSL
255      return
256      end
Note: See TracBrowser for help on using the repository browser.