CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

lookupObject

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By mturcios777
  • 1 Post By nimasam

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 14, 2012, 12:22
Default lookupObject
  #1
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25
nimasam is on a distinguished road
Hi dear foamer
i need to read runTime from main solver in a class, i tried to use the following implementation:
const Time& runTime = alpha1_.db().lookupObject<Time>("runTime");

it compiles fine, but when it runs it gives the following error:

request for time runTime from objectRegistry region0 failed
available objects of type time are

0
(
)

now:
How can i resolve this error?
and better question How i can read runTime.deltaT() in subclass from solver.C ?

Best Regards
nimasam is offline   Reply With Quote

Old   June 14, 2012, 15:07
Default
  #2
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
In chemistryModel and other classes, I've seen time access handled through the mesh, like mesh.time().timeName(). Its been a while before I looked at it, but I think that mesh is a part of that class (referencing a previously created mesh.
mm.abdollahzadeh likes this.
mturcios777 is offline   Reply With Quote

Old   June 15, 2012, 10:28
Default
  #3
Senior Member
 
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,267
Blog Entries: 1
Rep Power: 25
nimasam is on a distinguished road
yep, it works
Code:
dimensionedScalar deltaT = U.mesh().time().deltaT();
mm.abdollahzadeh likes this.
nimasam is offline   Reply With Quote

Old   June 15, 2012, 13:23
Default
  #4
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28
mturcios777 will become famous soon enough
Awesome, glad it works.
mturcios777 is offline   Reply With Quote

Reply

Tags
runtime


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
lookupObject nimasam OpenFOAM Bugs 0 July 3, 2011 08:55
dynamic_cast and lookupObject kev4573 OpenFOAM Programming & Development 0 December 10, 2009 19:12


All times are GMT -4. The time now is 01:22.