             PEDESTAL --- H-mode Pedestal Module

                      Prepared by 
	Thawatchai Onjun -- onjun@fusion.physics.lehigh.edu
        Glenn Bateman    -- bateman@fusion.physics.lehigh.edu
        Arnold Kritz     -- kritz@fusion.physics.lehigh.edu


REVISION HISTORY
----------------
       date            Description

   31 March 2003       Completed the first version for NTCC

UNPACKING INSTRUCTIONS

  > gunzip pedestal.tar.gz
  > tar xvf pedestal.tar

INSTRUCTIONS FOR PRINTING DOCUMENTATION:

	LaTeX files can be turned into PostScript files by typing: 
(Note: apply latex to this file twice to obtain correct 
cross-references.)

  > latex pedestal_models.tex
  > latex pedestal_models.tex
  > dvips -f pedestal_models.dvi > pedestal_models.ps

CONTENTS:

        This directory should contain the following files:

                README
		pedestal_models.tex
                driver.f
                bdped.f
		bdlh.f
		bdlhmode1.f
                bdhden.f
		bddensity1.f
		bdhtemp.f
		bdheight1.f
		bdheight2.f
		bdheight3.f
		bdheight11.f
		bdheight12.f
		bdshear1.f
		bdshear2.f
		bdshear3.f
		bdcoll.f
		bdboots.f
                stripx.f
                sample_input_1
                sample_input_2
                sample_input_3
                sample_input_4
                sample_output_1_fujitsu
                sample_output_1_sgi
                sample_output_2_fujitsu
                sample_output_2_sgi
                sample_output_3_fujitsu
                sample_output_3_sgi
                sample_output_4_fujitsu
                sample_output_4_sgi
                makefile (uses gmake)

	Call tree: driver calls the following routines

  	bdped	       - Prepare inputs to calculate edge condition 
  	|-bdlh         - Call a model to determine the transition from
	| |              L-mode to H-mode 
  	| |-bdlhmode1  - Determine the transition from L-mode to H-mode
	|		 using power treshold model 
  	|-bdhden       - Call a model to calculate the density at the 
     	| |		 top of pedestal
	| |-bddebsity1 - calculate the pedestal density using a simple
	|                empirical model 
  	|-bdhtemp      - Call a model to calculate pedestal temperature
     	|-bdheight1    - Calculate pedestal temperature using the model 
     	| |              that the width based on magnetic and flow shear 
     	| |              stabilization 
     	| |-bdshear1   - Calculate magnetic shear at the top of pedestal
     	|   |-bdcoll   - Calculate collisionality at the top of pedestal
     	|   |-bdboot   - Calculate boostrap current
     	|-bdheight2    - Calculate pedestal temperature using the model 
     	| |              that the width based on flow shear stabilization 
     	| |_bdshear2   - Calculate magnetic shear at the top of pedestal
     	|   |-bdcoll   - Calculate collisionality at the top of pedestal
     	|   |-bdboot   - Calculate boostrap current
     	|-bdheight3    - Calculate pedestal temperature using the model 
     	| |              that the width based on normalized pressure 
     	| |-bdshear3   - Calculate magnetic shear at the top of pedestal
     	|   |-bdcoll   - Calculate collisionality at the top of pedestal
     	|   |-bdboot   - Calculate boostrap current
     	|-bdheight11   - Calculate pedestal temperature based on the  
     	|                thermal conduction model 
     	|-bdheight12   - Calculate pedestal temperature based on the
        	         thermal conduction model  

        These files are as follows:

        README:  This file contains brief descriptions of the other files,
                and instructions for compiling the module.  Note, the
                PEDESTAL module has been tested using double precision,
                with the precision set by compiler flags.

	pedestal_models.tex: This file contains technical documentation for 
                all models used in this module. References for each model 
                are included.
 
        driver.f: This file contains fortran code for the driver program, 
                which reads the input file "input_1" and writes the output 
		file, "output_1".   
                
        bdped.f: This file contains fortran code and documentation 
		for the fortran subroutine that calls the other pedestal 
 		models. 

        bdlh.f: This file contains fortran code and documentation for
                the subroutine that calls the routines that compute the
		transition from L-mode to H-mode

        bdlhmode1.f: This file contains fortran code and documentation 
 		for the fortran routine that determines the transition 
		from the low confinement (L-mode) mode to the high 
		confinement (H-mode) mode. 

        bdhden.f: This file contains fortran code and documentation for
                the subroutine that calls the routines that compute the 
		density at the top of the pedestal. 

        bddensity1.f: This file contains fortran code and documentation for
                the routine used to determine the electron density at the 
		top of the pedestal using a simple empirical model. 

        bdhtemp.f: This file contains fortran code and documentation for
                the subroutine that calls the routines that compute the 
		temperature at the top of the pedestal. 

        bdheight1.f: This file contains fortran code and documentation 
		for the routine that is used to calculate the temperature 
		at the top of the pedestal using model with the pedestal 
                width based on magnetic and flow shear stabilization. 

        bdheight2.f: This file contains fortran code and documentation 
		for the routine that is used to calculate the temperature 
		at the top of the pedestal using model with the pedestal 
                width based on flow shear stabilization. 

        bdheight3.f: This file contains fortran code and documentation 
		for the routine that is used to calculate the temperature 
		at the top of the pedestal using model with the pedestal 
                width based on normalized poloidal pressure. 

        bdheight11.f: This file contains fortran code and documentation 
		for the routine that is used to calculate the temperature 
		at the top of the pedestal using model based on the 
		thermal conduction model 1 by G. Cordey. 

        bdheight12.f: This file contains fortran code and documentation 
		for the routine that is used to calculate the temperature 
		at the top of the pedestal using model based on the 
		thermal conduction model 2 by G. Cordey. 

        bdshear1.f: This file contains fortran code and documentation 
		for the routine that is used to calculate the magnetic 
		shear at the top of pedestal with the pedestal width based 
     		on magnetic and flow shear stabilization.

        bdshear2.f: This file contains fortran code and documentation 
		for the routine that is used to calculate the magnetic 
		shear at the top of pedestal with the pedestal width 
		based on flow shear stabilization.

        bdshear3.f: This file contains fortran code and documentation 
		for the routine that is used to calculate the magnetic 
		shear at the top of pedestal with the pedestal width 
           	based on normalized poloidal pressure.

        bdcoll.f: This file contains fortran code and documentation 
		for the routine that is used to calculate the 
		collisionality at the top of pedestal.

        bdboots.f: This file contains fortran code and documentation 
		for the routine that is used to calculate the effect 
		of collisionality on the bootstrap current.

        stripx.f:  This file is a utility routine, used by the driver 
		program. It strips all annotation and comments out of 
		the input namelist before it is read.

        sample_input_1:  Sample input namelist for running this module.
		This input files is for AUG discharges 8041. Copy this 
		file to a file called "input_1" before running this module.

        sample_input_2:  Sample input namelist for running this module.
		This input files is for D3D discharges 90766. Copy this 
		file to a file called "input_1" before running this module.

        sample_input_3:  Sample input namelist for running this module.
		This input files is for JET discharges 43153. Copy this 
		file to a file called "input_1" before running this module.

        sample_input_4:  Sample input namelist for running this module.
		This input files is for JT60U discharges 16101. Copy this 
		file to a file called "input_1" before running this module.

        sample_output_1_FUJITSU:  Sample output.  This file contains the 
		output that should be produced in file "output_1" when the 
		the "sample_input_1" file is copied to "input_1" and used on 
		the Linux computer.

        sample_output_1_sgi:  Sample output.  This file contains the output
                that should be produced in file "output_1" when the the 
                "sample_input_1" file is copied to "input_1" and used on the 
                Silicon Graphics computer.

        sample_output_1_ibm:  Sample output.  This file contains the output
                that should be produced in file "output_1" when the the 
                "sample_input_1" file is copied to "input_1" and used on the 
                RS6000 computer.

        sample_output_2_FUJITSU:  Sample output.  This file contains the 
		output that should be produced in file "output_1" when the 
		the "sample_input_2" file is copied to "input_1" and used on 
		the Linux computer.

        sample_output_2_sgi:  Sample output.  This file contains the output
                that should be produced in file "output_1" when the the 
                "sample_input_2" file is copied to "input_1" and used on the 
                Silicon Graphics computer.

        sample_output_2_ibm:  Sample output.  This file contains the output
                that should be produced in file "output_1" when the the 
                "sample_input_2" file is copied to "input_1" and used on the 
                RS6000 computer.

        sample_output_3_FUJITSU:  Sample output.  This file contains the 
		output that should be produced in file "output_1" when the 
		the "sample_input_3" file is copied to "input_1" and used on 
		the Linux computer.

        sample_output_3_sgi:  Sample output.  This file contains the output
                that should be produced in file "output_1" when the the 
                "sample_input_3" file is copied to "input_1" and used on the 
                Silicon Graphics computer.

        sample_output_3_ibm:  Sample output.  This file contains the output
                that should be produced in file "output_1" when the the 
                "sample_input_3" file is copied to "input_1" and used on the 
                RS6000 computer.

        sample_output_4_FUJITSU:  Sample output.  This file contains the 
		output that should be produced in file "output_1" when the 
		the "sample_input_4" file is copied to "input_1" and used on 
		the Linux computer.

        sample_output_4_sgi:  Sample output.  This file contains the output
                that should be produced in file "output_1" when the the 
                "sample_input_4" file is copied to "input_1" and used on the 
                Silicon Graphics computer.

        sample_output_4_ibm:  Sample output.  This file contains the output
                that should be produced in file "output_1" when the the 
                "sample_input_4" file is copied to "input_1" and used on the 
                RS6000 computer.


        makefile: File used by the gmake utility.  NOTE, "gmake" not
                "make" must be used. This makefile has been written to
                work on the IBM/AIX, SUN/Solaris, SGI/IRIX, HP/UX, and
                DEC platforms and can be modified to work on other
                systems.  This makefile contains the instructions for
                compiling and building the "xbdped" program.
                The executable file, "xbdped"
                is constructed using the files described above.

