Hello everyone! What is the
What is the recommended approach to handle "global" variables? For example a vector U0 which is calculated in a solvers main() function, but which is also required (and maybe modified) when boundary conditions are evaluated in a class myFvPatchField?
In order to avoid global variables I would assume that passing U0 through an objectRegistry, known to both main() and myFvPatchField, could be a common solution. If not, what else would you suggest?
Assuming myFvPatchField has a member variable mesh _ containing this objectRegistry, I can get retrieve U0 inside myFvPatchField with
But how do I get U0 *into* the objectRegistry mesh at the main() side? It must be something like
But I can't get sorted out how to use the regIOobject, IOobject, objectRegistry and IOdictionary in the correct way, because their interrelationship isn't clear to me.
Any hints how the ...checkIn... line has to look like? Or about other solutions to pass U0 between main() and fvPatchFields without looping over all patches from within main() and assigning U0 to each of the fvPatchFields through an additional setter function?
With kind regards
I am also trying to figure out how to add the vector into the object registry. Please share if you recall the solution.
|All times are GMT -4. The time now is 21:53.|