mutationpp / Mutationpp

The MUlticomponent Thermodynamic And Transport library for IONized gases in C++
GNU Lesser General Public License v3.0
101 stars 58 forks source link

link mutation++ to SU2 with meson/ninja #146

Closed CatarinaGarbacz closed 3 years ago

CatarinaGarbacz commented 3 years ago

Up to now, we were linking mpp to SU2 by means of: 1.install mpp - with cmake 2.compile mpp - with make 3.configure su2 with linking flags to mpp 4.compile su2 - with make

now SU2 has a new way of configuring/compiling, that uses building software called meson/ninja. So I have been working on making the previous process completely automatic within this software. The idea is: 1.configure su2 with meson, with flag mutationpp=true 2.compile su2 with ninja and everything else is done in the background with meson scripting.

It is generally going well. I specify the sources in the meson.build file (all .cpp files in Mutationpp/src/), as well as and include folders (all folders in Mutationpp/src/), and su2 configures and compiles well. However, when I run the code, I get the following error:

**M++ error: invalid input. input: key = RRHO Provider for type ThermoDB is not registered. Possible providers are:

Was trying to load the thermodynamic database.**

In the attempt to solve this, I tried also including all the folders in Mutationpp/data/ but as expected this did not work. Could you explain to me the origin of this error and perhaps any guess of what is missing in the meson.build linking files?

Thank you

grgbellasvki commented 3 years ago

Hello, It seems something is wrong with the auto-registration of RrhoDB.cpp file. I would be happy to try and reproduce the problem, but before that:

Do you get the same error with other databases, like NASA-9? Is the error you mention reproducible with mppequil with the mutation++ SU2 compiles? "mppequil -T 300 -P 1000 -m 32 air_5"

CatarinaGarbacz commented 3 years ago

thanks for helping!

this happens for any database. which is expected, since the work I am doing is linking Mutation to another code, so there's probably some link missing for the databases in general. which is strange, because it does not complain about mixture file or mechanism file, which suggests the folder Mutationpp/data is being recognized. so I'm a bit confused about this "contradiction"

also, this error is not reproducible with any executable from Mutation++, because the point is that we are running SU2 and not mutation++. simply inside SU2 we have #include, and declaration of Mixture object, and then calls to mixture functions.

the only way to reproduce the problem is to install SU2 with mutation++ the way I did. If you'd be willing to help, I can explain to you the necessary steps! let me know :)

thanks again

jbscoggi commented 3 years ago

Hey @CatarinaGarbacz, indeed this seems to be some type of linking problem. In fact, as you can see from the error message Provider for type ThermoDB is not registered. Possible providers are:, the ThermoDB type has no providers, meaning that none of the source files that provide ThermoDB loaders have been linked. Perhaps you can provide a verbose log from a clean Meson build to see if M++ is being compiled correctly?

CatarinaGarbacz commented 3 years ago

could you tell me what these files are, the ones which provide ThermoDB loaders?

The thing is, with meson, Mutation++ is not compiled explicitly, at leats not the way I did it - so I do not have that log. Now, my way is obviously wrong and maybe this is exactly the problem, i.e, the lack of an explicit compilation.

It's bit hard to explain all of what I did here, since I also do not master it, I wonder if it would make more sense to set up a meeting and I could show you all this ?

rdbisme commented 3 years ago

Let's try to see if we can solve it here before :). I'd kindly ask if you can provide:

This will help us to understand how to fix that. Don't worry if you do not master it, just try to do your best to provide those information.

jbscoggi commented 3 years ago

Hey @CatarinaGarbacz, it seems @rubendibattista beat me to it, but I think indeed if you could provide that info first, it would be helpful. I am super swamped with work for next week or so, but I will definitely be happy chat with you offline if it is not resolved by then. Like this, @rubendibattista can also help out if I'm not responding. The benefit of working it out here is that potentially others can find the solution useful in the future.

rdbisme commented 3 years ago

Oups, sorry @jbscoggi :).

jbscoggi commented 3 years ago

No problem @rubendibattista, thanks for helping!

CatarinaGarbacz commented 3 years ago

