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

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