CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (http://www.cfd-online.com/Forums/openfoam-installation/)
-   -   OpenFOAM updates (http://www.cfd-online.com/Forums/openfoam-installation/75478-openfoam-updates.html)

vaina74 April 27, 2010 07:59

OpenFOAM updates
 
I have some questions about git repository, I'm not so expert of linux. I have OpenFOAM 1.6 installed on Ubuntu 9.10. Have I to remove it, before installing 1.6.x, or can I update 1.6 directly? Is there a step-by-step guide for beginners? I read this and this thread, but maybe are about a first installation.
I'm afraid to not be able to update my OpenFOAM version, but I'd like to improve omega wall functions and other stuff.
Thank you for your help.

wyldckat April 27, 2010 09:19

Greetings vaina74,

Technically you can use either scripts in those threads. Nonetheless, the script indicated in the second thread is more powerful and can make use of already existing packages you've downloaded previously. If you want to use the 1st script, you could just steal the lines of code and run only those lines that will help you get and build the 1.6.x version.

OpenFOAM 1.6 and 1.6.x are designed to live side by side. Both scripts take this into account and keep a single ThirdParty folder shared between the two versions.

An additional tip: by concept, the first script only allows the 1.6.x to be active at the start of a new terminal window. The second script allows you to choose an alias method to start the OpenFOAM environment.
In other words, after you've installed OpenFOAM 1.6.x, you could set-up in your $HOME/.bashrc script the following two lines of code:
Code:

alias startFoam16='. $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc'
alias startFoam16x='. $HOME/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc'

And then, when you start a new terminal window, you can choose which environment to activate, namely run startFoam16 for OpenFOAM 1.6 or startFoam16x for OpenFOAM 1.6.x. Of course if you don't like such a long alias name, you could just define as of16 and of16x or something like this.

I hope this wasn't too much information in one post, but this way it should answer a few questions you could have had in the near future ;)

Best regards,
Bruno

vaina74 April 27, 2010 09:56

Thank you very much for your exhaustive explanation. I'm going to download and run the second script. It'll be interesting compare the same case with two different version of OpenFOAM. I'll keep track of my success (ora failure) in updating the code.

vaina74 April 27, 2010 13:50

1 Attachment(s)
* Sigh *
I had an error (look at the attached file). I'm a newbie, I can't fix a gcc version conflict :(
Can you help me, please?

wyldckat April 27, 2010 16:38

Hello vaina74,

OK, two things first:
  1. which version of the script are you using? Because the order of items of the output is different from the current version. The latest version of the script is available here: openfoam-ubuntu
  2. what options did you choose?
But by what I can see, apart from the critical error that it says it has, it seems perfectly fine to me :)
It seems to have built everything, although for some strange reason, it is set to use gcc 4.3.3 although it used the system's version 4.4.1.

Basically, in order for it not to complain, you have to edit the settings.sh file that exists in OpenFOAM/OpenFOAM-1.6.x/etc and change where it says something like use compiler=OpenFOAM to =System...

Best regards,
Bruno

vaina74 April 27, 2010 17:12

1 Attachment(s)
1. I downloaded your post (n° 18) attached file, I thought it was the last one. Should I launch again the lastest version in openfoam-ubuntu?
2. So, do you want this script to also upgrade the packages? yes
Build code documentation? yes
Use Ubuntu's gcc compiler (will use OpenFOAM's otherwise)? yes [I'm not so sure]
Do you want the OpenFOAM environment to be set as default whenever you start a new terminal? no [Later I can edit $HOME/.bashrc script]
Should I do again all the procedure with another script and others settings?
I attach settings.sh.

Cheers,
Maurizio

wyldckat April 27, 2010 19:47

Greetings Maurizio,

Well, I think it's all working fine, so no need to use the latest script version. It seems a bit odd that there is a collision of gcc 4.3.3 vs 4.4.1, but my guess is that it's possible that there was something left over from OpenFOAM's 1.6 environment that remained even after the installOF.sh had started its own OpenFOAM 1.6.x environment.

Quote:

Originally Posted by vaina74 (Post 256550)
Do you want the OpenFOAM environment to be set as default whenever you start a new terminal? no [Later I can edit $HOME/.bashrc script]

That means that you should now have a line at the end of $HOME/.bashrc starting with "alias startFoam" :) Like I wrote before, you can now rename it to startFoam16x ;)