@rubendibattista sounds good, thanks a lot for getting back to me in a detailed way. Not sure if I will be able to respond to every point, because of the way I did things, but I will explain precisely what I did. And if you have more questions please ask!

a)I did this in the past, with cmake/make, and things worked perfectly well b) now with meson/ninja, in an automatic way

a)

  1. git clone https://github.com/mutationpp/Mutationpp.git

  2. install and compile eigen3

    cd mutationpp/thirdparty/eigen; mkdir build_dir; cd build_dir; cmake .. ; make install;

    at the end of this step I have eigen here: /usr/local/include/eigen3

  3. install and compile mutation

    cd Mutationpp; mkdir build; cd build; cmake -DCMAKE_INSTALL_PREFIX:PATH=$(realpath ../install) .. ; make -j N install

  4. add lines to ~/.bashrc file

    export MPP_DIRECTORY=<path_to_mutation++_directory>
    export MPP_DATA_DIRECTORY=$MPP_DIRECTORY/data 
    export PATH=$MPP_DIRECTORY/install/bin:$PATH
    export LD_LIBRARY_PATH=$MPP_DIRECTORY/install/lib:$LD_LIBRARY_PATH
  5. create symbolic links to link to SU2 later on

    cd mutationpp/install/lib; ln -s libmutation++.so libmutation++.a; ln -s libmutation++.a libmutation++.dylib

  6. I modify the configure.ac file of SU2, adding:

# check for lib
Mutationpplib=libmutation++.a
Mutationppheader=mutation++.h
have_MPP="no"

if test "$with_Mutationpp_lib" != "no"
then
    AC_CHECK_FILE([$with_Mutationpp_lib/$Mutationpplib],[have_MPP="yes"],[have_MPP="no"])
    if test "$have_MPP" == "no"
    then
        AC_MSG_ERROR([Mutation++ requested but library file not found.])
    fi
fi

# check for header
if test "$have_MPP" != "no"
then
    if test "$with_Mutationpp_include" != "no"
    then
        AC_CHECK_FILE([$with_Mutationpp_include/$Mutationppheader],[have_MPP='yes'],[have_MPP='no'])
        if test "$have_MPP" == "no"
        then
            AC_MSG_ERROR([Mutation++ requested but header file not found.])
        fi
    else
        have_MPP="no"
    fi
fi

if test "$have_MPP" != "no"
then
    AM_CONDITIONAL(BUILD_MUTATIONPP,true,test x$enablempp = xyes -a x$have_MPP = xyes)
    MUTATIONPP_CXX="-DHAVE_MPP -I"$with_Mutationpp_include""
    MUTATIONPP_LD="$with_Mutationpp_lib"/$Mutationpplib
else
    AM_CONDITIONAL(BUILD_MUTATIONPP,false)
    MUTATIONPP_CXX=
    MUTATION_LD=
fi
AC_SUBST([MUTATIONPP_CXX])
AC_SUBST([MUTATIONPP_LD])
  1. I modify the MakeFile.am of SU2, adding
if BUILD_MUTATIONPP
  lib_cxxflags += @MUTATIONPP_CXX@
  lib_ldadd += @MUTATIONPP_LD@
endif
  1. I configure SU2 in the following way. Note this is where the actual link is done manually

./configure --prefix=<path_to_su2_nemo> CXXFLAGS="-O3 -std=c++0x -I <path_to_mutationpp>/install/include -I <path_to_eigen3>" --with-Mutationpp-lib=<path_to_mutationpp>/install/lib --with-Mutationpp-include=<path_to_mutationpp>/install/include/mutation++

  1. compile SU2, run SU2 - all good

b) with meson/ninja things work differently. I don't know exactly how the linking process should be done, this is what I am trying to figure out. The point of using meson/ninja is: instead of doing all these manual steps, simply configuring SU2 in the following way:

./meson.py --prefix=<path_to_su2> -Denable-mpp=true

