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

Last change on this file since 3562 was 1621, checked in by emillour, 8 years ago

Further work on full dynamics/physics separation.

LMDZ.COMMON:

  • added phy_common/vertical_layers_mod.F90 to store information on vertical grid. This is where routines in the physics should get the information.
  • The contents of vertical_layers_mod intialized via dynphy_lonlat/inigeomphy_mod.F90.

LMDZ.MARS:

  • physics now completely decoupled from dynamics; the physics package may now be compiled as a library (-libphy option of makelmdz_fcm).
  • created an "ini_tracer_mod" routine in module "tracer_mod" for a cleaner initialization of the later.
  • removed some purely dynamics-related outputs (etot0, zoom parameters, etc.) from diagfi.nc and stats.nc outputs as these informations are not available in the physics.

LMDZ.GENERIC:

  • physics now completely decoupled from dynamics; the physics package may now be compiled as a library (-libphy option of makelmdz_fcm).
  • added nqtot to tracer_h.F90.
  • removed some purely dynamics-related outputs (etot0, zoom parameters, etc.) from diagfi.nc and stats.nc outputs as these informations are not available in the physics.

LMDZ.VENUS:

  • physics now completely decoupled from dynamics; the physics package may now be compiled as a library (-libphy option of makelmdz_fcm).
  • added infotrac_phy.F90 to store information on tracers in the physics. Initialized via iniphysiq.
  • added cpdet_phy_mod.F90 to store t2tpot etc. functions to be used in the physics. Initialized via iniphysiq. IMPORTANT: there are some hard-coded constants! These should match what is in cpdet_mod.F90 in the dynamics.
  • got rid of references to moyzon_mod module within the physics. The required variables (tmoy, plevmoy) are passed to the physics as arguments to physiq.

LMDZ.TITAN:

  • added infotrac_phy.F90 to store information on tracers in the physics. Initialized via iniphysiq.
  • added cpdet_phy_mod.F90 to store t2tpot etc. functions to be used in the physics.
  • Extra work required to completely decouple physics and dynamics: moyzon_mod should be cleaned up and information passed from dynamics to physics as as arguments. Likewise moyzon_ch and moyzon_mu should not be queried from logic_mod (which is in the dynamics).

EM

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