为什么在C ++OpenFOAM中包含标头会导致我的程序无法正常运行?

问题描述

我已经成功地(在WSL中)在reaktoroFOAM中编译了一个名为OpenFOAM的求解器:

#include <Reaktoro/Reaktoro.hpp>
#include "fvCFD.H"

int main(int argc,char *argv[])
{
    //#include "setRootCaseLists.H"
    Reaktoro::ChemicalEditor editor;
    editor.addAqueousPhaseWithElements("H O C Ca");
    editor.addmineralPhase("Calcite");

    Reaktoro::ChemicalSystem system(editor);

    Reaktoro::EquilibriumProblem problem(system);
    problem.add("H2O",1,"kg");
    problem.add("CaCO3","mol");
    std::cout << "h" << std::endl;
    Reaktoro::ChemicalState state(system);
    std::cout << "h" << std::endl;
    state = Reaktoro::equilibrate(problem);
    std::cout << "h" << std::endl;
}

它工作得很好:

(base) mcrossover97@DESKTOP-E8DM4SE:/mnt/d/FOAM/run/reaktoro$ reaktoroFOAM
h
h
h

但是,当我包含setRootCaseLists.H时,尽管生成了求解器,但它无法正常运行。由于它不会给我任何WSL错误,因此我不知道可能是什么问题。它不会显示最后的“ h”:

(base) mcrossover97@DESKTOP-E8DM4SE:/mnt/d/FOAM/run/reaktoro$ reaktoroFOAM
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD ToolBox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  8
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
Build  : 8-9b73cf21a682
Exec   : reaktoroFOAM
Date   : Nov 05 2020
Time   : 22:25:24
Host   : "DESKTOP-E8DM4SE"
PID    : 10734
I/O    : uncollated
Case   : /mnt/d/FOAM/run/reaktoro
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster (fileModificationSkew 10)
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
h
h

更新:这是错误

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Reaktoro::Regularizer::Impl::assembleEchelonConstraints(Reaktoro::OptimumState const&) at ??:?
#4  Reaktoro::Regularizer::Impl::regularize(Reaktoro::OptimumProblem&,Reaktoro::OptimumState&,Reaktoro::OptimumOptions&) at ??:?
#5  ? at :?
#6  Reaktoro::OptimumSolver::solve(Reaktoro::OptimumProblem const&,Reaktoro::OptimumOptions const&) at ??:?
#7  ? at :?
#8  ? at :?
#9  ? at :?
#10  Reaktoro::EquilibriumSolver::solve(Reaktoro::ChemicalState&,double,Eigen::Ref<Eigen::Matrix<double,-1,1> const,Eigen::InnerStride<1> >) at ??:?
#11  Reaktoro::equilibrate(Reaktoro::ChemicalState&,Reaktoro::EquilibriumProblem const&,Reaktoro::EquilibriumOptions const&) at ??:?
#12  Reaktoro::equilibrate(Reaktoro::EquilibriumProblem const&,Reaktoro::EquilibriumOptions const&) at ??:?
#13  Reaktoro::equilibrate(Reaktoro::EquilibriumProblem const&) at ??:?
#14  ? in "/home/mohammad/OpenFOAM/mohammad-8/platforms/linux64GccDPInt32Opt/bin/reaktoroFoam"
#15  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#16  ? in "/home/mohammad/OpenFOAM/mohammad-8/platforms/linux64GccDPInt32Opt/bin/reaktoroFoam"
Floating point exception (core dumped)

如果有人可以帮助我,我将非常感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)