CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Installation (https://www.cfd-online.com/Forums/openfoam-installation/)
-   -   [OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch (https://www.cfd-online.com/Forums/openfoam-installation/130113-compile-2-3-mac-os-x-patch.html)

alexeym April 1, 2015 07:39

Hi,

In the first line you have decided to write sd extension instead of sh. And as you also decided to add mount & source code directly to your .profile, you can comment the first line.

Quote:

Yes, I looked with the Finder. I don't know why but I really can't see all the files there.
https://www.google.fr/search?q=os+x+finder+hidden+files

KateEisenhower April 10, 2015 07:08

Thank you, everything is working now!

ajmas April 20, 2015 09:04

Can anyone indicate who contributed to the original patch files. I just want to be sure that you are referenced in the GitHub project here:

https://github.com/ajmas/OpenFOAM-2.3.x

Jack001 June 22, 2015 09:54

Incompatible mpicxx when linking library
 
I am trying to compile a turbulence model in OpenFoam 2.3.x on a Mac v10.10

I run `
Code:

wmake libso`
in my directory where I have all my code.

and get the following readout:

Code:

    SOURCE=gammaReThetatSST/gammaReThetatSST.C ;  mpicxx -m64 -fsignaling-nans  -ftrapping-math -DdarwinIntel64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O2  -DNoRepository -ftemplate-depth-100 -I/Users/oscarwilsby/OpenFOAM/OpenFOAM-2.3.x/src/turbulenceModels -I/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/transportModels -I/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -I/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/meshTools/lnInclude -I/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/turbulenceModels/incompressible/RAS/lnInclude -IlnInclude -I. -I/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/POSIX/lnInclude  -fPIC -Ddarwin -c $SOURCE -o Make/darwinIntel64GccDPOpt/gammaReThetatSST.o
    dyld: Library not loaded: /usr/local/Cellar/open-mpi/1.8.4/lib/libopen-pal.6.dylib
      Referenced from: /usr/local/bin/mpicxx
      Reason: Incompatible library version: mpicxx requires version 9.0.0 or later, but libopen-pal.6.dylib provides version 8.0.0
    /bin/sh: line 1: 50563 Trace/BPT trap: 5      mpicxx -m64 -fsignaling-nans -ftrapping-math -DdarwinIntel64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O2 -DNoRepository -ftemplate-depth-100 -I/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/turbulenceModels -I/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/transportModels -I/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -I/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/meshTools/lnInclude -I/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/turbulenceModels/incompressible/RAS/lnInclude -IlnInclude -I. -I/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/POSIX/lnInclude -fPIC -Ddarwin -c $SOURCE -o Make/darwinIntel64GccDPOpt/gammaReThetatSST.o
    make: *** [Make/darwinIntel64GccDPOpt/gammaReThetatSST.o] Error 133

Is this a matter of installing the correct version of some type of dependency? Please advise.

I have already tried `
Code:

brew update
` followed by `
Code:

brew unlink open-mpi
` and finally `
Code:

brew install open-mpi
` but the problem persists. It may be worth pointing out that if I do `
Code:

brew unlink open-mpi
` then when I run `
Code:

wmake libso
` I now get some compiler errors:


Code:

/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/lduInterface.H:100:26: note: hidden overloaded virtual function
          'Foam::lduInterface::initInternalFieldTransfer' declared here: type mismatch at 2nd parameter ('const labelUList &'
          (aka 'const UList<label> &') vs 'labelUList &' (aka 'UList<label> &'))
                virtual void initInternalFieldTransfer
                            ^
    gammaReThetatSST/gammaReThetatSST.C:240:24: error: conversion from 'tmp<GeometricField<double, fvPatchField, Foam::volMesh> >' to 'volScalarField'
          (aka 'GeometricField<scalar, fvPatchField, Foam::volMesh>') is ambiguous
            volScalarField magVort = sqrt(scalar(2))*mag(skew(fvc::grad(U_)));
                          ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/tmp.H:124:16: note: candidate function
            inline operator const T&() const;
                  ^
    /Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/GeometricField.H:359:9: note: candidate constructor
            GeometricField
            ^
    gammaReThetatSST/gammaReThetatSST.C:260:20: error: conversion from 'tmp<GeometricField<typename scalarProduct<SymmTensor<double>, Tensor<double>
          >::type, fvPatchField, Foam::volMesh> >' to 'volScalarField' (aka 'GeometricField<scalar, fvPatchField, Foam::volMesh>') is ambiguous
        volScalarField U2gradU = (sqr(U_)&&(fvc::grad(U_)));
                      ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/tmp.H:124:16: note: candidate function
            inline operator const T&() const;
                  ^
    /Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/GeometricField.H:359:9: note: candidate constructor
            GeometricField
            ^
    gammaReThetatSST/gammaReThetatSST.C:363:20: error: conversion from 'tmp<GeometricField<double, fvPatchField, Foam::volMesh> >' to 'volScalarField'
          (aka 'GeometricField<scalar, fvPatchField, Foam::volMesh>') is ambiguous
        volScalarField CDkOmegaPlus = max
                      ^              ~~~
    /Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/tmp.H:124:16: note: candidate function
            inline operator const T&() const;
                  ^
    /Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/GeometricField.H:359:9: note: candidate constructor
            GeometricField
            ^
    gammaReThetatSST/gammaReThetatSST.C:393:20: error: conversion from 'tmp<GeometricField<double, fvPatchField, Foam::volMesh> >' to 'volScalarField'
          (aka 'GeometricField<scalar, fvPatchField, Foam::volMesh>') is ambiguous
        volScalarField arg2 = min
                      ^      ~~~
    /Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/tmp.H:124:16: note: candidate function
            inline operator const T&() const;
                  ^
    /Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/GeometricField.H:359:9: note: candidate constructor
            GeometricField
            ^
    gammaReThetatSST/gammaReThetatSST.C:858:20: error: conversion from 'tmp<GeometricField<scalar, fvPatchField, Foam::volMesh> >' to 'volScalarField'
          (aka 'GeometricField<scalar, fvPatchField, Foam::volMesh>') is ambiguous
        volScalarField S2 = magSqr(symm(fvc::grad(U_)));
                      ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/tmp.H:124:16: note: candidate function
            inline operator const T&() const;
                  ^
    /Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/GeometricField.H:359:9: note: candidate constructor
            GeometricField
            ^
    gammaReThetatSST/gammaReThetatSST.C:864:20: error: conversion from 'tmp<GeometricField<scalar, fvPatchField, Foam::volMesh> >' to 'volScalarField'
          (aka 'GeometricField<scalar, fvPatchField, Foam::volMesh>') is ambiguous
        volScalarField CDkOmega =
                      ^
    /Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/tmp.H:124:16: note: candidate function
            inline operator const T&() const;
                  ^
    /Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/GeometricField.H:359:9: note: candidate constructor
            GeometricField
            ^
    gammaReThetatSST/gammaReThetatSST.C:895:20: error: conversion from 'tmp<GeometricField<double, fvPatchField, Foam::volMesh> >' to 'volScalarField'
          (aka 'GeometricField<scalar, fvPatchField, Foam::volMesh>') is ambiguous
        volScalarField gammaEff = max
                      ^          ~~~
    /Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/tmp.H:124:16: note: candidate function
            inline operator const T&() const;
                  ^
    /Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/GeometricField.H:359:9: note: candidate constructor
            GeometricField
            ^

Any help would be greatly appreciated!

ajmas June 22, 2015 10:47

@Jack001 Where are you getting the source from, to make it easier to compare note? - Thanks

Jack001 June 22, 2015 10:48

@ajmas Thank you for your reply. I assume you mean the source for the turbulence model. It can be found here: https://github.com/langfeldt/gammaReThetatSST

alexeym June 22, 2015 11:03

Hi,

@Jack001

Quote:

Originally Posted by Jack001 (Post 551540)
Code:

...
    dyld: Library not loaded: /usr/local/Cellar/open-mpi/1.8.4/lib/libopen-pal.6.dylib
      Referenced from: /usr/local/bin/mpicxx
      Reason: Incompatible library version: mpicxx requires version 9.0.0 or later, but libopen-pal.6.dylib provides version 8.0.0
...


In general this means, you have got OpenMPI binaries in /usr/local/bin and they conflict with OpenMPI, installed with Homebrew. After you do brew unlink, you remove Homebrew-installed OpenMPI from PATH and start using that other version.

Quote:

...
I now get some compiler errors:

Code:

/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/lduInterface.H:100:26: note: hidden overloaded virtual function
          'Foam::lduInterface::initInternalFieldTransfer' declared here: type mismatch at 2nd parameter ('const labelUList &'
          (aka 'const UList<label> &') vs 'labelUList &' (aka 'UList<label> &'))
                virtual void initInternalFieldTransfer
                            ^
    gammaReThetatSST/gammaReThetatSST.C:240:24: error: conversion from 'tmp<GeometricField<double, fvPatchField, Foam::volMesh> >' to 'volScalarField'
          (aka 'GeometricField<scalar, fvPatchField, Foam::volMesh>') is ambiguous
            volScalarField magVort = sqrt(scalar(2))*mag(skew(fvc::grad(U_)));
...


I would suggest to change

Code:

volScalarField magVort = sqrt(scalar(2))*mag(skew(fvc::grad(U_)));
to

Code:

volScalarField magVort(sqrt(scalar(2))*mag(skew(fvc::grad(U_))));
I.e. instead of assignment you use constructor. Other errors are of the same type.

Jack001 June 22, 2015 11:25

Hi,

@alexeym Wow! You were right, the make seems to be working now albeit with a few warnings. I will try later tonight to see if the linked library works.

But one question remains- why was assignment in the original code? Would it work on other systems the way it was originally written? I only ask because the code is obviously open source and many people have used it without those changes. Anyway - aside - I feel like I really need to learn c++ but diving into this source code places me in very deep water - i only have a basic understanding of c++ I should probably take the time to learn it though. What should I focus on learning in terms of c++ so that I can better understand OpenFoam source? (I am currently reading the OF manual)

I wish to thank you for your help- people like you in this community are a huge help to beginners like myself and I am immensely grateful for your time. Hopefully talk soon if I have more questions!

alexeym June 22, 2015 12:03

Hi,

Quote:

Originally Posted by Jack001 (Post 551559)
But one question remains- why was assignment in the original code? Would it work on other systems the way it was originally written?

This behaviour is compiler-depended. g++ can cope with assignment, while clang is in general is not so happy about them. In fact all those expressions in turbulence model should be written as constructors and not as assignments.

Quote:

What should I focus on learning in terms of c++ so that I can better understand OpenFoam source? (I am currently reading the OF manual)
I do not know. That thing with assignment is implementation nuance, and I know about it cause already tried to build similar code on OS X. Except that, turbulence model code (gammaReThetatSST) is straight-forward.

Jack001 June 23, 2015 10:58

@alexeym

Seems like I wasn't quite over the hurdle:


After running
Code:

wmake libso
I get

Code:

'/Users/ow222/OpenFOAM/ow222-2.3.x/platforms/darwinIntel64GccDPOpt/lib/libGammaReThetatSST.dylib' is up to date.
But when I run
Code:

simpleFoam
in my case directory I get:


Code:

--> FOAM FATAL ERROR:
Unknown RASModel type gammaReThetatSST

Valid RASModel types:

18
(
LRR
LamBremhorstKE
LaunderGibsonRSTM
LaunderSharmaKE
LienCubicKE
LienCubicKELowRe
LienLeschzinerLowRe
NonlinearKEShih
RNGkEpsilon
SpalartAllmaras
kEpsilon
kOmega
kOmegaSST
kkLOmega
laminar
qZeta
realizableKE
v2f
)


    From function RASModel::New(const volVectorField&, const surfaceScalarField&, transportModel&, const word&)
    in file RASModel/RASModel.C at line 140.

FOAM exiting

So it seems the library is not yet linked? I placed my directory containing the make files and source in a directory called mygammaReThetatSST in side my OpenFOAM-2.3.x directory, but maybe I should have placed them inside OpenFOAM-2.3.x/src/turbulenceModels/incompresssible/RAS instead? would this make a difference? Can I simpy copy my directory to there and rerun
Code:

wmake libso
or will I screw things up ?

Edit:

I tried placing the source code for the turbulence model in the directory OpenFOAM-2.3.x/src/turbulenceModels/incompresssible/RAS (where all the other turbulence models are located) and modifying the Make/files and to include the new source code. I then run wmake libso in that directory but I now get this error:

/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/wmake/Makefile:152: *** multiple target patterns. Stop.

alexeym June 23, 2015 11:37

Hi,

It is not enough just to compile library, you need to load it. See for example $FOAM_TUTORIALS/incompressible/pimpleFoam/TJunctionFan/system/controlDict. In your case it should be something like

Code:

libs
(
    "libGammaReThetatSST.dylib"
);

If you copy model folder into src/turbulenceModels/incompresssible/RAS, Make folder in src/turbulenceModels/incompressible starts conflicting with Make folder your model.

And this time the problem really has nothing to do with OS X patch.

Jack001 June 23, 2015 11:45

Hi,

@alexeym

Yes I do have exactly that at the end of my system/controlDict which is why I'm confused.


Edit:
I was in the wrong OpenFoam directory. Now it seems to run at least but I get this:

Code:

Selecting incompressible transport model Newtonian
Selecting RAS turbulence model gammaReThetatSST
#0  Foam::error::printStack(Foam::Ostream&)An admin user name and password is required to enter Developer Mode.
Admin user name (ow222): ow222
Password:
 in "libOpenFOAM.dylib"
#1  0x0 in "/Users/ow222/OpenFOAM/OpenFOAM-2.3.x/platforms/darwinIntel64GccDPOpt/bin/simpleFoam"
Segmentation fault: 11

Sorry should I begin a thread elsewhere for this problem? Just hoping you can continue helping me with it! :)

alexeym June 23, 2015 15:02

Hi,

Can you provide your case? Right now I can only see that it is sigSegv, i.e. somebody tries to corrupt memory. It is hard to tell where exactly it is happening and cause of it.

You can start new thread about gammaReThetatSST, as a) our discussion is not about OS X patch, b) somebody experienced in gammaReThetatSST can answer your question.

