source: trunk/LMDZ.GENERIC/libf/phystd/iniwrite_specIR.F @ 537

Last change on this file since 537 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.9 KB
RevLine 
[305]1      SUBROUTINE iniwrite_specIR(nid,idayref,phis)
2
3      use radinc_h, only: L_NSPECTI
[533]4      use radcommon_h, only: WNOI,DWNI
[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_bandsIR ! "IR 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, "IR Wavenumber",L_NSPECTI,idim_bandsIR)
[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
137      ierr = NF_REDEF (nid)
138#ifdef NC_DOUBLE
139      ierr =NF_DEF_VAR(nid, "latitude", NF_DOUBLE, 1, idim_rlatu,nvarid)
140#else
141      ierr =NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim_rlatu,nvarid)
142#endif
143      ierr =NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north")
144      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14,
145     .      "North latitude")
146      ierr = NF_ENDDEF(nid)
147#ifdef NC_DOUBLE
148      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu/pi*180)
149#else
150      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu/pi*180)
151#endif
152c
153c --------------------------
154      ierr = NF_REDEF (nid)
155#ifdef NC_DOUBLE
156      ierr =NF_DEF_VAR(nid,"longitude", NF_DOUBLE, 1, idim_rlonv,nvarid)
157#else
158      ierr = NF_DEF_VAR(nid,"longitude", NF_FLOAT, 1, idim_rlonv,nvarid)
159#endif
160      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14,
161     .      "East longitude")
162      ierr = NF_PUT_ATT_TEXT(nid,nvarid,'units',12,"degrees_east")
163      ierr = NF_ENDDEF(nid)
164#ifdef NC_DOUBLE
165      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv/pi*180)
166#else
167      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv/pi*180)
168#endif
169c
170
171!-------------------------------
172! Number of bands in the IR
173!-------------------------------
174
175      ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode
176      ! define variable
177#ifdef NC_DOUBLE
[526]178      ierr=NF_DEF_VAR(nid,"IR Wavenumber",NF_DOUBLE,1,
179     .                          idim_bandsIR,nvarid)
[305]180#else
[526]181      ierr=NF_DEF_VAR(nid,"IR Wavenumber",NF_FLOAT,1,
182     .                          idim_bandsIR,nvarid)
[305]183#endif
[526]184      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 34,
185     .                        "Band mid frequency in the infrared")
186      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"units",5,"cm^-1")
[305]187      ierr=NF_ENDDEF(nid) ! Leave NetCDF define mode
188      ! write variable
189#ifdef NC_DOUBLE
[526]190      ierr=NF_PUT_VAR_DOUBLE (nid,nvarid,dble(WNOI))
[305]191#else
[526]192      ierr=NF_PUT_VAR_REAL (nid,nvarid,real(WNOI))
[305]193#endif
194
[533]195!-------------------------------
196! Width of bands in the IR
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,"IR Bandwidth",NF_DOUBLE,1,
203     .                          idim_bandsIR,nvarid)
[305]204#else
[533]205      ierr=NF_DEF_VAR(nid,"IR Bandwidth",NF_FLOAT,1,
206     .                          idim_bandsIR,nvarid)
[305]207#endif
[533]208      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 25,
209     .                        "Bandwidth in the infrared")
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(DWNI))
[305]215#else
[533]216      ierr=NF_PUT_VAR_REAL (nid,nvarid,real(DWNI))
[305]217#endif
218c
219c --------------------------
[533]220c  Mesh area and conversion coefficients cov. <-> contra. <--> natural
221
222
[305]223      id(1)=idim_rlonv
224      id(2)=idim_rlatu
225c
226c --------------------------
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      END
Note: See TracBrowser for help on using the repository browser.