CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Sharing a scalar Solver -> Boundary (http://www.cfd-online.com/Forums/openfoam-programming-development/97623-sharing-scalar-solver-boundary.html)

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 23:56.