Subsections


How to Implement a New Variable in FASTEST


Local variable

Local variables are only accessible in the actual subroutine or function. It is impossible to access these ones from somewhere else in the code. There are no implicit declerations and there shouldn't be any in the future. Thus all local variables have to be declared manually. Pay attention to the include files. Some of them contain code. Right now only hahihjhk.h contains code. So all kinds of declerations have to be done before including these files.

ATTENTION: NEVER USE PARAMETERS FOR THE DECLARATION OF LOCAL AREAS!!! If you need something like myvariable(nxyza) it must be a global variable, make sure that this field is declared in fhp.F and is passed through parameter lists or common blocks to the part of the program where it is used!!!


Global variable

Is it necessary to access variables at several places in the code, these variables have to be defined in a special way. Fastest uses so called variable lists to get a kind of structure. The lists are defined in listdefines.h. It is possible to add the new variable to an existing list, if the new variable is used in the context of this list. Otherwise it is better to define a new list.

example:

#define _TAYINT tayfx,tayfy,tayfz
TAYINT is the name of the list and tayfx,tayfy,tayfz are the variables of the list.

All lists have to be registered in the file listall.h.

In case that the new variable is a vector or field the dimensioning has to be done in a special file. The filename is derived from the list name: dim<listname>.h. In the given example the filename is dimtayint.h. Within the dimension files the Fortran77 nomenclature has to be used.

example:

c234567
      real*8 tayfx(3*nxyza),tayfy(3*nxyza),tayfz(3*nxyza)

All dimensioning files have to be registered in the file dimall.h.

All global variable lists have to be passed from fhp.F down to the subroutine where they are needed. First all lists have to passed from fhp.F to fmg3d.F. In fhp.F all lists are listed by their listnames, while in fmg3d.F the listall.h file is used. The dimensioning files are handled in the same manner. Keep this in mind while implementing new variable lists.

For each existing Fortan file (subroutine) an include file is used to pass the global variables to subroutine. In this file the variable lists are registered, which are used with in the called subroutine. The filename of the include file is derived from the Fortran filename name: list<filename>.h.Within these listfiles the Fortran77 nomenclature has to be used. While calling a subrotine some variables are passed by name but most of them by the mentioned include file. The dimensioning has to be done in the subroutine by calling the dimensioning files which are used by the listfile.

Attention: Never use list<filename>.h for other subroutines than <filename>, even though they are including same variables like you need (perhaps the list will change, and someone else has to change all lists in the subroutine under your first calling subroutine).

example - fmg3d calls caluvw:

fmg3d.F::
...
c234567
      call caluvw(kgrid,
#          include "listcaluvw.h"
...

caluvw.F:
...
c#######################################################################
      subroutine caluvw(ngr,
#                       include "listcaluvw.h"
c#######################################################################
c  Calculate velocity components u,v, and w
c#######################################################################
      implicit none
#     include "cb3dall.h"
#     include "cbglobaldim.h"
#     include "cbporous.h"
#     include "dimacoef.h"
#     include "dimbcoef.h"
#     include "dimlilk.h"
#     include "dimliglkg.h"
#     include "dimindex2.h"
#     include "dimiters.h"
#     include "dimindex4.h"
#     include "dimlogic4.h"
#     include "dimdivers.h"
#     include "dimstoffw12.h"
#     include "dimifldir.h"
#     include "dimnuamol.h"
#     include "dimuvwvel.h"
#     include "dimuvwvelg.h"
#     include "dimuvwvold.h"
#     include "dimtemp.h"
#     include "dimtempg.h"
#     include "dimtempold.h"
#     include "dimkeps.h"
#     include "dimkepsg.h"
#     include "dimkepsold.h"
#     include "dimlowre.h"
#     include "dimgeom12.h"
#     include "dimgeomm123.h"
#     include "dimgeomt12.h"
#     include "dimbndcon.h"
#     include "dimbndcont.h"
#     include "dimrhelp3.h"
#     include "dimcreac.h"
#     include "dimporous.h"
#     include "dimblopar.h"
#     include "dimpst.h"
#     include "dimtayint.h"
#     include "macros.h"
...

Remember the top-down principle (A $\rightarrow$ B $\rightarrow$ C) while implementing new variable lists. If a list is needed by subroutine C which is called from subroutine B, the list has to be passed first from A to B.