According to this issue, the function to define a certain parameter does not limit to “simple” expressions, but it can be extremely refined, for example using boolean conditions.
I repost here the documentation link:
I personally never tried them (will do asap), but I think it would be useful to have it somewhere in the OGS conventions section (but in the meanwhile I post it here).
indeed, the documentation of the exprtk features in OGS could be better. I’ll try to extend it ASAP. The relevant sections in the Doxygen documentation are rather brief, see:
for function material properties and parameters, respectively. The pages only say: “For the evaluation of the expressions the exprtk library is used”.
Btw.: Besides “normal” formulas, we have one test in OGS that uses “advanced” features of exprtk:
Tests/Data/ThermoHydroMechanics/Linear/Beam_sealed_bimaterial/square_1e2_function.xml:8:
<expression>if (x < 2) 19; else if (x < 2.1) 0.95; else 9.5;</expression>
Note: the "<"s have been changed to "<"s to avoid conflicts with the enclosing XML syntax.
However, I tried the switching case and for the OGS parser it is difficult to understand. I will open an issue
<expression> switch {
case y > 3 : if (z+20 > y+3) -9e6; else -5e6;;
case y < 3 : -7e6;
default : 7.5e6;
}
</expression>
and the error is
info: Reading project file /projects2/AG3193/aug_22/run/test_functions-expr/test_stress.prj.
Entity: line 418: parser error : StartTag: invalid element name
case y < 3 : -7e6;
^
critical: /projects2/AG3193/ogs_branch/ogsPW/BaseLib/PrjProcessing.cpp:124 replaceIncludes()
No, spaces have meaning in XML. However, <, >, &, ', " are considered as special characters and therefore these need to be replaced the same way as you would do in HTML.