|
[Sponsors] |
January 27, 2020, 11:56 |
Write Control at Specified Times
|
#1 |
New Member
Mark
Join Date: Oct 2018
Posts: 18
Rep Power: 8 |
I am running a combustion simulation model in OpenFoam and would like to write out my solution only at specified times.
So, my model runs for 8000 timeSteps and I would like to only write down solutions at 5500, 5782, 6245 and other times. I can create a separate case and change its end-time to those specified times as follows: foamDictionary -entry "writeInterval" -set "1" system/controlDict foamDictionary -entry "purgeWrite" -set "1" system/controlDict foamDictionary -entry "endTime" -set "5782" system/controlDict However, with the above method, I need to clone the case and change my endTime for every desired time-based solution. I would like to sample about 30 different solution times quite far from each other meaning I cannot write out all 8000 time-steps due to storage issues. Is there any way to do that? Thank you! |
|
January 27, 2020, 15:48 |
|
#2 |
Senior Member
Join Date: Aug 2015
Posts: 494
Rep Power: 15 |
Couldn't you, with a single simulation, run until 5500 and (write and) stop. Then restart and run until your next cutoff (and stop), etc... ? You would just need to edit the controlDict accordingly before each restart (and make sure to make startTime latestTime). No programming necessary.
Caelan |
|
February 11, 2020, 09:14 |
|
#3 |
New Member
Mark
Join Date: Oct 2018
Posts: 18
Rep Power: 8 |
Thank you for this suggestion!
I did just that and wrote a small python script that generates text that can be directly copied into your Allrun script: from itertools import tee, islice, chain def previous_and_next(some_iterable): prevs, items, nexts = tee(some_iterable, 3) prevs = chain([None], prevs) nexts = chain(islice(nexts, 1, None), [None]) return zip(prevs, items, nexts) list_of_times = [2425, 2733, 2735, 2737, 2738, 2984, 3001, 3307, 3309, 3311, 3312] for previous, item, nxt in previous_and_next(list_of_times): print('foamDictionary -entry "startTime" -set "%d" system/controlDict' %item) print('foamDictionary -entry "writeInterval" -set "1" system/controlDict') print('foamDictionary -entry "purgeWrite" -set "1" system/controlDict') print('foamDictionary -entry "endTime" -set "%d" system/controlDict' %nxt) print('runParallel -o $application') |
|
February 11, 2020, 09:42 |
|
#4 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13 |
might help a bit?
https://www.openfoam.com/documentati...e-control.html
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
March 11, 2020, 13:26 |
|
#5 |
New Member
Mark
Join Date: Oct 2018
Posts: 18
Rep Power: 8 |
Hi! Thanks for your response but I cannot seem to find (in the link you shared) a tool that would help me? I see conditioning like stop simulation if x occurs but not how to write out custom time steps? Thanks!
|
|
Tags |
controldict, openfoam v7 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Write data at specific times, not intervals | artymk4 | OpenFOAM | 7 | November 13, 2020 03:30 |
Write control options: Start writing after certain time? | redbullah | OpenFOAM Running, Solving & CFD | 0 | December 4, 2018 11:42 |
Residuals and forces spiraling out of control before failing | edomalley1 | OpenFOAM Running, Solving & CFD | 3 | September 7, 2018 11:42 |
[ANSYS Meshing] Match Control, is this weird or am I stupid? | Moufle | ANSYS Meshing & Geometry | 2 | November 18, 2015 17:00 |
benchmark: flow over a circular cylinder | goodegg | Main CFD Forum | 12 | January 22, 2013 12:47 |