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

copy cache file to each processor

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   August 6, 2012, 16:54
Default copy cache file to each processor
  #1
Member
 
ak
Join Date: May 2011
Posts: 71
Rep Power: 6
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, 05:50
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,488
Blog Entries: 34
Rep Power: 86
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
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, 17:06
Default
  #3
Member
 
ak
Join Date: May 2011
Posts: 71
Rep Power: 6
newOFuser is on a distinguished road
Thanks!

Option 3 works like a charm!
newOFuser is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
groovyBC in openFOAM-2.0 for parabolic velocity bc ofslcm OpenFOAM 24 August 23, 2015 22:41
error message with modeling a cube with a hold at the center hsingtzu OpenFOAM Native Meshers: blockMesh 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
Compiling gmshFoam with OpenFOAM-1.5 BlGene Open Source Meshers: Gmsh, Netgen, CGNS, ... 10 August 6, 2009 04:26
DecomposePar links against liblamso0 with OpenMPI jens_klostermann OpenFOAM Bugs 11 June 28, 2007 17:51


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