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

Last change on this file since 1524 was 1524, checked in by emillour, 9 years ago

All GCMS:
More updates to enforce dynamics/physics separation:

get rid of references to "temps_mod" from physics packages;
make a "time_phylmdz_mod.F90" module to store that
information and fill it via "iniphysiq".

EM

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