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

Creating symbolic link instead of copy of a field?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 18, 2011, 19:58
Default Creating symbolic link instead of copy of a field?
  #1
Senior Member
 
chegdan's Avatar
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 543
Rep Power: 18
chegdan will become famous soon enough
hello all,

I have a domain that is quite large and have found that using symbolically linked files save a lot of space. For example, a polymesh file is 5 GB in size and rather than having a 5 GB file in each of my cases...i symbolically link my polymesh folder in these cases to the "original" polymesh folder. Is there a way to have a field when it write at a certain timestep to write a symbolic link to the original directory? This is useful when say we want to provide a velocity field to scalarTransportFoam and have U present in each timestep (so that when the solver continues it has all the info it needs). Thoughts? I can do this after the fact, but maybe people have ideas how to add another option to a solver field declaration that is ALWAYS_WRITE to ALWAYS_LINK_TO_START_TIME or something of that nature.

Cheers,
__________________
Dan

Find me on twitter @dancombest and LinkedIn
chegdan is offline   Reply With Quote

Old   December 19, 2011, 14:18
Default
  #2
Senior Member
 
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 397
Rep Power: 12
marupio is on a distinguished road
Hey Dan,

Interesting idea. Definitely possible. Just looking through src/OpenFOAM/include/OSspecific.H, the command you want to use is there: ln(source, destination).

To do it properly:

1. add another member data to IOobject holding the link-to path
2. add the link-to path as a parameter for the IOobject constructors, with default to fileName::null (or whatever) so as to not break the other million instances of IOobject constructors.
3. If you want to add an enumeration option "ALWAYS_LINK_TO_START_TIME", feel free, but you could also take the non-emptiness of this linkToPath_ to indicate such. (You know, you might want to have the linkToPath read in from an inputDictionary so the user can change its behaviour).
4. Change regIOobject.write so that it performs this ln() command if linkToPath != fileName::null, right before returning osGood;

That solution requires changes to the core of OpenFOAM. You could always hack it to make it work without that, using derived classes. Create a custom derived volScalarFieldWithLinking or whatever, inherit volScalarField, give it the linkToPath, and the constructor is entirely yours to command, so just add it to the parameter list. Override the writeData() function, and just before the end, use the ln() command. You should be able to use volScalarFieldWithLinking anywhere you can normally use a volScalarField.

Hope that helps!
__________________
~~~
Follow me on twitter @DavidGaden
marupio is offline   Reply With Quote

Old   December 19, 2011, 14:46
Default
  #3
Senior Member
 
chegdan's Avatar
 
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 543
Rep Power: 18
chegdan will become famous soon enough
Dave,

Thanks for the point in the right direction. I'll give it a try and see what I get.

Thanks again.
__________________
Dan

Find me on twitter @dancombest and LinkedIn
chegdan 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
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51
Phase locked average in run time panara OpenFOAM 2 February 20, 2008 15:37
Parallel LES computation stops with reason vvqf OpenFOAM Running, Solving & CFD 4 March 6, 2006 08:55
Creating a mesh of the flow field in GAMBIT Vidya Raja FLUENT 0 October 3, 2005 09:53


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