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

foamListTimes: How to select latestTime or 0/ folder

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By JNSN

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 27, 2021, 14:04
Default foamListTimes: How to select latestTime or 0/ folder
  #1
Member
 
Petros Ampatzidis
Join Date: Oct 2018
Location: Bath, UK
Posts: 64
Rep Power: 7
petros is on a distinguished road
Hi all,

I hope I am not posting a question that has been previously answered.

Question
How can I use foamListTimes to get the latest time directory regardless the presence of just the 0/ folder? More specifically, if a folder contains 0/, 1000/, 2000/ time directories I want to select the 2000/ while if a folder contains only the 0/ folder then I want it to return 0/ with no problem.

Context
When I use
Code:
latestTime=$(foamListTimes -latestTime)
for a common postProcessing folder, say samples, everything works as expected as all the output is stored in different time directories.

However, when I intent to use the same piece of code for a probes folder then things are getting complicated as output for probes is written to a single time directory, and specifically the one that matches the startTime value.

Of course the alternative:
Code:
latestTime=$(foamListTimes -latestTime -withZero)
works well when there is only the 0/ folder but if there are more time directories, e.g. 0/, 1000/, 2000/ I get something like:
Code:
postProcessing/probes/0\n2000
The solution to this would be particularly useful for simulations that carry on from the latestTime and thus new time directories are created as output.
Any help will be much appreciated.

Best,
Petros
petros is offline   Reply With Quote

Old   January 28, 2021, 07:11
Default
  #2
Senior Member
 
JNSN's Avatar
 
Jan
Join Date: Jul 2009
Location: Hamburg
Posts: 137
Rep Power: 19
JNSN is on a distinguished road
Code:
latestTime=$(foamListTimes -latestTime  -withZero | tail -n 1)
should do the trick.



Best,

Jan
petros likes this.
JNSN is offline   Reply With Quote

Reply

Tags
foamlisttimes


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
[OpenFOAM.com] v1606+ Run Folder JSMOKA OpenFOAM Installation 5 December 18, 2016 19:47
polyMesh in /0 folder PanPeter OpenFOAM Running, Solving & CFD 1 August 11, 2016 07:00
[snappyHexMesh] SnappyHexMesh in parallel missing 0 folder libindaniel2000 OpenFOAM Meshing & Mesh Conversion 0 May 26, 2016 22:46
Cht tutorial in 15 braennstroem OpenFOAM Running, Solving & CFD 197 June 10, 2015 03:02
In CFX workbench, which surface, i have to select senCFX CFX 19 December 19, 2011 01:31


All times are GMT -4. The time now is 00:18.