Hi,
it would be great, if the parser is able to handle the regexp from openfoam,i.e.
in the fvSolution file some settings for the relaxation could look like:
"(k|omega|epsilon)" 0.3;
or for the solver "p.*"{someSolver}, similar for the fields.
What do you think!?
Fabian
I'd think that its already there in the released version. Try this code snipplet:
from os import path,environ
from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile
fvsol=ParsedParameterFile(path.join(environ["FOAM_TUTORIALS"],
"heatTransfer/buoyantSimpleFoam/buoyantCavity",
"system/fvSolution"))
assert(fvsol["relaxationFactors"]["omega"]==0.7)
print fvsol["relaxationFactors"]["omega"]
Yes, this works, you are right. Though if one tries to get all entries of the relxationFactors by
print fvsol["relaxationFactors"]
then the entry is missing:
{'h': 0.29999999999999999, 'p_rgh': 0.69999999999999996, 'U': 0.29999999999999999, 'rho': 0.69999999999999996}
The problem is that the regular-expression key has to be treated separately. As it can theoretically have multiple values one can not put it into a regular dictionary.
When printing the dictionary in OF-Format then the regular-expression will be printed. Check with pyFoamEchoDictionary.py