source: LMDZ6/branches/Amaury_dev/libf/dyn3dmem/writehist_loc.F @ 5103

Last change on this file since 5103 was 5103, checked in by abarral, 8 weeks ago

Handle CPP_INLANDSIS in lmdz_cppkeys_wrapper.F90
Remove obsolete key wrgrads_thermcell, _ADV_HALO, _ADV_HALLO, isminmax
Remove redundant uses of CPPKEY_INCA (thanks acozic)
Remove obsolete misc/write_field.F90
Remove unused ioipsl_* wrappers
Remove calls to WriteField_u with wrong signature
Convert .F -> .[fF]90
(lint) uppercase fortran operators
[note: 1d and iso still broken - working on it]

  • 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
File size: 4.5 KB
Line 
1
2! $Id: writedynav_p.F 1279 2009-12-10 09:02:56Z fairhead $
3
4      SUBROUTINE writehist_loc( time, vcov, ucov,teta,ppk,phi,q,
5     .                          masse,ps,phis)
6
7! This routine needs IOIPSL
8      USE ioipsl
9      USE parallel_lmdz
10      USE misc_mod
11      USE infotrac, ONLY: nqtot
12      use com_io_dyn_mod, ONLY: histid,histvid,histuid
13      USE comconst_mod, ONLY: cpp
14      USE temps_mod, ONLY: itau_dyn
15     
16      implicit none
17
18C
19C   Ecriture du fichier histoire au format IOIPSL
20C
21C   Appels succesifs des routines: histwrite
22C
23C   Entree:
24C      histid: ID du fichier histoire
25C      time: temps de l'ecriture
26C      vcov: vents v covariants
27C      ucov: vents u covariants
28C      teta: temperature potentielle
29C      phi : geopotentiel instantane
30C      q   : traceurs
31C      masse: masse
32C      ps   :pression au sol
33C      phis : geopotentiel au sol
34C     
35C
36C   Sortie:
37C      fileid: ID du fichier netcdf cree
38C
39C   L. Fairhead, LMD, 03/99
40C
41C =====================================================================
42C
43C   Declarations
44      include "dimensions.h"
45      include "paramet.h"
46      include "comgeom.h"
47      include "description.h"
48      include "iniprint.h"
49
50C
51C   Arguments
52C
53
54      REAL vcov(ijb_v:ije_v,llm),ucov(ijb_u:ije_u,llm)
55      REAL teta(ijb_u:ije_u,llm),phi(ijb_u:ije_u,llm)
56      REAL ppk(ijb_u:ije_u,llm)                 
57      REAL ps(ijb_u:ije_u),masse(ijb_u:ije_u,llm)                   
58      REAL phis(ijb_u:ije_u)                 
59      REAL q(ijb_u:ije_u,llm,nqtot)
60      integer time
61
62
63! This routine needs IOIPSL
64C   Variables locales
65C
66      INTEGER,SAVE,ALLOCATABLE :: ndex2d(:),ndexu(:),ndexv(:)
67      INTEGER :: iq, ii, ll
68      REAL,SAVE,ALLOCATABLE :: tm(:,:)
69      REAL,SAVE,ALLOCATABLE :: vnat(:,:),unat(:,:)
70      logical ok_sync
71      integer itau_w
72      integer :: ijb,ije,jjn
73      LOGICAL,SAVE :: first=.TRUE.
74!$OMP THREADPRIVATE(first)
75
76C
77C  Initialisations
78C
79      if (adjust) return
80
81      IF (first) THEN
82!$OMP BARRIER
83!$OMP MASTER
84        ALLOCATE(unat(ijb_u:ije_u,llm))
85        ALLOCATE(vnat(ijb_v:ije_v,llm))
86        ALLOCATE(tm(ijb_u:ije_u,llm))
87        ALLOCATE(ndex2d(ijnb_u*llm))
88        ALLOCATE(ndexu(ijnb_u*llm))
89        ALLOCATE(ndexv(ijnb_v*llm))
90        ndex2d = 0
91        ndexu = 0
92        ndexv = 0
93!$OMP END MASTER
94!$OMP BARRIER
95        first=.FALSE.
96      ENDIF
97
98      ok_sync = .TRUE.
99      itau_w = itau_dyn + time
100
101C Passage aux composantes naturelles du vent
102      CALL covnat_loc(llm, ucov, vcov, unat, vnat)
103
104C
105C  Appels a histwrite pour l'ecriture des variables a sauvegarder
106C
107C  Vents U
108C
109
110!$OMP BARRIER
111!$OMP MASTER
112      ijb=ij_begin
113      ije=ij_end
114      jjn=jj_nb
115
116      CALL histwrite(histuid, 'u', itau_w, unat(ijb:ije,:),
117     .               iip1*jjn*llm, ndexu)
118!$OMP END MASTER
119
120C
121C  Vents V
122C
123      ije=ij_end
124      if (pole_sud) jjn=jj_nb-1
125      if (pole_sud) ije=ij_end-iip1
126!$OMP BARRIER
127!$OMP MASTER
128      CALL histwrite(histvid, 'v', itau_w, vnat(ijb:ije,:),
129     .               iip1*jjn*llm, ndexv)
130!$OMP END MASTER
131
132
133C
134C  Temperature potentielle
135C
136      ijb=ij_begin
137      ije=ij_end
138      jjn=jj_nb
139!$OMP MASTER
140      CALL histwrite(histid, 'theta', itau_w, teta(ijb:ije,:),
141     .                iip1*jjn*llm, ndexu)
142!$OMP END MASTER
143
144C
145C  Temperature
146C
147
148!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
149      do ll=1,llm
150        do ii = ijb, ije
151          tm(ii,ll) = teta(ii,ll) * ppk(ii,ll)/cpp
152        enddo
153      enddo
154!$OMP ENDDO
155
156!$OMP MASTER
157      CALL histwrite(histid, 'temp', itau_w, tm(ijb:ije,:),
158     .                iip1*jjn*llm, ndexu)
159!$OMP END MASTER
160
161
162C
163C  Geopotentiel
164C
165!$OMP MASTER
166      CALL histwrite(histid, 'phi', itau_w, phi(ijb:ije,:),
167     .                iip1*jjn*llm, ndexu)
168!$OMP END MASTER
169
170
171C
172C  Traceurs
173C
174!!$OMP MASTER
175!        DO iq=1,nqtot
176!          CALL histwrite(histid, tracers(iq)%longName, itau_w,
177!     .                   q(ijb:ije,:,iq), iip1*jjn*llm, ndexu)
178!        enddo
179!!$OMP END MASTER
180
181
182C
183C  Masse
184C
185!$OMP MASTER
186       CALL histwrite(histid, 'masse', itau_w, masse(ijb:ije,:),
187     .                iip1*jjn*llm, ndexu)
188!$OMP END MASTER
189
190
191C
192C  Pression au sol
193C
194!$OMP MASTER
195       CALL histwrite(histid, 'ps', itau_w, ps(ijb:ije),
196     .                 iip1*jjn, ndex2d)
197!$OMP END MASTER
198
199C
200C  Geopotentiel au sol
201C
202!$OMP MASTER
203!       CALL histwrite(histid, 'phis', itau_w, phis(ijb:ije),
204!     .                 iip1*jjn, ndex2d)
205!$OMP END MASTER
206
207C
208C  Fin
209C
210!$OMP MASTER
211      if (ok_sync) then
212        CALL histsync(histid)
213        CALL histsync(histvid)
214        CALL histsync(histuid)
215      endif
216!$OMP END MASTER
217      end
Note: See TracBrowser for help on using the repository browser.