# Script for install a KRC distribution tar file on H3
# basically a keystroke file
# 2014may06 jun19  Hugh Kieffer

cd /work1/build/	  	      	    	 # cd to the build area
rm -Rf *		    	 # empty it entirely
tar -xvf /work2/krcdist.tar.gz   # untar the distro. May have unique version name
# tar -xvf /work2/krcbig.tar 	 # untar the big files

# skip all the uniq stuff on H3
cd src/cfiles      #  low-level I/O routines, required before a Fortran build
make all		       # build the C library
cd ..		       # cd to the Dir with all the FORTRAN source code
make krcd		       # Make KRC   double precision version
make porbmn		       # Make PORB
cd ../idl/extern    		# Move to area for Shared Object Library (SOL)
make ftnwrap64.so			# build the SOL 
cd ../../run			# move to directory in which normally run KRC
mkdir out                       # 
ln -s ../src/krcd .		# soft link to KRC executable
ln -s ../src/porbmn . 		# " " to PORB program 

[ exit

krcd   	     	 		# Start krc
  enter:  VerTest.inp
  enter:  /  or the name of a print output file


cd /K/idl   # top of IDL execution area
source idlPath        # set the path for IDL 

idl  # Start IDL. If not found, then give the full path:
   e.g.:  /usr/local/exelis/idl82/bin/idl    		     

IDL> kirin [ src=??, dat=??,ver=??,prn=??,diss=??]  ; initialize IDL for KRC
   see comments at the top of /K/idl/kirin.pro  for what the ?? are.

IDL> .rnew krcvtest	      ; follow the description in /k/doc/Vtest.pdf

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

  ./aaa/AAREADME will describe how the distribution package was made.

Files in ~/doc/ that may be helpful

  helplist.tex
        General help in setting up input files. ASCII text 
	Much of this is MANDATORY READING

  Kieffer13krc.pdf
     Journal article describing some of the algorithms, with some 
     post-pub corrections. Some of the auxiliary
     on-line material is included here, the rest are largely redundant to
     this distribution.
   ds01.txt   Architecture of the KRC code set
     02  Index of FORTRAN and C routines 
     08  Sample input files with some explanation text
     09  Sample layer table
     10  Sample One point input and output files

  HeatOfT.pdf 
    Information on T-dependent materials, and how to create KRC parameters

  cement.pdf 
    Thermal conductivity of cemented particulates

krc and mkrc (not included in most distributions) require different versions
 of the common krccom. For krc, need krccom2.inp, copied to krccom.inp


In ./src/ there is the Makefile  which will probably need 
editing for your site. You should remove reference to any libraries 
(unless you make some) except the cfiles one.

I have had problems with FORTRAN unformatted files in IDL, probably related to
different interpretations of what is the lenghts of the extra word FORTRAN adds
at each end of a file. At ASU, the problem was resolved by using the
 -fdefault-integer-8  flag.

See your local Guru. Then do:  make krc
which should complile, although there may be some of warnings about 
different variable types for R2R

Copy master.inp to krc.inp  and edit to fit your needs; the default
name that krc looks for is krc.inp. If you want 5 degree latitude spacing,
'mast37' contains just the latitudes and mean elevations for every 5 degrees.

Run krc.  It will ask for an input file name. If you wish krc.inp,
    respond simply:  / <CR 
  At the request for a print file name, you can respond simply:  / <CR 


The original print log output for master.inp is run/output/master.prtOrig
    The output binary file is run/output/masterA.t52 
The input file  run/master5x.inp tests all the type 5x output modes, 
the corresponding binary output files are run/output/master5B.t5x  x=1,2,4,5,6 

Input file krcOneA.inp will run KRC in the one-point mode, using the specific 
points listed on oneA.inp. The expected output is in oneA.prtOrig

krc          # this will start the execution. 
Respond to first request with:  krc.inp   or   simply  /
Respond to second request with:  / 
Should run, creating  krc.prt and a binary file defined by the 8 0 0 ---
 line in the input file

--------------  Use of the IDL programs ---------------------

Before starting IDL, edit and source idlPath.

With each new installation, should rebuild the Shared Object Library;

Look at kirin.pro (probably requires an IDL guru), edit it as appropriate for
your installation, and run it as the first thing after starting IDL.  It uses
setcolor.pro to setup 256 colors.