so simply tell the configure string we want to enable mutation++, and all the rest would be done automatically.

  1. in the general meson.build of SU2, i.e, SU2/meson.build file, I added the following lines:
   # Mutation++
   if get_option('enable-mpp')
     subdir('externals/Mutationpp-meson')
     su2_deps     += mpp_dep
     su2_cpp_args += '-DHAVE_MPP'
   endif   
  1. the externals/Mutationpp-meson/meson.build looks like this
mpp_c_args = []

mpp_default_warnings = []

mpp_src = ['../Mutationpp/src/fortran/cwrapper.cpp',
           '../Mutationpp/src/general/bprime.cpp',
           '../Mutationpp/src/general/checkmix.cpp',
           '../Mutationpp/src/general/Mixture.cpp',
           '../Mutationpp/src/general/MixtureOptions.cpp',
           '../Mutationpp/src/general/mppequil.cpp',
           '../Mutationpp/src/gsi/DiffusionVelocityCalculator.cpp',
           '../Mutationpp/src/gsi/GasFourierHeatFluxCalculator.cpp',
           '../Mutationpp/src/gsi/GasSurfaceInteraction.cpp',
           '../Mutationpp/src/gsi/GSIRateLawGammaConst.cpp',
           '../Mutationpp/src/gsi/GSIRateLawGammaT.cpp',
           '../Mutationpp/src/gsi/GSIRateLawSublimation.cpp',
           '../Mutationpp/src/gsi/GSIRateManagerPhenomenological.cpp',
           '../Mutationpp/src/gsi/GSIReactionAblation.cpp',
           '../Mutationpp/src/gsi/GSIReactionCatalysis.cpp',
           '../Mutationpp/src/gsi/GSIStoichiometryManager.cpp',
           '../Mutationpp/src/gsi/MassBlowingRateAblation.cpp',
           '../Mutationpp/src/gsi/MassBlowingRateNull.cpp',
           '../Mutationpp/src/gsi/SolidPropertiesNull.cpp',
           '../Mutationpp/src/gsi/SolidPropertiesSteadyState.cpp',
           '../Mutationpp/src/gsi/SurfaceBalanceSolverMass.cpp',
           '../Mutationpp/src/gsi/SurfaceBalanceSolverMassEnergy.cpp',
           '../Mutationpp/src/gsi/SurfaceChemistry.cpp',
           '../Mutationpp/src/gsi/SurfacePropertiesAblation.cpp',
           '../Mutationpp/src/gsi/SurfacePropertiesNull.cpp',
           '../Mutationpp/src/gsi/SurfaceRadiation.cpp',
           '../Mutationpp/src/gsi/SurfaceState.cpp',
           '../Mutationpp/src/kinetics/JacobianManager.cpp',
           '../Mutationpp/src/kinetics/Kinetics.cpp',
           '../Mutationpp/src/kinetics/RateLaws.cpp',
           '../Mutationpp/src/kinetics/RateManager.cpp',
           '../Mutationpp/src/kinetics/Reaction.cpp',
           '../Mutationpp/src/kinetics/ReactionType.cpp',
           '../Mutationpp/src/kinetics/StoichiometryManager.cpp',
           '../Mutationpp/src/numerics/Interpolators.cpp',
           '../Mutationpp/src/thermo/ChemNonEqStateModel.cpp',
           '../Mutationpp/src/thermo/ChemNonEqTTvStateModel.cpp',
           '../Mutationpp/src/thermo/Composition.cpp',
           '../Mutationpp/src/thermo/EquilStateModel.cpp',
           '../Mutationpp/src/thermo/MultiPhaseEquilSolver.cpp',
           '../Mutationpp/src/thermo/Nasa7DB.cpp',
           '../Mutationpp/src/thermo/Nasa7Polynomial.cpp',
           '../Mutationpp/src/thermo/Nasa9DB.cpp',
           '../Mutationpp/src/thermo/Nasa9Polynomial.cpp',
           '../Mutationpp/src/thermo/ParticleRRHO.cpp',
           '../Mutationpp/src/thermo/RrhoDB.cpp',
           '../Mutationpp/src/thermo/Species.cpp',
           '../Mutationpp/src/thermo/SpeciesListDescriptor.cpp',
           '../Mutationpp/src/thermo/SpeciesNameFSM.cpp',
           '../Mutationpp/src/thermo/ThermoDB.cpp',
           '../Mutationpp/src/thermo/Thermodynamics.cpp',
           '../Mutationpp/src/transfer/MillikanWhite.cpp',
           '../Mutationpp/src/transfer/OmegaCE.cpp',
           '../Mutationpp/src/transfer/OmegaCElec.cpp',
           '../Mutationpp/src/transfer/OmegaCV.cpp',
           '../Mutationpp/src/transfer/OmegaET.cpp',
           '../Mutationpp/src/transfer/OmegaI.cpp',
           '../Mutationpp/src/transfer/OmegaVT.cpp',
           '../Mutationpp/src/transport/CapitelliIntegrals.cpp',
           '../Mutationpp/src/transport/CollisionDB.cpp',
           '../Mutationpp/src/transport/CollisionGroup.cpp',
           '../Mutationpp/src/transport/CollisionIntegral.cpp',
           '../Mutationpp/src/transport/CollisionPair.cpp',
           '../Mutationpp/src/transport/CoulombIntegrals.cpp',
           '../Mutationpp/src/transport/ElectronSubSystem.cpp',
           '../Mutationpp/src/transport/ExactDiffMat.cpp',
           '../Mutationpp/src/transport/LangevinIntegrals.cpp',
           '../Mutationpp/src/transport/RamshawDiffMat.cpp',
           '../Mutationpp/src/transport/ThermalConductivityChapmannEnskog.cpp',
           '../Mutationpp/src/transport/ThermalConductivityWilke.cpp',
           '../Mutationpp/src/transport/Transport.cpp',
           '../Mutationpp/src/transport/ViscosityChapmannEnskog.cpp',
           '../Mutationpp/src/transport/ViscosityGuptaYos.cpp',
           '../Mutationpp/src/transport/ViscosityWilke.cpp',
           '../Mutationpp/src/utilities/StringUtils.cpp',
           '../Mutationpp/src/utilities/TemporaryFile.cpp',
           '../Mutationpp/src/utilities/Units.cpp',
           '../Mutationpp/src/utilities/XMLite.cpp']

