| Next || Previous || Top |
This keyword data block allows the definition of Basic functions that can be used in other PHREEQC Basic programs or to display isotopic compositions as defined in the ISOTOPE_ALPHAS and ISOTOPE_RATIOS data blocks. Isotope ratios are the ratio of moles of a minor isotope to moles of a major isotope in an aqueous, gas, or mineral species. Isotope alphas are the ratio of two isotope ratios, which is the fractionation factor between two species. The data block is used primarily to display results from the isotopic simulations, but also can be used to write Basic functions to simplify Basic programming for RATES, USER_GRAPH, USER_PRINT, and USER_PUNCH.
name of Basic function --Alphanumeric character string that defines the name of the Basic function; no spaces are allowed. The function defined in this example would be evaluated in other PHREEQC Basic programs by using CALC_VALUE(“R(D)”).
numbered Basic statement --A valid Basic language statement that must be numbered. The statements are evaluated in numerical order. The statement “SAVE expression ” must be included in the list of statements, where the value of expression is the result that is returned from the Basic function. Statements and functions that are available through the Basic interpreter are listed in The Basic Interpreter (tables 7 and 8).
The CALCULATE_VALUES data block is used to write Basic functions. These functions have no arguments and return a single numeric result defined in the line with the SAVE command. The functions may be called from other PHREEQC Basic programs by using the function CALC_VALUE(“ function_name ”), where function_name is the name of a function defined in a CALCULATE_VALUES data block.
The CALCULATE_VALUES data block is used primarily to implement isotopic calculations as described in Thorstenson and Parkhurst (2002, 2004), but could be used for other purposes as well. The database iso.dat contains many instances of Basic functions in CALCULATE_VALUES data blocks. Basic functions have been written to calculate isotope ratios (moles of minor isotope divided by moles of major isotope) for a large number of isotopes and aqueous, gas, and mineral species. The example given at the beginning of this section calculates the ratio of deuterium to hydrogen in an aqueous solution. The functions also are used to calculate ratios of isotope ratios (alphas), which are equal to the fractionation factors among species. These functions are then specified in the ISOTOPE_ALPHAS and ISOTOPE_RATIOS data blocks to enable listing isotopic ratios and alphas in the output file. The functions also can be used in Basic programs in RATES, USER_GRAPH, USER_PRINT, and USER_PUNCH data blocks.
| Next || Previous || Top |