fsiFoam 无法识别 interflow 传输模型问题

/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright held by original author
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
    Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM; if not, write to the Free Software Foundation,
    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

\*---------------------------------------------------------------------------*/

#include "interFlow.H"
#include "volFields.H"
#include "fvm.H"
#include "fvc.H"
#include "fvMatrices.H"
#include "addToRunTimeSelectionTable.H"
#include "findRefCell.H"
#include "adjustPhi.H"
#include "fluidStructureInterface.H"
#include "fixedGradientFvPatchFields.H"
#include "interfaceProperties.H"
#include "twoPhaseMixture.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
namespace flowModels
{

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

defineTypeNameAndDebug(interFlow, 0);
addToRunTimeSelectionTable(flowModel, interFlow, dictionary);


// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

interFlow::interFlow(const fvMesh& mesh)
:
    flowModel(this->typeName, mesh),
    U_
    (
        IOobject
        (
            "U",
            runTime().timeName(),
            mesh,	
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    ),
    pd_
    (
        IOobject
        (
            "pd",
             runTime().timeName(),
             mesh,
             IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    ),
    p_
    (
        IOobject
        (
            "p",
            runTime().timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    ),
    gradp_(fvc::grad(p_)),
    alpha1_
    (
        IOobject
        (
           "alpha1",
           runTime().timeName(),
           mesh,
           IOobject::MUST_READ,
           IOobject::AUTO_WRITE
     ),
     mesh
    ),
    phi_
    (
        IOobject
        (
            "phi",
            runTime().timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
        fvc::interpolate(U_) & mesh.Sf()
    ),
    laminarTransport_(U_, phi_),
    turbulence_
    (
        incompressible::turbulenceModel::New
        (
            U_, phi_, laminarTransport_
        )
    ),
    rho10_(laminarTransport_.rho1()),
    rho20_(laminarTransport_.rho2()),
    rho_
    (
           IOobject
           (
               "rho",
                runTime().timeName(),
                mesh,
                IOobject::NO_READ,
                IOobject::AUTO_WRITE
           ),
           alpha1_*rho10_ + (1.0-alpha1_)*rho20_,   // 这里是初始值
           alpha1_.boundaryField().types()       // 边界类型
    )
{}

// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //

const volVectorField& interFlow::U() const
{
    return U_;
}


const volScalarField& interFlow::p() const
{
    return p_;
}


//- Patch viscous force (N/m2)
tmp<vectorField> interFlow::patchViscousForce(const label patchID) const
{
    tmp<vectorField> tvF
    (
        new vectorField(mesh().boundary()[patchID].size(), vector::zero)
    );

    tvF() = 
        rho_.value()
       *(
            mesh().boundary()[patchID].nf()
          & turbulence_->devReff()().boundaryField()[patchID]
        );

//     vectorField n = mesh().boundary()[patchID].nf();
//     tvF() -= n*(n&tvF());

    return tvF;
}

//- Patch pressure force (N/m2)
tmp<scalarField> interFlow::patchPressureForce(const label patchID) const
{
    tmp<scalarField> tpF
    (
        new scalarField(mesh().boundary()[patchID].size(), 0)
    );

    tpF() = rho_.value()*p().boundaryField()[patchID];

    return tpF;
}

//- Patch viscous force (N/m2)
tmp<vectorField> interFlow::faceZoneViscousForce
(
    const label zoneID,
    const label patchID
) const
{
    vectorField pVF = patchViscousForce(patchID);

    tmp<vectorField> tvF
    (
        new vectorField(mesh().faceZones()[zoneID].size(), vector::zero)
    );
    vectorField& vF = tvF();

    const label patchStart = 
        mesh().boundaryMesh()[patchID].start();

    forAll(pVF, i)
    {
        vF[mesh().faceZones()[zoneID].whichFace(patchStart + i)] = 
            pVF[i];
    }

    // Parallel data exchange: collect pressure field on all processors
    reduce(vF, sumOp<vectorField>());
    

    return tvF;
}

//- Patch pressure force (N/m2)
tmp<scalarField> interFlow::faceZonePressureForce
(
    const label zoneID, 
    const label patchID
) const
{
    scalarField pPF = patchPressureForce(patchID);

    tmp<scalarField> tpF
    (
        new scalarField(mesh().faceZones()[zoneID].size(), 0)
    );
    scalarField& pF = tpF();

    const label patchStart = 
        mesh().boundaryMesh()[patchID].start();

    forAll(pPF, i)
    {
        pF[mesh().faceZones()[zoneID].whichFace(patchStart + i)] = 
            pPF[i];
    }

    // Parallel data exchange: collect pressure field on all processors
    reduce(pF, sumOp<scalarField>());

    return tpF;
}

tmp<scalarField> interFlow::faceZoneMuEff
(
    const label zoneID,
    const label patchID                
) const
{
    scalarField pMuEff = 
        rho_.value()*turbulence_->nuEff()().boundaryField()[patchID];

    tmp<scalarField> tMuEff
    (
        new scalarField(mesh().faceZones()[zoneID].size(), 0)
    );
    scalarField& muEff = tMuEff();

    const label patchStart = 
        mesh().boundaryMesh()[patchID].start();

    forAll(pMuEff, i)
    {
        muEff[mesh().faceZones()[zoneID].whichFace(patchStart + i)] = 
            pMuEff[i];
    }

    // Parallel data exchange: collect pressure field on all processors
    reduce(muEff, sumOp<scalarField>());

    return tMuEff;
}

void interFlow::evolve()
{
    Info << "Evolving flow model" << endl;

    const fvMesh& mesh = flowModel::mesh();

    int nCorr(readInt(flowProperties().lookup("nCorrectors")));

    int nNonOrthCorr =
        readInt(flowProperties().lookup("nNonOrthogonalCorrectors"));

    // Prepare for the pressure solution
    label pRefCell = 0;
    scalar pRefValue = 0.0;
    setRefCell(p_, flowProperties(), pRefCell, pRefValue);

    if(mesh.moving())
    {
        // Make the fluxes relative
        phi_ -= fvc::meshPhi(U_);
    }

    // CourantNo
    {
        scalar CoNum = 0.0;
        scalar meanCoNum = 0.0;
        scalar velMag = 0.0;

        if (mesh.nInternalFaces())
        {
            surfaceScalarField SfUfbyDelta =
                mesh.surfaceInterpolation::deltaCoeffs()*mag(phi_);

            CoNum = max(SfUfbyDelta/mesh.magSf())
                .value()*runTime().deltaT().value();

            meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
                .value()*runTime().deltaT().value();

            velMag = max(mag(phi_)/mesh.magSf()).value();
        }

        Info<< "Courant Number mean: " << meanCoNum
            << " max: " << CoNum
            << " velocity magnitude: " << velMag << endl;
    }

    fvVectorMatrix UEqn
    (
        fvm::ddt(U_)
      + fvm::div(phi_, U_)
      + turbulence_->divDevReff(U_)
    );

    solve(UEqn == -gradp_);

    // --- PISO loop

    volScalarField rUA = 1.0/UEqn.A();

    for (int corr=0; corr<nCorr; corr++)
    {
        U_ = rUA*UEqn.H();
        phi_ = (fvc::interpolate(U_) & mesh.Sf());

        for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
        {
            fvScalarMatrix pEqn
            (
                fvm::laplacian(rUA, p_) == fvc::div(phi_)
            );

            pEqn.setReference(pRefCell, pRefValue);

            if
            (
                corr == nCorr-1
             && nonOrth == nNonOrthCorr
            )
            {
                pEqn.solve(mesh.solutionDict().solver("pFinal"));
            }
            else
            {
                pEqn.solve();
            }

            if (nonOrth == nNonOrthCorr)
            {
                phi_ -= pEqn.flux();
            }
        }

        // Continuity error
        {
            volScalarField contErr = fvc::div(phi_);

            scalar sumLocalContErr = runTime().deltaT().value()*
                mag(contErr)().weightedAverage(mesh.V()).value();

            scalar globalContErr = runTime().deltaT().value()*
                contErr.weightedAverage(mesh.V()).value();

            Info<< "time step continuity errors : sum local = "
                << sumLocalContErr << ", global = " << globalContErr << endl;
        }

        gradp_ = fvc::grad(p_);

        U_ -= rUA*gradp_;
        U_.correctBoundaryConditions();
    }

    turbulence_->correct();
}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace flowModels
} // End namespace Foam

// ************************************************************************* //
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright held by original author
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
    Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM; if not, write to the Free Software Foundation,
    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Class
    interFlow

Description
    icoFoam flow model

Author
    Hrvoje Jasak, Wikki Ltd.  All rights reserved.

SourceFiles
    interFlow.C

\*---------------------------------------------------------------------------*/

#ifndef interFlow_H
#define interFlow_H

#include "flowModel.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "twoPhaseMixture.H"
#include "turbulenceModel.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
namespace flowModels
{

/*---------------------------------------------------------------------------*\
                        Class interFlow Declaration
\*---------------------------------------------------------------------------*/

class interFlow
:
    public flowModel
{
    // Private data

        //- Velocity field
        volVectorField U_;

        //- Pressure field
        volScalarField pd_;

        //- Pressure field
        volScalarField p_;

        //- Pressure field
        volVectorField gradp_;

        //- Phase field
        volScalarField alpha1_;

        //- Flux field
        surfaceScalarField phi_;


        //- Transport model
        twoPhaseMixture laminarTransport_;

        //- Turbulence model
        autoPtr<incompressible::turbulenceModel> turbulence_;

        //- Density
        dimensionedScalar rho10_;

        //- Density
        dimensionedScalar rho20_;

        //- Pressure field
        volScalarField rho_; 

    // Private Member Functions

        //- Disallow default bitwise copy construct
        interFlow(const interFlow&);

        //- Disallow default bitwise assignment
        void operator=(const interFlow&);


public:

    //- Runtime type information
    TypeName("interFlow");

    // Constructors

        //- Construct from components
        interFlow(const fvMesh& mesh);

//         //- Construct from components
//         interFlow
//         (
//             const word& type,
//             const fvMesh& mesh
//         );

    // Destructor

        virtual ~interFlow()
        {}


    // Member Functions

        // Access

            //- Return velocity field
            virtual const volVectorField& U() const;

            //- Return velocity field
            volVectorField& U()
            {
                return U_;
            }

            //- Return pressure field
            virtual const volScalarField& p() const;

            //- Return pressure field
            volScalarField& p()
            {
                return p_;
            }

            //- Return pressure gradient
            volVectorField& gradp()
            {
                return gradp_;
            }

            //- Return flux field
            surfaceScalarField& phi()
            {
                return phi_;
            }

//             //- Return kinematic viscosity
//             const dimensionedScalar& nu() const
//             {
//                 return nu_;
//             }

            //- Density
            const dimensionedScalar& rho()
            {
                return rho_;
            }

            //- Patch viscous force (N/m2)
            virtual tmp<vectorField> patchViscousForce
            (
                const label patchID
            ) const;

            //- Patch pressure force (N/m2)
            virtual tmp<scalarField> patchPressureForce
            (
                const label patchID
            ) const;

            //- Patch viscous force (N/m2)
            virtual tmp<vectorField> faceZoneViscousForce
            (
                const label zoneID,
                const label patchID
            ) const;

            //- Patch pressure force (N/m2)
            virtual tmp<scalarField> faceZonePressureForce
            (
                const label zoneID,
                const label patchID
            ) const;

            //- Face zone effective dynamic viscosity
            virtual tmp<scalarField> faceZoneMuEff
            (
                const label zoneID,
                const label patchID                
            ) const;

        // Edit

            //- Evolve the flow model
            virtual void evolve();
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace flowModels
} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //

我没有上传文件的权限 只能复制文本了 麻烦你了 对我这个陌生人帮了那么多忙

我就一起回复了。如果有问题你再贴编译结果出来。但是,目前这个只能解决你的编译问题。我手上也没有 foam-extend-3.1,所以需要你来编译下,看看有没有错误。

/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright held by original author
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
    Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM; if not, write to the Free Software Foundation,
    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

\*---------------------------------------------------------------------------*/

#include "interFlow.H"
#include "volFields.H"
#include "fvm.H"
#include "fvc.H"
#include "fvMatrices.H"
#include "addToRunTimeSelectionTable.H"
#include "findRefCell.H"
#include "adjustPhi.H"
#include "fluidStructureInterface.H"
#include "fixedGradientFvPatchFields.H"
#include "interfaceProperties.H"
#include "twoPhaseMixture.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
namespace flowModels
{

// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

defineTypeNameAndDebug(interFlow, 0);
addToRunTimeSelectionTable(flowModel, interFlow, dictionary);


// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

interFlow::interFlow(const fvMesh& mesh)
:
    flowModel(this->typeName, mesh),
    U_
    (
        IOobject
        (
            "U",
            runTime().timeName(),
            mesh,	
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    ),
    pd_
    (
        IOobject
        (
            "pd",
             runTime().timeName(),
             mesh,
             IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    ),
    p_
    (
        IOobject
        (
            "p",
            runTime().timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    ),
    gradp_(fvc::grad(p_)),
    alpha1_
    (
        IOobject
        (
           "alpha1",
           runTime().timeName(),
           mesh,
           IOobject::MUST_READ,
           IOobject::AUTO_WRITE
     ),
     mesh
    ),
    phi_
    (
        IOobject
        (
            "phi",
            runTime().timeName(),
            mesh,
            IOobject::READ_IF_PRESENT,
            IOobject::AUTO_WRITE
        ),
        fvc::interpolate(U_) & mesh.Sf()
    ),
    laminarTransport_(U_, phi_),
    turbulence_
    (
        incompressible::turbulenceModel::New
        (
            U_, phi_, laminarTransport_
        )
    ),
    rho10_(laminarTransport_.rho1()),
    rho20_(laminarTransport_.rho2()),
    rho_
    (
           IOobject
           (
               "rho",
                runTime().timeName(),
                mesh,
                IOobject::NO_READ,
                IOobject::AUTO_WRITE
           ),
           alpha1_*rho10_ + (1.0-alpha1_)*rho20_,   // 这里是初始值
           alpha1_.boundaryField().types()       // 边界类型
    )
{}

// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //

const volVectorField& interFlow::U() const
{
    return U_;
}


const volScalarField& interFlow::p() const
{
    return p_;
}


//- Patch viscous force (N/m2)
tmp<vectorField> interFlow::patchViscousForce(const label patchID) const
{
    tmp<vectorField> tvF
    (
        new vectorField(mesh().boundary()[patchID].size(), vector::zero)
    );

    tvF() = 
        rho()
       *(
            mesh().boundary()[patchID].nf()
          & turbulence_->devReff()().boundaryField()[patchID]
        );

//     vectorField n = mesh().boundary()[patchID].nf();
//     tvF() -= n*(n&tvF());

    return tvF;
}

//- Patch pressure force (N/m2)
tmp<scalarField> interFlow::patchPressureForce(const label patchID) const
{
    tmp<scalarField> tpF
    (
        new scalarField(mesh().boundary()[patchID].size(), 0)
    );

    tpF() = rho()*p().boundaryField()[patchID];

    return tpF;
}

//- Patch viscous force (N/m2)
tmp<vectorField> interFlow::faceZoneViscousForce
(
    const label zoneID,
    const label patchID
) const
{
    vectorField pVF = patchViscousForce(patchID);

    tmp<vectorField> tvF
    (
        new vectorField(mesh().faceZones()[zoneID].size(), vector::zero)
    );
    vectorField& vF = tvF();

    const label patchStart = 
        mesh().boundaryMesh()[patchID].start();

    forAll(pVF, i)
    {
        vF[mesh().faceZones()[zoneID].whichFace(patchStart + i)] = 
            pVF[i];
    }

    // Parallel data exchange: collect pressure field on all processors
    reduce(vF, sumOp<vectorField>());
    

    return tvF;
}

//- Patch pressure force (N/m2)
tmp<scalarField> interFlow::faceZonePressureForce
(
    const label zoneID, 
    const label patchID
) const
{
    scalarField pPF = patchPressureForce(patchID);

    tmp<scalarField> tpF
    (
        new scalarField(mesh().faceZones()[zoneID].size(), 0)
    );
    scalarField& pF = tpF();

    const label patchStart = 
        mesh().boundaryMesh()[patchID].start();

    forAll(pPF, i)
    {
        pF[mesh().faceZones()[zoneID].whichFace(patchStart + i)] = 
            pPF[i];
    }

    // Parallel data exchange: collect pressure field on all processors
    reduce(pF, sumOp<scalarField>());

    return tpF;
}

tmp<scalarField> interFlow::faceZoneMuEff
(
    const label zoneID,
    const label patchID                
) const
{
    scalarField pMuEff = 
        rho()*turbulence_->nuEff()().boundaryField()[patchID];

    tmp<scalarField> tMuEff
    (
        new scalarField(mesh().faceZones()[zoneID].size(), 0)
    );
    scalarField& muEff = tMuEff();

    const label patchStart = 
        mesh().boundaryMesh()[patchID].start();

    forAll(pMuEff, i)
    {
        muEff[mesh().faceZones()[zoneID].whichFace(patchStart + i)] = 
            pMuEff[i];
    }

    // Parallel data exchange: collect pressure field on all processors
    reduce(muEff, sumOp<scalarField>());

    return tMuEff;
}

void interFlow::evolve()
{
    Info << "Evolving flow model" << endl;

    const fvMesh& mesh = flowModel::mesh();

    int nCorr(readInt(flowProperties().lookup("nCorrectors")));

    int nNonOrthCorr =
        readInt(flowProperties().lookup("nNonOrthogonalCorrectors"));

    // Prepare for the pressure solution
    label pRefCell = 0;
    scalar pRefValue = 0.0;
    setRefCell(p_, flowProperties(), pRefCell, pRefValue);

    if(mesh.moving())
    {
        // Make the fluxes relative
        phi_ -= fvc::meshPhi(U_);
    }

    // CourantNo
    {
        scalar CoNum = 0.0;
        scalar meanCoNum = 0.0;
        scalar velMag = 0.0;

        if (mesh.nInternalFaces())
        {
            surfaceScalarField SfUfbyDelta =
                mesh.surfaceInterpolation::deltaCoeffs()*mag(phi_);

            CoNum = max(SfUfbyDelta/mesh.magSf())
                .value()*runTime().deltaT().value();

            meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
                .value()*runTime().deltaT().value();

            velMag = max(mag(phi_)/mesh.magSf()).value();
        }

        Info<< "Courant Number mean: " << meanCoNum
            << " max: " << CoNum
            << " velocity magnitude: " << velMag << endl;
    }

    fvVectorMatrix UEqn
    (
        fvm::ddt(U_)
      + fvm::div(phi_, U_)
      + turbulence_->divDevReff(U_)
    );

    solve(UEqn == -gradp_);

    // --- PISO loop

    volScalarField rUA = 1.0/UEqn.A();

    for (int corr=0; corr<nCorr; corr++)
    {
        U_ = rUA*UEqn.H();
        phi_ = (fvc::interpolate(U_) & mesh.Sf());

        for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
        {
            fvScalarMatrix pEqn
            (
                fvm::laplacian(rUA, p_) == fvc::div(phi_)
            );

            pEqn.setReference(pRefCell, pRefValue);

            if
            (
                corr == nCorr-1
             && nonOrth == nNonOrthCorr
            )
            {
                pEqn.solve(mesh.solutionDict().solver("pFinal"));
            }
            else
            {
                pEqn.solve();
            }

            if (nonOrth == nNonOrthCorr)
            {
                phi_ -= pEqn.flux();
            }
        }

        // Continuity error
        {
            volScalarField contErr = fvc::div(phi_);

            scalar sumLocalContErr = runTime().deltaT().value()*
                mag(contErr)().weightedAverage(mesh.V()).value();

            scalar globalContErr = runTime().deltaT().value()*
                contErr.weightedAverage(mesh.V()).value();

            Info<< "time step continuity errors : sum local = "
                << sumLocalContErr << ", global = " << globalContErr << endl;
        }

        gradp_ = fvc::grad(p_);

        U_ -= rUA*gradp_;
        U_.correctBoundaryConditions();
    }

    turbulence_->correct();
}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace flowModels
} // End namespace Foam

// ************************************************************************* //

.H 文件

/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright held by original author
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License
    This file is part of OpenFOAM.

    OpenFOAM is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
    Free Software Foundation; either version 2 of the License, or (at your
    option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM; if not, write to the Free Software Foundation,
    Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

Class
    interFlow

Description
    icoFoam flow model

Author
    Hrvoje Jasak, Wikki Ltd.  All rights reserved.

SourceFiles
    interFlow.C

\*---------------------------------------------------------------------------*/

#ifndef interFlow_H
#define interFlow_H

#include "flowModel.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "twoPhaseMixture.H"
#include "turbulenceModel.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
namespace flowModels
{

/*---------------------------------------------------------------------------*\
                        Class interFlow Declaration
\*---------------------------------------------------------------------------*/

class interFlow
:
    public flowModel
{
    // Private data

        //- Velocity field
        volVectorField U_;

        //- Pressure field
        volScalarField pd_;

        //- Pressure field
        volScalarField p_;

        //- Pressure field
        volVectorField gradp_;

        //- Phase field
        volScalarField alpha1_;

        //- Flux field
        surfaceScalarField phi_;


        //- Transport model
        twoPhaseMixture laminarTransport_;

        //- Turbulence model
        autoPtr<incompressible::turbulenceModel> turbulence_;

        //- Density
        dimensionedScalar rho10_;

        //- Density
        dimensionedScalar rho20_;

        //- Pressure field
        volScalarField rho_; 

    // Private Member Functions

        //- Disallow default bitwise copy construct
        interFlow(const interFlow&);

        //- Disallow default bitwise assignment
        void operator=(const interFlow&);


public:

    //- Runtime type information
    TypeName("interFlow");

    // Constructors

        //- Construct from components
        interFlow(const fvMesh& mesh);

//         //- Construct from components
//         interFlow
//         (
//             const word& type,
//             const fvMesh& mesh
//         );

    // Destructor

        virtual ~interFlow()
        {}


    // Member Functions

        // Access

            //- Return velocity field
            virtual const volVectorField& U() const;

            //- Return velocity field
            volVectorField& U()
            {
                return U_;
            }

            //- Return pressure field
            virtual const volScalarField& p() const;

            //- Return pressure field
            volScalarField& p()
            {
                return p_;
            }

            //- Return pressure gradient
            volVectorField& gradp()
            {
                return gradp_;
            }

            //- Return flux field
            surfaceScalarField& phi()
            {
                return phi_;
            }

//             //- Return kinematic viscosity
//             const dimensionedScalar& nu() const
//             {
//                 return nu_;
//             }

            //- Density
            const volScalarField& rho()
            {
                return rho_;
            }

            //- Patch viscous force (N/m2)
            virtual tmp<vectorField> patchViscousForce
            (
                const label patchID
            ) const;

            //- Patch pressure force (N/m2)
            virtual tmp<scalarField> patchPressureForce
            (
                const label patchID
            ) const;

            //- Patch viscous force (N/m2)
            virtual tmp<vectorField> faceZoneViscousForce
            (
                const label zoneID,
                const label patchID
            ) const;

            //- Patch pressure force (N/m2)
            virtual tmp<scalarField> faceZonePressureForce
            (
                const label zoneID,
                const label patchID
            ) const;

            //- Face zone effective dynamic viscosity
            virtual tmp<scalarField> faceZoneMuEff
            (
                const label zoneID,
                const label patchID                
            ) const;

        // Edit

            //- Evolve the flow model
            virtual void evolve();
};


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

} // End namespace flowModels
} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#endif

// ************************************************************************* //

附件:

interFlow.zip (4.5 KB)

下载了您的的附件还是有一些报错

加上边界值就 OK 了,你再试一下。

interFlow.C.zip (2.8 KB)

还是差一点点 :rofl:

函数声明有点问题,这下应该可以了。

interFlow.H.zip (1.7 KB)

这个只是能编译通过。还不能完全解决你的问题。你还需要 alpha 求解,rho_ 场更新。

:rofl: 终于通过了 ,我一个人估计搞不出来,非常感谢!!!
还有一个问题这是怎么回事

我研一的老师叫我对着人家论文弄出他的效果

很神奇的他的interflow构造根本还是singlephase的
我也不知道到时候搞不搞的出来 ,估计后面还有很长的路走
我再去学学 alpha 求解,rho_ 场更新 :rofl:

libfluidStructureINteraction.so: undefined symbol: _ZN4Foam10flowModels9interFlow3rheoEv

这个错误的意思是有某个库没有定义,你需要重新更新一下 fsiFoam/Make/options,再编译 fsiFoam,具体的库和头文件跟 interFlow 有关,关于 options ,可以参考

欢迎入坑 OpenFOAM

一入OF深似海,从此头发掉不停,给两位OF大神递茶 :pleading_face:
谢谢大神的帮助!!!

:joy:大神你好,还是报那个错误。论文说只要在options里面加蓝色字体就行,在file加flowModels/interFlow/interFlow.C就行


我考虑了下加了以下的option还是报那个错误,连不起

EXE_INC = \
    -I./numerics/fvMeshSubset \
    -I./stressModels/componentReference \
    -I./numerics/findRefCell \
    -I./stressModels/constitutiveModel/plasticityStressReturnMethods/plasticityStressReturn \
    -I./stressModels/constitutiveModel \
    -I./stressModels/stressModel/fvMeshSubset \
    -I./numerics/ggi/ExtendedGGIInterpolation \
    -I./fluidStructureInterface \
    -I./numerics/leastSquaresVolPointInterpolation \
    -I./numerics/skewCorrectedSnGrad \
    -I./numerics/skewCorrectedVectorSnGrad \
    -I./numerics/fvc \
    -I./stressModels/fvPatchFields/tractionDisplacement \
    -I./stressModels/fvPatchFields/tractionDisplacementIncrement \
    -I./stressModels/fvPatchFields/fixedDisplacement \
    -I./stressModels/fvPatchFields/symmetryDisplacement \
    -I./stressModels/stressModel \
    -I./numerics/ddtSchemes \
    -I./flowModels/flowModel \
    -I./interFoam \
    -I$(LIB_SRC)/finiteVolume/lnInclude \
    -I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
    -I$(LIB_SRC)/transportModels \
    -I$(LIB_SRC)/transportModels/incompressible/lnInclude \
    -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
    -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
    -I$(LIB_SRC)/transportModels/incompressible/incompressibleTwoPhaseMixture \
    -I$(LIB_SRC)/dynamicMesh/dynamicFvMesh/lnInclude \
    -I$(LIB_SRC)/dynamicMesh/dynamicMesh/lnInclude \
    -I$(LIB_SRC)/dynamicMesh/meshMotion/RBFMotionSolver/lnInclude \
    -I$(LIB_SRC)/dynamicMesh/meshMotion/fvMotionSolver/lnInclude \
    -I$(LIB_SRC)/finiteArea/lnInclude \
    -I$(LIB_SRC)/lagrangian/basic/lnInclude \
    -I$(LIB_SRC)/meshTools/lnInclude \
    -I$(LIB_SRC)/tetFiniteElement/lnInclude \
    -I$(LIB_SRC)/solidModels/lnInclude

EXE_LIBS = \
    -linterfaceProperties \
    -lincompressibleTurbulenceModel \
    -lincompressibleRASModels \
    -lincompressibleLESModels \
    -lincompressibleTransportModels \
    -lfiniteVolume \
    -ldynamicFvMesh \
    -ldynamicMesh \
    -lmeshTools \
    -ltopoChangerFvMesh \ 
    -llduSolvers \
    -L$(MESQUITE_LIB_DIR) -lmesquite
    -lsolidModels

不是这里哈,是 fsiFoam/Make/options

sorry, 前面这个错误跟库关系不大,而是函数重载和指针的问题,给你更新一下。

interFlow.zip (4.5 KB)

这里论文上完全没说要改 :rofl: 是将上面蓝色的也补在这里然后wmake以下就行了吗

是的,不加的话,有些库就没有连上,怎么用呢?

还是那个fsi报错 我已经把全部能加的都加在fsifoam的option里面了,也没报错还是不行

bata把他成功连起来真是难

kanshangqu看上去好像还是rho的问题 更新rho不是就把transportProperties变成两相的就行了吗 :joy:

函数的问题,更新一下。

interFlow.zip (4.5 KB)

传输模型还是有问题 :rofl:


是这里有问题吗 不知道怎么改