mpp_include = include_directories(['../Mutationpp/thirdparty/eigen',
                                   '../Mutationpp/src',
                                   '../Mutationpp/src/general',
                                   '../Mutationpp/src/thermo',
                                   '../Mutationpp/src/kinetics',
                                   '../Mutationpp/src/transfer',
                                   '../Mutationpp/src/transport',
                                   '../Mutationpp/src/utilities',
                                   '../Mutationpp/src/fortran',
                                   '../Mutationpp/src/gsi',
                                   '../Mutationpp/src/numerics'])
mpp_lib     = static_library('mpp', 
                               mpp_src,
                   include_directories : mpp_include,
                   c_args: mpp_c_args + mpp_default_warnings)

mpp_dep = declare_dependency(link_with : mpp_lib, 
                               include_directories : mpp_include)
  1. I configure SU2 with

    ./meson.py --prefix=<path_to_su2> -Denable-mpp=true

    output:

   The Meson build system
Version: 0.54.999
Source dir: /home/catarina/Desktop/PhD/Codes/SU2
Build dir: /home/catarina/Desktop/PhD/Codes/SU2/build
Build type: native build
Project name: SU2
Project version: 7.0.7 "Blackbird"
C compiler for the host machine: cc (gcc 7.5.0 "cc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0")
C linker for the host machine: cc ld.bfd 2.30
C++ compiler for the host machine: c++ (gcc 7.5.0 "c++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0")
C++ linker for the host machine: c++ ld.bfd 2.30
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program python3 found: YES (/usr/bin/python3)
Found pkg-config: /usr/bin/pkg-config (0.29.1)
mpicc found: NO
Run-time dependency MPI for c found: NO (tried pkgconfig and config-tool)
mpic++ found: NO
Run-time dependency MPI for cpp found: NO (tried pkgconfig and config-tool)
Message: Boost sources found.
Run-time dependency threads found: YES
Message: -------------------------------------------------------------------------
         |    ___ _   _ ___                                                      |
         |   / __| | | |_  )   Release 7.0.7 "Blackbird"                         |
         |   \__ \ |_| |/ /                                                      |
         |   |___/\___//___|   Meson Configuration Summary                       |
         |                                                                       |
         -------------------------------------------------------------------------

         Option          Value
         ---------------------
         TecIO:          true
         CGNS:           true
         AD (reverse):   false
         AD (forward):   false
         Python Wrapper: false
         Intel-MKL:      false
         OpenBlas:       false
         PaStiX:         false
         Mixed Float:    false
         Mutation++:     true

         Please be sure to add the $SU2_HOME and $SU2_RUN environment variables,
         and update your $PATH (and $PYTHONPATH if applicable) with $SU2_RUN

         Based on the input to this configuration, add these lines to your .bashrc file:

         export SU2_RUN=/home/catarina/Desktop/PhD/Codes/SU2/bin
         export SU2_HOME=/home/catarina/Desktop/PhD/Codes/SU2
         export PATH=$PATH:$SU2_RUN
         export PYTHONPATH=$PYTHONPATH:$SU2_RUN

         Use './ninja -C build install' to compile and install SU2

