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.com] Installing OpenFOAM with MPICH (https://www.cfd-online.com/Forums/openfoam-installation/221948-installing-openfoam-mpich.html)

venkcy November 6, 2019 04:56

Installing OpenFOAM with MPICH
 
Hello!


I am trying to install with mpich3.2 in CentOS7. I made couple of changes in the root folder.




In etc/bashrc, I have changed the following
Code:

export WM_MPLIB=MPICH
In etc/config.sh/mpi, I have changed the following
Code:

MPICH)
    export FOAM_MPI=mpich-3.2
    export MPI_ARCH_PATH=/home/D/mpich-3.2/install
    export MPI_HOME=$MPI_ARCH_PATH
    export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpich-3.2

    # Could be sourced from ThirdParty with incomplete environment
    if command -v _foamAddLibAuto > /dev/null 2>&1  # Normal sourcing
    then
        _foamAddPath    $MPI_ARCH_PATH/bin
        _foamAddMan    $MPI_ARCH_PATH/share/man
        _foamAddLib $MPI_ARCH_PATH/lib
    fi
    ;;

But while compiling the code I get the following error in both V1812 and V1906
Code:

/home/D/foam/OpenFOAM-v1812/src/OpenFOAM/lnInclude/IOobject.H:497:14: note: because ‘Foam::IOobject’ has user-provided ‘void Foam::IOobject::operator=(const Foam::IOobject&)’
  497 |        void operator=(const IOobject& io);
      |              ^~~~~~~~
In file included from /home/D/foam/OpenFOAM-v1812/src/OpenFOAM/lnInclude/postProcess.H:131,
                from coldEngineFoam.C:55:
../XiFoam/createFields.H: In function ‘int main(int, char**)’:
../XiFoam/createFields.H:3:9: error: ‘psiuReactionThermo’ was not declared in this scope
    3 | autoPtr<psiuReactionThermo> pThermo
      |        ^~~~~~~~~~~~~~~~~~
../XiFoam/createFields.H:3:27: error: template argument 1 is invalid
    3 | autoPtr<psiuReactionThermo> pThermo
      |                          ^
../XiFoam/createFields.H:5:5: error: ‘psiuReactionThermo’ is not a class, namespace, or enumeration
    5 |    psiuReactionThermo::New(mesh)
      |    ^~~~~~~~~~~~~~~~~~
../XiFoam/createFields.H:7:21: error: ‘thermo’ was not declared in this scope; did you mean ‘pThermo’?
    7 | psiuReactionThermo& thermo = pThermo();
      |                    ^~~~~~
      |                    pThermo
../XiFoam/createFields.H:7:38: error: ‘pThermo’ cannot be used as a function
    7 | psiuReactionThermo& thermo = pThermo();
      |                                      ^
../XiFoam/createFields.H:10:1: error: ‘basicSpecieMixture’ was not declared in this scope
  10 | basicSpecieMixture& composition = thermo.composition();
      | ^~~~~~~~~~~~~~~~~~
../XiFoam/createFields.H:10:21: error: ‘composition’ was not declared in this scope
  10 | basicSpecieMixture& composition = thermo.composition();
      |                    ^~~~~~~~~~~
In file included from /home/D/foam/OpenFOAM-v1812/src/OpenFOAM/lnInclude/postProcess.H:131,
                from coldEngineFoam.C:55:
../XiFoam/createFields.H:78:9: error: ‘laminarFlameSpeed’ was not declared in this scope
  78 | autoPtr<laminarFlameSpeed> unstrainedLaminarFlameSpeed
      |        ^~~~~~~~~~~~~~~~~
../XiFoam/createFields.H:78:26: error: template argument 1 is invalid
  78 | autoPtr<laminarFlameSpeed> unstrainedLaminarFlameSpeed
      |                          ^
../XiFoam/createFields.H:80:5: error: ‘laminarFlameSpeed’ is not a class, namespace, or enumeration
  80 |    laminarFlameSpeed::New(thermo)


I would like to know if I need to change anything else apart from these values.



Thanks for your time.

HPE December 4, 2019 17:06

Hmmm.. let's issue a ticket in the issue tracker in GitLab.

Any further information you can provide regarding your compilation?

venkcy December 13, 2019 03:14

Thanks for the reply!


Let me know the information will be required and helpful to identify the error?



I have used GCC 9 and MPICH 3.2 for compilation.

HPE December 20, 2019 11:56

I assume you've downloaded the mp* package into the ThirdParty dir?

LUQILIN December 25, 2019 19:17

One workaround
 
I have run into the same problem but I have figured it out on Ubuntu 18.04. But I bet it will work on Centos 8 as well. Here is what I propose, you may want to install Openmpi alongside with the MPICH compiled from source. And once you got a way to switch back and forth, Problem solved! I suggest using "bash", which is a way to edit your ~/.bashrc or ~/.profile.

Add following lines to .bashrc

## switch between mpich and openmpi
use_mpi () {
shopt -s nocaematch
case "$1" in
mpich) export PATH=/home/to/your/MPICH/bin:$PATH
openmpi) export PATH=/usr/bin:$PATH ;;
*) return 1 ;;
esac
shopt -u nocasematch
}

After adding those lines, type
1. "source ~/.bashrc" to activate the commands;
2. "use_mpi mpich" will allow you to use mpich in the current terminal;
3. "use_mpi openmpi" will allow you to use openmpi.

Then you can handle different versions of MPI on your system (not limited to two, could be three, four, ..., etc) . I feel this is more elegant other than messing with OpenFoam source code before you are an advanced user.

Hope this will help you.

venkcy January 18, 2020 05:13

Quote:

Originally Posted by HPE (Post 752979)
I assume you've downloaded the mp* package into the ThirdParty dir?


No! I built the package directly as I needed the newer version.


I was able to install OpenFOAM with IntelMPI.


Thanks for your concern!

venkcy January 18, 2020 05:20

Quote:

Originally Posted by LUQILIN (Post 753220)
I have run into the same problem but I have figured it out on Ubuntu 18.04. But I bet it will work on Centos 8 as well. Here is what I propose, you may want to install Openmpi alongside with the MPICH compiled from source. And once you got a way to switch back and forth, Problem solved! I suggest using "bash", which is a way to edit your ~/.bashrc or ~/.profile.

Add following lines to .bashrc

## switch between mpich and openmpi
use_mpi () {
shopt -s nocaematch
case "$1" in
mpich) export PATH=/home/to/your/MPICH/bin:$PATH
openmpi) export PATH=/usr/bin:$PATH ;;
*) return 1 ;;
esac
shopt -u nocasematch
}

After adding those lines, type
1. "source ~/.bashrc" to activate the commands;
2. "use_mpi mpich" will allow you to use mpich in the current terminal;
3. "use_mpi openmpi" will allow you to use openmpi.

Then you can handle different versions of MPI on your system (not limited to two, could be three, four, ..., etc) . I feel this is more elegant other than messing with OpenFoam source code before you are an advanced user.

Hope this will help you.


I was able to install OpenFOAM with IntelMPI.


Thanks for your help! Will try and get back to you.


All times are GMT -4. The time now is 22:44.