twoPhaseEulerFoam中的ITAE模型
-
各位前辈,想要在twoPhaseEulerFoam中的ITAE模型中,添加一个温度传输方程,准备求解液固流沉积后的管内温度场,在ITAE.C中添加完成T的求解方程后,出现了两个问题:
(1)这里的phase_.phi()只是单纯的离散相的通量,而这个求解温度场需要的是离散相和连续相的通量和即fluid.phi(),这个fluid.phi()应该怎么去表示?
(2)当植入求解方程T后,报错如下,希望各位老师指点一下,不胜感激diameterModels/IATE/IATE.C: In member function ‘virtual void Foam::diameterModels::IATE::correct()’: diameterModels/IATE/IATE.C:220:19: error: ‘laplacian’ is not a member of ‘Foam::fvm’ -fvm::laplacian(niandu,Tcell_) ^ /opt/openfoam4/wmake/rules/General/transform:8: recipe for target '/opt/openfoam4/platforms/linux64GccDPInt32Opt/applications/solvers/multiphase/twoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.o' failed
更改后的ITAE.C代码如下
Foam::diameterModels::IATE::IATE ( const dictionary& diameterProperties, const phaseModel& phase ) : diameterModel(diameterProperties, phase), kappai_ ( IOobject ( IOobject::groupName("kappai", phase.name()), phase_.U().time().timeName(), phase_.U().mesh(), IOobject::MUST_READ, IOobject::AUTO_WRITE ), phase_.U().mesh() ), Tcell_ ( IOobject ( // "Tcell", IOobject::groupName("Tcell", phase.name()), phase_.U().time().timeName(), phase_.U().mesh(), IOobject::MUST_READ, IOobject::AUTO_WRITE ), phase_.U().mesh()//T ), rho1_("rho1", dimensionSet(1,0,-3,0,0), diameterProperties_),//properties rho2_("rho2", dimensionSet(1,0,-3,0,0), diameterProperties_), Khydrate_("Khydrate", dimensionSet(1,1,-3,1,0), diameterProperties_), Kwater_("Kwater", dimensionSet(1,1,-3,1,0), diameterProperties_), Cpwater_("Cpwater", dimensionSet(0,2,-2,1,0), diameterProperties_), Cphydrate_("Cphydrate", dimensionSet(0,2,-2,1,0), diameterProperties_), dMax_("dMax", dimLength, diameterProperties_), dMin_("dMin", dimLength, diameterProperties_), residualAlpha_ ( "residualAlpha", dimless, diameterProperties_ ), d_ ( IOobject ( IOobject::groupName("d", phase.name()), phase_.U().time().timeName(), phase_.U().mesh(), IOobject::NO_READ, IOobject::AUTO_WRITE ), dsm() ), sources_ ( diameterProperties_.lookup("sources"), IATEsource::iNew(*this) ) //Tcellnow(phase.TTT) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::diameterModels::IATE::~IATE() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // /* const volScalarField& Tcelliate() const { return phase.fluid().Tcell(); } */ Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATE::dsm() const { return max(6/max(kappai_, 6/dMax_), dMin_); } // Placeholder for the nucleation/condensation model // Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATE::Rph() const // { // const volScalarField& T = phase_.thermo().T(); // const volScalarField& p = phase_.thermo().p(); // // scalar A, B, C, sigma, vm, Rph; // // volScalarField ps(1e5*pow(10, A - B/(T + C))); // volScalarField Dbc // ( // 4*sigma*vm/(constant::physicoChemical::k*T*log(p/ps)) // ); // // return constant::mathematical::pi*sqr(Dbc)*Rph; // } void Foam::diameterModels::IATE::correct() { // Initialise the accumulated source term to the dilatation effect volScalarField R ( ( (1.0/3.0) /max ( fvc::average(phase_ + phase_.oldTime()), residualAlpha_ ) ) *(fvc::ddt(phase_) + fvc::div(phase_.alphaPhi())) ); volScalarField niandu ( Khydrate_*phase_/Cphydrate_/rho1_+Kwater_*(1-phase_)/Cpwater_/rho2_ );//niandu // Accumulate the run-time selectable sources forAll(sources_, j) { R -= sources_[j].R(); } fv::options& fvOptions(fv::options::New(phase_.mesh())); // Construct the interfacial curvature equation fvScalarMatrix kappaiEqn ( fvm::ddt(kappai_) + fvm::div(phase_.phi(), kappai_) - fvm::Sp(fvc::div(phase_.phi()), kappai_) == - fvm::SuSp(R, kappai_) // - Rph() // Omit the nucleation/condensation term + fvOptions(kappai_) ); kappaiEqn.relax(); fvOptions.constrain(kappaiEqn); kappaiEqn.solve(); // surfaceScalarField& phiphi = phase_.phi(); fvScalarMatrix TEqn//qiu jie T ( fvm::ddt(Tcell_) +fvm::div(phase_.phi(),Tcell_) -fvm::laplacian(niandu,Tcell_) ); TEqn.solve(); // Update the Sauter-mean diameter d_ = dsm(); }
-
各位老师,经过测试发现问题好像是fvm::laplacian(A,B)中的AB两个的数据类型不正确,对于第一个mesh注册的Tcell是没有问题的,对于第二个注册在phase_.U().mesh()内的Tcell就不可以进行计算。现在主要问题是怎么在ITAE.C中将T注册到mesh中,或者有什么办法能够在ITAE库中进行fvm::laplacian(A,B),标量传输方程正常计算,希望各位老师点拨一下,添加一个标量传输方程咋这么难,哎
volScalarField Tcell ( IOobject ( "Tcell", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE ), mesh ); volScalarField Tcell ( IOobject ( "Tcell", // IOobject::groupName("Tcell", phase.name()), phase_.U().time().timeName(), phase_.U().mesh(), IOobject::MUST_READ, IOobject::AUTO_WRITE ), phase_.U().mesh()//T );
-
@东岳 东岳老师现在出现这个问题,麻烦老师有时间再给看看,谢谢谢谢
diameterModels/IATE/IATEsources/randomCoalescence/randomCoalescence.C: In member function ‘virtual Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::diameterModels::IATEsources::randomCoalescence::R() const’: diameterModels/IATE/IATEsources/randomCoalescence/randomCoalescence.C:94:40: error: ‘mesh’ was not declared in this scope const volScalarField& TcellnowLX = mesh.lookupObject<volScalarField>("Tcell"); ^ diameterModels/IATE/IATEsources/randomCoalescence/randomCoalescence.C:94:72: error: expected primary-expression before ‘>’ token const volScalarField& TcellnowLX = mesh.lookupObject<volScalarField>("Tcell");
-
@东岳 东岳老师,现在植入进去也能编译成功了,但是开始计算就发散,错误代码如下,看了论坛上和网上的也没找到啥相关的资料,希望东岳老师再给点指导,谢谢
Starting jisuan kappai smoothSolver: Solving for kappai.air, Initial residual = 0.164043, Final residual = 3.33679e-07, No Iterations 2 Constructing momentum equations GAMG: Solving for p_rgh, Initial residual = 0.0861362, Final residual = 8.71808e-09, No Iterations 55 GAMG: Solving for p_rgh, Initial residual = 0.00100705, Final residual = 9.19158e-09, No Iterations 42 GAMG: Solving for p_rgh, Initial residual = 9.49796e-06, Final residual = 9.7128e-09, No Iterations 18 new cannot satisfy memory request. This does not necessarily mean you have run out of virtual memory. It could be due to a stack violation caused by e.g. bad use of pointers or an out of date shared library 已放弃 (核心已转储)
植入代码如下:
ITAE.C中Foam::tmp<Foam::volScalarField> Foam::diameterModels::IATE::Rph() const { //const volScalarField& T = phase_.thermo().T(); //const volScalarField& p = phase_.thermo().p(); const volScalarField& Tcellnow = phase_.U().mesh().lookupObject<volScalarField>("Tcell"); // scalar Teq = 275; //scalar rhohydrate = 850; // scalar phaseh = 50; //scalar qianre = 43500; dimensionedScalar Teq("Teq", dimensionSet(0,0,0,1,0), 275); dimensionedScalar rhohydrate("rhohydrate", dimensionSet(1,-3,0,0,0), 850); dimensionedScalar phaseh("phaseh", dimensionSet(1,1,-3,-1,0), 50); dimensionedScalar qianre("qianre", dimensionSet(0,2,-2,0,0), 43500); volScalarField delt(Tcellnow - Teq); volScalarField Rph(0.0085*phaseh*delt*phase_*pow(kappai_,5)/rhohydrate/qianre); volScalarField Dsm(max(6/max(kappai_, 6/dMax_), dMin_)); // volScalarField Dbc // ( // 4*sigma*vm/(constant::physicoChemical::k*T*log(p/ps)) //); return constant::mathematical::pi*sqr(Dsm)*Rph; }