Chapter 3
Experimental design and test
In this section, the elements of any experimental design are illustrated. Examples will be given for more specific problems.
3.1 Elements of an experimental design
There are generally three files in each of the experiments for the regional forecast, and two files for the global forecast. These three files are called DCLSYS, DCLRSM and run[exp]. DCLSYS is a FORTRAN preprocessor definition and is used to define the model dimension and options etc. DCLRSM is a namelist type of file and is used to define the location of the regional domain, so it is not used in global model experiments. run[exp] can be rung2r, rung2n, or runc2r, etc. These are scripts that control all kinds of the applications. After you learn all of these files, you should be able to setup your own experiment and test a run.
DCLSYS
DCLSYS should contain the following:
%DCL DEFINE WHICH MACHINE TO RUN;% ##CRA = 'C-CRA'; %DCL SWITCH FOR CRAY CODE; % ##AFA = ' '; %DCL SWITCH FOR WORKSTATION CODE; %DCL TURN ON REGIONAL MODEL; % #RGEN = '99' ; %DCL NO USE LEAVE AS IT IS; % ##RSM = ' '; %DCL SWITCH FOR RSM; %DCL MODEL OPTIONS; % ##NON = ' '; %DCL SWITCH FOR NONHYDROSTATIC CODE; % ##HYD = 'C-HYD'; %DCL SWITCH FOR HYDROSTATIC CODE; % ##G2R = ' '; %DCL GLOBAL TO REGIONAL NEST; % ##C2R = 'C-C2R'; %DCL REGIONAL COARSE GRID TO REGIONAL NEST; %DCL IF NEXT C2R IS OPENED THEN ABOVE C2R HAS TO BE OPENED; % ##N2R = 'C-N2R'; %DCL NONHYDRO COARSE GRID TO REGIONAL NEST; %DCL TECHNIQUE OPTIONS; % ##RKN = 'C-RKN'; %DCL REGIONAL KEN POINTS; % ##LOCD = 'C-LOC'; %DCL LOCAL DIFFUSION; % ##SQK = ' '; %DCL SPHQK SWITCH OFF IF SPHPT IS ON; % ##SPT = 'C-SPT'; %DCL SPHPT SLOW; %DCL THEORETICAL AND OTHER OPTIONS; % ##2D = 'C-2D' ; %DCL 2D VERSION; % ##VD = 'C-VD' ; %DCL 2D VERTICAL DIFFUSION VERSION; % #VDIFU = 0.0 ; %DCL 2D VERTICAL DIFFUSION VERSION; % ##COR = ' '; %DCL CORIOLIS OPTION; % ##PHY = ' '; %DCL MODEL PHYSICS OPTION; % ##GWD = ' '; %DCL PHYSICS GRAVITY WAVE DRAG; % ##SAS = ' '; %DCL PHYSICS SIMPLIFIED ARAKAWA-SHUBERT; % ##RAS = 'C-RAS'; %DCL PHYSICS RELAXED ARAKAWA-SHUBERT; %DCL MODEL TERRAIN RESOLUTION OPTION; % ##M10 = ' '; %DCL NAVY10 MIN TOPO DATA OPTION; % ##M05 = 'C-M05'; %DCL 5 MIN TOPO DATA OPTION; %DCL REGIONAL MODEL LANCZOS SMOOTHER FOR MOUNTAIN HEIGHT; % #ORDER = '1.0' ; %DCL ORDER OF LANCZOS SMOOTHER; %DCL REGIONAL ENERGY BUDGET; % ##A = 'C-A' ; %DCL TURN ON FOR ANY BUDGET; % ##T = 'C-T' ; %DCL FOR TEMPERATURE BUDGET; % ##Q = 'C-Q' ; %DCL FOR MOISTURE BUDGET; % ##U = 'C-U' ; %DCL FOR U MOMENTUM BUDGET; % ##V = 'C-V' ; %DCL FOR V MOMENTUM BUDGET; % ##P = 'C-P' ; %DCL FOR PS MASS BUDGET; %DCL REGIONAL MODEL GRID DIMENSIONS; % #IGRD = '96' ; %DCL FACTORS OF 2 AND 3 ONLY FOR FFT; % #JGRD = '75' ; %DCL HAS TO BE AN ODD INTEGER NUMBER; % #LEVR = '28' ; %DCL THE SAME VERTICAL LAYERS AS GLOBAL; %DCL DEFINE MODEL PHYSIC DIMENSION FOR LOCAL; % #ILOT = #IGRD*2+2 ; %DCL FOR PHYSICS IMAX; % #KLOT = #LEVR ; %DCL FOR PHYSICS KMAX; % #ILOR = #ILOT ; %DCL FOR RADIATION IMAX; %DCL REGIONAL MODEL COARSE GRID DIMENSION; % #CIGRD1 = '384' ; %DCL IGRD+1 FROM OUTTER GRID; % #CJGRD1 = '190' ; %DCL JGRD+1 FROM OUTTER GRID; %DCL CLOUD SPECIES; % #NCLD = '1' ; %DCL CLOUD TYPES 1 FOR QV 3 FOR QV QC QR; % #NCLDG = '1' ; %DCL CLOUD TYPES 1 FOR QV 3 FOR QV QC QR; % #NCLDC = '1' ; %DCL CLOUD TYPES 1 FOR QV 3 FOR QV QC QR; % #NCLDB = '1' ; %DCL CLOUD TYPES 1 FOR QV 3 FOR QV QC QR; %DCL REGIONAL MODEL NUMERICAL PARAMETERS; % #NST = '1' ; %DCL STEPS FOR INITIAL SMOOTH START; % #RELX = '40' ; %DCL STEPS FOR LTBN RELAXATION; % #RELZ = '1.E20'; %DCL STEPS FOR MODEL TOP RELAXATION; % #DIFUH = '6' ; %DCL STEPS FOR DIFFUSION OF T AND Q; % #DIFUM = '4' ; %DCL STEPS FOR DIFFUSION OF U AND V; %DCL REGIONAL MODEL BASE FIELD PARAMETERS; % #BORDER = '3' ; %DCL INTERPOLATE ORDER; % #BSMOOTH= '1' ; %DCL SMOOTH ORDER AFTER INTERPOLATE; % #BGF = '5' ; %DCL DELX BASE EQUAL TO BGF TIME DELX; %DCL KEN POINT FOR REGIONAL; % #RLPNT = '50' ; %DCL NUMBER OF KEN POINTS; % #RLTSTP = '36' ; %DCL NUMBER OF STEPS; % #RSLVARK= '80' ; %DCL NUMBER OF SINGLE LAYER VARIABLE; % #RMLVARK= '8' ; %DCL NUMBER OF MULTI-LAYERS VARIABLE; %DCL POST DIMENSION; %DCL USE NWORDS FOR DEC ALPHA USE NBYTES FOR SGI HP IBM SUN; % #RECL = 'NWORDS';%DCL RECORD LENGTH VARIABLE NAME; % #IO = #IGRD+1 ;%DCL POST OUTPUT GRID DIMENSION IN X; % #JO = #JGRD+1 ;%DCL POST OUTPUT GRID DIMENSION IN Y;
The syntax shown here is used for the FORTRAN preprocessor, as mentioned in chapter 2, related to the file called fortprep.x in $DISK/[machine]/etc. The definition of the syntax is that it starts with ' % ' and end with ' ; ', the comment line is ' %DCL .....; ' and the definition line is formed by ' % #... = ...; '. If there is a ' ' after =, the name after # should be replaced by the character inside of ' ', otherwise the computation will be performed. For double # sign, they are switched to turn on and off in the code before compilation, if it is 'C-...', then it is turned off, if it is ' ' then it is turned on. To decide how many spaces are needed in ' ' depends on the number of the characters includes # sign at the left hand side of =. All the function and definition are explained by %DCL there. Without carefully following the instructions to define a proper number, a significant error or poor performance of the model may result.
LOCRSM
The next file, LOCRSM, is the location of RSM, which can be like the following: while it is using global file as initial condition and base fields,
&NAMLOC RPROJ = 0.0 , RTRUTH = 20.0 , RORIENT = -157. , RDELX = 30000. , RDELY = 30000. , RCENLAT = 20.0 , RCENLON = -157. , RLFTGRD = 53. , RBTMGRD = 35. , CPROJ = 0. , CTRUTH = 0. , CORIENT = 0. , CDELX = 0. , CDELY = 0. , CCENLAT = 0. , CCENLON = 0. , CLFTGRD = 0. , CBTMGRD = 0. , &END
where the names start with R for regional domain and with C for outside coarse grid. For global model as the outside coarse grid, all the C* variables are assigned to be zero. When a regional model is the outside coarse grid, all the C* variables have to be assigned as the same as the definition of R* in the outside grid. For example, the above the definition is for domain A, which is nested into global model. Then there is a domain B, nested inside domain A, then the definition of LOCRSM for domain B can be something like
&NAMLOC RPROJ = 0.0 , RTRUTH = 23.0 , RORIENT = -157. , RDELX = 10000. , RDELY = 10000. , RCENLAT = 21.0 , RCENLON = -156. , RLFTGRD = 53. , RBTMGRD = 35. , CPROJ = 0.0 , CTRUTH = 20.0 , CORIENT = -157. , CDELX = 30000. , CDELY = 30000. , CCENLAT = 20.0 , CCENLON = -157. , CLFTGRD = 53. , CBTMGRD = 35. , &END
where all the C* in the above LOCRSM are the same as R* in the previous LOCRSM. It is required to be the same. Note that any projection can be nested into any projection.
Next, we explain the meaning of each variable and their relation. Whether it is for R* or C*, the definition to the model grid is the same and thus these are ignored here.
PROJ is the projection index.
0 is Mercater,
1 for north polar stereographic projection,
-1 for south polar stereographic projection
TRUTH is the latitude where the map plane cuts through the earth’s surface
for Mercater, use the north latitude.
for north polar projection, it is fixed as 60.
for south polar projection, it is fixed as -60.
ORIENT is the longitude which is parallel to the y-axis
for Mercater, it can be any value.
DELX The grid spacing (meter) in x-direction at TRUTH.
DELY The grid spacing (meter) in y-direction at TRUTH.
CENLAT The reference latitude
for Mercater, it can be any latitude
for north polar projection, it is fixed as 90.
for south polar projection, it is fixed as -90.
CENLON The reference longitude
for Mercater, it can be any longitude
for north or south polar projection, it's fixed as 0.
LFTGRD =[X(CENLON,CENLAT)-X(i=1,j=1)]/DELX + 1
BTMGRD =[Y(CENLON,CENLAT)-Y(i=1,j=1)]/DELY + 1
The last two definitions can be understood as the (i,j) of the reference point, (CENLON,CENLAT) related to the origin point (1,1) of the regional domain.
RUN[case]
The last file in the experimental directory is the run script, which can be named whatever you want. We have used a conventional name and call it as rung2r, for the case of the hydrostatic regional model using global files, rung2n for the case of the non-hydrostatic regional model using global file, runc2r for the case of the hydrostatic regional model using the hydrostatic regional files as input and base field etc.
This file is written using /bin/sh script. There are four sections in the run script, (1) the initial section, which provides the usage of the run script, (2) the definition section of all necessary directory and compile option with environment setting, (3) the definition section of the running time parameters with namelist, and (4) the function section needed for the computation. The function section of the run includes capability to display model domain, prepare input data, prepare the regional mountain, prepare the regional input, and run the regional forecast.
Let's describe the initial section, for example,
#! /bin/sh
# This script makes all possible jobs
set -x
if [ $# -lt 1 ]
then
set +x
echo "This script runs with argument as"
echo " rmap (for check domain map only)"
echo " cmpl (for compile only)"
echo " rmtn (for regional mountain and sea land mask etc)"
echo " inpt (for global or coarse grid input only)"
echo " rinp (for regional input only)"
echo " fcst (for forecast and post only)"
echo " 1 (for rmap)"
echo " 2 (for cmpl and rmtn)"
echo " 3 (for inpt, rinp, and fcst)"
echo " rm (for remove DIRMTN, DIREXE, DIRRUN, and OUTPUT)"
exit
fi
This usage will show out and the script will end, if you issue run script without giving any argument. You can give an argument for each job or a group of jobs by an integer number, as shown. The option rmap is for a display model domain in grads, the option cmpl is for the compiler, the option rmtn is for preparing the regional terrain, the option inpt is for preparing the initial data for regional input, the option rinp is for regional input, and the option fcst is for the forecast which includes model integration and postprocessor.
The next section is all the environmental definition, for example,
# ----------------- DEFINE CASE RELATION --------------------- export DISK; DISK=`pwd`/../.. export MACH; MACH=dec export CASE; CASE=g2r97 export BASE; BASE=input export DATA; DATA=remote export FTN; FTN=f77 export FORT_OPTNS; FORT_OPTNS='-r8 -i4 -O2 -Olimit 5000' export W3LIB; W3LIB=$DISK/$MACH/grib$MACH/w3lib.a export PATH; PATH=$PATH:$DISK/$MACH/gradsdec export GADDIR; GADDIR=$DISK/$MACH/gradsdec # ---- for CRAY users ------------------- #xport FILEENV; FILEENV='FILEENV=assign;ASSIGN -R' #xport FILEFORM; FILEFORM='-Nibm -Fcos -Cascii ' #xport ASSIGN; ASSIGN='assign -a' # ---- for non CRAY users (workstations) ------------------- export FILEENV; FILEENV='/bin/rm -rf fort.*' export FILEFORM; FILEFORM=' ' export ASSIGN; ASSIGN='ln -s' # ---- for HP, use ftn; for others use fort. export UNIT; UNIT='fort.' # ----------------- DEFINE THE DIRECTORY --------------------- export DIRHOME; DIRHOME=`pwd` export DIRUTIL; DIRUTIL=$DISK/$MACH/etc export DIRCONS; DIRCONS=$DISK/$MACH/condata export DIRFMTS; DIRFMTS=$DISK/common/fmtdata export DIRSORC; DIRSORC=$DISK/common/source97 export DIRDOCS; DIRDOCS=$DISK/common/docblock97 export DIRDEFS; DIRDEFS=$DISK/common/definition export DIRINCS; DIRINCS=$DISK/common/include export DIRPROC; DIRPROC=$DISK/common/script export DIRINPT; DIRINPT=$DISK/input/daily_data export DIRBASE; DIRBASE=$DISK/run/$MACH/$BASE/output export DIRCMPL; DIRCMPL=$DISK/tmp/$CASE mkdir -p $DIRCMPL export DIRRMTN; DIRRMTN=$DISK/run/$MACH/$CASE/rmtn mkdir -p $DIRRMTN export DIREXEC; DIREXEC=$DISK/run/$MACH/$CASE/exec mkdir -p $DIREXEC export DIRTEMP; DIRTEMP=$DISK/run/$MACH/$CASE/dirrun mkdir -p $DIRTEMP export DIROUTP; DIROUTP=$DISK/run/$MACH/$CASE/output mkdir -p $DIROUTP export TOPODATA;TOPODATA=$DISK/common/fmtdata/navy10.fmt.Z #export TOPODATA;TOPODATA=$DISK/common/fmtdata/topo05.fmt.Z export rmtnvar; rmtnvar=$DIRRMTN/rmtnvar export rmtnoro; rmtnoro=$DIRRMTN/rmtnoro export rmtnors; rmtnors=$DIRRMTN/rmtnors export rmtnoss; rmtnoss=$DIRRMTN/rmtnoss export rmtnslm; rmtnslm=$DIRRMTN/rmtnslm
where DISK is the top directory name. As mentioned before, if you are using the default system, then `pwd`/../.. should be the name of the top directory where this system located. MACH is the name we used to call the machine dependent directory as mentioned as [machine]. In this example, it is dec for Dec alpha. CASE is the name for this experimental directory. BASE and DATA have relation, if DATA=remote then DIRINPT is the place to get initial and base field for this case then BASE can be anything, if DATA=local then the DIRBASE is the place to get initial and base fields, so BASE is the experimental directory name for it, say BASE=gsm97. FORTRAN compiler can be FTN=f77, FTN=f90 or FTN=xlf (for IBM sp2) etc, and the FORTRAN compiler option can be
FORT_OPTNS='-qrealsize=8 -O3' # for IBM SP2 xlf compiler
FORT_OPTNS='+autodblpad -O2' # for HP UX f77 compiler
FORT_OPTNS='-r8 -i4 -O2' # for DEC, SGI etc
Then the others of W3LIB, PATH and GADDIR have described in section 2 about initial configuration. The file assignment and unit symbol are defined in ASSIGN, FILEENV, FILEFORM and UNIT. Most of machine use, for example, as
ln -s yourfile fort.11
but the other, such as HP UX, as
ln -s yourfile ftn11
The last part is directory definition, if you follow the default configuration, you don't need to change, but you are the second user, you can copy some example directory from the primary user and change some directory related to default system but some are yours, the default system directories should be DIRUTIL, DIRCONS, DIRFMTS, DIRSORC, DIRDOCS, DIRDEFS, DIRINCS, and DIRPROC, and others should be your own directories which you can give in explicit name except $DISK etc. The last definitions are the directory for global topographic data, if you turn on ##M10 (turn off ##M05), then you have to set TOPODATA=$DISK/common/fmtdata/navy10.fmt.Z otherwise turn on the other one. No matter how you want to use your directory, you have to figure out the directory name for the scripts later.
The next part in the run script is parameter definition to put to scripts and executable code through namelist. For example, it is as following:
# ------------------- DEFINE THE CONSTANT ---------------------- export WAVINP; WAVINP=126 export LEVINP; LEVINP=28 export WAVGSM; WAVGSM=126 export LEVGSM; LEVGSM=28 export STRHOUR; STRHOUR=0 export ENDHOUR; ENDHOUR=24 export INCHOUR; INCHOUR=6 export PRTHOUR; PRTHOUR=3 export DELTIMG; DELTIMG=-1 export INIHGBL; INIHGBL=0 export SWHRGBL; SWHRGBL=3 export LWHRGBL; LWHRGBL=3 export DELTIMR; DELTIMR=60 export INIHREG; INIHREG=0 export SWHRREG; SWHRREG=1 export LWHRREG; LWHRREG=1 export LOCDIFR; LOCDIFR=0 export BNDRLXR; BNDRLXR=1 export IMPLREG; IMPLREG=1 export NESTSEC; NESTSEC=` expr $INCHOUR \* 3600 ` export PRNTSEC; PRNTSEC=` expr $PRTHOUR \* 3600 ` export EXITSEC; EXITSEC=` expr $NESTSEC \* 2 ` export NEWMTN; NEWMTN=TRUE
For this case, the input initial data from global is T126 (WAVINP=126) and layer 28 (LEVINP=28) for regional input program, and the base field is from global T126 (WAVGSM=126) and layer 28 (LEVGSM=28) as well. The starting hour (STRHOUR) and ending hour (ENDHOUR) for the forecast are 0 and 24. The increment hour (INCHOUR) for restart is 6. The model print hour (PRTHOUR) interval is 3. If global time step (DELTIMG) is negative, we have RSM running without GSM. The digital filter hour for global (INIHGBL) is 0 hour in this case. The short wave hour in the radiation computation for the global (SWHRGBL) and long wave (LWHRGBL) are 3. However, in a regional model experiment, we have to set DELTIMG to negative, and we don't care about INIHGBL, SWHRGBL and LWHRGBL. There is a relation between DELTIMG, INCHOUR and NESTSEC; the easiest relation is shown here. If the available base field is 3 hour, we set INCHOUR=3 and have DELTIMG=-1 always. But if we want to have INCHOUR=6 but use 3 hour interval of base field, we set INCHOUR=6, DELTIMG=-2, then NESTSEC='10800' which is from the relation of (INCHOUR/ABS(DELTIMG))*3600 instead of INCHOUR*3600.
The regional time step (DELTIMR) can be linearly related to the RDELX in LOCRSM as DELTIMR=RDELX/1000*6. Thus the 10-km resolution requires a 60-second timestep. The digital initialization hour for regional model (INIHREG) is 0 hour here, you can turn it on, the effect may not be significant, but it has to be less than INCHOUR. The short wave and long wave hours for radiation computation for regional (SWHRREG and LWHRREG) used to set to be 1 hour. The local strong wind damping for regional (LOCDIFR) used to turn off (=0) for short-range weather forecast to have better-undamped solution, but it can be turn on (LOCDIFR=1) for regional climate to have longer DELTIMR with strong wind dumped. The lateral boundary relaxation for regional model (BNDRLXR) can be an explicit type (=0) or an implicit type (=1). The results from implicit type of relaxation make a better forecast than the explicit. And this option may be removed if the implicit keeps giving better results than explicit. There is also an option to turn on or off the semi-implicit time scheme by IMPLREG (=1 is implicit; =0 explicit).
The next is the namelist files used for regional input and regional forecast as
# ------------------- DEFINE NAMELISTS ------------------------ if [ $1 = rinp -o $1 = 3 ] then cd $DIRTEMP echo " &NAMRIN " >rinpparm echo " SIG2RG=.TRUE.,SFC2RG=.TRUE.,PERCMTN=0.2, " >>rinpparm echo " NEWSIG=.FALSE.,NEWMTN=.$NEWMTN.,NEWHOR=.FALSE., " >>rinpparm echo " &END " >>rinpparm fi if [ $1 = fcst -o $1 = 3 ] then cd $DIRTEMP echo " &NAMSMF NUM(5)=0,ALPHA=0.8,FILTA=0.8, " >rfcstparm echo " CON(1)=$DELTIMG.,CON(3)=$INIHGBL., " >>rfcstparm echo " CON(4)=$SWHRGBL.,CON(5)=$LWHRGBL., " >>rfcstparm echo " CON(7)=$INCHOUR.,CON(9)=$PRNTSEC., " >>rfcstparm echo " CON(11)=$DELTIMR.,CON(12)=$NESTSEC., " >>rfcstparm echo " CON(13)=$INIHREG., " >>rfcstparm echo " CON(14)=$SWHRREG.,CON(15)=$LWHRREG., " >>rfcstparm echo " CON(16)=$STRHOUR.,CON(17)=$ENDHOUR., " >>rfcstparm echo " CON(18)=$LOCDIFR.,CON(19)=$BNDRLXR., " >>rfcstparm echo " CON(20)=$IMPLREG.,CON(30)=$EXITSEC., " >>rfcstparm echo " &END " >>rfcstparm fi
The file rinpparm contains the namelist NAMRIN for regional input program. It can control the options in regional input routine, see the script in $DISK/common/script/PRINP. If SIG2RG=.TRUE., the horizontal interpolation from coarse grid, either GSM or RSM, to regional grid for sigma file, otherwise no regional sigma file will be prepared. If SFC2RG=.TRUE., the horizontal interpolation from coarse grid to regional grid is performed for surface file. PERCMTN is used to determine the percentage of the grids for blending regional terrain height with the outer coarse model terrain along the boundary. For example, the total horizontal grid point in the x direction is 82, about 16 grid points will be used to blend the terrain between two grid mesh, thus only 8 point for each side. While NEWSIG=.TRUE. or NEWMTN=.TRUE., the sigma to sigma interpolation in vertical will be used to obtain new sigma surface values. NEWHOR is an option but has not implemented in the code, and it has .FALSE. as the default option.
The file rfcstparm contains the namelist NAMSMF for regional forecast program. It can control the options in the forecast model, see the script in $DISK/common/script/PRFCST. NUM(5)=0, ALPHA=0.8 and FILTA=0.8 are the defaults, all others are defined and described in the section called '---DEFINE THE CONSTANT --'.
The next one is the block to issue PRMAP, see $DISK/common/script/PRMAP, to show you the model domain by getting your DCLSYS and LOCRSM information to construct the domain.
# ------------------- RMAP -----------------
if [ $1 = rmap -o $1 = 1 ]
then
cd $DIRCMPL || exit
$DIRPROC/PRMAP || exit
fi
To run this block, you do
unix % rung2n rmap
for example.
The next one is the block for compilation, PCMPL. There are more than 10 options in $DISK/common/script/PCMPL. We used to choose what we want to turn on them. In this example, five executable codes have to be generated before any further action, thus they have to turn on (=yes) at the first time. But after the initial compilation for all of them are finished. Then any of them can be turn off (=no) if there is no need to re-compile it.
# ------------------- CMPL -----------------
if [ $1 = cmpl -o $1 = 2 ]
then
cd $DIRCMPL || exit
export RDMTN; RDMTN=no
export RINPT; RINPT=no
export RFCST; RFCST=yes
export RPPGB; RPPGB=no
export RPSGB; RPSGB=no
$DIRPROC/PCMPL || exit
fi
To run this block, you do
unix % rung2n cmpl
forexample. The next block is for prepartion of model terrain. it can be issued by
unix % rung2n rmtn
# ------------------- RMTN -----------------
if [ $1 = rmtn -o $1 = 2 ]
then
cd $DIRRMTN || exit
#DIRPROC/PRMTN || exit
fi
The next block is used to prepare input data either from remote by ftp to NCEP for initial data, or from the local directory which has the coarse grid sigma file for input and base fields.
To run this block, you do
unix % rung2n inpt
forexample.
# ------------------- INPT ----------------
if [ $1 = inpt -o $1 = 3 ]
then
cd $DIRTEMP || exit
if [ $DATA = local ]
then
cp $DIRBASE/sigf00 siganl
cp $DIRBASE/sfcf00 sfcanl
else
ln -s $DIRINPT/siganl$WAVINP.fmt.Z \
$DIRINPT/sig$WAVINP\f00.fmt.Z
cp $DIRINPT/siganl$WAVINP.fmt.Z . && \
uncompress siganl$WAVINP.fmt.Z && \
$DIRUTIL/unfmtsig$WAVINP.s \
siganl$WAVINP.fmt siganl && \
rm siganl$WAVINP.fmt
cp $DIRINPT/sfcanl$WAVINP.fmt.Z . && \
uncompress sfcanl$WAVINP.fmt.Z && \
$DIRUTIL/unfmtsfc$WAVINP.s \
sfcanl$WAVINP.fmt sfcanl && \
rm sfcanl$WAVINP.fmt
fi
fi
If the definition of $DATA is local, the initial files can be obtained at $DIRBASE which defines in the definition of directory. Users can modify these parts according to their data. The next block is for regional initial values prepared by PRINP.
# -------------------- RINP -----------------
if [ $1 = rinp -o $1 = 3 ]
then
cd $DIRTEMP || exit
$DIRPROC/PRINP || exit
cp r_sigi $DIROUTP/r_sigf00
cp r_sfci $DIROUTP/r_sfcf00
cp r_sigi r_sigim
cp siganl basei
fi
To run this block, you do
unix % rung2n rinp
for example.
The last block is the forecast block. In this block, it will check the existence of the restart files, r_sigi, r_sigim, and r_sfci, obtain the forecast hour from the restart file (fhour.s), prepare base fields, do model forecast, then run postprocessor to have mach-independent GRIB file output.
# -------------------- FCST ------------------
if [ $1 = fcst -o $1 = 3 ]
then
cd $DIRTEMP
if [ -s r_sigi -a -s r_sigim -a -s r_sfci ]
then
echo 'Restart files existed!!!!!!!'
$DIRUTIL/fhour.s r_sigi >out
read FH <out && rm out
if test $FH -lt 10;then FH=0$FH;fi
export FH
right_base=F
if [ -s basei ]
then
echo 'Initial Base file existed!!!!!!!'
$DIRUTIL/fhour.s basei >out
read BFH <out && rm out
if test $BFH -lt 10;then BFH=0$BFH;fi
if [ $BFH = $FH ]
then
echo 'Initial base file has the right date.'
right_base=T
fi
fi
if [ $right_base = F ]
then
if [ $DATA = local ]
then
cp $DIRBASE/sigf$FH basei || exit
else
cp $DIRINPT/sig$WAVGSM\f$FH.fmt.Z . && \
uncompress sig$WAVGSM\f$FH.fmt.Z && \
$DIRUTIL/unfmtsig$WAVGSM.s \
sig$WAVGSM\f$FH.fmt basei && \
rm sig$WAVGSM\f$FH.fmt || exit
fi
fi
while test $FH -lt $ENDHOUR;do
FH=`expr $FH + $INCHOUR `
if test $FH -lt 10;then FH=0$FH;fi
export FH
if [ $DATA = local ]
then
cp $DIRBASE/sigf$FH basef
else
cp $DIRINPT/sig$WAVGSM\f$FH.fmt.Z . && \
uncompress sig$WAVGSM\f$FH.fmt.Z && \
$DIRUTIL/unfmtsig$WAVGSM.s \
sig$WAVGSM\f$FH.fmt basef && \
rm sig$WAVGSM\f$FH.fmt
fi
# ---------------------- RSM FCST ------------------
$DIRPROC/PRFCST || exit
# ------TREAT INTERMEDIUM OUTPUT AND RSM POST -------
if [ $FH -eq $INCHOUR ]
then
mv r_flxf00 $DIROUTP/.
$DIRPROC/PRPOST \
$DIROUTP/r_sigf00 $DIROUTP/r_flxf00 \
$DIROUTP/r_sgbf00 $DIROUTP/r_pgbf00 00 || exit
mv r_sgbf00 $DIROUTP/.
mv r_pgbf00 $DIROUTP/.
fi
printstep=` expr $INCHOUR \/ $PRTHOUR `
mt=0
hr=` expr $FH - $INCHOUR `
while [ $mt -lt $printstep ]
do
mt=` expr $mt + 1 `
mf=` expr 100 + $mt `
hr=` expr $hr + $PRTHOUR `
if [ $hr -lt 10 ];then hr=0$hr ;fi
mv R_SIG.F$mf $DIROUTP/r_sigf$hr
mv R_SFC.F$mf $DIROUTP/r_sfcf$hr
mv R_FLX.F$mf $DIROUTP/r_flxf$hr
$DIRPROC/PRPOST \
$DIROUTP/r_sigf$hr $DIROUTP/r_flxf$hr \
$DIROUTP/r_sgbf$hr $DIROUTP/r_pgbf$hr $hr || exit
done
#------------END OF RSM POST-------------------
# --------------RSM RESTART --------------------
mv r_sigfm r_sigim
mv r_sigf r_sigi
mv r_sfcf r_sfci
mv basef basei
done
rm -rf fort.*
echo "NORMAL EXIT of FCST"
else
echo "** No start or restart files found. ***"
echo "** No forecast is execut!!!!!!!!!!! ***"
fi
fi