CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Question regarding building/compiling OF codes, using wmake (https://www.cfd-online.com/Forums/openfoam/110071-question-regarding-building-compiling-codes-using-wmake.html)

Traib December 3, 2012 08:33

Question regarding building/compiling OF codes, using wmake
 
Hi,

I made some changes to the original codes in /opt directory, but when running an application it doesnot 'see' the changes and simply runs as originally programmed. So I am trying to use wmake command since that's what I think I should be doing but its says the 'linuxGCcDPopt' folder is missing, which means there's a lot more to do tahn simply change the codes.

I do not have much programming knowledge or experience so this is kind of complicated for me. Anyone please explain how this works? As I understand it wmake that I should use but there must be some files I must create to let the application know where the changes have been made and what other places are affected by the changes....???

If there's a certain method that I need to follow please explain, it would really be a great help...

wyldckat December 3, 2012 16:37

Greetings Traib,

The go-to tutorial I usually point people to is this one: http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam

The idea is to make a copy of the original code to a personal folder and then make the necessary modifications, so that the modified application will not collide with the original one.

Best regards,
Bruno

Traib December 4, 2012 02:48

Hi Bruno, thanks for the reply.

Actually I am making changes to the thermophysicalModels in the src directory. So I am confused about whether the method for creating an application is similar to making a library... ??? :confused::confused:

I was trying to use wmake by creating a folder Make inside the subdirectories where I make the changes since yesterday but it doesn't work (I checked the userguide and this method was explained there). Sorry if its stupid... :o

Anyways, now I am trying the method you suggested, but can you please tell me whether its right to built libraries in the same way???

Thanks again.

Bernhard December 4, 2012 03:53

For building libraries, you should use "wmake libso".

It is good practice not to change things in the original 'src', but copy the files first, and compile it into a different library into the user folder ($FOAM_USER_APPBIN, or _LIBBIN) with a different name (in Make/files). Only when that compiles, you should start making the changes.

Traib December 4, 2012 08:48

Hi Bernhard,

I tried compiling the changed files into a user library using 'wmake libso' as you suggested, but it seems there are a lot of header files included that i have to copy into the user directory and recompile into the user library. So I am now trying to find all the dependent and affected files. Right now it all seems too complex.

I have built an application by modifying reactingFoam following the steps provided in the document that Bruno suggested earlier, and it worked. But building libraries seems to be a problem.

Actually I am trying to modify the transport, reaction and janafThermo source codes but apparently its not as straight forward as I thought. Has anyone already done similar work already?? Please let me know, it would be very helpful.

Thanks.

Bernhard December 4, 2012 08:50

There is no need to copy all the files, as you can link them within Make/options (see any of these as an example). If you study a few of the options-files in any directory, you should get an idea of what you need there.

Traib December 4, 2012 08:59

Thanks for the quick reply,
I did check the Make/option files from some directories but the problem is when I try to link the modified code with those in he original directories, the compilation shows error regarding the "redefinitions" of the functions inside the file that I am compiling. Apparently the new name that I choose for the copied code is not recognized by the codes that it is linked to...

wyldckat December 4, 2012 16:35

Greetings to all!

@Traib: It starts to get a bit complicated along the way. Certain libraries cannot simply be copied-changed and be ready to work.

I think the quickest way to do things right is to do your own full build of OpenFOAM, leaving the original the way it is on "/opt". At least until you start to understand how OpenFOAM does things.

I don't know which Linux Distribution you're using, so I can only give you the general directions:
Best regards,
Bruno

Traib December 5, 2012 04:58

Hi Bruno,

I am using ubuntu 12.04 in my windows laptop with virtualbox for testing my codes and cases (in case I mess up things badly, I can simply back up my files and reinstall the whole thing :o) and to run full simulations I am using a supercomputer running on 12.04 LTS on which I do not make changes until I am certain about what I am doing.

I followed Bernard's comment and started building all the linked codes yesterday, and I think I ended-up doing something like what you have suggested. I copied the whole thermophysicalModels directory to user directory :D and compiled it with necessary modifications into a user library. It built the libraries (without changing their names) and now I have new Thermo files, though with the same names as the original versions. I tried a test case with reactingFoam and it seems to have no interference due to the new library files.

However, now I am trying to find out how the solver will make the distinctions between the old and new thermo files that are in two different locations. I checked rhoReactingFoam solver files and found Make/options.txt file where these libraries are defined, and my guess is that is where I make the changes. So I am defining them for every solver I use and try...

Thanks for the links, I am checking them now, and thanks a lot for your help.


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