NOTE: This H-mode pedestal module has been tested and used only with double 
      precision.

COMPILATION INSTRUCTIONS:

       * First, set the environmental variable "CPU" to one of the following:

FUJITSU  for the Lahey/Fujitsu F90/95 compiler on LINUX systems
IBM      for the standard compiler on IBM/AIX workstations
SOL      for the standard compiler on Sun Solaris workstations
SGI      for the standard compiler on SGI Origin 200 workstations
DEC      for the standard compiler on DEC alpha workstations
HP       for the standard compiler on Hewlett Packard workstations

       For example, in the Bourne shell on an SGI workstation, type:

export CPU=SGI

       If you are using the C-shell on an SGI workstation, type

setenv CPU SGI

       * To compile the stand-alone test code "xbdped"
         simply type:

                gmake

        at the unix prompt.  The makefile contains all the
        instructions needed by the "gmake" utility to create the test
        executable, which is called "xbdped".

        NOTE: The makefile uses make-variable CPU to control platform-
        dependent settings. CPU can be set either by defining an
        environment variable CPU, or by editting the makefile to
        include a line CPU=... , or by typing CPU=... on the gmake
        execute line.  If CPU is not set, it is defaulted to IBM. This
        version of the makefile is prepared for CPU=IBM (for an
        IBM/AIX system), for CPU=SOL (for Solaris), for CPU=SGI
        (for the SGI Origin 200), for CPU=DEC (for the DEC), and for
        CPU=HP (for the Hewlett Packard), and for the Lahey/Fujitsu
        F90/95 compiler set CPU=FUJITSU.  If you add another CPU
        branch to the makefile, please let us know what works.


      * If the make utility does not work, or if the module is being
        compiled on a non-IBM, non-SUN platform, non-SGI, non-DEC, or 
        non-HP platform then the compilations will need to be done by 
        hand. What follows are step-by-step instructions for creating 
        the test executable xbdped.

        1) Compile and produce object codes for "driver.f", "bdped.f"
           "bdlh.f", "bdlhmode1.f", "bdhden.f", "bddensity1.f", 
	   "bdhtemp.f", "bdheight1.f", "bdheight2.f", "bdheight3.f", 
	   "bdheight11.f", "bdheight12.f", "bdshear1.f", "bdshear2.f", 
	   "bdshear3.f", "bdcoll.f", "bdboots.f" and "stripx.f". 
	   Suppose the Fortran 90 compiler on your system is called 
	   "f90".  Suppose "-r8" is the option needed to promote all 
	   single precision variables to double precision. An object 
	   code is produced when the compiler is invoked with 
	   a "-c" option:

                f90 -c -r8 -o driver.o driver.f
                f90 -c -r8 -o bdped.o bdped.f
                f90 -c -r8 -o bdlh.o bdlh.f
                f90 -c -r8 -o bdlhmode1.o bdlhmode1.f
                f90 -c -r8 -o bdhden.o bdhden.f
                f90 -c -r8 -o bddensity1.o bddensity1.f
                f90 -c -r8 -o bdhtemp.o bdhtemp.f
                f90 -c -r8 -o bdheight1.o bdheight1.f
                f90 -c -r8 -o bdheight2.o bdheight2.f
                f90 -c -r8 -o bdheight3.o bdheight3.f
                f90 -c -r8 -o bdheight11.o bdheight11.f
                f90 -c -r8 -o bdheight12.o bdheight12.f
                f90 -c -r8 -o bdshear1.o bdshear1.f
                f90 -c -r8 -o bdshear2.o bdshear2.f
                f90 -c -r8 -o bdshear3.o bdshear3.f
                f90 -c -r8 -o bdcoll.o bdcoll.f
                f90 -c -r8 -o bdboots.o bdboots.f
                f90 -c -r8 -o stripx.o stripx.f

        4) Link these object codes together, producing the executable "xbdped".
          For example:

                f90 -r8 -o xbdped \
                driver.o bdped.o bdlh.o bdlhmode1.o bdhden.o bddensity1.o 
		bdhtemp.o bdheight1.o bdheight2.o bdheight3.o bdheight11.o 
		bdheight12.o bdshear1.o bdshear2.o bdshear3.o bdcoll.o 
		bdboots.o stripx.o

        There are, of course, several compiling options that one could
        use when carrying out steps (1)-(4).  The makefile contains
        the recommended compiling options for the IBM and SUN systems,
        along with a brief description of each.  These comments should
        make the task of finding analogous compiling options on
        another system easier.

