CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

runtime.loop() and runtime.run()

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

Reply
 
LinkBack Thread Tools Display Modes
Old   September 19, 2013, 13:01
Default runtime.loop() and runtime.run()
  #1
New Member
 
Join Date: Apr 2012
Posts: 6
Rep Power: 4
CoolKau is on a distinguished road
I am using sonicFoam in the versions 2.1.1 and 2.2.1 in a fairly simple setup.
In version 2.1.1 sonicFoam is using runtime.loop() for time iteration, while in 2.2.1 it has been changed to runtime.run().
I also manually changed version 2.1.1 to runtime.run() to be able to access the variable time step.

However, I realized that I get different results for runtime.run() and for runtime.loop() independent of the Open Foam version. So it seems to be a problem with the time iteration.

Does anyone else had similar problems?
CoolKau is offline   Reply With Quote

Old   September 20, 2013, 02:46
Default
  #2
Member
 
Hassan
Join Date: Oct 2012
Location: Iran
Posts: 60
Rep Power: 3
luckycfd is on a distinguished road
Hi CoolKau,

What's the meaning of this part of the code in the application solver?
Code:
while (runTime.loop())
{
...
}
Regards,
Hassan
luckycfd is offline   Reply With Quote

Old   September 20, 2013, 11:39
Default
  #3
New Member
 
Join Date: Apr 2012
Posts: 6
Rep Power: 4
CoolKau is on a distinguished road
Quote:
Originally Posted by luckycfd View Post
Hi CoolKau,

What's the meaning of this part of the code in the application solver?
Code:
while (runTime.loop())
{
...
}
Regards,
Hassan

Hi Hassan,

I am not entirely sure what the difference of both of them are. It is my first time to dig deeper into the source code. They are basically running the solver repeatedly until the final time is reached. I know that one does allow for a variable time step (.run) and the other does not.

Also .\src\OpenFOAM\db\time.h has some annotations in it. But the only difference is that one iterates the time, while the other one just checks if the final time has been reached.

This is all I found out so far.
CoolKau is offline   Reply With Quote

Old   September 28, 2013, 11:59
Default
  #4
New Member
 
Join Date: Apr 2013
Posts: 24
Rep Power: 3
GPesch is on a distinguished road
http://foam.sourceforge.net/docs/cpp...3d8c7fdc4638d9

This actually contains the same information as you already mentioned:

One is incrementing the time and is checking whether final time has been reached (loop), whilst the other one is only checking whether the final time has been reached (run), WITHOUT incrementing the timestep.

Please look into the 2 very short examples provided in my link to see how to use them: When using run, you need to increment the time manually as part of the iteration. If using loop, you do not need to do that.

So i guess the old version of sonicFoam didnt increment the time step during the iterated routine while the new version, which is using runtime.run() is calling a routine which is incrementing the time step somewhere in the process..

Georg.
GPesch is offline   Reply With Quote

Old   October 30, 2013, 08:00
Default
  #5
New Member
 
Join Date: Apr 2012
Posts: 6
Rep Power: 4
CoolKau is on a distinguished road
Quote:
Originally Posted by GPesch View Post
http://foam.sourceforge.net/docs/cpp...3d8c7fdc4638d9

This actually contains the same information as you already mentioned:

One is incrementing the time and is checking whether final time has been reached (loop), whilst the other one is only checking whether the final time has been reached (run), WITHOUT incrementing the timestep.

Please look into the 2 very short examples provided in my link to see how to use them: When using run, you need to increment the time manually as part of the iteration. If using loop, you do not need to do that.

So i guess the old version of sonicFoam didnt increment the time step during the iterated routine while the new version, which is using runtime.run() is calling a routine which is incrementing the time step somewhere in the process..

Georg.

Hi Georg,

thanks for your reply. Do you think you could check you sent the right link?

Also, so far I would think both functions work as they should. the time is iterated. However, I am still struggling to understand why both time function give different results. They both should just run the solver and stop it when the time limit is reached.
CoolKau is offline   Reply With Quote

Old   November 6, 2013, 03:08
Default
  #6
New Member
 
Join Date: Apr 2013
Posts: 24
Rep Power: 3
GPesch is on a distinguished road
Actually I wanted to post this link No idea what went wrong:

http://foam.sourceforge.net/docs/cpp/a02307.html

Does sonicFoam 2.2.1 is giving you different results than sonicFoam 2.1.1 (in the original version without changing anything)?
Or do the differences only appear when you start changing from runTime.loop() to runTime.run() (or the other way round) in one of the two solvers?
GPesch is offline   Reply With Quote

Old   August 5, 2014, 13:14
Default
  #7
New Member
 
Join Date: Apr 2012
Posts: 6
Rep Power: 4
CoolKau is on a distinguished road
Hi Georg,
I am sorry for the late reply because I went on to different projects outside of the CFD world.

2.2.1 and the original 2.1.1 give different results. When switching 2.1.1 over to runtime.run() (same as 2.2.1) both versions agree. Therefore I thought the error is not in the version but in the time iteration.
CoolKau 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
Difference between runTime.run() and runTime.loop() JimKnopf OpenFOAM Programming & Development 1 October 28, 2011 11:08


All times are GMT -4. The time now is 14:33.