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

How should new class constructors be compiled and linked?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 18, 2014, 05:56
Default How should new class constructors be compiled and linked?
  #1
New Member
 
Kasper Linnestad
Join Date: Jun 2014
Posts: 8
Rep Power: 12
kasper1301 is on a distinguished road
Hi,

I am currently working on extending twoPhaseEulerFoam to include mutlicomponent mixtures in each phase . So far I have switched from the thermodynamic model rhoThermo to rhoReactionThermo and created the necessary fields in createFields.H.

The problem is that the mixture model (basicMulticomponentMixture) doesn't have a constructor that includes the phase names. I was therefore wondering on how to include a new constructor that includes phase names (similar to what is done in basicThermo). The implementation in itself looks quite straightforward, but I am unsure on how to extend the existing model with the new constructor.

The only solution that I can think of is to copy the whole reactionThermo folder, apply the changes and compile it to the user library. However, this will create a lot of duplicate code and I'm guessing there is a better way to do it. Does anyone know how to do it with less duplications?

I could compile the changes directly in the src folder, but I would rather not do any changes to the original source code.

Kasper
kasper1301 is offline   Reply With Quote

Old   July 18, 2014, 15:56
Default
  #2
New Member
 
Kalli
Join Date: Jul 2014
Posts: 9
Rep Power: 12
osha is on a distinguished road
I would have done the modification in following manner.

  1. Goto $WM_PROJECT_USER_DIR directory and create the following folders --> /src/thermophysicalModels/reactionThermo
  2. Modify the required code on basis of code available in OpenFOAM, like adding the required constructor, as you mentions or anything else.
  3. Edit 'files' and 'options' files in the 'Make' folder to include new code. Refer Make folder in reactionThermo folder to see how it has been written and modify the name of your *.C file and the lib file. for e.g libreactionThermophysicalModels as newlibreactionThermophysicalModels.
  4. Final step will involve wmake.
I believe this method will keep the the original source intact and you will be aware of your own library built on OpenFOAM.

I hope this helps.

Kalli

Last edited by osha; July 18, 2014 at 18:18.
osha is offline   Reply With Quote

Old   July 18, 2014, 16:10
Default
  #3
New Member
 
Kasper Linnestad
Join Date: Jun 2014
Posts: 8
Rep Power: 12
kasper1301 is on a distinguished road
Thanks for the reply!

I will try that once I get back from vacation

Another possibility that has arisen is to copy only the files that will be altered from the source folder, and link to the other original files. Since I am adding a constructor (without deleting the old ones), I believe that it is safe to create a user library that precedes the original library while all the other functionality is maintained (please correct me if I'm wrong).
kasper1301 is offline   Reply With Quote

Reply

Tags
compilation, constructor, library, library solver linking, linking

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interepreted Vs. Compiled UDFs Antonis Fluent UDF and Scheme Programming 10 March 22, 2018 12:15
customization can not be linked hpkidmr FLOW-3D 0 November 12, 2013 22:40
Compiled library vs. inInclude Files, DSMC solver crashes after run GPesch OpenFOAM Programming & Development 8 April 18, 2013 08:17


All times are GMT -4. The time now is 20:03.