Jack001 June 23, 2015 17:14

Hi

@alexeym

I started a new thread where I refer to the place you can get the case and everything else. Find this new thread at http://www.cfd-online.com/Forums/ope...tml#post551787

Thank you for your help.

arnolnic July 27, 2015 09:46

Hi

@alexeym

I am facing the same problem as KateEisenhower some time ago. Everytime I try to run SHM the quoted error occurs!
In comparison to Kate, I use the OF Version 2.3.0 on Mac OS X 10.9.5, so I guess I need a different patch to fix this "Scotch problem"?


Quote:

Originally Posted by KateEisenhower (Post 538098)
Then I performed the following steps in the motorBike directory:
1) I built the initial mesh with blockMesh and viewed it in ParaView. This worked.
2) Then I entered snappyHexMesh. I got the following output:
Code:

dyld: Symbol not found: __SCOTCHbgraphbipartststratab
  Referenced from: /usr/local/opt/scotch/lib/libptscotch.dylib
  Expected in: flat namespace
 in /usr/local/opt/scotch/lib/libptscotch.dylib
Trace/BPT trap: 5

Is this the proper way of proceeding? Does anyone know which point I am missing here?


alexeym July 28, 2015 06:49

Hi,

@arnolnic

Unfortunately your post contains too many unknowns. See post #177 for a list of standard questions. I even can not reproduce the error as I do not have neither OS X 10.9.5, nor OpenFOAM 2.3.0 installed.