My advice now is to edit $HOME/.bashrc and do as I said on the #2 post: setup the two "alias", one for each OpenFOAM version. Then start the 1.6.x environment in a new terminal (by running startFoam16x) and run foamInstallationTest again to see if it still complains about version collisions! If I'm right, it now shouldn't complain again.


You should do a few tests with the usual OpenFOAM solvers and utilities on tutorial cases that you know well, and compare results between versions, to make sure that everything is OK.

I completely forgot to tell you to disable OpenFOAM's 1.6 environment before running the install script :( Hopefully no damage was done. I can only assume that there aren't any issues, since using the pre-built OpenFOAM 1.6 libraries and applications work just fine in Ubuntu 9.10 :)

Best regards,
Bruno

vaina74 April 28, 2010 04:13

In my $HOME/.bashrc I see
Code:

source $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc
alias startFoam=". ~/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc"

and I'll replace the second line with something as:
Code:

alias startFoam16=". $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc"
alias startFoam16x=". $HOME/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc"

Quote:

I completely forgot to tell you to disable OpenFOAM's 1.6 environment before running the install script
Do you mean I had to delete
Code:

source $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc
before launching the script? I'm asking to you because I want to write a step-by-step post, for those who will read this thread. Should I write
Code:

source $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc
source $HOME/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc
alias startFoam16=". $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc"
alias startFoam16x=". $HOME/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc"

or just
Code:

alias startFoam16=". $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc"
alias startFoam16x=". $HOME/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc"

?

Thank you again, best regards.
Maurizio

wyldckat April 28, 2010 06:07

Greetings Maurizio,

Quote:

Originally Posted by vaina74 (Post 256618)
Do you mean I had to delete
Code:

source $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc
before launching the script?

Yes, I forgot to tell you about that :(


Quote:

Originally Posted by vaina74 (Post 256618)
or just
Code:

alias startFoam16=". $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc"
alias startFoam16x=". $HOME/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc"

?

This is the correct solution :)
The other solution with "source" would activate OF 1.6 environment, and then OF 1.6.x and then set-up the alias... which would be a bit redundant :( and the OF 1.6.x would always be active.


Additionally, that dot after the first quote does the same as the command "source"... or at least it should. So you can choose either one. In other words, this is the same as the last quoted code:
Code:

alias startFoam16="source $HOME/OpenFOAM/OpenFOAM-1.6/etc/bashrc"
alias startFoam16x="source $HOME/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc"

Also, like I said before, if you feel that "startFoam16" is too long of a word, you could define it as "of16" or something like that ;)

And you're welcome :)
Best regards,
Bruno

vaina74 April 28, 2010 07:15

1. I edited $HOME/.bashrc, it'all ok.
2. Out of curiosity, I replaced compilerInstall=System with OpenFOAM in settings.sh and ran foamInstallationTest: no critical errors, but obviously simple actions as decomposePar don't work. I chose again System: gcc conflict critical error but decomposePar works.
3. I think something in OpenFOAM1.6.x (or ThirdParty-1.6.x) went wrong (gcc conflict?). I launched my case (simpleFoam on a airfoil) and forces libraries included in my controlDict don't work anymore:
Code:

Starting time loop
--> FOAM Warning :
    From function void forces::read(const dictionary& dict)
    in file forces/forces.C at line 278
    Could not find U, p or rho in database.
    De-activating forces.
--> FOAM Warning :
    From function void forces::read(const dictionary& dict)
    in file forces/forces.C at line 278
    Could not find U, p or rho in database.
    De-activating forces

What should I do? Should I delete 1.6.x folders and try to install OpenFOAM 1.6.x one more time or keep only 1.6? :(

wyldckat April 28, 2010 08:07

Hi Maurizio,

I forgot to mention at my first post, but I though it was a bit obvious: always make a backup before doing serious changes ;)

OK, before doing the following steps, can you firstly describe what force libraries are you using? Are they the ones from OpenFOAM or your own, or from some tutorial case from OpenFOAM 1.6? In other words, did you have to build the force libraries yourself, or you just used it after building OpenFOAM 1.6? Where is the specific force library located?


