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

writeControl for certain times ?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By marupio
  • 1 Post By marupio

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 14, 2012, 21:03
Default writeControl for certain times ?
  #1
Member
 
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 15
gary7 is on a distinguished road
Hi all,

Is that possible to write solution out just at specified times? e.g I want solution at just 20*Dt, 40*Dt and 130*Dt. I don't wanna write out anything else, it's both messy and slow down the simulation...I appreciate any help

Cheers,
gary7 is offline   Reply With Quote

Old   March 16, 2012, 15:05
Default
  #2
Member
 
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 15
gary7 is on a distinguished road
I've not found the solution yet! any idea?
gary7 is offline   Reply With Quote

Old   March 16, 2012, 16:02
Default
  #3
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22
marupio is on a distinguished road
You could create a derived class of Time and use that in your solver. Give it the behaviour you want - perhaps extend its "writeInterval" to "writeIntervalList"...

Or if you want to hack it on your top level of your solver, you know how to write conditionals, and runTime.writeNow() forces it to write.
gary7 likes this.
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Old   March 16, 2012, 19:22
Default
  #4
Member
 
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 15
gary7 is on a distinguished road
Thank you David, well I'm a newbie in OpenFoam and C++...I'd really appreciate it if you could give me more details on that or maybe a code snippet so I can have a better picture of what I need to do...again thanks for your relpy
gary7 is offline   Reply With Quote

Old   March 16, 2012, 19:28
Default
  #5
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22
marupio is on a distinguished road
Sure, at the bottom of the solver you are running, it says "runTime.write();" In place of that, put this:

Code:
if
(
    mag(runTime.value() - runTime.deltaT().value() * 20) < SMALL)
 || mag(runTime.value() - runTime.deltaT().value() * 40) < SMALL)
 || mag(runTime.value() - runTime.deltaT().value() * 130) < SMALL)
)
{
    runTime.writeNow();
}
recompile, and then it should behave as you expect. Hope it works for you.

-Dave
gary7 likes this.
__________________
~~~
Follow me on twitter @DavidGaden

Last edited by marupio; March 16, 2012 at 19:29. Reason: Oops, changed && to or ||
marupio is offline   Reply With Quote

Old   March 18, 2012, 15:33
Default
  #6
Member
 
Kasra
Join Date: Jun 2010
Location: USA
Posts: 44
Rep Power: 15
gary7 is on a distinguished road
Thank you so much Dave, I really appreciate it
gary7 is offline   Reply With Quote

Reply


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
Transient DPM-About Start Stop times Julie FLUENT 3 January 24, 2014 07:39
benchmark: flow over a circular cylinder goodegg Main CFD Forum 12 January 22, 2013 11:47
writeControl and writeInterval preichl OpenFOAM 0 June 1, 2011 03:34
Drag coefficient is 1000 times smaller ! Cyril FLUENT 12 April 7, 2006 03:04
reporting cpu times jahangir Main CFD Forum 3 March 25, 2004 15:25


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