mutationpp / Mutationpp

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

Mutation coupling #124

Closed ggange closed 4 years ago

ggange commented 4 years ago

Hello, I am performing a coupling in C++ of M++ to my solver. I linked the .so to the program with cmake (without any alert rising) both on my workstation and a public one (VKI). The source files (and mixture/mechanisms .xml) are the same (transfered through git) but calling a forward reaction rate gives different results.

Debugging I discovered that, with the same procedure, on my pc I'm unable to set the number density of the single species (with setState) and obtain -nan when recalled; on the other hand on the public machine the setting works fine. In both cases the temperature (with the flag "1" in ChemNonEqTTv) is set fine.

Are you aware of some issues that may arise with some compilers versions or similar? I am working on Ubuntu 18.04 on my pc and I haven't touched the predefined compilers (while the other machine is on Fedora ). I couldn't find other explanations yet...

Thank you in advance for your help! Giuseppe Gangemi

rdbisme commented 4 years ago

Hello @ggange.

Like this it's kinda hard to troubleshoot why you're getting this. Let's try to gain more informations.

  1. Can you please report in a detailed way all the steps you took to build mutation++?
  2. Can you provide the output of the cmake command you used to compile mutation++?
  3. Can you please provide the CMakeLists.txt of your solver in which you're integrating mutation++? (Or equivalent, if you're not using cmake)
  4. Can you please provide the output of this command uname -a on both machines?
  5. Can you provide the output of this command env on both machines, just after you compiled mutation++?
ggange commented 4 years ago

Thank you for the reply!

  1. For installing and building mutation++ I used the steps detailed in the wiki (both on the personal and public machine)
  2. cmake_output.txt
  3. CMakeLists.txt
  4. "Linux elementaryOS 5.3.0-46-generic #38~18.04.1-Ubuntu SMP Tue Mar 31 04:17:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux" "Linux aglin24.private.vki.eu 4.15.14-300.fc27.x86_64 #1 SMP Thu Mar 29 16:13:44 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux"
  5. env_personal.txt env_public.txt

rdbisme commented 4 years ago

First of all, let's try to use the "right" way of integrating mutation++ into a code. Informations are here.

So can you try with this CMakeListst.txt?

cmake_minimum_required(VERSION 2.8.12)
project(muffin)

add_subdirectory(pybind11)

set(CPPFLAGS "-O3 -Wall -shared -std=c++11 -undefined dynamic_lookup" )

file(GLOB_RECURSE Muffin_SOURCES "src/*.cpp")
file(GLOB_RECURSE Muffin_HEADERS "src/*.h")

set (Muffin_INCLUDE_DIRS "")

foreach (_headerFile ${Muffin_HEADERS})
    get_filename_component(_dir ${_headerFile} PATH)
    list (APPEND Muffin_INCLUDE_DIRS ${_dir})
endforeach()
list(REMOVE_DUPLICATES Muffin_INCLUDE_DIRS)

# Include the PETSC library
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake-modules")

FIND_PACKAGE(MPI REQUIRED)
set(CMAKE_CXX_COMPILE_FLAGS ${CMAKE_CXX_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS})
set(CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} ${MPI_LINK_FLAGS})
include_directories(MPI_INCLUDE_PATH)

FIND_PACKAGE(PETSc REQUIRED)
INCLUDE_DIRECTORIES(${PETSC_INCLUDES})
ADD_DEFINITIONS(${PETSC_DEFINITIONS})

find_package(mutation++ REQUIRED)

pybind11_add_module(muffin ${Muffin_SOURCES})
target_link_libraries(muffin PRIVATE mutation++ ${PETSC_LIBRARIES} ${MPI_LIBRARIES})
target_include_directories(muffin PRIVATE ${Muffin_INCLUDE_DIRS} )
rdbisme commented 4 years ago

You might need to provide mutation++_DIR on the cmake command line or add the mutation++ cmake files install folder to CMAKE_PREFIX_PATH.

PS: Is your code available somewhere? Such that I can test it maybe on my machine?