RUNNING INTRUCTIONS:

        "xbdped" requires only one input file, the namelist "input_1".

        To produce each of the test cases, copy the sample input
        file, "sample_input_1", to the file "input_1" and run "xbdped".

        As it runs, "xbdped" will generate two files: "temp" and
        "output_1".
        
        "temp" is a temporary file, containing the input namelist
        without annotation and notes.  "temp" is actually the file
        read during the namelist read in the xbdped program.

        "output_1" is the output file.  At the beginning of this file,
        the input namelist (with annotation) is reproduced.  Then, the
        program produces a substantial amount of diagnostic output,
        which fills out the rest of this file.

        When this package is ported to a new platform, it is suggested
        that the test cases be run first.  Each time, compare the
        output file "output_1" to the appropriate sample output file, in
        order to verify that all is working as expected.  For machines
        other than HP and IBM, use the SGI version sample output files
        for comparison.

IF YOU HAVE ANY PROBLEMS, PLEASE CONTACT EITHER:


	THAWATCHAI ONJUN, Lehigh University
		 onjun@fusion.physics.lehigh.edu

	or

        GLENN BATEMAN, Lehigh University 
                 bateman@fusion.physics.lehigh.edu

        or

        ARNOLD KRITZ, Lehigh University 
                 kritz@fusion.physics.lehigh.edu


This implementation of the BDPED H-mode pedestal module is based on work
carried out by (except the L-H transition model):

Thawatchai Onjun, Lehigh University
Glenn Bateman, Lehigh University
Arnold H. Kritz, Lehigh University
