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

copy cache file to each processor

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 6, 2012, 17:54
Default copy cache file to each processor
  #1
Member
 
ak
Join Date: May 2011
Posts: 64
Rep Power: 15
newOFuser is on a distinguished road
Hi

I have to copy a data file, that each processor would require, into the respective constant directories of the processors.

Is there a simpler way to do this, than to manually do "cp constant/cachefile processor(n)/constant" for each of the N processors whenever I try to run a case.

Maybe a script that I can write just once, and use whenever a case is run?

Any help is appreciated.

Thanks!
ak
newOFuser is offline   Reply With Quote

Old   August 7, 2012, 06:50
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Hi newOFuser,

This command line will copy the file "file_name" as you asked:
Code:
for a in processor*; do cp constant/file_name $a/constant/file_name; done
The way I see it, you have 3 options:
  1. You can create an alias command for this line. For example, add this line to "~/.bashrc":
    Code:
    alias copy_constant_file='for a in processor*; do cp constant/file_name $a/constant/file_name; done'
  2. You can create a script and place it somewhere visible, namely in OpenFOAM's "bin" folder or on your home folder "~/bin".
  3. Or the best option, which gives you a better implied documentation method: use the same types of scripts as Allrun and Allclean that OpenFOAM's tutorials use! See for example the ones in "incompressible/simpleFoam/motorBike/".
Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   August 7, 2012, 18:06
Default
  #3
Member
 
ak
Join Date: May 2011
Posts: 64
Rep Power: 15
newOFuser is on a distinguished road
Thanks!

Option 3 works like a charm!
newOFuser 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
[swak4Foam] groovyBC in openFOAM-2.0 for parabolic velocity bc ofslcm OpenFOAM Community Contributions 25 March 6, 2017 11:03
[blockMesh] error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Meshing & Mesh Conversion 2 March 14, 2012 10:56
Problem installing on Ubuntu 9.10 -> 'Cannot open : No such file or directory' mfiandor OpenFOAM Installation 2 January 25, 2010 10:50
[Gmsh] Compiling gmshFoam with OpenFOAM-1.5 BlGene OpenFOAM Meshing & Mesh Conversion 10 August 6, 2009 05:26
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 18:51


All times are GMT -4. The time now is 13:46.