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

How can I copy a solver/class to my directory?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 12, 2016, 03:36
Default How can I copy a solver/class to my directory?
  #1
Member
 
Join Date: Apr 2016
Posts: 90
Rep Power: 10
CellZone is on a distinguished road
Hi,

I am trying to run a solver which is located on a network path. I allways copy tutorials from there to my network directory and run it. This works all well.

Now I would like to change some details in the source code of scr/fvOptions/sources/derived/effectivnessHeatExchangerSource/effectivnessHeatExchangerSource.H

Therefore I would like to make a backup copy and change only the copy. I have to save this copy on my local computer, since I do not have writing permission on network. But how do I tell all used solvers and fvOptions etc. where my classes are now located?

I read this http://www.cfd-online.com/Forums/ope...m-2-1-0-a.html

But this is for the whole solver? I only want to change one class.

Thank you for any help
CellZone is offline   Reply With Quote

Old   May 13, 2016, 07:56
Default
  #2
Senior Member
 
floquation's Avatar
 
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 20
floquation will become famous soon enough
You can trace the usage of the fvOptions file you mentioned back to
Code:
$FOAM_SRC/fvOptions/Make/files:

...
derivedSources=sources/derived
...
$(derivedSources)/effectivenessHeatExchangerSource/effectivenessHeatExchangerSource.C
...
LIB = $(FOAM_LIBBIN)/libfvOptions
Looking at this file, it can be seen that all fvOptions are compiled into one library: libfvOptions. This library is included in your case in the controlDict file.


---

If you want to create a custom version of the "effectiveness..."-class, you must either recompile this library (overwriting the original one), or you should create your own custom library. The latter would be a better idea.

To do so, you should copy all the related .H and .C files to your machine.
Then you should make a new Make/files (and Make/options) file as follows:
Code:
$MY_LOCATION/effectivenessHeatExchangerSource.C

LIB = $(FOAM_USER_LIBBIN)/libmyfvOptions
If you then compile this library, you will have a new library "myfvOptions" available in your $FOAM_USER_LIBBIN folder... That is, on the machine you compiled it at.

I'm not sure, but I think you should probably rename "effectivenessHeatExchangerSource" to "myeffectivenessHeatExchangerSource"... Then you can be certain which fvOptions your case uses. Otherwise it depends on how OpenFOAM implemented it, which I reckon is "first FOAM_USER_LIBBIN, then FOAM_LIBBIN".

---

If you wish to run this at your network location, you must have write access somewhere at that network location. If you don't, it is impossible to get your custom library there. If you do, store it in the network location's $FOAM_USER_LIBBIN directory (or set the FOAM_USER_LIBBIN environmental variable to where you choose to store it).

Sidenote:
If the network location has a different architecture than your local computer, you may need to do the compilation at the network location instead of at your local computer.
floquation is offline   Reply With Quote

Old   May 13, 2016, 13:28
Default
  #3
Senior Member
 
Mahdi Hosseinali
Join Date: Apr 2009
Location: NB, Canada
Posts: 273
Rep Power: 18
anishtain4 is on a distinguished road
It's as Kevin said,
it's usually a good idea to keep the same structure as the source code in your $WM_PROJECT_USER_DIR similar to $WM_PROJECT_DIR. You can use echo $... to check their address. If you keep it consistent you won't have any trouble accessing the files.
It's better to rename them after you copy them, you gotta rename any occurrences inside the files too.
Change the Make/file,options as Kevin mentioned.

The last step is to add
Quote:
lib("libmyfvOptions");
in system/controlDict for openFoam to be able to find your developments.
anishtain4 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
how to calculate mass flow rate on patches and summation of that during the run? immortality OpenFOAM Post-Processing 104 February 16, 2021 08:46
[OpenFOAM.org] Error creating ParaView-4.1.0 OpenFOAM 2.3.0 tlcoons OpenFOAM Installation 13 April 20, 2016 17:34
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 19:43
OpenFoam install script Error during paraFoam installation SePe OpenFOAM Installation 10 June 19, 2010 15:15
critical error during installation of openfoam Fabio88 OpenFOAM Installation 21 June 2, 2010 03:01


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