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

Last change on this file since 848 was 787, checked in by aslmd, 12 years ago

LMDZ.GENERIC. (Sorry for long text but this is a quite major commit)

Paving the path for parallel computations. And moving towards a more flexible code.

Automatic allocation is used within all routines in phystd. No further mention to ngridmx and nqmx.

  1. ngridmx and nqmx are still used in LMDZ.GENERIC in the dyn3d part
  2. if the LMDZ4/LMDZ5 dynamical core is used, there is no more fixed dimensions ngridmx and nqmx --> a fully flexible parallel implementation is now possible (e.g. no need to recompile when changing numbers of processors)

The important stuff :

  • Compilation checked with ifort. OK with and without debug mode. No errors. Checked for: gcm, newstart, rcm1d, kcm1d
  • RUN GCM: Running an Earth test case. Comparison with previous revision --> debug mode : perfect match. bit by bit (diff command). checked with plots --> O1 mode : close match (checked with plots) --> O2 mode : sometimes up to 0.5 K departure.... BUT in this new version O2 and O1 are quite close while in previous version O1 and O2 differed by about, well, typically 0.5 K (pictures available on request)
  • RUN NEWSTART : perfect match (bit-by-bit) in either debug or normal mode.
  • RUN RCM1D : perfect match in normal mode.
  • RUN KCM1D : not tested (I don't know what is the use of kcm1d)

List of main changes :

  • Additional arguments to some subroutines (ngrid and nq)
  • F77 include strategy is obsolete and replaced by F90 module strategy In this new strategy arrays are allocatable and allocated once at first use This has to be done for all common featuring arrays defined with ngridmx or nqmx

surfdat.h >> surfdat_h.F90
tracer.h >> tracer_h.F90
comsaison.h >> comsaison_h.F90
comgeomfi.h >> comgeomfi_h.F90
comsoil.h >> comsoil_h.F90
comdiurn.h >> comdiurn_h.F90
fisice.h >> DELETED. was not used. probably a fossil.
watercap.h >> DELETED. variable put in surfdat_h.F90

  • F77 'save' strategy is obsolete and replaced by F90 'allocatable save' strategy (see previous point and e.g. new version of physiq.F90)
  • Suppressing any mention to advtrac.h which is a common in the dynamics and needs nqmx This was easily solved by adding an argument with tracer names, coming from the dynamics This is probably not a definitive solution, ... but this allows for generic physics to work easily with either LMDZ.GENERIC or LMDZ dynamical cores
  • Removing consistency tests between nq and nqmx ; and ngrid and ngridmx. No use now!
  • Adaptation of rcm1d, kcm1d, newstart given above-mentioned changes

A note on phyetat0 and soil_setting:

  • Now written so that a slice of horizontal size 'ngrid' starting at grid point 'cursor' is read in startfi.nc 'cursor' is defined in dimphys.h and initialized by inifis (or in newstart) this is useful for parallel computations. default behavior is the usual one : sequential runs, cursor is 1, size ngrid is the whole global domain

A note on an additional change :

  • nueffrad is now an argument to callcorrk as is the case for reffrad both are saved in physiq this is for consistency and lisibility (previously nueffrad was saved in callcorrk) ... but there is a call to a function which modifies nueffrad in physiq ... previously this was not modifying nueffrad (although it was quite cumbersome to detect this) ... to be conservative I kept this behaviour and highlighted it with an array nueffrad_dummy ... I added a comment because someone might want to change this
File size: 6.8 KB
Line 
1      SUBROUTINE iniwrite_specVI(nid,idayref,phis)
2
3      use radinc_h, only: L_NSPECTV
4      use radcommon_h, only: WNOV,DWNV
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 "description.h"
36#include "serre.h"
37#include"dimphys.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 #
56      integer :: idim_bandsVI ! "VI Wavenumber" dimension ID #
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)
111      ierr = NF_DEF_DIM (nid, "VI Wavenumber",L_NSPECTV,idim_bandsVI)
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      ierr = NF_REDEF (nid)
137#ifdef NC_DOUBLE
138      ierr =NF_DEF_VAR(nid, "latitude", NF_DOUBLE, 1, idim_rlatu,nvarid)
139#else
140      ierr =NF_DEF_VAR (nid, "latitude", NF_FLOAT, 1, idim_rlatu,nvarid)
141#endif
142      ierr =NF_PUT_ATT_TEXT(nid,nvarid,'units',13,"degrees_north")
143      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14,
144     .      "North latitude")
145      ierr = NF_ENDDEF(nid)
146#ifdef NC_DOUBLE
147      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu/pi*180)
148#else
149      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu/pi*180)
150#endif
151c
152c --------------------------
153      ierr = NF_REDEF (nid)
154#ifdef NC_DOUBLE
155      ierr =NF_DEF_VAR(nid,"longitude", NF_DOUBLE, 1, idim_rlonv,nvarid)
156#else
157      ierr = NF_DEF_VAR(nid,"longitude", NF_FLOAT, 1, idim_rlonv,nvarid)
158#endif
159      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 14,
160     .      "East longitude")
161      ierr = NF_PUT_ATT_TEXT(nid,nvarid,'units',12,"degrees_east")
162      ierr = NF_ENDDEF(nid)
163#ifdef NC_DOUBLE
164      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv/pi*180)
165#else
166      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv/pi*180)
167#endif
168c
169
170!-------------------------------
171! Number of bands in the IR
172!-------------------------------
173
174      ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode
175      ! define variable
176#ifdef NC_DOUBLE
177      ierr=NF_DEF_VAR(nid,"VI Wavenumber",NF_DOUBLE,1,
178     .                          idim_bandsVI,nvarid)
179#else
180      ierr=NF_DEF_VAR(nid,"VI Wavenumber",NF_FLOAT,1,
181     .                          idim_bandsVI,nvarid)
182#endif
183      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 33,
184     .                        "Band mid frequency in the visible")
185      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"units",5,"cm^-1")
186      ierr=NF_ENDDEF(nid) ! Leave NetCDF define mode
187      ! write variable
188#ifdef NC_DOUBLE
189      ierr=NF_PUT_VAR_DOUBLE (nid,nvarid,dble(WNOV))
190#else
191      ierr=NF_PUT_VAR_REAL (nid,nvarid,real(WNOV))
192#endif
193
194c
195!-------------------------------
196! Width of bands in the Visible
197!-------------------------------
198
199      ierr=NF_REDEF (nid) ! Enter NetCDF (re-)define mode
200      ! define variable
201#ifdef NC_DOUBLE
202      ierr=NF_DEF_VAR(nid,"VI Bandwidth",NF_DOUBLE,1,
203     .                          idim_bandsVI,nvarid)
204#else
205      ierr=NF_DEF_VAR(nid,"VI Bandwidth",NF_FLOAT,1,
206     .                          idim_bandsVI,nvarid)
207#endif
208      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"long_name", 24,
209     .                        "Bandwidth in the visible")
210      ierr=NF_PUT_ATT_TEXT (nid,nvarid,"units",5,"cm^-1")
211      ierr=NF_ENDDEF(nid) ! Leave NetCDF define mode
212      ! write variable
213#ifdef NC_DOUBLE
214      ierr=NF_PUT_VAR_DOUBLE (nid,nvarid,dble(DWNV))
215#else
216      ierr=NF_PUT_VAR_REAL (nid,nvarid,real(DWNV))
217#endif
218c
219c --------------------------
220c   Mesh area
221c --------------------------
222
223      id(1)=idim_rlonv
224      id(2)=idim_rlatu
225
226
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
244      END
Note: See TracBrowser for help on using the repository browser.