Build targets in project: 11

Found ninja-1.10.0.git at /home/catarina/Desktop/PhD/Codes/SU2/ninja
  1. I compile SU2 with

    ./ninja -C build install -- all good

  2. I run the code :

   ..........SU2 non-relevant output.............

   M++ error: invalid input.
   input: key = NASA-9
   Provider <NASA-9> for type ThermoDB is not registered.  Possible providers are:

   Was trying to load the thermodynamic database.
  1. note that I never compiled mutation++ explicitly, which could have been the problem. So to check if this is the actual problem, manually I go to SU2/externals/Mutationpp and I install and compile mutation explicity following steps a)1-5.

  2. I re-run meson as in 3. - same output

  3. $env

  MPP_DIRECTORY=/home/catarina/Desktop/PhD/Codes/SU2/externals/Mutationpp
CLUTTER_IM_MODULE=xim
LD_LIBRARY_PATH=/home/catarina/Desktop/PhD/Codes/SU2/externals/Mutationpp/install/lib:/home/catarina/Desktop/PhD/Codes/Mutationpp/install/lib:
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
LC_MEASUREMENT=pt_PT.UTF-8
LESSCLOSE=/usr/bin/lesspipe %s %s
LC_PAPER=pt_PT.UTF-8
LC_MONETARY=pt_PT.UTF-8
XDG_MENU_PREFIX=gnome-
LANG=en_US.UTF-8
DISPLAY=:0
OLDPWD=/home/catarina/Desktop/PhD/Codes
MPP_DATA_DIRECTORY=/home/catarina/Desktop/PhD/Codes/SU2/externals/Mutationpp/data
GNOME_SHELL_SESSION_MODE=ubuntu
COLORTERM=truecolor
USERNAME=catarina
XDG_VTNR=2
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
LC_NAME=pt_PT.UTF-8
XDG_SESSION_ID=2
USER=catarina
DESKTOP_SESSION=ubuntu
QT4_IM_MODULE=xim
TEXTDOMAINDIR=/usr/share/locale/
GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/27720672_6db5_436f_9f83_1648ad513fd3
DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
PWD=/home/catarina/Desktop/PhD/Codes/SU2
HOME=/home/catarina
SU2_HOME=/home/catarina/Desktop/PhD/Codes/SU2
LC_CTYPE=pt_PT.UTF-8
TEXTDOMAIN=im-config
SSH_AGENT_PID=2703
QT_ACCESSIBILITY=1
XDG_SESSION_TYPE=x11
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
XDG_SESSION_DESKTOP=ubuntu
LC_ADDRESS=pt_PT.UTF-8
GJS_DEBUG_OUTPUT=stderr
LC_NUMERIC=pt_PT.UTF-8
SU2_RUN=/home/catarina/Desktop/PhD/Codes/SU2/bin
GTK_MODULES=gail:atk-bridge
WINDOWPATH=2
VTE_VERSION=5202
TERM=xterm-256color
SHELL=/bin/bash
QT_IM_MODULE=ibus
XMODIFIERS=@im=ibus
IM_CONFIG_PHASE=2
XDG_CURRENT_DESKTOP=ubuntu:GNOME
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
GNOME_TERMINAL_SERVICE=:1.116
XDG_SEAT=seat0
SHLVL=1
PYTHONPATH=:/home/catarina/Desktop/PhD/Codes/SU2/bin:/home/catarina/Desktop/PhD/Codes/SU2/bin
LC_TELEPHONE=pt_PT.UTF-8
GDMSESSION=ubuntu
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
LOGNAME=catarina
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
XDG_RUNTIME_DIR=/run/user/1000
XAUTHORITY=/run/user/1000/gdm/Xauthority
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
PATH=/home/catarina/Desktop/PhD/Codes/SU2/externals/Mutationpp/install/bin:/home/catarina/Desktop/PhD/Codes/Mutationpp/install/bin:/home/catarina/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/catarina/Desktop/PhD/Codes/SU2/bin:/home/catarina/Desktop/PhD/Codes/SU2/bin
LC_IDENTIFICATION=pt_PT.UTF-8
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
SESSION_MANAGER=local/catarina-VivoBook-ASUSLaptop-X580GD-N580GD:@/tmp/.ICE-unix/2607,unix/catarina-VivoBook-ASUSLaptop-X580GD-N580GD:/tmp/.ICE-unix/2607
LESSOPEN=| /usr/bin/lesspipe %s
GTK_IM_MODULE=ibus
LC_TIME=pt_PT.UTF-8
_=/usr/bin/env
  1. re-run ninja as in 4. - all good

  2. run SU2, same error as in 6.

  3. $uname -a

