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

lookupObject

Register Blogs Members List Search Today's Posts Mark Forums Read

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

Reply
 
LinkBack Thread Tools Display Modes
Old   June 14, 2012, 11:22
Default lookupObject
  #1
Senior Member
 
Nima Sam
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,123
Blog Entries: 1
Rep Power: 14
nimasam is on a distinguished road
Send a message via Yahoo to nimasam
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, 14:07
Default
  #2
Senior Member
 
mturcios777's Avatar
 
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 725
Rep Power: 18
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, 09:28
Default
  #3
Senior Member
 
Nima Sam
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,123
Blog Entries: 1
Rep Power: 14
nimasam is on a distinguished road
Send a message via Yahoo to nimasam
yep, it works
Code:
dimensionedScalar deltaT = U.mesh().time().deltaT();
mm.abdollahzadeh likes this.
nimasam is offline   Reply With Quote

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

Reply

Tags
runtime

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 11:40.