source: trunk/LMDZ.GENERIC/libf/phystd/iniwrite_specVI.F @ 1351

Last change on this file since 1351 was 1308, checked in by emillour, 10 years ago

Generic GCM:
Some cleanup to simplify dynamics/physics interactions by getting rid
of dimphys.h (i.e. the nlayermx parameter) and minimizing use of
dimension.h in the physics.
EM

File size: 6.7 KB
Line 
1      SUBROUTINE iniwrite_specVI(nid,idayref)
2
3      use radinc_h, only: L_NSPECTV
4      use radcommon_h, only: WNOV,DWNV
5      use comsoil_h
6
7      implicit none
8
9c=======================================================================
10c
11c   Auteur:  L. Fairhead  ,  P. Le Van, Y. Wanherdrick, F. Forget
12c   -------
13c
14c   Objet:
15c   ------
16c
17c   'Initialize' the diagfi_spec.nc file: write down dimensions as well
18c   as time-independent fields (e.g: geopotential, mesh area, ...)
19c
20c=======================================================================
21c-----------------------------------------------------------------------
22c   Declarations:
23c   -------------
24
25#include "dimensions.h"
26#include "paramet.h"
27!include "comconst.h"
28#include "comcstfi.h"
29#include "comvert.h"
30#include "comgeom.h"
31#include "temps.h"
32#include "ener.h"
33#include "logic.h"
34#include "netcdf.inc"
35#include "serre.h"
36!#include"dimphys.h"
37
38c   Arguments:
39c   ----------
40
41      integer nid        ! NetCDF file ID
42      INTEGER*4 idayref  ! date (initial date for this run)
43
44c   Local:
45c   ------
46      INTEGER length,l
47      parameter (length = 100)
48      REAL tab_cntrl(length) ! run parameters are stored in this array
49      INTEGER ierr
50
51      integer :: nvarid,idim_index,idim_rlonu,idim_rlonv
52      integer :: idim_rlatu,idim_rlatv,idim_llmp1,idim_llm
53 !     integer :: idim_nsoilmx ! "subsurface_layers" dimension ID #
54      integer :: idim_bandsVI ! "VI Wavenumber" dimension ID #
55      integer, dimension(2) :: id 
56
57c-----------------------------------------------------------------------
58
59      DO l=1,length
60         tab_cntrl(l)=0.
61      ENDDO
62      tab_cntrl(1)  = FLOAT(iim)
63      tab_cntrl(2)  = FLOAT(jjm)
64      tab_cntrl(3)  = FLOAT(llm)
65      tab_cntrl(4)  = FLOAT(idayref)
66      tab_cntrl(5)  = rad
67      tab_cntrl(6)  = omeg
68      tab_cntrl(7)  = g
69      tab_cntrl(8)  = mugaz
70      tab_cntrl(9)  = rcp
71      tab_cntrl(10) = daysec
72      tab_cntrl(11) = dtphys
73      tab_cntrl(12) = etot0
74      tab_cntrl(13) = ptot0
75      tab_cntrl(14) = ztot0
76      tab_cntrl(15) = stot0
77      tab_cntrl(16) = ang0
78c
79c    ..........    P.Le Van  ( ajout le 8/04/96 )    .........
80c         .....        parametres  pour le zoom          ......   
81      tab_cntrl(17)  = clon
82      tab_cntrl(18)  = clat
83      tab_cntrl(19)  = grossismx
84      tab_cntrl(20)  = grossismy
85c
86c     .....   ajout  le 6/05/97 et le 15/10/97  .......
87c
88      IF ( fxyhypb )   THEN
89        tab_cntrl(21) = 1.
90        tab_cntrl(22) = dzoomx
91        tab_cntrl(23) = dzoomy
92      ELSE
93        tab_cntrl(21) = 0.
94        tab_cntrl(22) = dzoomx
95        tab_cntrl(23) = dzoomy
96        tab_cntrl(24) = 0.
97        IF( ysinus )  tab_cntrl(24) = 1.
98      ENDIF
99
100c    .........................................................
101
102! Define dimensions
103   
104      ierr = NF_REDEF (nid)
105
106      ierr = NF_DEF_DIM (nid, "index", length, idim_index)
107      ierr = NF_DEF_DIM (nid, "latitude", jjp1, idim_rlatu)
108      ierr = NF_DEF_DIM (nid, "longitude", iip1, idim_rlonv)
109      ierr = NF_DEF_DIM (nid, "VI Wavenumber",L_NSPECTV,idim_bandsVI)
110
111      ierr = NF_ENDDEF(nid)
112
113c  Contol parameters for this run
114      ierr = NF_REDEF (nid)
115#ifdef NC_DOUBLE
116      ierr = NF_DEF_VAR (nid, "controle", NF_DOUBLE, 1,
117     .       idim_index,nvarid)
118#else
119      ierr = NF_DEF_VAR (nid, "controle", NF_FLOAT, 1,
120     .       idim_index,nvarid)
121#endif
122      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 18,
123     .                       "Control parameters")
124      ierr = NF_ENDDEF(nid)
125#ifdef NC_DOUBLE
126      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,tab_cntrl)
127#else
128      ierr = NF_PUT_VAR_REAL (nid,nvarid,tab_cntrl)
129#endif
130
131c --------------------------
132c  longitudes and latitudes
133
134      ierr = NF_REDEF (nid)
135#ifdef NC_DOUBLE
136      ierr =NF_DEF_VAR(nid, "latitude", NF_DOUBLE, 1, idim_rlatu,nvarid)
137#else
138      ierr =NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim_rlatu,nvarid)
139#endif
140      ierr =NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north")
141      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14,
142     .      "North latitude")
143      ierr = NF_ENDDEF(nid)
144#ifdef NC_DOUBLE
145      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu/pi*180)
146#else
147      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu/pi*180)
148#endif
149c
150c --------------------------
151      ierr = NF_REDEF (nid)
152#ifdef NC_DOUBLE
153      ierr =NF_DEF_VAR(nid,"longitude", NF_DOUBLE, 1, idim_rlonv,nvarid)
154#else
155      ierr = NF_DEF_VAR(nid,"longitude", NF_FLOAT, 1, idim_rlonv,nvarid)
156#endif
157      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14,
158     .      "East longitude")
159      ierr = NF_PUT_ATT_TEXT(nid,nvarid,'units',12,"degrees_east")
160      ierr = NF_ENDDEF(nid)
161#ifdef NC_DOUBLE
162      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv/pi*180)
163#else
164      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv/pi*180)
165#endif
166c
167
168!-------------------------------
169! Number of bands in the IR
170!-------------------------------
171
172      ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode
173      ! define variable
174#ifdef NC_DOUBLE
175      ierr=NF_DEF_VAR(nid,"VI Wavenumber",NF_DOUBLE,1,
176     .                          idim_bandsVI,nvarid)
177#else
178      ierr=NF_DEF_VAR(nid,"VI Wavenumber",NF_FLOAT,1,
179     .                          idim_bandsVI,nvarid)
180#endif
181      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 33,
182     .                        "Band mid frequency in the visible")
183      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"units",5,"cm^-1")
184      ierr=NF_ENDDEF(nid) ! Leave NetCDF define mode
185      ! write variable
186#ifdef NC_DOUBLE
187      ierr=NF_PUT_VAR_DOUBLE (nid,nvarid,dble(WNOV))
188#else
189      ierr=NF_PUT_VAR_REAL (nid,nvarid,real(WNOV))
190#endif
191
192c
193!-------------------------------
194! Width of bands in the Visible
195!-------------------------------
196
197      ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode
198      ! define variable
199#ifdef NC_DOUBLE
200      ierr=NF_DEF_VAR(nid,"VI Bandwidth",NF_DOUBLE,1,
201     .                          idim_bandsVI,nvarid)
202#else
203      ierr=NF_DEF_VAR(nid,"VI Bandwidth",NF_FLOAT,1,
204     .                          idim_bandsVI,nvarid)
205#endif
206      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 24,
207     .                        "Bandwidth in the visible")
208      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"units",5,"cm^-1")
209      ierr=NF_ENDDEF(nid) ! Leave NetCDF define mode
210      ! write variable
211#ifdef NC_DOUBLE
212      ierr=NF_PUT_VAR_DOUBLE (nid,nvarid,dble(DWNV))
213#else
214      ierr=NF_PUT_VAR_REAL (nid,nvarid,real(DWNV))
215#endif
216c
217c --------------------------
218c   Mesh area
219c --------------------------
220
221      id(1)=idim_rlonv
222      id(2)=idim_rlatu
223
224
225      ierr = NF_REDEF (nid)
226#ifdef NC_DOUBLE
227      ierr = NF_DEF_VAR (nid, "aire", NF_DOUBLE, 2, id,nvarid)
228#else
229      ierr = NF_DEF_VAR (nid, "aire", NF_FLOAT, 2, id,nvarid)
230#endif
231      ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 9,
232     .                       "Mesh area")
233      ierr = NF_ENDDEF(nid)
234#ifdef NC_DOUBLE
235      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire)
236#else
237      ierr = NF_PUT_VAR_REAL (nid,nvarid,aire)
238#endif
239
240
241
242      END
Note: See TracBrowser for help on using the repository browser.