Linux catarina-VivoBook-ASUSLaptop-X580GD-N580GD 4.15.0-123-generic #126-Ubuntu SMP Wed Oct 21 09:40:11 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

rdbisme commented 3 years ago

Ehi @CatarinaGarbacz, I think the problem is in the meson files. Is your code available somewhere? Is it standard SU2?

CatarinaGarbacz commented 3 years ago

it is. not standard SU2, but you can checkout to this branch: https://github.com/su2code/SU2/tree/feature_NEMO_streamline

rdbisme commented 3 years ago

The right way of using Mutation++ with meson should be:

  1. (Build and) install Mutation where you want it to be using cmake. (When you install it, Mutation++ exports a mutation++Config.cmake file that is called "Export file" and it's the way a CMake project provides discoverability)

  2. Example meson.build for a simple main.cpp file:

    project('example', 'cpp')
    mutation = dependency('mutation++', method: 'cmake')
    exe = executable('main', 'main.cpp', dependencies : mutation)

Theoretically meson should be able to discover the dependency and link your code against it.

Unfortunately meson is missing support for CMake export files so this does not work.

The Meson build system
Version: 0.56.0
Source dir: /tmp/mutation-meson
Build dir: /tmp/mutation-meson/builddir
Build type: native build
Project name: example
Project version: undefined
Using 'CXX' from environment with value: '/home2/softmassot/spack2/linux-centos7-x86_64/gcc-4.8.5/gcc-9.2.0-wqdecm4rkyyhejagxwmnabt6lscgm45d/bin/g++'
C++ compiler for the host machine: /home2/softmassot/spack2/linux-centos7-x86_64/gcc-4.8.5/gcc-9.2.0-wqdecm4rkyyhejagxwmnabt6lscgm45d/bin/g++ (gcc 9.2.0 "g++ (Spack GCC) 9.2.0")
C++ linker for the host machine: /home2/softmassot/spack2/linux-centos7-x86_64/gcc-4.8.5/gcc-9.2.0-wqdecm4rkyyhejagxwmnabt6lscgm45d/bin/g++ ld.bfd 2.27-44
Using 'CXX' from environment with value: '/home2/softmassot/spack2/linux-centos7-x86_64/gcc-4.8.5/gcc-9.2.0-wqdecm4rkyyhejagxwmnabt6lscgm45d/bin/g++'
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found CMake: /home2/softmassot/spack2/linux-centos7-x86_64/gcc-9.2.0/cmake-3.18.2-lcjefgbrqg7tz2ebfyvi4n7fun55dg2f/bin/cmake (3.18.2)
Using 'CMAKE_PREFIX_PATH' from environment with value: '/home2/softmassot/spack2/linux-centos7-x86_64/gcc-9.2.0/mutationpp-1.0.0-trlaixpf72tamrff77xmifg2stg2knlh/lib64/cmake/mutation++:/home2/softmassot/spack2/linux-centos7-x86_64/gcc-9.2.0/cmake-3.18.2-lcjefgbrqg7tz2ebfyvi4n7fun55dg2f:/home2/softmassot/spack2/linux-centos7-x86_64/gcc-9.2.0/mutationpp-1.0.0-trlaixpf72tamrff77xmifg2stg2knlh:/home2/softmassot/spack2/linux-centos7-x86_64/gcc-9.2.0/texlive-live-5an722qp4yuxlnee66g6x6mfreoeilee:/home2/softmassot/spack2/linux-centos7-x86_64/gcc-9.2.0/pinentry-1.1.0-orjum2gylyfzrnedepgxhcpuki4v6eel:/home2/softmassot/spack2/linux-centos7-x86_64/gcc-9.2.0/gnupg-2.2.19-nou273k7da4p6yzhx2i2uolryhkwpy72:/home2/softmassot/spack2/linux-centos7-x86_64/gcc-9.2.0/git-2.25.0-df2wwwxta5mifluyheox4nui6zu2yicw:/home2/softmassot/spack2/linux-centos7-x86_64/gcc-4.8.5/gcc-9.2.0-wqdecm4rkyyhejagxwmnabt6lscgm45d'
Run-time dependency mutation++ found: NO (tried cmake)

meson.build:2:0: ERROR: Dependency "mutation++" not found, tried cmake

Possible workarounds:

I'm not familiar with meson, but it looks like a limitation. I cannot be of better help, let me know if you're able to implement a workaround

rdbisme commented 3 years ago

Ok, it seems to work.

  1. Create a subprojects folder in the repository root
  2. Add Mutationpp folder in ${SU2_ROOT}/subprojects (probably as a git submodule)
  3. Fix the meson.build with this:
    # Mutation++
    if get_option('enable-mpp')
    cmake = import('cmake')
    mpp_subproj = cmake.subproject('Mutationpp')
    mpp_dep = mpp_subproj.dependency('mutation++')
    su2_deps     += mpp_dep
    su2_cpp_args += '-DHAVE_MPP'
    endif
  4. Compile SU2 (it will compile Mutationpp)
  5. export MPP_DATA_DIRECTORY="${SU2_ROOT}/subprojects/Mutationpp/data"
  6. Adapt the TestCases/nonequilibrium/invwedge test case like this:
    diff --git TestCases/nonequilibrium/invwedge/invwedge.cfg TestCases/nonequilibrium/invwedge/invwedge.cfg
    index ccc48f23f2..45dba0d328 100644
    --- TestCases/nonequilibrium/invwedge/invwedge.cfg
    +++ TestCases/nonequilibrium/invwedge/invwedge.cfg
    @@ -16,7 +16,7 @@
    %                               POISSON_EQUATION)
    SOLVER= NEMO_EULER
    %
    -GAS_MODEL= AIR-5
    +GAS_MODEL= air_5
    %
    GAS_COMPOSITION= (0.77, 0.23, 0.0, 0.0, 0.0)
    %
    @@ -56,7 +56,7 @@ FREESTREAM_TEMPERATURE_VE= 288.15
    %
    % Fluid model (STANDARD_AIR, IDEAL_GAS, VW_GAS, PR_GAS,
    %              CONSTANT_DENSITY, INC_IDEAL_GAS, INC_IDEAL_GAS_POLY, MUTATIONPP, USER_DEFINED_NONEQ)
    -FLUID_MODEL= USER_DEFINED_NONEQ
    +FLUID_MODEL= MUTATIONPP
    %
    % -------------------- BOUNDARY CONDITION DEFINITION --------------------------%
    %
    (END)
  7. Run the code (in the invwedge directory)
    ../../../builddir/SU2_CFD/src/SU2_CFD invwedge.cfg

