Inconsistent Use of Names
| SimCon Home | fpt Reference Manual Home |
Why Does the Inconsistent Use of Names Matter?
A large program may contain several thousand sub-programs. The same name may be used for different local objects in many of them. The objects are independent, and no error occurs. There are two situations where inconsistent use of names may indicate a problem:
Different Values for a PARAMETER Name in Different Routines
Fortran parameters with the same name usually refer to the same quantity, particularly if they are of type real. The command to fpt to check that parameter values are consistent is:
Part of the report for the weather and climate code WRF is shown below. The parameter CO2 is the atmospheric carbon dioxide concentration. It varies between routines. This is not necessarily an error. WRF contains about 14 different atmospheric physics models and different models may require the concentration to be set up in different ways.
Name: co2 --------- Sub-prog's COMMON/Use Address Type Size Bounds/Value ---------- ---------- ------- ---- ---- ------------ noahmplsm Parameter REAL *4 df 0.395000E-03 stomata Formal Input Argument REAL *4 df rrtmg_swrad Local REAL *4 df rrtmg_lwrad Local REAL *4 df module_ra_gsfcsw Parameter REAL *4 df 0.300000E-03 module_ra_goddard Parameter REAL *8 0.336770E-03 module_ra_cam,module_ra_cam_support Local REAL *8 (1:233)
fpt lists all of the names with the same name as the parameter.
The Same Name At Different COMMON Block Addresses
COMMON blocks are set up independently in every routine in which they are declared. The variables are placed in each COMMON block strictly in the order in which they appear in the COMMON statements. If the COMMON block declarations are written separately in different routines there is a risk that names will be placed at different addresses. Data are tranferred between different routines through the variables in the COMMON blocks. If the addresses are different the data will be transferred incorrectly. Inconsistent addressing of names within the same COMMON block almost always indicates an error.
The fpt command to check the consistency of COMMON block addressing is:
Part of the report for the VMS Start Trek game, TREK7, is shown below. Whatever is supposed to be in ibasr, it looks as though kzin isn't going to see it.
Name: ibase ----------- Sub-prog's COMMON/Use Address Type Size Bounds/Value ---------- ---------- ------- ---- ---- ------------ moe,zeppo,chico,shadow,eccle n 176 INTEGER *4 df (1:2) mccoy,sauron,finney,knuth,tholia,dune,enemy,talos,balok,entemp,tpau,leguin, mnerva,doomve,atack,kzin,mendez,fizbin,belial,styx,charon,erebus,tophet,hades, harpo,sarek,spock,laurel,sulu,uhura,info,gamovr,blockdat,main n 200 INTEGER *4 df (1:2) Name: ibasr ----------- Sub-prog's COMMON/Use Address Type Size Bounds/Value ---------- ---------- ------- ---- ---- ------------ kzin l 284 INTEGER *4 df (1:2) sauron,blish,knuth,dune,moloch,enemy,balok,gotme,boom,leguin,simak,alpha, niven,mnerva,edible,doomve,pike,mordor,atack,mendez,fizbin,styx,erebus,tophet, hades,moe,curly,larry,chico,harpo,sarek,spock,laurel,dunsel,sulu,mress,eccle, scott,uhura,info,gollum,godot,horta,main l 296 INTEGER *4 df (1:2)
Copyright ©1995 to 2024 Software Validation Ltd. All rights reserved.