|
[Sponsors] |
November 25, 2013, 17:00 |
objectRegistry::lookupObject<scalar>
|
#1 | |
New Member
Tom Chyczewski
Join Date: Mar 2009
Location: Bethpage, New York, USA
Posts: 15
Rep Power: 17 |
(I have tried to add to an existing thread of the same title initiated by Brent Craven a couple years ago but don't seem to have been successful. I'm reposting here to cover my bases. Sorry for duplication, if any).
I have followed the procedure outlined in an earlier post (quoted at bottom) to update the boundary value in the course of a run and seem to have it working. But I get a warning message that is troubling me and I'd like to eliminate it. Here is the warning: --> FOAM Warning : From function Field<Type>::Field(const word& keyword, const dictionary&, const label) in file /....../Field.C at line 262 Reading "myDict" from line 0 to line 0 expected keyword 'uniform' or 'nonuniform', assuming deprecated Field format from Foam version 2.0. Here is my coding: The dictionary is created in createFields.H: Code:
IOdictionary myDict ( IOobject ( "myDict", runTime.constant(), mesh, IOobject::NO_READ, IOobject::NO_WRITE ) ); Code:
myDict.set("myValue",aeq[m][n]); Code:
const dictionary& myDict = this->db().objectRegistry::lookupObject<IOdictionary>("myDict"); this->refValue() = Field<Type>("myValue",myDict,this->refValue().size()); Quote:
|
||
November 26, 2013, 02:58 |
|
#2 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21 |
May I ask why you are using a dictionary, if you define the variable in the source code anyhow?
|
|
November 26, 2013, 08:09 |
|
#3 |
New Member
Tom Chyczewski
Join Date: Mar 2009
Location: Bethpage, New York, USA
Posts: 15
Rep Power: 17 |
Hi Bernhard,
My understanding is that this is a good way to bring a variable from the scope of the main solver into the boundary condition (following the discussion in the quoted thread). It is not practical to calculate this value within the boundary condition because a cubic equation needs to be solved at each point in wavenumber space to fill the array (aeq[m][n]) and it doesn't change over the course of the run. Also, I would have to bring a number of additional variables into the bc to do the calculation. |
|
November 27, 2013, 12:36 |
|
#4 |
New Member
Tom Chyczewski
Join Date: Mar 2009
Location: Bethpage, New York, USA
Posts: 15
Rep Power: 17 |
Thanks to help from Dave Boger and Brent Craven, the solution was found to be replacing
Code:
myDict.set("myValue",aeq[m][n]); Code:
std::stringstream strs; strs<<"uniform "<< aeq[m][n]; myDict.set("myValue",strs.str().c_str())); |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|