Norman version 2
User's Guide

Previous page

Email the author

Index

Reference list

Next page


Appendix 3: Preparing user-defined functions

NORMAN provides a simple way for preparing calculation scripts, or user-defined functions, which are stored as plain ASCII files. These modules can call other user-defined functions, standard modules and their own parameters calculated earlier. The penalty for such a versatility is the speed of calculation; it is necessary to keep in mind that for each parameter of the particular user-defined function, the formula needs to be interpreted and the necessary modules called. Meanwhile, all the provisional results are stored on the hard disc to enable recursive calling of the calculation module. It is therefore obvious that the calculation time grows with complexity and number of the parameters to be calculated (as well as with the processor age ;-).

The *.DEF files have a very simple structure. Here is an example taken from one of them, MAN.DEF (major-element based classification of granitoids after Maniar & Piccoli, 1989):

 

 

The *.DEF files can contain as many spaces as desired for the aesthetics sake. Each line starts either by an asterisk (if it is a comment) or a name of a parameter followed by "=" and the definition. In the definitions, common arithmetic operators can combine together constants and variables, whose examples are given below (see Tabs 1 and 5 for default suffixes):

  

Operators:

+ - * / ^ ( ) are supported operators (hence these cannot be used in the names of the parameters)

Variables:

%SiO2

wt % oxide (as stored in the array q() )

%Si

concentration of the element in millications (atomic proportions*1000; stored in the array r())

An[CPW]

name of the parameter with the default suffix of a standard module in square brackets (here anorthite from the CIPW norm)

ANOR[STR]

the same philosophy is used also to refer to user-defined functions (here ANOR from the Streckeisen & Le Maitre's classification scheme)

Constants (as stored in the setup file CONS.DAT, see Appendix IV.):

WSiO2

molecular weight of silica

WSi

atomic weight of silicon

fFeO

factor to recalculate wt% FeO to wt% Fe2+

fFe2

factor to recalculate wt% Fe2+ to wt% FeO

 

All other strings will be treated as user-defined constants and if they are not found in the file CONST.DAT, an error is displayed.

 

 


Previous page

Email the author

Index

Reference list

Next page