CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   reconstruct certain time steps (https://www.cfd-online.com/Forums/openfoam/84934-reconstruct-certain-time-steps.html)

usergk February 12, 2011 14:43

reconstruct certain time steps
 
Hi

I have the time directories as 0, 0.001, 0.002 .... 0.499, 0.5 in the processors.

I want to reconstruct only 0, 0.05, 0.10, ... 0.40, 0.45, 0.50

I know one could individually generate these time directories, but is there a single statement that I could use to reconstruct at intervals of 0.05 instead of 0.001?

Thanks,
gk

olesen February 14, 2011 02:51

Quote:

Originally Posted by usergk (Post 294976)
Hi

I have the time directories as 0, 0.001, 0.002 .... 0.499, 0.5 in the processors.

I want to reconstruct only 0, 0.05, 0.10, ... 0.40, 0.45, 0.50

I know one could individually generate these time directories, but is there a single statement that I could use to reconstruct at intervals of 0.05 instead of 0.001?

There is no simple way to do this. The -times option can handle ranges, but doesn't handle step sizes (which can be a bit messy/fuzzy for non-integer values).
If you don't mind a small workaround:
Use a small Perl/Python/whatever program to generate the required list for you and then use it. For example,
Code:

reconstructPar $(myTimes) ...
where 'myTimes' would emit the required times list
Code:

-times 0,0.05,0.10,0.40,0.45,0.50
This might even prove more flexible for you than anything else that could be added to OpenFOAM.

usergk February 14, 2011 12:19

Thanks so much, Mark!

This looks quite convenient too.

gk

rmn_990 April 30, 2019 12:22

It doesn't have to be a time range. You can do it with this command:
Quote:

reconstructPar -time 0,0.05,0.10,0.40,0.45,0.50

Dohyun December 9, 2021 02:30

floating point loop command
 
I've solved this problem using a loop command in linux terminal as below.
The range from 36 to 38, with time interval 0.05.

Code:

for t in $(seq 36 .05 38); do reconstructPar -time $t; done

s1291 December 9, 2021 04:14

Without using an explicit for loop, try:

Code:


reconstructPar -time $(seq -s ',' 0 0.05 0.5)



All times are GMT -4. The time now is 21:38.