|
[Sponsors] |
January 21, 2011, 10:04 |
Lookup autoPtr from fvMesh
|
#1 |
New Member
Misha Marie Gregersen
Join Date: Nov 2009
Posts: 7
Rep Power: 17 |
Dear openFOAM'ers
I am trying to access to the turbulence properties from a class where I have access to the mesh. That is, in createFields.H I have: singlePhaseTransportModel laminarTransport(U, phi); autoPtr<incompressible::RASModel> turbulence ( incompressible::RASModel::New(U, phi, laminarTransport) ); And I would now like to access the pointer named "turbulence" from another class. I thought it would be possible to access it in the way a dictionary can be accessed in another class, where the mesh has been passed and named mesh_: dictionary transport = mesh_.lookupObject<IOdictionary>("transportPropert ies"); So what I need might be something like: autoPtr<incompressible::RASModel> turbulence = mesh_.lookupObject<incompressible::RASModel>("turb ulence"); The expression above is of course not consistent, so I would appreciate any help or comments on how to access such a pointer from the objectRegistry! Best regards Misha |
|
January 21, 2011, 10:43 |
|
#2 |
Senior Member
Sandeep Menon
Join Date: Mar 2009
Location: Amherst, MA
Posts: 403
Rep Power: 25 |
It appears that RASModel is derived from IOdictionary, which means that any turbulence model can be accessed by looking for it's typeName (like "kEpsilon", for instance). The (object).names() member function should give you a list of all objects currently registered with the mesh.
Also, any particular reason why you're looking for an autoPtr? Wouldn't a const reference to the object do the trick? |
|
January 24, 2011, 07:20 |
|
#3 |
New Member
Misha Marie Gregersen
Join Date: Nov 2009
Posts: 7
Rep Power: 17 |
Thank you for your answer!
I see that my pointer is not listed in mesh.names(), so I guess I cannot access it that way. I want to be able to solve my equations using a member function in my new class; Code:
void new_class::solveEqn() {volScalarField& U = const_cast<volScalarField&>(mesh_.lookupObject<volScalarField>("U")); surfaceScalarField& phi = const_cast<surfaceScalarField&>(mesh_.lookupObject<surfaceScalarField>("phi")); volScalarField& p = const_cast<volScalarField&>(mesh_.lookupObject<volScalarField>("p")); {}// (.... Standard SIMPLE code) tmp<fvVectorMatrix> UEqn ( fvm::div(phi, U) + turbulence->divDevReff(U) ); // (.... Standard SIMPLE code)} My approach to the problem may be wrong - if so, I would really appreciate your comments! ~ Misha |
|
Tags |
autoptr, lookupobject, objectregistry, rasmodel |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Run time Selection Mechanism - Some help required to understand | jaswi | OpenFOAM Programming & Development | 3 | October 29, 2015 14:42 |
Convergence on anisotropic tetahedral meshes | pbo | OpenFOAM Running, Solving & CFD | 12 | December 14, 2010 12:59 |
face order in fvMesh constructor | schmittp54 | OpenFOAM Programming & Development | 2 | November 2, 2010 10:42 |
Error with 'vanAlbada' scheme | Julian K. | OpenFOAM Running, Solving & CFD | 0 | June 18, 2009 10:31 |
Buoyancydriven cavity flow | anita | OpenFOAM Running, Solving & CFD | 3 | March 26, 2008 11:24 |