Build mfixsolver error using MFix-20.1.2 in linux and source tarball

@mark.meredith @onlyjus @jmusser
Dear all,
I built a coal-fired fluidized bed using MFix-20.1.2. When I built mfixsolver in Windows using GUI (mfix-20.1.2), the mfixsolver can be built successfully. In order to realize parallel computing, I used the same mfx document and usr_rates.f in linux with version of Mfix-20.1.2. When I tried to build the mfixsolver using command make -j, an error occurs as
(base) [customer@node02 FR]$ make -j
[ 0%] Building Fortran object model/CMakeFiles/mfixcore.dir/dmp_modules/compar_mod.f.o
/home/customer/Downloads/mfix-20.1.2/model/dmp_modules/compar_mod.f:18.15:

    USE mpi
           1

Fatal error: File ‘mpi.mod’ opened at (1) is not a GFORTRAN module file
make[3]: *** [model/CMakeFiles/mfixcore.dir/dmp_modules/compar_mod.f.o] error 1
make[2]: *** [model/CMakeFiles/mfixcore.dir/dmp_modules/compar_mod.f.o.provides] error 2
make[2]:………………………………

The commands are :

cmake … -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_MPI=1 -DMPI_Fortran_COMPILER=mpifort
cmake …
make -j

Who can help me to solve this problem? Thanks very much.

The message Fatal error: File ‘mpi.mod’ opened at (1) is not a GFORTRAN module file usually means that you have different versions of GFortran installed.
What is your gfortran --version ?
What is your mpifort --version ?

The -DMPI_Fortran_COMPILER option is no longer needed in the latest version of MFiX. If you just specify ENABLE_MPI=1, CMake will check for the MPI libraries in the Fortran compiler used.

You can try building again with:

export FC=mpifort
cmake … -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_MPI=1 

Thanks your reply. I have tried building again using the commands you offered. However, there are still the errors as following:

– MFIX build settings summary:
– Build type = RelWithDebInfo
– CMake version = 3.7.2
– Fortran compiler = /usr/bin/f95
– Fortran flags = -O2 -g -DNDEBUG
– ENABLE_MPI = 1
– ENABLE_OpenMP = OFF
– ENABLE_CTEST = OFF
– ENABLE_COVERAGE = OFF
CMake Warning at model/cmake/MfixOptions.cmake:128 (message):
Unknown CMake version
Call Stack (most recent call first):
model/CMakeLists.txt:645 (set_mfix_version)

Found UDFs:
/home/customer/wxd/mfix-20.1.2/FR/usr0.f;/home/customer/wxd/mfix-20.1.2/FR/usr1.f;/home/customer/wxd/mfix-20.1.2/FR/usr_init_namelist.f;/home/customer/wxd/mfix-20.1.2/FR/usr_rates.f;/home/customer/wxd/mfix-20.1.2/model/usr_read_namelist.f;/home/customer/wxd/mfix-20.1.2/FR/species.inc
– Configuring done
– Generating done
– Build files have been written to: /home/customer/wxd/mfix-20.1.2/FR
(base) [customer@node02 FR]$ make -j
[ 0%] Building Fortran object model/CMakeFiles/mfixcore.dir/dmp_modules/compar_mod.f.o
/home/customer/wxd/mfix-20.1.2/model/dmp_modules/compar_mod.f:18.15:

    USE mpi
           1

fatal error: File ‘mpi.mod’ opened at (1) is not a GFORTRAN module file
make[3]: *** [model/CMakeFiles/mfixcore.dir/dmp_modules/compar_mod.f.o] error 1
make[2]: *** [model/CMakeFiles/mfixcore.dir/dmp_modules/compar_mod.f.o.provides] error 2
make[2]: *** waiting for unfinished jobs…
[ 0%] Building Fortran object model/CMakeFiles/mfixcore.dir/tau_g_mod.f.o
[ 0%] Building Fortran object model/CMakeFiles/mfixcore.dir/tau_s_mod.f.o
[ 0%] Building Fortran object model/CMakeFiles/mfixcore.dir/qmomk/qmomk_parameters_mod.f.o
[ 2%] Building Fortran object model/CMakeFiles/mfixcore.dir/cartesian_grid/dashboard_mod.f.o
[ 2%] Building Fortran object model/CMakeFiles/mfixcore.dir/dqmom/gaussj.f.o
[ 2%] Building Fortran object model/CMakeFiles/mfixcore.dir/qmomk/qmomk_tools_mod.f.o
[ 2%] Building Fortran object model/CMakeFiles/mfixcore.dir/indices_mod.f.o
[ 3%] Building Fortran object model/CMakeFiles/mfixcore.dir/machine_mod.f.o
[ 3%] Building Fortran object model/CMakeFiles/mfixcore.dir/energy_mod.f.o
/home/customer/wxd/mfix-20.1.2/model/machine_mod.f:77.20:

  character(len=:), allocatable :: hostname
                1

error:declaration grammar error CHARACTER at (1)
/home/customer/wxd/mfix-20.1.2/model/machine_mod.f:103.23:

     **character(len=:), allocatable :: f_string**

** 1**
error: declaration grammar error CHARACTER at (1) **
/home/customer/wxd/mfix-20.1.2/model/machine_mod.f:101.60:
** pure function c_to_f_string(c_string) result(f_string)

** 1**
error: function reture value ‘f_string’ at (1) has no implicit type
/home/customer/wxd/mfix-20.1.2/model/machine_mod.f:110.28:

** allocate (character(len=n) :: f_string)**
** 1**
error: ALLOCATE grammar error at (1)
/home/customer/wxd/mfix-20.1.2/model/machine_mod.f:93.14:

** hostname = c_to_f_string(cstr_hostname)**
** 1**
error: symbol ‘hostname’ at (1) has no implicit type
make[3]: *** [model/CMakeFiles/mfixcore.dir/machine_mod.f.o] error 1
make[2]: *** [model/CMakeFiles/mfixcore.dir/machine_mod.f.o.provides] error 2
make[1]: *** [model/CMakeFiles/mfixcore.dir/all] error 2
make: *** [all] error 2
(base) [customer@node02 FR]$

When I build mfixsolver in GUI (Linux), aformentioned errors in bold also occurs.

What is your compiler version, the output of: /usr/bin/f95 --version
?

running result is
(base) [customer@node02 Desktop]$ /usr/bin/f95 --version
GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)

I have updated Cmake version as 3.18.

MFiX requires GCC/GFortran 4.8 or later, you have version 4.4.7.

You need to install a newer version of GCC.

I have updated all the versions of GCC, GFortran etc. It does work well. Thank you very much.