This gives me the following output:

[...]
+------------------------------------------------------------------------------+
-- Initial and free-stream conditions:
+------------------------------------------------------------------------------+
|                  Name|    Dim. value|    Ref. value|      Unit|Non-dim. value|
+------------------------------------------------------------------------------+
|       Static Pressure|        101325|             1|        Pa|        101325|
|               Density|      0.609849|             1|    kg/m^3|      0.609849|
|       T-R Temperature|        288.15|             1|         K|        288.15|
|       V-E Temperature|        288.15|             1|         K|        288.15|
|          Total Energy|   3.28354e+07|             1|   m^2/s^2|   3.28354e+07|
|            Velocity-X|       2631.12|             1|       m/s|       2631.12|
|            Velocity-Y|             0|             1|       m/s|             0|
|    Velocity Magnitude|       2631.12|             1|       m/s|       2631.12|
+------------------------------------------------------------------------------+
|           Mach Number|             -|             -|         -|             5|
+------------------------------------------------------------------------------+
Explicit Scheme. No Jacobian structure (Euler). MG level: 0.

------------------- Numerics Preprocessing ( Zone 0 ) -------------------

----------------- Integration Preprocessing ( Zone 0 ) ------------------

------------------- Iteration Preprocessing ( Zone 0 ) ------------------
Euler/Navier-Stokes/RANS fluid iteration.