Now that I think about it, it makes more sense that you should have built OpenFOAM 1.6.x also with gcc 4.3.3. So, if I'm not mistaken, you don't need to remove anything. But keep in mind that the following steps are only to increase compatibility between libraries from OpenFOAM 1.6 and 1.6.x. For example, if you are using a custom solver, library or utility, you might not need to rebuild them for them to work with both versions.
The steps should be something along these lines:
  1. Change in settings.sh of OpenFOAM 1.6.x back to OpenFOAM compiler.
  2. Start a new clean terminal and set-up the OpenFOAM 1.6.x environment, by running startFoam16x.
  3. CAUTION: the following commands will erase the runs made in the tutorial folders of OpenFOAM 1.6.x and all 1.6.x application binaries and libraries; it won't delete anything from the ThirdParty folder.
    Run:
    Code:

    cd $WM_PROJECT_DIR
    wcleanAll
    wcleanLnIncludeAll

  4. Rebuild OpenFOAM 1.6.x, by running:
    Code:

    ./Allwmake > make2.log 2>&1
    This will make a second log of the build procedure, just in case. The first log is from when you ran the install script.
  5. Run foamInstallationTest and check again the know tutorial cases, as well as the desired applications.
Best regards,
Bruno

vaina74 April 28, 2010 08:55

To evaluate forces on my airfoil I use libforces.so, a standard library included in OpenFOAM-1.6(.x)/lib/linuxGccDPOpt. If I understand you correctly, I must rebuild OpenFOAM, as you described in the previous post.

wyldckat April 28, 2010 09:01

Quote:

Originally Posted by vaina74 (Post 256672)
To evaluate forces on my airfoil I use libforces.so, a standard library included in OpenFOAM-1.6(.x)/lib/linuxGccDPOpt. If I understand you correctly, I must rebuild OpenFOAM, as you described in the previous post.

I can only guess that: yes, you should rebuild OpenFOAM 1.6.x :( I think something went awfully wrong when OpenFOAM 1.6 environment affected 1.6.x's environment during installation.
Hopefully the steps I wrote are enough to get things going correctly. And don't forget to make backups once in a while ;)

vaina74 April 29, 2010 05:59

I rebuild OpenFOAM1.6.x and it's ok, no critical errors. But forces library still doesn't work, I have the same error. My case in OpenFOAM1.6 works instead, I don't understand that. And I notice ThirdParty-1.6 is a folder, ThirdParty-1.6.x is a link to the ThirdParty-1.6 folder: is it correct?
I can work with 1.6 but I'd like to fix 1.6.x. What should I do? Is there a procedure to fully reinstall the '1.6.x suite'? :(

vaina74 April 29, 2010 06:35

Maybe it's NOT an install question and forces library has been modified (and works differently).

wyldckat April 29, 2010 06:47

Greetings Maurizio,

It's normal to have ThirdParty-1.6.x linked to 1.6. This way you don't have an exact replica of the same folder, occupying space!

Well, this is very strange :confused: It should have worked fine like this :(

NOTE: I forgot it could be a version issue... some things change along time ;) OK, if that doesn't turn out well in adapting the case (I think the post #7 on that thread should work well), here is the steps you can follow:

You can install a new clean instance of OpenFOAM. Currently the script at "openfoam-ubuntu" has a simple glitch, that although it asks you where you want to install OpenFOAM, it doesn't change the path in bashrc... rendering it a bit misleading :( This weekend I hope to have it fixed. So, for now, you can do the following steps:
  1. You can remove the OpenFOAM-1.6.x folder and the ThirdParty-1.6.x link from the current installation, in case you want to save space.
  2. Then rename the $HOME/OpenFOAM folder to some other name.
  3. Then run the install script, using the standard options or whichever you wish to use.
  4. Then when it is all done, test your case that uses forces. If all goes well (and I hope it does), you can rename the latest installation of $HOME/OpenFOAM to$HOME/OpenFOAMx and the old installation back to $HOME/OpenFOAM.
  5. Then edit the bashrc file at OpenFOAM-1.6.x and change in the first lines of code (after the block of comments):
    Code:

    foamInstall=$HOME/$WM_PROJECT
    Change it to your folder
    Code:

    foamInstall=$HOME/OpenFOAMx
  6. Then fix the "alias" you have for 1.6.x in $HOME/.bashrc and voilá, a separate installation of OpenFOAM :)