arnolnic July 28, 2015 12:12

First of all thanks for your quick reply alexeym!


Second you are absolutely right, I should have provided some Information in the first place - better late than never:

Code:

sw_vers:

ProductName:    Mac OS X
ProductVersion:    10.9.5
BuildVersion:    13F1096

gcc --version:

Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

clang --version:

Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

Now to the problem I am facing:
When I try to run the snappyHexMesh tool (e.g. execute on the iglooWithFridges tutorial case), the following error occurs, which is the exact same error message @KateEisenhower stumbled on in post #175

Code:

dyld: Symbol not found: __SCOTCHbgraphbipartststratab
  Referenced from: /usr/local/opt/scotch/lib/libptscotch.dylib
  Expected in: flat namespace
 in /usr/local/opt/scotch/lib/libptscotch.dylib
Trace/BPT trap: 5

In post #179 you figured that it's due to a change in Homebrew's Scotch build process and that a patch would fix that problem. However, I use the OF Version 2.3.0. instead of 2.3.1. and I think I need a different patch?

alexeym July 28, 2015 17:47

Hi,

Yes, it is possible that I have updated patch for version 2.3.1 and did not for version 2.3.0. So yes, maybe you need the patch that does not exist yet. I will check and post an update during next several days.

arnolnic July 29, 2015 05:19

Thanks for your great effort, I really appreciate it!

alexeym July 29, 2015 05:53

Hi,

I have checked 2.3.0 patch and you have two choices:
  • Use "new Scotch" patch for 2.3.1 [1]. I.e. you download the patch into $HOME/OpenFOAM/OpenFOAM-2.3.0 (or wherever you installed OpenFOAM), issue "git apply OpenFOAM-2.3.1-scotch.patch", then "source etc/bashrc" (if your environment is not set up automatically) and run Allwmake script.
  • Correct $FOAM_SRC/parallel/decompose/ptscotchDecomp/Make/options yourself, adding -lscotch before -lptscotch in LIB_LIBS variable (this is what patch [1] basically does). Then run $FOAM_SRC/parallel/decompose/Allwmake script.

Also you can reference post 179, for compilation instructions, just change 2.3.1 to 2.3.0 in installation path and use [1] as patch download URL.

1. https://raw.githubusercontent.com/mr...1-scotch.patch


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