tmp类使用问题,承接上次的帖子问题



  • 根据各位老师的建议这次我将代码直接贴上来,补充说明问题,有老师说我的错误提示应该在tmp的使用不当上面,但是我现在对具体出错的地方还是不甚明白。我之前对于tmp的理解停留在一个智能的指针分配管理者上,知道它能减少内存的调配,提高效率,但实际所知并不多,对它的使用也停留在仿照源代码湍流模型上的类似公式。这次的问题我直接贴上来,承接上次帖子贴出来的问题:

    tmp<fvScalarMatrix> epstEqn
    (
        fvm::ddt(epsilont_)
      + fvm::div(phi_, epsilont_)
      - fvm::laplacian(alphaEff(), epsilont_) 
     ==
         Cp1_*Gt*epsilont_/kt_
      + Cp2_*G*epsilont_/k_
      - Cd1_*(sqr(epsilont_)/kt_)
      - Cd2_*((epsilont_*epsilon_)/k_)
    );
    
    epstEqn.ref().relax();
    epstEqn.ref().boundaryManipulate(epsilont_.boundaryFieldRef());
    solve(epstEqn);   
    bound(epsilont_, epsilontMin_);
    tmp<fvScalarMatrix> ktEqn
    (
        fvm::ddt(kt_)
      + fvm::div(phi_, kt_)
      - fvm::laplacian(alphaEff(), kt_)
     ==
        - Gt//速度产生项
      - fvm::Sp(2*epsilont_/kt_, kt_)
      
    );
    
    ktEqn.ref().relax();
    solve(ktEqn);
    bound(kt_, ktMin_);
    
    correctalphat();


  • 仅仅运行一步直接报错,这是具体的错误提示:

    Time = 1
    
     smoothSolver:  Solving for Ux, Initial residual = 1, Final residual = 0.0667125, No Iterations 3
     smoothSolver:  Solving for Uy, Initial residual = 1, Final residual =     0.0804578, No Iterations 3
     GAMG:  Solving for p, Initial residual = 1, Final residual = 0.0500194, No Iterations 4
     time step continuity errors : sum local = 0.879188, global = -0.272208, cumulative = -0.272208
     smoothSolver:  Solving for T, Initial residual = 1, Final residual = 0.0597181, No Iterations 2
    smoothSolver:  Solving for epsilon, Initial residual = 0.418304, Final residual = 0.0304297, No Iterations 2
    smoothSolver:  Solving for k, Initial residual = 1, Final residual = 0.00011942, No Iterations 1
    smoothSolver:  Solving for epsilont, Initial residual = 1, Final residual = 0.0345744, No Iterations 2
    bounding epsilont, min: -1800.64 max: 30630.5 average: 1357.93
    
    
      --> FOAM FATAL ERROR: 
     tmp<N4Foam14GeometricFieldIdNS_12fvPatchFieldENS_7volMeshEEE> deallocated
    
    From function const T& Foam::tmp<T>::operator()() const [with T = Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>]
    in file /opt/openfoam6/src/OpenFOAM/lnInclude/tmpI.H at line 278.

Log in to reply
 

CFD中文网 2016 - 2020 | 京ICP备15017992号-2