Subject: nupdate stuff

From: [email-masked] (Ken Hansen)
Date: Tue, 7 May 1996 16:27:41 -0600 (MDT)

Ben,
As I mentioned earlier, nupdate will probably no longer be available in
the future.   CRI has announced that they are droping support beginning
with UNICOS 9.0.  I cannot emphisize how much of an impact it's removal
can potentially have on users of our Cray systems.    I've been keeping
access statistics since May 18, 95, and on shavano alone there have been
over 48,000 accesses by 217 unique users.  (jobs running under "roble"
have accessed it over 265 times during this period).

I've been trying to put together a plan to help the nupdate users extract
thier model source in some kind of a workable form.  At this point I'm not
concerned about source maintenance (CVS/RCS might be a good replacement),
only extracting source.

Below is a first cut.  At YOUR convenience I would greatly appreciate your
looking it over and trying the examples.  The files you will need are in

 ~hansen/roble/tgcm20.pl
 ~hansen/roble/mods_20_rg
 ~hansen/roble/TIGCM.script        (creates tcgm20_src  from tcgm20.pl)
 ~hansen/roble/lazy.f              (extracts *CMD decks from tcgm20_src
				    and writes them as individual files
				    *CALL and *CA references are replaced
				    with appropriate FORTRAN INCLUDES)

				    thanks much, Ken Hansen

	  ------------------ How_to -----------------------------

Extract the source deck from the program library (PL) using the "-s"
option.  This will become the program you will work from, so have all
mods made as you will want them.

In this example a source named "tcgm20.pl" is input to create a nupdate
source named "tcgm20_src"

mod deck(s)  "mods_20_rg" is applied and the source "tgcm20_src"
is extracted by specifying the "s" option.

nupdate -f -o "sq um" -w 100 -p tcgm20.pl -i mods_20_rg -s tgcm20_src

The "-w" width option

    "-o" options  is, sq, ...

Change file_in and file_out in lazy.f to reflect name of source from
above

   file_in   'tgcm20_src'
   file_out  'tcgm20.f'

The default PL master character is an astrisk "*" if your PL uses a
different character, make the appropriate change to the character variable
"mc" in lazy.f

---------------- Conditional blocks only --------------------------

Conditional blocks are only evaluated when the "-c cpl" compile file
option is envoked.

If your PL includes conditional block directives of the form

   *IF DEF,def
   *ELSEIF DEF,def
     - - -
you will need to:

 1) create the source "tgcm20_src" from the PL as described above

    nupdate -f -o "sq um" -w 100 -p tcgm20.pl -i mods_20_rg -s tgcm20_src
	-d RES100,UNICOS,DEL2,FILTER,SEASON,COUPLED

 2) execute "lazy" to extract the COMDECKS. The IF/ELSEIF/ELSE conditionals
    are only evaluated and when creating a compile file.

 3) execute nupdate and create a compile file "-c cpl" using the source
    output from "lazy"

    nupdate -f -osq -w100 -i tcgm20.f -c tcgm20.cpl \
        -d RES100,UNICOS,DEL2,FILTER,SEASON,COUPLED

You also need to check the COMDECK extracted in step 2 and see if they
contain any conditional directives.  If they do, you'll need to edit them
to reflect the "-d" directives.

---------------------------------------------------------------------------

Create a Makefile using the "fmgen" utility.   Fmgen will scan the large
Fortran source file "mm5_src.f" and strip  the individual subroutines and
functions.

 fmgen -f '-Wf"-eh"' tcgm20.f

Modify "makefile" to link in the appropriate library routines   LIBS =
Name the executable that is produced (a.out by default)          CMD =
Specify any compiler options you wish to use                  FFLAGS =

CF =		cf77
LDFLAGS =	
LIBS    = -L /usr/local/lib  -l ncaro,mss \
	  -L /usr/local/bin  -l ncarg,ncarg_gks,ncarg_c,ncarg_loc,X11

CMD =           a.out
FFLAGS =        -Wf"-eh"

One of the main advantages for using Make is only routines modified since
the last time make was invoked need to be recompiled.

When you are finished tar up the ".f", ".o" and the INCLUDE files and write
them back to the MSS.  If you want to save the original model configuration;
perhaps as a benchmark, or for some other reason, write the new tar file
under a new name.  For example:

   mswrite -ftr -t367 model.tar /USER/models/Case_326/model.tar

You need to decide where in the job flow you create the tar file. You may
want to include NAMELIST files, but not restart files any files that are
read from the MSS.