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

Delete files in different processors in Parallel running

Register Blogs Community New Posts Updated Threads Search

Like Tree10Likes
  • 5 Post By olesen
  • 5 Post By arvindpj

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 5, 2017, 01:45
Default Delete files in different processors in Parallel running
  #1
Member
 
Upuli
Join Date: Feb 2016
Posts: 68
Rep Power: 10
upuli is on a distinguished road
Dear All

Is there an easy way to delete a file in each processor in parallell running an openfoam case. For example to delete U file in each processor for last time step in a decomposed case openfoam.


Thanks and rgds

Upuli
upuli is offline   Reply With Quote

Old   January 5, 2017, 09:52
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,684
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by upuli View Post
Dear All

Is there an easy way to delete a file in each processor in parallell running an openfoam case. For example to delete U file in each processor for last time step in a decomposed case openfoam.
If you wanted to remove the entire directories, this would be much easier:
Code:
foamListTimes -processor -latestTime -rm
To remove just one field, you could combine with some shell commands, Eg,
Code:
latestTime=$(foamListTimes -processor -latestTime)
if [ -n "$latestTime" ]
then
    /bin/rm ./processor*/$latestTime/U
fi
olesen is offline   Reply With Quote

Old   January 5, 2017, 10:03
Default use OF's buildIn file management scripts
  #3
Member
 
Arvind Jay
Join Date: Sep 2012
Posts: 96
Rep Power: 14
arvindpj is on a distinguished road
You could use OF's buildIn file management scripts:

Code:
foamListTimes -processor // lists all the time directories

Code:
foamListTimes -processor -latestTime  // lists the latest time directorie

Code:
foamListTimes -processor -latestTime -rm // removes only the latest time directory

For removing only one file, you could use bash:

Code:
ls -d processor* | xargs -I {} rm -rf ./{}/0/U
Copying back from 0.orig to processor*
Code:
ls -d processor* | xargs -I {} cp -r 0.orig/U ./{}/0/U
in the above replace 0 with the latest time directory to delete only the U file in latest time

Cheers,
arvindpj is offline   Reply With Quote

Old   January 5, 2017, 22:47
Default
  #4
Member
 
Upuli
Join Date: Feb 2016
Posts: 68
Rep Power: 10
upuli is on a distinguished road
Dear all

thank you very much for your prompt replies. I'll try it.


rgds Upuli
upuli 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
Error running simpleFoam in parallel Yuby OpenFOAM Running, Solving & CFD 14 October 7, 2021 04:38
simpleFoam parallel AndrewMortimer OpenFOAM Running, Solving & CFD 12 August 7, 2015 18:45
running OpenFoam in parallel vishwa OpenFOAM Running, Solving & CFD 22 August 2, 2015 08:53
SigFpe when running ANY application in parallel Pj. OpenFOAM Running, Solving & CFD 3 April 23, 2015 14:53
Kubuntu uses dash breaks All scripts in tutorials platopus OpenFOAM Bugs 8 April 15, 2008 07:52


All times are GMT -4. The time now is 12:05.