CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (http://www.cfd-online.com/Forums/openfoam-installation/)
-   -   c++ libraries and solver compiling (http://www.cfd-online.com/Forums/openfoam-installation/84020-c-libraries-solver-compiling.html)

vaina74 January 18, 2011 10:24

c++ libraries and solver compiling
 
I'm talking about OF-1.5-dev. I'd like to compile the simpleSRFFoam solver and study the mixer tutorial case (they both are in /opt/OpenFOAM/OpenFOAM-1.5-dev/tutorials/simpleSRFFoam) but there is a c++ libraries version problem. I already met it with MRFSimpleFoam but a coworker of mine got rid of it by editing the links:
Code:

lrwxrwxrwx  1 maurizio maurizio        23 2011-01-18 15:10 libstdc++.so.6 -> /usr/lib/libstdc++.so.6
lrwxrwxrwx  1 maurizio maurizio        28 2011-01-18 15:10 libstdc++.so.6.0.10 -> /usr/lib/libstdc++.so.6.0.13

Anyway, this trick doesn't work for simpleSRFFoam: can somebody help me? I use Ubuntu 10.04 64-bit.

vaina74 January 19, 2011 02:36

I report the compiling error I refer to:
Code:

g++ -m64 -Dlinux64 -DDP -DFOAM_DEV_REVISION_NUMBER=1861 -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-40 -I/opt/OpenFOAM/OpenFOAM-1.5-dev/src/finiteVolume/lnInclude -I/opt/OpenFOAM/OpenFOAM-1.5-dev/src/turbulenceModels/RAS -I/opt/OpenFOAM/OpenFOAM-1.5-dev/src/transportModels -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude  -fPIC Make/linux64GccDPOpt/simpleSRFFoam.o -L/opt/OpenFOAM/OpenFOAM-1.5-dev/lib/linux64GccDPOpt \
            -lincompressibleRASModels -lincompressibleTransportModels -lfiniteVolume -lmeshTools -llduSolvers -lOpenFOAM -liberty -ldl  -lm -o /home/maurizio/OpenFOAM/maurizio-1.5-dev/applications/bin/linux64GccDPOpt/simpleSRFFoam
/opt/OpenFOAM/OpenFOAM-1.5-dev/lib/linux64GccDPOpt/libincompressibleRASModels.so: undefined reference to `std::ctype<char>::_M_widen_init() const@GLIBCXX_3.4.11'
collect2: ld returned 1 exit status
make: *** [/home/maurizio/OpenFOAM/maurizio-1.5-dev/applications/bin/linux64GccDPOpt/simpleSRFFoam] Errore 1

Please, can anyone help me to compile simpleSRFFoam?

vaina74 January 19, 2011 05:47

I also tried to compile simpleSRFFoam in OpenFOAM-1.7, but I failed. Which is the correct procedure? I launched wmake in /opt/openfoam171/tutorials/incompressible/simpleSRFFoam/simpleSRFFoam. What is my error?

wyldckat January 19, 2011 08:16

Hi Maurizio,

OK, lets step back a bit:
  • What were the steps you've taken to install OpenFOAM 1.5-dev?
  • What gcc version did you use to compile it?
  • Was 1.5-dev compiled on the same machine and Ubuntu version you are currently working on?
  • If we can know, why was OpenFOAM 1.5-dev installed in "/opt" and not in your home folder?
Best regards,
Bruno

vaina74 January 19, 2011 14:33

Hi, Bruno.

You're right, I gave no informations. That's just because I couldn't understand anything about libraries, compiling and so on.
OK, let's start again. I usually use OpenFOAM-1.7, but I just started to be involved with OpenFOAM-1.5-dev. First I installed it via CAE Team PPA, but soon I had problems with MRFSimpleFoam solver. I realized it needed to be builded when I downloaded some tutorials about rotating meshes. Anyway, wmake seemed not to work. I asked a coworker to help me - I'm having a work experience abroad - and he suggested to re-install OF-1.5-dev in an alternative way. I agreed, OF-1.5-dev via PPA has a very, very strange folder distribution.
Now I'm entering in a black box. I think he downloaded OF-1.5-dev from the company cluster and compiled it with gcc-4.3.1 (resident in the cluster or included in OF, I don't know). It was all OK - just have to open a second terminal, with OF-1.7 environment, to launch paraFoam (don't ask me why).Then I tried to compile MRFSimpleFoam solver (/opt/OpenFOAM/OpenFOAM-1-5-dev/tutorials/MRFSimpleFoam/MRFSimpleFoam) with wmake, but it didn't work - OF complained about gcc version or something similar. The guy solved that by 're-linking' the c++ libraries (see first post in this thread).
Yesterday I also tried to compile simpleSRFFoam but I had a similar problem. Why the re-linking trick doesn't work with it? We don't know. Anyway, he's still working at it.
Getting back to my problem, in the meantime I'd like to use OF-15-dev via CAE Team PPA (I didn't uninstall it yet). If I enter in /usr/share/doc/openfoam-dev-1.5/simpleSRFFoam/simpleSRFFoam, I find createFields.H, Make and simpleSRFFoam.H.gz (that I extracted). I launched wmake and obtained
Code:

Making dependency list for source file simpleSRFFoam.C
could not open file fvCFD.H for source file simpleSRFFoam.C
could not open file incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H for source file simpleSRFFoam.C
could not open file incompressible/RASModel/RASModel.H for source file simpleSRFFoam.C
could not open file SRFModel.H for source file simpleSRFFoam.C
could not open file setRootCase.H for source file simpleSRFFoam.C
could not open file createTime.H for source file simpleSRFFoam.C
could not open file createMesh.H for source file simpleSRFFoam.C
could not open file initContinuityErrs.H for source file simpleSRFFoam.C
could not open file readSIMPLEControls.H for source file simpleSRFFoam.C
could not open file continuityErrs.H for source file simpleSRFFoam.C
SOURCE=simpleSRFFoam.C ;  g++ -m64 -Dlinux64 -DDP -DFOAM_DEV_REVISION_NUMBER=exported -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3  -DNoRepository -ftemplate-depth-40 -I/usr/lib/OpenFOAM-1.5-dev/src/finiteVolume/lnInclude -I/usr/lib/OpenFOAM-1.5-dev/src/turbulenceModels/RAS -I/usr/lib/OpenFOAM-1.5-dev/src/transportModels -IlnInclude -I. -I/usr/lib/OpenFOAM-1.5-dev/src/OpenFOAM/lnInclude -I/usr/lib/OpenFOAM-1.5-dev/src/OSspecific/Unix/lnInclude  -fPIC -c $SOURCE -o Make/linux64Gcc/simpleSRFFoam.o
simpleSRFFoam.C:34:19: error: fvCFD.H: Nessun file o directory
simpleSRFFoam.C:35:80: error: incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H: Nessun file o directory
simpleSRFFoam.C:36:46: error: incompressible/RASModel/RASModel.H: Nessun file o directory
simpleSRFFoam.C:37:22: error: SRFModel.H: Nessun file o directory
simpleSRFFoam.C:44:28: error: setRootCase.H: Nessun file o directory
simpleSRFFoam.C:46:27: error: createTime.H: Nessun file o directory
simpleSRFFoam.C:47:27: error: createMesh.H: Nessun file o directory
simpleSRFFoam.C:49:35: error: initContinuityErrs.H: Nessun file o directory
simpleSRFFoam.C:61:39: error: readSIMPLEControls.H: Nessun file o directory
simpleSRFFoam.C:103:39: error: continuityErrs.H: Nessun file o directory
In file included from simpleSRFFoam.C:48:
createFields.H: In function ‘int main(int, char**)’:
createFields.H:1: error: ‘Info’ was not declared in this scope
createFields.H:1: error: ‘endl’ was not declared in this scope
createFields.H:2: error: ‘volScalarField’ was not declared in this scope
createFields.H:2: error: expected ‘;’ before ‘p’
createFields.H:16: error: ‘volVectorField’ was not declared in this scope
createFields.H:16: error: expected ‘;’ before ‘Urel’
createFields.H:30: error: ‘surfaceScalarField’ was not declared in this scope
createFields.H:30: error: expected ‘;’ before ‘phi’
createFields.H:43: error: ‘label’ was not declared in this scope
createFields.H:43: error: expected ‘;’ before ‘pRefCell’
createFields.H:44: error: ‘scalar’ was not declared in this scope
createFields.H:44: error: expected ‘;’ before ‘pRefValue’
createFields.H:45: error: ‘p’ was not declared in this scope
createFields.H:45: error: ‘mesh’ was not declared in this scope
createFields.H:45: error: ‘pRefCell’ was not declared in this scope
createFields.H:45: error: ‘pRefValue’ was not declared in this scope
createFields.H:45: error: ‘setRefCell’ was not declared in this scope
createFields.H:47: error: ‘singlePhaseTransportModel’ was not declared in this scope
createFields.H:47: error: expected ‘;’ before ‘laminarTransport’
createFields.H:49: error: ‘autoPtr’ was not declared in this scope
createFields.H:49: error: ‘incompressible’ has not been declared
createFields.H:51: error: ‘incompressible’ has not been declared
createFields.H:51: error: ‘Urel’ was not declared in this scope
createFields.H:51: error: ‘phi’ was not declared in this scope
createFields.H:51: error: ‘laminarTransport’ was not declared in this scope
createFields.H:52: error: ‘turbulence’ was not declared in this scope
createFields.H:55: error: ‘SRF’ has not been declared
createFields.H:57: error: ‘SRF’ has not been declared
createFields.H:58: error: ‘SRF’ was not declared in this scope
simpleSRFFoam.C:57: error: ‘runTime’ was not declared in this scope
simpleSRFFoam.C:59: error: ‘nl’ was not declared in this scope
simpleSRFFoam.C:68: error: ‘tmp’ was not declared in this scope
simpleSRFFoam.C:68: error: ‘fvVectorMatrix’ was not declared in this scope
simpleSRFFoam.C:70: error: ‘fvm’ has not been declared
simpleSRFFoam.C:73: error: ‘UrelEqn’ was not declared in this scope
simpleSRFFoam.C:77: error: ‘fvc’ has not been declared
simpleSRFFoam.C:77: error: ‘solve’ was not declared in this scope
simpleSRFFoam.C:80: error: expected ‘;’ before ‘AUrel’
simpleSRFFoam.C:81: error: ‘AUrel’ was not declared in this scope
simpleSRFFoam.C:83: error: ‘fvc’ has not been declared
simpleSRFFoam.C:84: error: ‘adjustPhi’ was not declared in this scope
simpleSRFFoam.C:87: error: ‘nNonOrthCorr’ was not declared in this scope
simpleSRFFoam.C:89: error: ‘fvScalarMatrix’ was not declared in this scope
simpleSRFFoam.C:89: error: expected ‘;’ before ‘pEqn’
simpleSRFFoam.C:94: error: ‘pEqn’ was not declared in this scope
simpleSRFFoam.C:109: error: ‘fvc’ has not been declared
simpleSRFFoam.C:118: error: expected ‘;’ before ‘Uabs’
make: *** [Make/linux64Gcc/simpleSRFFoam.o] Errore 1

what am I supposed to do? Maybe I missed some important steps, after installing OF-1.5-dev via PPA.

Anyway, in order to answer to your questions:

1. Described
2. 4.3.1 (I have 4.4.3 in my computer)
3. Yes, I refer to OpenFOAMs on my computer, running Ubuntu 10.04 LTS.
4. Why opt/ and not in home? Why not? There's not a particular reason, I thought it was usual. OpenFOAM-1.7 is also in opt/ (I followed the official instructions for Ubuntu in OpenFOAM homesite).

Thanks for your patience and sorry for the long post.
Regards,

wyldckat January 19, 2011 20:07

Hi Maurizio,

About the PPA version, did you run this command?
Code:

sudo apt-get install openfoam-dev-1.5-dev
Notice that there are two "-dev"! Then you have to start a new terminal and activate the respective environment.



As for the 1.5-dev version you have in "/opt":
  • Well, "/opt" allegedly is only the default installation folder for when installing in shared computers or clusters, or when installing with a ".deb" or ".rpm" package. The pain with this kind of installation is that most people will build OpenFOAM with root permissions, so it can be automatically placed in the "/opt" folder, since it's the easiest way. It's also potentially the most dangerous way of doing this, since if something goes wrong in a path definition somewhere during the build process, you could damage the Linux installation.
  • Secondly, as far as I can figure it out, the problem you are having is that the 1.5-dev version was installed in its already built version, without gcc 4.3.1 in the ThirdParty folder for 1.5-dev. In other words, you can use that OpenFOAM 1.5-dev installation, with the symbolic links fix, but you cannot build applications with gcc 4.4.3 to work with the one built with 4.3.1. At least, it's what I've been able do deduce from the information you provided.
So, how to fix this crazy ordeal? The simplest way I can think of is to rebuild 1.5-dev with your Ubuntu's gcc 4.4.3:
  1. First of all, DO NOT CHANGE TO ROOT user. Run this command for enabling your user direct access to the OpenFOAM folder in "/opt":
    Code:

    sudo o+w -R /opt/OpenFOAM
  2. Edit the file "/opt/OpenFOAM/OpenFOAM-1.5-dev/etc/settings.sh" and change where it says:
    Code:

    : ${compilerInstall:=OpenFOAM}
    change it to:
    Code:

    : ${compilerInstall:=system}
    It might not be exactly this line, but what matters is changing "OpenFOAM" to "system".
    Save and close.
  3. Start a new terminal and activate the respective environment:
    Code:

    . /opt/OpenFOAM/OpenFOAM-1.5-dev/etc/bashrc
  4. Make sure you have allocated all of the processing power in your machine to be used for building OpenFOAM 1.5-dev:
    Code:

    export WM_NCOMPPROCS=$(egrep "^processor" /proc/cpuinfo | wc -l)
    Or simply, for example:
    Code:

    export WM_NCOMPPROCS=4
    if your machine has 4 cores/threads.
  5. Clean up and fully build OpenFOAM 1.5-dev:
    Code:

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

    And wait a while... it takes about 20-30min on an i7 920, up-to 6h on a single core 2GHz machine...
    In the file "make.log" will be stored all of the messages for the whole build process.
  6. When it's done, run:
    Code:

    grep -e "Error " make.log | wc -l
    Notice the space between the word Error and the quote symbol. This command should give you the count of the number of errors that might have occurred during the build process:
    • If 0 is the resulting value, then all is well.
    • If a non zero value is returned, then something went very wrong :( Run:
      Code:

      tar -czf make.log.tar.gz make.log
      and attach the file on your next post.
  7. Finally, if all went well, reverse the first step:
    Code:

    sudo o-w -R /opt/OpenFOAM
And hopefully, you should be able to build any and all applications and libraries for OpenFOAM 1.5-dev. And remember that you should copy the desired tutorial case or the whole tutorials folder to your user folder, so you can keep the version in "/opt" untouched!

As for making the ParaView version from OpenFOAM 1.7 work with 1.5-dev... I'll try to explain that tomorrow :( I'm too tired today...

Best regards and good luck!
Bruno

vaina74 January 20, 2011 10:30

Thank you, thank you, thank you very much, Bruno. Your answer is very exhaustive, we are working on it. It's like a tutorial, I hope it will be useful for someone else.
Quote:

As for making the ParaView version from OpenFOAM 1.7 work with 1.5-dev... I'll try to explain that tomorrow I'm too tired today...
We're very interested in a solution, even if it's not such a problem to open a new terminale for OF17 environment and launch paraFoam for the current case. Anyway, don't lose your sleep and patience too: you're too precious.
Thanks for your unbelievable availibility, regards.

wyldckat January 20, 2011 19:42

Hi Maurizio,

I hope by now the build is up and running :)
As for getting ParaView 3.8.1, that comes with OpenFOAM 1.7.1 from OpenCFD's official Debian packages for Ubuntu, to work in 1.5-dev is very simple:
  1. Edit the file, in your case, "/opt/OpenFOAM/OpenFOAM-1.5-dev/etc/bashrc";
  2. Find the part where it says:
    Code:

    # Source user setup files for optional packages
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # _foamSource $WM_PROJECT_DIR/etc/apps/paraview/bashrc
    _foamSource $WM_PROJECT_DIR/etc/apps/paraview3/bashrc
    _foamSource $WM_PROJECT_DIR/etc/apps/ensightFoam/bashrc
    # _foamSource $WM_PROJECT_DIR/etc/apps/cint/bashrc

    Change it to this:
    Code:

    # Source user setup files for optional packages
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # _foamSource $WM_PROJECT_DIR/etc/apps/paraview/bashrc
    # _foamSource $WM_PROJECT_DIR/etc/apps/paraview3/bashrc
    _foamSource /opt/openfoam171/etc/apps/paraview3/bashrc
    _foamSource $WM_PROJECT_DIR/etc/apps/ensightFoam/bashrc
    # _foamSource $WM_PROJECT_DIR/etc/apps/cint/bashrc

    Save and close!
    This is the quickest pseudo-hack for using this version.
  3. Now, for the finishing touch - with the respective 1.5-dev environment activated, run:
    Code:

    sed -i -e 's=\.OpenFOAM=\.foam=' $WM_PROJECT_DIR/bin/paraFoam
    This will change the file extension to be used for telling ParaView to open OpenFOAM cases. As of ParaView 3.8.0, Takuya's reader is part of the mainstream build, therefore you can enjoy the ready to be used internal reader :)
Hopefully, you'll finally have the whole artillery up and running and ready to go :D

Best regards,
Bruno

vaina74 January 21, 2011 02:49

Thanks for your reply, I'll apply your hints. Anyway, I forgot a little question: about OpenFOAM-1.5-dev, what do you mean with
Quote:

About the PPA version, did you run this command?
Code:
sudo apt-get install openfoam-dev-1.5-dev
I only installed openFOAM-1.5-dev via CAE Team PPA, had I to install both packages to make that OF version work?


UPDATE
Your hints work! But I have an unexpected error when launching paraFOAM (it's just a warning, I can make post-procession anyway):
Code:

Warning: In /home/opencfd/OpenFOAM/ThirdParty-1.7.x/ParaView-3.8.1/VTK/IO/vtkOpenFOAMReader.cxx, line 4273
vtkOpenFOAMReaderPrivate (0x39ecb60): Different time directories with the same time value 0.5 and 0.1 found. 0.1 will be ignored.
Warning: In /home/opencfd/OpenFOAM/ThirdParty-1.7.x/ParaView-3.8.1/VTK/IO/vtkOpenFOAMReader.cxx, line 4273
vtkOpenFOAMReaderPrivate (0x39ecb60): Different time directories with the same time value 0.4 and 0.2 found. 0.2 will be ignored.
Warning: In /home/opencfd/OpenFOAM/ThirdParty-1.7.x/ParaView-3.8.1/VTK/IO/vtkOpenFOAMReader.cxx, line 4273
vtkOpenFOAMReaderPrivate (0x39ecb60): Different time directories with the same time value 0 and 0.3 found. 0.3 will be ignored.

It seems to be a mpirun error (I launched the test tutorial case icoFoam with no parallel computation). Indeed, if I edit the /opt/OpenFOAM/OpenFoam-1.5-dev/etc/bashrc
Code:

# Compilation options (architecture, precision, optimised, debug or profiling)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export WM_NCOMPPROCS=2

and set the number of processors to 1, it works. Is there a solution to fix the problem? I'd like to launch a single processor or a parallel running without editing the above file.

karamiag January 21, 2011 08:20

To solve the error when launching paraFOAM you can try to modify the file
~/OpenFOAM/OpenFOAM-1.5-dev/bin/paraFoam

or what comes out from the command
which paraFoam

adding
export LC_ALL=C

at the end of the file just before
paraview --data="$caseFile"

vaina74 January 21, 2011 08:43

I already know that little trick, I used myself. But I didn't think the trouble was about that because paraFoam with OF-1.7 solved cases already worked fine.
Anyway, I trusted you and applied your hint. I can't believe it, you're right :-)
Thanks.

wyldckat January 21, 2011 15:29

Hi Maurizio,

Quote:

Originally Posted by vaina74 (Post 291497)
Thanks for your reply, I'll apply your hints. Anyway, I forgot a little question: about OpenFOAM-1.5-dev, what do you mean with I only installed openFOAM-1.5-dev via CAE Team PPA, had I to install both packages to make that OF version work?

Yes, you have to install this second package, because it's the one that has the whole artillery for building OpenFOAM stuff for that version! It should include wmake, respective building rules and other miscellaneous files. Hence the two "-dev" in the package name. The first package is just for running OpenFOAM 1.5-dev.


Quote:

Originally Posted by vaina74 (Post 291497)
Indeed, if I edit the /opt/OpenFOAM/OpenFoam-1.5-dev/etc/bashrc
Code:

# Compilation options (architecture, precision, optimised, debug or profiling)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export WM_NCOMPPROCS=2

and set the number of processors to 1, it works. Is there a solution to fix the problem? I'd like to launch a single processor or a parallel running without editing the above file.

That's very odd, because the flag "WM_NCOMPPROCS" should only apply for building OpenFOAM binaries, it shouldn't be used for anything else!


Quote:

Originally Posted by vaina74 (Post 291547)
I already know that little trick, I used myself. But I didn't think the trouble was about that because paraFoam with OF-1.7 solved cases already worked fine.
Anyway, I trusted you and applied your hint. I can't believe it, you're right :-)
Thanks.

Wow, I didn't even remember that little issue could still haunt us :) that fix was only applied to OpenFOAM 1.7.1 and 1.7.x. Any version prior to these do not have the miracle string :) I'm not sure if this has been fixed in 1.6-ext either...

Best regards,
Bruno

vaina74 January 21, 2011 15:43

Quote:

Yes, you have to install this second package, because it's the one that has the whole artillery for building OpenFOAM stuff for that version! It should include wmake, respective building rules and other miscellaneous files. Hence the two "-dev" in the package name. The first package is just for running OpenFOAM 1.5-dev.
I couldn't imagine that! That's why nothing worked :eek:
I think this info is essential (for not so expert users like me), I can't understand why the installation wiki page misses it (or didn't i read well?). I thought the 2nd 'dev' meant 'this stuff is under development, take care, it's not stable'. I'm going to test it.About export LC_ALL=C, I didn't think of it because OpenFOAM-1.6.x express this trouble in a different way: paraFOAM opened without warnings, but it didn't show anything.
A special thank to Bruno e grazie anche a te, Giovanni :)

wyldckat February 3, 2012 18:43

Greetings,

Sorry for fishing this post out of the past, but after I saw a reputation detail given today to my post #6, I noticed a glitch on my own instructions. The fix is shown in bold below:
Quote:

Originally Posted by wyldckat (Post 291227)
  • 1. First of all, DO NOT CHANGE TO ROOT user. Run this command for enabling your user direct access to the OpenFOAM folder in "/opt":
    Code:

    sudo chmod o+w -R /opt/OpenFOAM
  • 7. Finally, if all went well, reverse the first step:
    Code:

    sudo chmod o-w -R /opt/OpenFOAM

Best regards,
Bruno


All times are GMT -4. The time now is 07:32.