CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Sharing a scalar Solver -> Boundary (

Aurelien Thinat February 21, 2012 12:20

Sharing a scalar Solver -> Boundary
Hello everyone,

It's maybe a simple question. I'd like to share a value (integer, float, table or whatever...) store in the main solver with a boundary condition.

Is it possible to have an access to this value from the BC code ?

Thank you all.

laurensvd March 1, 2012 08:38

const volScalarField& someScalar = this->db().objectRegistry::lookupObject<volScalarFiel d> ("someScalar");

where you change someScalar with the name of what you are looking for, and in case its a vector,tensor,... just change volScalarField& to the appropriate type.

marupio March 1, 2012 13:15

single element types can't be registered in the objectRegistry. You could use an IOlist, or the IOreferencer (just google it). Also, an objectRegistry lookup returns a const reference, so you can't change it.

All times are GMT -4. The time now is 16:46.