The ORCHESTRA calculator only has a single type of variables, which represent double floating point values.
Variables are defined with the keyword "@Var:
" followed by a name and default value.
@Var: pH 3.9
@Var: pe 13.3
Variables can be defined anywhere in the input file and may contain +, -, . [,] characters in their names.
However, names containing mathematical operators must be enclosed by {} when used in expressions.
So e.g. Ca2+.logact
or H+.logact
are allowed as variable names.
@globalvar:
name value
Define a global variable, that is defined within this calculator, but also automatically as cell/node variable with the given default value
@Calc:( 1, "pH = -{H+.logact}")
e.g.:
@Calc: (1, "pH = -{H+.logact})
First all expressions in stage 1 are calculated in the order in which they are defined.
Then all expressions in stage 2 are calculated also in order of definition.
Then all expressions in stage 3, also in order of definition.
After that all expression in stage 4 but in reverse order!
Finally all expression in stage 5 also in reverse order!
Variables, operators and functions can be used to compose expressions.
+, -, *, /, ^
Mathematical functions
sqrt(),
log(),
log10(),
abs(),
exp(),
sin(),
cos(),
tan(),
sinh(),
cosh(),
tanh(),
atan(),
min(,)
max(,)
if(logical expression, return expression true, return expression false)
logical operators {==, >, < ,=",">=, !=}>
@synonym:
Define a synonym for an existing variable. This synonym can also be used externally, so in cells and for input/ouput.
@maxiter: int value
Maximum number of iterations to find solution (default is 300)
@maxmineraliterations: int value
Maximum number of mineral iterations (default is nr_minerals).
@stop:
Stop calculations when system is non convergent
@exit:
Exit ORCHESTRA on non-convergent system
@trysteps: int value
In case of non-convergence ORCHESTRA tries to find better start estimations by re-doing the last successful calculation and perform intermediate calculations between last successful and new system.
@trysteps: int value
defines the number of intermediate steps. (default = 30)
@maxtry: int value
The procedure of finding better start estimations is recursive, and the
@maxtry: int value
indicates the maximum depth of recursion. (default 3)
indicates the maximum depth of recursion. (default 3)
Simple example
A simple example that defines some variables, and expression and shows how to solve an equation.
@Var: x 0.1 // the default value of x = 0, but this value can be overwritten by @Var: y 3.0 // the actual value of y is calculated by the expression below @Calc:(1, "y = sqrt(x)") // we now solve x for a given value of y of 3.0 @solve: unknown:(name: x) equation:(name: y)