I hope you can finally get things going, whichever method used :)

Best regards,
Bruno

vaina74 April 29, 2010 11:36

First, thank you very much for your time and your help. I'm testing some tips, other users experienced forces problems. Maybe somewhat changed in libforces.so and I have to edit the code in controlDict and the initial conditions.
If it works, I'll ask your pardon.
If it doesn't work, I'll follow your last suggestions.
If even it doesn't work, I keep on using 1.6 (and I'll wait for 1.7 ;)). I'm sure your script is fantastic, anyway :D

vaina74 April 29, 2010 12:33

Another stupid question of mine. I read on the terminal that your installation script notices the 2 cores. When I open a new terminal and set Openfoam-1.6.x environment, I read building on 2 cores. Now I'm in doubt: I usually use
Code:

decomposePar
and
Code:

foamJob -p -s simpleFoam
for my case. Maybe my parallel running is superfluos (on the terminal I read building on 2 cores twice) or even dangerous (is it in conflict?), I obtain:
Code:

mpirun noticed that process rank 1 with PID [4 digits] on node xxx-laptop
exited on signal 11 (segmentation fault)

after that my notebook freezes or explodes.
If I launch a simple simpleFoam, my case runs without problem (yes, the problem was in calling libforces.so, somewhat changed in the library or in using it).

wyldckat April 29, 2010 17:43

Hi Maurizio,

Uhm, "building on 2 cores" should not affect solver execution. It should only affect the building process, namely Allwmake and wmake!

Quote:

after that my notebook freezes or explodes.
:eek: What the ...?
The true reason for the crash should be related to some misconfiguration of OpenMPI. Does it work with OpenFOAM 1.6?

There is a test application in OpenFOAM that you can build for testing with OpenFOAM+OpenMPI. Run:
Code:

cd $WM_PROJECT_DIR
wmake applications/test/parallel

This will create an application named parallelTest in your user folder (more specifically, in $FOAM_USER_APPBIN). You can do this in both versions of OpenFOAM.
NOTE: when using OpenFOAM 1.6, there is a glitch that has been fixed in OpenFOAM 1.6.x; before running wmake, you will need to edit the file $WM_PROJECT_DIR/applications/test/parallel/parallelTest.C, search for the following lines (non lines contiguous):
Code:

                OPstream toMaster(Pstream::masterNo());
...
            IPstream fromMaster(Pstream::masterNo());
...
                IPstream fromSlave(slave);
...
                OPstream toSlave(slave);

and change them respectively to:
Code:

                OPstream toMaster(Pstream::scheduled,  Pstream::masterNo());
...
            IPstream fromMaster(Pstream::scheduled,  Pstream::masterNo());
...
                IPstream fromSlave(Pstream::scheduled, slave);
...
                OPstream toSlave(Pstream::scheduled, slave);

Then, go to your case that has the decomposePar already done and run:
Code:

foamJob -p -s parallelTest
It should output something similar to this (source: my wiki page on openfoamwiki.net :)):
Code:

Create time

[1]
Starting transfers
[1]
[1] slave sending to master 0
[1] slave receiving from master 0
[0]
Starting transfers
[0]
[0] master receiving from slave 1
[0] (0 1 2)
[0] master sending to slave 1
End

[1] (0 1 2)
Finalising parallel run