------------------------------ Begin Solver -----------------------------

Simulation Run using the Single-zone Driver
+---------------------------------------------------------------------------------------------------------------------------------+
|  Inner_Iter|  rms[Rho_0]|  rms[Rho_1]|  rms[Rho_2]|  rms[Rho_3]|  rms[Rho_4]|   rms[RhoU]|   rms[RhoV]|   rms[RhoE]| rms[RhoEve]|
+---------------------------------------------------------------------------------------------------------------------------------+
|           0|    3.942598|    2.745529|    2.309800|    3.937851|    2.651051|    2.502827|  -13.260262|    6.601220|    5.237562|
|           1|   -0.622880|   -1.147643|   -0.931788|    0.696263|   -0.590537|    3.768063|    3.839363|    7.009293|    7.931364|
Warning, didn't converge temperatures: f = 8.03751e+18
Warning, didn't converge temperatures: f = 2.61814e+17
Warning, didn't converge temperatures: f = 5.21711e+12
Warning, didn't converge temperatures: f = 1.36784e+17
Warning, didn't converge temperatures: f = 5.17945e+16
|           2|    3.318968|    1.978563|    1.527387|    3.315993|    1.890395|    3.663803|    3.736285|    7.013566|    8.957421|
Warning!! Instances of NaN in the following source terms:
Axisymmetry: 0
Chemical:    25830
Vib. Relax:  25830

Error in "void CSolver::SetResidual_RMS(CGeometry*, CConfig*)":
-------------------------------------------------------------------------
SU2 has diverged. (NaN detected)
------------------------------ Error Exit -------------------------------

It explodes, but at least it seems to not complain about Mutation.

What do you think @CatarinaGarbacz?

CatarinaGarbacz commented 3 years ago

Uau I'm very impressed, that was quick! it definitely works perfectly well in term of linking mutation with SU2 :D

Probably the reason why it explodes is simply because in MPP we have N,O,NO,N2,O2 as the list of species and in the userdefined model we have N2,O2,N,O,NO, so you're giving 0.77, 0.23 mass fractions to N and O. which shoud be fine generally, but this test-case was only configured and tested for 0.77 N2 and 0.23 O2 so might give some issues if we change that. in any case, I will implement this and test with the right mass fractions.

and let you know how it went. But many thanks, this is incredibly helpful. I can tell you understand more about this scripting/compilation/installation stuff than I do, so very much appreciated.

rdbisme commented 3 years ago

Amazing! 👍

I'll close this issue since it's resolved in terms of build systems shenanigans, feel free to drop a message to let us know if you manage to make the simulation work as expected.

PS: I should probably checkout SU2, sooner or later, it looks a cool project! :)