Read fields from viscosity model
Hi all.
I'm having a I/O related problem. To put it simple: I need to read some scalar fields defined in the main solver (based on interFoam, OpenFOAM 2.1.1). Here's what I've done (myModel.C): Code:
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // Here's the output of the simulation: Code:
Reading transportProperties Code:
volScalarField myField Another question: how can I access the overall rho field from within my viscosity model? Thanks in advance :) Gaetano |
I think what you need, is probably to look up the fields from the object registry database, which you can access via the mesh.
There are multiple topics that should help you find how to do it, using these keywords http://www.cfd-online.com/Forums/ope...-registry.html contains a lot of info. |
Hi Gaetano and Bernhard,
I'm dealing with the same problem. - In incompressible models, the viscosity object constructor contains the reference of the volScalarField U. So we can define an object "mesh" : Code:
mesh& myMesh = U.mesh(); Code:
volScalarField& T = myMesh().lookupObject<volScalarField>("T"); How can I get an access to the mesh without modifying the transport object's constructor ? I also saw this : Code:
const volVectorField& U = obr_.lookupObject<volvectorField>("U"); |
As said by Bernhard and Aurelien it is possible to access fields in this way:
Code:
const volScalarField& myField = U_.mesh().lookupObject<volScalarField>("myField"); Thanks for your help! :) |
All times are GMT -4. The time now is 22:46. |