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

Last change on this file since 3435 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
RevLine 
[1531]1      SUBROUTINE iniwrite_specVI(nid,idayref,area,nbplon,nbplat)
[305]2
3      use radinc_h, only: L_NSPECTV
[533]4      use radcommon_h, only: WNOV,DWNV
[1524]5      use comcstfi_mod, only: rad, omeg, g, mugaz, rcp, pi
6      use time_phylmdz_mod, only: daysec, dtphys
[1621]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
[1529]10      USE regular_lonlat_mod, ONLY: lon_reg, lat_reg
11      USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev
[1422]12
[305]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
[1529]31      include "netcdf.inc"
[305]32
33c   Arguments:
34c   ----------
35
[1529]36      integer,intent(in) :: nid        ! NetCDF file ID
37      INTEGER*4,INTENT(IN) :: idayref  ! date (initial date for this run)
[1531]38      real,intent(in) :: area(nbplon,nbplat) ! mesh area (m2)
39      integer,intent(in) :: nbplon,nbplat ! sizes of area
[305]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
[1531]47      REAl,ALLOCATABLE :: lon_reg_ext(:) ! extended longitudes
[305]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 #
[526]52      integer :: idim_bandsVI ! "VI Wavenumber" dimension ID #
[305]53      integer, dimension(2) :: id 
54
55c-----------------------------------------------------------------------
56
[1531]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
[305]65      DO l=1,length
66         tab_cntrl(l)=0.
67      ENDDO
[1529]68      tab_cntrl(1)  = FLOAT(nbp_lon)
69      tab_cntrl(2)  = FLOAT(nbp_lat-1)
70      tab_cntrl(3)  = FLOAT(nbp_lev)
[305]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
[1621]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
[305]84c
85c    ..........    P.Le Van  ( ajout le 8/04/96 )    .........
86c         .....        parametres  pour le zoom          ......   
[1621]87!      tab_cntrl(17)  = clon
88!      tab_cntrl(18)  = clat
89!      tab_cntrl(19)  = grossismx
90!      tab_cntrl(20)  = grossismy
[305]91c
92c     .....   ajout  le 6/05/97 et le 15/10/97  .......
93c
[1621]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
[305]105
106c    .........................................................
107
108! Define dimensions
109   
110      ierr = NF_REDEF (nid)
111
112      ierr = NF_DEF_DIM (nid, "index", length, idim_index)
[1529]113      ierr = NF_DEF_DIM (nid, "latitude", nbp_lat, idim_rlatu)
[1531]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, "VI_Wavenumber",L_NSPECTV,idim_bandsVI)
[305]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      ierr = NF_REDEF (nid)
145#ifdef NC_DOUBLE
146      ierr =NF_DEF_VAR(nid, "latitude", NF_DOUBLE, 1, idim_rlatu,nvarid)
147#else
148      ierr =NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim_rlatu,nvarid)
149#endif
150      ierr =NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north")
151      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14,
152     .      "North latitude")
153      ierr = NF_ENDDEF(nid)
154#ifdef NC_DOUBLE
[1529]155      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lat_reg/pi*180)
[305]156#else
[1529]157      ierr = NF_PUT_VAR_REAL (nid,nvarid,lat_reg/pi*180)
[305]158#endif
159c
160c --------------------------
[1529]161      lon_reg_ext(1:nbp_lon)=lon_reg(1:nbp_lon)
162      !add extra redundant point (180 degrees, since lon_reg starts at -180
[1531]163      IF (nbp_lon*nbp_lat/=1) THEN
164        ! In 3D, add extra redundant point (180 degrees,
165        ! since lon_reg starts at -180)
166        lon_reg_ext(nbp_lon+1)=-lon_reg_ext(1)
167      ENDIF
[1529]168
[305]169      ierr = NF_REDEF (nid)
170#ifdef NC_DOUBLE
171      ierr =NF_DEF_VAR(nid,"longitude", NF_DOUBLE, 1, idim_rlonv,nvarid)
172#else
173      ierr = NF_DEF_VAR(nid,"longitude", NF_FLOAT, 1, idim_rlonv,nvarid)
174#endif
175      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14,
176     .      "East longitude")
177      ierr = NF_PUT_ATT_TEXT(nid,nvarid,'units',12,"degrees_east")
178      ierr = NF_ENDDEF(nid)
179#ifdef NC_DOUBLE
[1529]180      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lon_reg_ext/pi*180)
[305]181#else
[1529]182      ierr = NF_PUT_VAR_REAL (nid,nvarid,lon_reg_ext/pi*180)
[305]183#endif
184c
185
186!-------------------------------
187! Number of bands in the IR
188!-------------------------------
189
190      ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode
191      ! define variable
192#ifdef NC_DOUBLE
[1531]193      ierr=NF_DEF_VAR(nid,"VI_Wavenumber",NF_DOUBLE,1,
[1529]194     .                                idim_bandsVI,nvarid)
[305]195#else
[1531]196      ierr=NF_DEF_VAR(nid,"VI_Wavenumber",NF_FLOAT,1,
[1529]197     .                                idim_bandsVI,nvarid)
[305]198#endif
[526]199      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 33,
200     .                        "Band mid frequency in the visible")
201      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"units",5,"cm^-1")
[305]202      ierr=NF_ENDDEF(nid) ! Leave NetCDF define mode
203      ! write variable
204#ifdef NC_DOUBLE
[526]205      ierr=NF_PUT_VAR_DOUBLE (nid,nvarid,dble(WNOV))
[305]206#else
[526]207      ierr=NF_PUT_VAR_REAL (nid,nvarid,real(WNOV))
[305]208#endif
209
210c
[533]211!-------------------------------
212! Width of bands in the Visible
213!-------------------------------
[305]214
[533]215      ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode
216      ! define variable
[305]217#ifdef NC_DOUBLE
[1531]218      ierr=NF_DEF_VAR(nid,"VI_Bandwidth",NF_DOUBLE,1,
[1529]219     .                                idim_bandsVI,nvarid)
[305]220#else
[1531]221      ierr=NF_DEF_VAR(nid,"VI_Bandwidth",NF_FLOAT,1,
[1529]222     .                                idim_bandsVI,nvarid)
[305]223#endif
[533]224      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 24,
225     .                        "Bandwidth in the visible")
226      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"units",5,"cm^-1")
227      ierr=NF_ENDDEF(nid) ! Leave NetCDF define mode
228      ! write variable
[305]229#ifdef NC_DOUBLE
[533]230      ierr=NF_PUT_VAR_DOUBLE (nid,nvarid,dble(DWNV))
[305]231#else
[533]232      ierr=NF_PUT_VAR_REAL (nid,nvarid,real(DWNV))
[305]233#endif
234c
235c --------------------------
[533]236c   Mesh area
237c --------------------------
238
[305]239      id(1)=idim_rlonv
240      id(2)=idim_rlatu
[533]241
242
[305]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
[1529]253      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,area)
[305]254#else
[1529]255      ierr = NF_PUT_VAR_REAL (nid,nvarid,area)
[305]256#endif
257
258
259
260      END
Note: See TracBrowser for help on using the repository browser.