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

Last change on this file since 1243 was 993, checked in by emillour, 12 years ago

Generic GCM:

  • Some more cleanup in dynamics:
    • Moved "start2archive" (and auxilliary routines) to phystd
    • removed unused (obsolete) testharm.F , para_netcdf.h , readhead_NC.F , angtot.h from dyn3d
    • removed obsolete addit.F (and change corresponding lines in gcm)
    • remove unused "description.h" (and many places where it was "included")

EM

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