If all goes well, you've gotten an output similar to this one above. Otherwise, it's OpenMPI the one to blame, and it's the one you'll need to configure. Also, it could be a firewall issue... if you have one up and running!
Although you said you usually use foamJob... something is amiss :(

By what I can vaguely remember, last time I ran it in Linux (Ubuntu and OpenSUSE), I didn't need to edit anything for it to work properly, but my memory isn't all that good lately :(


On the other hand, didn't foamJob return any other useful information? It should have created a file named log with something in it... wait, probably has the same text that you posted...


Is there a tutorial case in OpenFOAM that uses libforces that I could test with?

Best regards,
Bruno

vaina74 April 30, 2010 07:41

Here I am :)
Everything is (almost) ok. I had no problems with parallel running in OpenFOAM-1.6 but I ran the parallel test. Or rather, I tried:
Code:

giulia@giulia-laptop:~$ cd $WM_PROJECT_DIR
giulia@giulia-laptop:~/OpenFOAM/OpenFOAM-1.6$ wmake applications/test/parallel
SOURCE=parallelTest.C ;  g++ -m32 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-40  -IlnInclude -I. -I/home/giulia/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude -I/home/giulia/OpenFOAM/OpenFOAM-1.6/src/OSspecific/POSIX/lnInclude  -fPIC -c $SOURCE -o Make/linuxGccDPOpt/parallelTest.o
parallelTest.C: In function ‘int main(int, char**)’:
parallelTest.C:63: error: no matching function for call to ‘Foam::OPstream::OPstream(int)’
/home/giulia/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/OPstream.H:88: note: candidates are: Foam::OPstream::OPstream(Foam::Pstream::commsTypes, int, Foam::label, Foam::IOstream::streamFormat, Foam::IOstream::versionNumber)
/home/giulia/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/OPstream.H:56: note:                Foam::OPstream::OPstream(const Foam::OPstream&)
parallelTest.C:69: error: no matching function for call to ‘Foam::IPstream::IPstream(int)’
/home/giulia/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/IPstream.H:89: note: candidates are: Foam::IPstream::IPstream(Foam::Pstream::commsTypes, int, Foam::label, Foam::IOstream::streamFormat, Foam::IOstream::versionNumber)
/home/giulia/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/IPstream.H:56: note:                Foam::IPstream::IPstream(const Foam::IPstream&)
parallelTest.C:84: error: no matching function for call to ‘Foam::IPstream::IPstream(int&)’
/home/giulia/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/IPstream.H:89: note: candidates are: Foam::IPstream::IPstream(Foam::Pstream::commsTypes, int, Foam::label, Foam::IOstream::streamFormat, Foam::IOstream::versionNumber)
/home/giulia/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/IPstream.H:56: note:                Foam::IPstream::IPstream(const Foam::IPstream&)
parallelTest.C:98: error: no matching function for call to ‘Foam::OPstream::OPstream(int&)’
/home/giulia/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/OPstream.H:88: note: candidates are: Foam::OPstream::OPstream(Foam::Pstream::commsTypes, int, Foam::label, Foam::IOstream::streamFormat, Foam::IOstream::versionNumber)
/home/giulia/OpenFOAM/OpenFOAM-1.6/src/OpenFOAM/lnInclude/OPstream.H:56: note:                Foam::OPstream::OPstream(const Foam::OPstream&)
make: *** [Make/linuxGccDPOpt/parallelTest.o] Errore 1

Who cares? However foamJob -p -s simpleFoam worked and works :D

OpenFOAM-1.6.x output seems to be better:
Code:

giulia@giulia-laptop:~/OpenFOAM/giulia-1.6.x/run/hydrofoil$ foamJob -p -s parallelTest
Parallel processing using OPENMPI with 2 processors
Executing: mpirun -np 2 /home/giulia/OpenFOAM/OpenFOAM-1.6.x/bin/foamExec parallelTest -parallel | tee log
Building on  2  cores
Building on  2  cores
/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  1.6.x                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 1.6.x-069803848c44
Exec  : parallelTest -parallel
Date  : Apr 30 2010
Time  : 12:42:54
Host  : giulia-laptop
PID    : 5601
[0]
Starting transfers
[0]
[0] master receiving from slave 1
Case  : /home/giulia/OpenFOAM/giulia-1.6.x/run/hydrofoil
nProcs : 2
Slaves :
1
(
giulia-laptop.5602
)

Pstream initialized with:
    floatTransfer    : 0
    nProcsSimpleSum  : 0
    commsType        : nonBlocking
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

[1]
Starting transfers
[1]
[1] slave sending to master 0
[1] slave receiving from master 0
[0] (0 1 2)
[0] master sending to slave 1
End

Finalising parallel run
[1] (0 1 2)

and NOW my case parallel running works! Paranormal phenomena, I guess.
If I am correct, to periodically update OF-1.6.x. I have to type:
Code:

cd $WM_PROJECT_DIR
git pull
./Allwmake >make.log 2>&1

Later I'll post a summary for OpenFOAM-1.6.x installation, coexisting with OF-1.6.


All times are GMT -4. The time now is 18:21.