CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   OpenFOAM - Quick way to delete previous calculation & HowTo get access to variables (https://www.cfd-online.com/Forums/openfoam/75209-openfoam-quick-way-delete-previous-calculation-howto-get-access-variables.html)

kriz April 19, 2010 11:18

OpenFOAM - Quick way to delete previous calculation & HowTo get access to variables
 
Hi!

Is there a quick way to delete all previous timesteps in a calculation (e.g. a script, deleting all directories regarding the time-steps w/o the "0" directory)?

plus: how can I tell the solver which variables to write to the result file - using buoyantBoussinesqPisoFoam I would like to have access to e.g. k and eps for post-processing.

Regards,
Kriz

eelcovv April 19, 2010 12:18

Hi Kriz,

Just install pyFoam, a great set of python utilities by Bernhard Gschaider for doing all kind of openfoam tasks. Have a look at
http://openfoamwiki.net/index.php/Contrib_PyFoam

For clearing your case directory, it would become one single command:

pyFoamClearCase.pl .

Regards,

Eelco

gschaider April 19, 2010 13:02

Quote:

Originally Posted by kriz (Post 255291)
Hi!

Is there a quick way to delete all previous timesteps in a calculation (e.g. a script, deleting all directories regarding the time-steps w/o the "0" directory)?

There might be a script in OpenFOAM-1.6/bin (only had a quick glance and nothing caught my fancy)

It's not an uncommon task. I usually use http://openfoamwiki.net/index.php/Co...amClearCase.py for that (but usually every computer I touch becomes polluted with that stuff, so this is the easiest thing to do for ME, not necessarily for everyone)

Quote:

Originally Posted by kriz (Post 255291)
plus: how can I tell the solver which variables to write to the result file - using buoyantBoussinesqPisoFoam I would like to have access to e.g. k and eps for post-processing.

That was discussed last week (I think the discussion was about rho) and two functionObjects that do that were referenced

Just curious: are you sure you're using a turbulence model that HAS k/epsilon (because usually such a turbulence model writes these out)

Bernhard

mixkats February 14, 2018 18:16

There is a command included in OpenFOAM that lists all of the time directories, you just just have to type > foamListTimes.

Now, if you want to remove all those directories, you type > foamListTimes -rm

piu58 February 15, 2018 00:27

Code:

mv 0 O
rm -r 0*
rm -r 1*
rm -r 2*
rm -r 3*
rm -r 4*
rm -r 5*
rm -r 6*
rm -r 7*
rm -r 8*
rm -r 9*
mv O 0
rm -r postProcessing


RobertHB February 15, 2018 09:33

Or shorter
Code:

rm -r 0.* [1-9]*
removes all time folders but zero.

gschaider February 15, 2018 10:30

Quote:

Originally Posted by RobertHB (Post 681602)
Or shorter
Code:

rm -r 0.* [1-9]*
removes all time folders but zero.

Which can be problematic for some of the tutorial-cases that have a 0.orig-directory

Carlo_P July 31, 2019 02:59

Hey guys,

if you need, it is possible to use the command "foamCleanTutorials".
It is very usefull command to clean the directory.
Cheers,
Carlo

Yugal Sharma July 23, 2021 07:32

Quote:

Originally Posted by mixkats (Post 681507)
There is a command included in OpenFOAM that lists all of the time directories, you just just have to type > foamListTimes.

Now, if you want to remove all those directories, you type > foamListTimes -rm

Thanks it worked on OpenFoam version 2012 as well.

Yugal Sharma July 23, 2021 07:39

Quote:

Originally Posted by Carlo_P (Post 740565)
Hey guys,

if you need, it is possible to use the command "foamCleanTutorials".
It is very usefull command to clean the directory.
Cheers,
Carlo

But it also will remove the mesh-related files, (which are in constant/polymesh/ directory)
So you have to again do the meshing stuff (i.e.- blockMesh).
Basically, the foamCleanTutorial command makes your case's folder contain only the 0/, constant/, system/ directories. (and maybe someother files), more like a fresh case folder.

Hughtong September 1, 2021 02:23

decomposed
 
Quote:

Originally Posted by mixkats (Post 681507)
There is a command included in OpenFOAM that lists all of the time directories, you just just have to type > foamListTimes.

Now, if you want to remove all those directories, you type > foamListTimes -rm

This is useful when the time files are reconstructed, but when the time files are in decomposed processors use this is good :

rm -rf processor*/[time]
or
rm -rf processor*
to delete all processors

Yann September 1, 2021 09:42

For decomposed cases, you can also use foamListTimes with the processor option:

Code:

foamListTimes -processor -rm

Cheers,
Yann

Kar93 March 6, 2023 03:20

Vielen Danke.


All times are GMT -4. The time now is 16:10.