コード例 #1
0
ファイル: psiThermo.C プロジェクト: OpenFOAM/OpenFOAM-dev
Foam::psiThermo::psiThermo(const fvMesh& mesh, const word& phaseName)
:
    fluidThermo(mesh, phaseName),

    psi_
    (
        IOobject
        (
            phasePropertyName("thermo:psi"),
            mesh.time().timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        mesh,
        dimensionSet(0, -2, 2, 0, 0)
    ),

    mu_
    (
        IOobject
        (
            phasePropertyName("thermo:mu"),
            mesh.time().timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        mesh,
        dimensionSet(1, -1, -1, 0, 0)
    )
{}
コード例 #2
0
void Foam::fv::tabulatedAccelerationSource::addSup
(
    const RhoFieldType& rho,
    fvMatrix<vector>& eqn,
    const label fieldi
)
{
    Vector<vector> acceleration(motion_.acceleration());

    // If gravitational force is present combine with the linear acceleration
    if (mesh_.foundObject<uniformDimensionedVectorField>("g"))
    {
        uniformDimensionedVectorField& g =
            mesh_.lookupObjectRef<uniformDimensionedVectorField>("g");

        const uniformDimensionedScalarField& hRef =
            mesh_.lookupObject<uniformDimensionedScalarField>("hRef");

        g = g0_ - dimensionedVector("a", dimAcceleration, acceleration.x());

        dimensionedScalar ghRef
        (
            mag(g.value()) > SMALL
          ? g & (cmptMag(g.value())/mag(g.value()))*hRef
          : dimensionedScalar("ghRef", g.dimensions()*dimLength, 0)
        );

        mesh_.lookupObjectRef<volScalarField>("gh") = (g & mesh_.C()) - ghRef;

        mesh_.lookupObjectRef<surfaceScalarField>("ghf") =
            (g & mesh_.Cf()) - ghRef;
    }
    // ... otherwise include explicitly in the momentum equation
    else
    {
        eqn -= rho*dimensionedVector("a", dimAcceleration, acceleration.x());
    }

    dimensionedVector Omega
    (
        "Omega",
        dimensionSet(0, 0, -1, 0, 0),
        acceleration.y()
    );

    dimensionedVector dOmegaDT
    (
        "dOmegaDT",
        dimensionSet(0, 0, -2, 0, 0),
        acceleration.z()
    );

    eqn -=
    (
        rho*(2*Omega ^ eqn.psi())         // Coriolis force
      + rho*(Omega ^ (Omega ^ mesh_.C())) // Centrifugal force
      + rho*(dOmegaDT ^ mesh_.C())        // Angular tabulatedAcceleration force
    );
}
コード例 #3
0
ファイル: kOmegaSSTSASnew.C プロジェクト: Kiiree/foam-dev
tmp<fvScalarMatrix> kOmegaSSTSASnew<BasicTurbulenceModel>::Qsas
(
    const volScalarField& S2
) const
{
    volScalarField L
    (
        sqrt(this->k_)/(pow025(this->betaStar_)*this->omega_)
    );

    volScalarField Lvk
    (
        max
        (
            kappa_*sqrt(S2)
           /(
                mag(fvc::laplacian(this->U_))
              + dimensionedScalar
                (
                    "ROOTVSMALL",
                    dimensionSet(0, -1, -1, 0, 0),
                    ROOTVSMALL
                )
            ),
            Cs_*delta()
        )
    );

    return fvm::Su
    (
        this->alpha_*this->rho_
       *min
        (
            max
            (
                zeta2_*kappa_*S2*sqr(L/Lvk)
              - (2*C_/sigmaPhi_)*this->k_
               *max
                (
                    magSqr(fvc::grad(this->omega_))/sqr(this->omega_),
                    magSqr(fvc::grad(this->k_))/sqr(this->k_)
                ),
                dimensionedScalar("0", dimensionSet(0, 0, -2, 0, 0), 0)
            ),
            // Limit SAS production of omega for numerical stability,
            // particularly during start-up
            this->omega_/(0.1*this->omega_.time().deltaT())
        ),
        this->omega_
    );
}
コード例 #4
0
ファイル: phasePair.C プロジェクト: BarisCumhur/OpenFOAM-dev
Foam::phasePair::phasePair
(
    const phaseModel& phase1,
    const phaseModel& phase2,
    const dimensionedVector& g,
    const scalarTable& sigmaTable,
    const bool ordered
)
:
    phasePairKey(phase1.name(), phase2.name(), ordered),
    phase1_(phase1),
    phase2_(phase2),
    g_(g),
    sigma_
    (
        "sigma",
        dimensionSet(1, 0, -2, 0, 0),
        sigmaTable
        [
            phasePairKey
            (
                phase1.name(),
                phase2.name(),
                false
            )
        ]
    )
{}
tmp<volScalarField> SpalartAllmarasIDDES::rd
(
    const volScalarField& visc,
    const volScalarField& S
) const
{
    return min
    (
        visc
       /(
           max
           (
               S,
               dimensionedScalar("SMALL", S.dimensions(), SMALL)
           )*sqr(kappa_*y_)
         + dimensionedScalar
           (
               "ROOTVSMALL",
               dimensionSet(0, 2 , -1, 0, 0),
               ROOTVSMALL
           )
       ),
       scalar(10)
    );
}
コード例 #6
0
virtualMassForce::virtualMassForce
(
    const dictionary& multiphaseSurfaceForcesDict,
    const multiphase::transport& mtm,
    const PtrList<volScalarField>& alpha,
    const volScalarField& beta
)
:
	multiphaseSurfaceForcesDict_(multiphaseSurfaceForcesDict),
    alpha_(alpha),
    beta_(beta),
    mtm_(mtm),
    virtualMassForce_
	(
		IOobject
		(
			"virtualMassForce",
			beta.time().timeName(),
			beta.mesh(),
			IOobject::NO_READ,
			IOobject::AUTO_WRITE
		),
        beta.mesh(),
        dimensionedVector("zero", dimensionSet(0, 0, 0, 0, 0), vector(0.0, 0.0, 0.0))
    )
{}
コード例 #7
0
tmp<volScalarField> Foam::voidFractionModel::voidFractionInterp() const
{
    tmp<volScalarField> tsource
    (
        new volScalarField
        (
            IOobject
            (
                "alpha_voidFractionModel",
                particleCloud_.mesh().time().timeName(),
                particleCloud_.mesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            particleCloud_.mesh(),
            dimensionedScalar
            (
                "zero",
                dimensionSet(0, 0, 0, 0, 0),
                0
            )
        )
    );

    scalar tsf = particleCloud_.dataExchangeM().timeStepFraction();
    if(1-tsf < 1e-4 && particleCloud_.dataExchangeM().couplingStep() > 1) //tsf==1
    {
        tsource() = voidfractionPrev_;
    }
    else
    {
        tsource() = (1 - tsf) * voidfractionPrev_ + tsf * voidfractionNext_;
    }
    return tsource;
}
コード例 #8
0
tmp<volScalarField> meshMotionModel::body() const
{
    tmp<volScalarField> tmp
    (
        new volScalarField
        (
            IOobject
            (
                "xxx",
                particleCloud_.mesh().time().timeName(),
                particleCloud_.mesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            particleCloud_.mesh(),
            dimensionedScalar
            (
                "zero",
                dimensionSet(0, 1, -1, 0, 0),
                0.
            )
        )
    );
    return tmp;
}
コード例 #9
0
tmp<volVectorField> meshMotionModel::f() const
{
    tmp<volVectorField> tmp
    (
        new volVectorField
        (
            IOobject
            (
                "xxx",
                particleCloud_.mesh().time().timeName(),
                particleCloud_.mesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            particleCloud_.mesh(),
            dimensionedVector
            (
                "zero",
                dimensionSet(0, 1, -1, 0, 0),
                vector::zero
            )
        )
    );
    return tmp;
}
コード例 #10
0
tmp<volScalarField> realizableKE::rCmu
(
    const volTensorField& gradU,
    const volScalarField& S2,
    const volScalarField& magS
)
{
    tmp<volSymmTensorField> tS = dev(symm(gradU));
    const volSymmTensorField& S = tS();

    volScalarField W =
        (2*sqrt(2.0))*((S&S)&&S)
       /(
            magS*S2
          + dimensionedScalar("small", dimensionSet(0, 0, -3, 0, 0), SMALL)
        );

    tS.clear();

    volScalarField phis =
        (1.0/3.0)*acos(min(max(sqrt(6.0)*W, -scalar(1)), scalar(1)));
    volScalarField As = sqrt(6.0)*cos(phis);
    volScalarField Us = sqrt(S2/2.0 + magSqr(skew(gradU)));

    return 1.0/(A0_ + As*Us*k_/(epsilon_ + epsilonSmall_));
}
コード例 #11
0
ファイル: Syamlal.C プロジェクト: jheylmun/OpenFOAM-dev
Foam::dragModels::Syamlal::Syamlal
(
    const dictionary& dict,
    const phasePair& pair,
    const bool registerObject
)
:
    dragModel(dict, pair, registerObject),
    C1_
    (
        dimensionedScalar::lookupOrDefault
        (
            "C1",
            dict,
            dimensionSet(0, -2, 1, 0, 0, 0, 0),
            0.3
        )
    ),
    kineticTheorySystem_
    (
        pair_.phase1().mesh().lookupObject<kineticTheorySystem>
        (
            "kineticTheorySystem"
        )
    )
{}
Foam::hThermo<MixtureType>::hThermo(const fvMesh& mesh)
:
    basicThermo(mesh),
    MixtureType(*this, mesh),

    h_
    (
        IOobject
        (
            "h",
            mesh.time().timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        mesh,
        dimensionSet(0, 2, -2, 0, 0),
        hBoundaryTypes()
    )
{
    scalarField& hCells = h_.internalField();
    const scalarField& TCells = T_.internalField();

    forAll(hCells, celli)
    {
        hCells[celli] = this->cellMixture(celli).H(TCells[celli]);
    }
コード例 #13
0
tmp<volScalarField> noCouple::impMomSource() const
{
    tmp<volScalarField> tsource
    (
        new volScalarField
        (
            IOobject
            (
                "Ksl_implicitCouple",
                particleCloud_.mesh().time().timeName(),
                particleCloud_.mesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            particleCloud_.mesh(),
            dimensionedScalar
            (
                "zero",
                dimensionSet(1, -3, -1, 0, 0), // N/m3 / m/s
                0
            )
        )
    );

    return tsource;
}
コード例 #14
0
tmp<volVectorField> noCouple::expMomSource() const
{
    tmp<volVectorField> tsource
    (
        new volVectorField
        (
            IOobject
            (
                "f_explicitCouple",
                particleCloud_.mesh().time().timeName(),
                particleCloud_.mesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            particleCloud_.mesh(),
            dimensionedVector
            (
                "zero",
                dimensionSet(1, -2, -2, 0, 0), // N/m3
                vector::zero
            )
        )
    );

    return tsource;
}
コード例 #15
0
hhuCombustionThermo::hhuCombustionThermo(const fvMesh& mesh)
:
    hCombustionThermo(mesh),

    Tu_
    (
        IOobject
        (
            "Tu",
            mesh.time().timeName(),
            mesh,
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        mesh
    ),

    hu_
    (
        IOobject
        (
            "hu",
            mesh.time().timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        mesh,
        dimensionSet(0, 2, -2, 0, 0),
        huBoundaryTypes()
    )
{}
コード例 #16
0
Foam::tmp<Foam::volScalarField> Foam::consumptionSpeed::omega0Sigma
(
    const volScalarField& sigma
)
{
    tmp<volScalarField> tomega0
    (
        new volScalarField
        (
            IOobject
            (
                "omega0",
                sigma.time().timeName(),
                sigma.db(),
                IOobject::NO_READ,
                IOobject::NO_WRITE
            ),
            sigma.mesh(),
            dimensionedScalar
            (
                "omega0",
                dimensionSet(1, -2, -1, 0, 0, 0, 0),
                0
            )
        )
    );

    volScalarField& omega0 = tomega0();

    volScalarField::InternalField& iomega0 = omega0.internalField();

    forAll(iomega0, celli)
    {
        iomega0[celli] = omega0Sigma(sigma[celli], 1.0);
    }
コード例 #17
0
ファイル: flameletModel.C プロジェクト: aguerrehoracio/CCIMEC
Foam::flameletModel::flameletModel
(
	volScalarField& rho
)
:
	ProdRateForSigma_
    (
        IOobject
        (
            "ProdRateForSigma",
            rho.mesh().time().timeName(),
            rho.mesh(),
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        rho.mesh(),
        dimensionSet(1, -3, -1, 0, 0)
    ),

    DestrRateForSigma_
    (
        IOobject
        (
            "DestrRateForSigma",
            rho.mesh().time().timeName(),
            rho.mesh(),
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        rho.mesh(),
        dimensionSet(1, -3, -1, 0, 0)
    ),

    I0_
    (
        IOobject
        (
            "I0",
            rho.mesh().time().timeName(),
            rho.mesh(),
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        rho.mesh(),
        dimensionSet(0, 0, 0, 0, 0)
    )
{}
コード例 #18
0
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
dimensionedVector momCoupleModel::returnIntegralSourceField() const
{
    FatalError<<"the solver calls for returnIntegralSourceField()\n"
              <<", please set 'momCoupleModel' to type 'explicitCouple' to access this data.\n"
              << abort(FatalError);

    return dimensionedVector("0", dimensionSet(1, 1, -2, 0, 0), vector::zero); // Newton
}
コード例 #19
0
ファイル: XPP_SE.C プロジェクト: chnrdu/idurun
XPP_SE::XPP_SE
(
    const word& name,
    const volScalarField& alpha,
    const volVectorField& U,
    const surfaceScalarField& phi,
    const dictionary& dict
)
:
    viscoelasticLaw(name, alpha, U, phi),
    tau_
    (
        IOobject
        (
            "tau" + name,
            U.time().timeName(),
            U.mesh(),
            IOobject::MUST_READ,
            IOobject::AUTO_WRITE
        ),
        U.mesh()
    ),
    I_
    (
        dimensionedSymmTensor
        (
            "I",
            dimensionSet(0, 0, 0, 0, 0, 0, 0),
            symmTensor
            (
                1, 0, 0,
                   1, 0,
                      1
            )
        )
    ),
    etaS1_(dict.subDict("phase1").lookup("etaS")),
    etaS2_(dict.subDict("phase2").lookup("etaS")),
    etaP1_(dict.subDict("phase1").lookup("etaP")),
    etaP2_(dict.subDict("phase2").lookup("etaP")),
    alpha1_(dict.subDict("phase1").lookup("alpha")),
    alpha2_(dict.subDict("phase2").lookup("alpha")),
    lambdaOb1_(dict.subDict("phase1").lookup("lambdaOb")),
    lambdaOb2_(dict.subDict("phase2").lookup("lambdaOb")),
    lambdaOs1_(dict.subDict("phase1").lookup("lambdaOs")),
    lambdaOs2_(dict.subDict("phase2").lookup("lambdaOs")),
    q1_(dict.subDict("phase1").lookup("q")),
    q2_(dict.subDict("phase2").lookup("q")),
    pt_
    (
        dimensionedScalar
        (
            "zero",
            lambdaOb1_.dimensions(),
            scalar( SMALL )
        )
    )
{}
void Foam::porosityZone::addResistance
(
    const fvVectorMatrix& UEqn,
    volTensorField& AU,
    bool correctAUprocBC
) const
{
    if (cellZoneID_ == -1)
    {
        return;
    }

    bool compressible = false;
    if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
    {
        compressible = true;
    }

    const labelList& cells = mesh_.cellZones()[cellZoneID_];
    const vectorField& U = UEqn.psi();

    const tensor& D = D_.value();
    const tensor& F = F_.value();

    if (magSqr(D) > VSMALL || magSqr(F) > VSMALL)
    {
        if (compressible)
        {
            addViscousInertialResistance
            (
                AU,
                cells,
                mesh_.lookupObject<volScalarField>("rho"),
                mesh_.lookupObject<volScalarField>("mu"),
                U
            );
        }
        else
        {
            addViscousInertialResistance
            (
                AU,
                cells,
                geometricOneField(),
                mesh_.lookupObject<volScalarField>("nu"),
                U
            );
        }
    }

    if (correctAUprocBC)
    {
        // Correct the boundary conditions of the tensorial diagonal to ensure
        // processor boundaries are correctly handled when AU^-1 is interpolated
        // for the pressure equation.
        AU.correctBoundaryConditions();
    }
}
void recalcPhiFunctionObject::recalc()
{
    Info << "Calculating flux field " << phiName_
        << " for velocity " << UName_ << endl;

    const fvMesh &mesh=dynamicCast<const fvMesh&>(obr_);

    const volVectorField &U=mesh.lookupObject<volVectorField>(UName_);
    volScalarField &p=const_cast<volScalarField&>(
        mesh.lookupObject<volScalarField>(pName_)
    );
    surfaceScalarField &phi=const_cast<surfaceScalarField&>(
        mesh.lookupObject<surfaceScalarField>(phiName_)
    );

    if(writeOldFields_) {
        Info << "Writing copy of old " << phiName_ << endl;
        surfaceScalarField oldPhi(phiName_+".old",phi);
        oldPhi.write();
    }

    if(phi.dimensions()==dimensionSet(0,3,-1,0,0,0,0)) {
        phi = fvc::interpolate(U) & mesh.Sf();
    } else if(phi.dimensions()==dimensionSet(1,0,-1,0,0,0,0)) {
        if(rhoName_=="none") {
            // force read
            rhoName_=word(dict_.lookup("rhoName"));
        }
        const volScalarField &rho=mesh.lookupObject<volScalarField>(rhoName_);
        phi = fvc::interpolate(rho)*(fvc::interpolate(U) & mesh.Sf());
     } else {
        FatalErrorIn("recalcPhiFunctionObject::calcPhi()")
            << "Can't deal with a flux field " << phiName_
                << " with dimensions " << phi.dimensions()
                << endl
                << exit(FatalError);

    }
    adjustPhi(phi, U, p);

    if(writeFields_) {
        Info << "Writing new value of " << phiName_ << endl;
        phi.write();
    }
}
コード例 #22
0
Foam::kineticTheoryModels::conductivityModels::HrenyaSinclair::HrenyaSinclair
(
    const dictionary& dict
)
:
    conductivityModel(dict),
    coeffDict_(dict.optionalSubDict(typeName + "Coeffs")),
    L_("L", dimensionSet(0, 1, 0, 0, 0), coeffDict_)
{}
コード例 #23
0
Foam::kineticTheoryModels::viscosityModels::HrenyaSinclair::HrenyaSinclair
(
    const dictionary& dict
)
:
    viscosityModel(dict),
    coeffDict_(dict.subDict(typeName + "Coeffs")),
    L_("L", dimensionSet(0, 1, 0, 0, 0), coeffDict_.lookup("L"))
{}
コード例 #24
0
void Foam::porousBafflePressureFvPatchField::updateCoeffs()
{
    if (updated())
    {
        return;
    }

    const surfaceScalarField& phi =
            db().lookupObject<surfaceScalarField>(phiName_);

    const fvsPatchField<scalar>& phip =
        patch().patchField<surfaceScalarField, scalar>(phi);

    scalarField Un(phip/patch().magSf());

    if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
    {
        Un /= patch().lookupPatchField<volScalarField, scalar>(rhoName_);
    }

    scalarField magUn(mag(Un));

    const turbulenceModel& turbModel = db().lookupObject<turbulenceModel>
    (
        IOobject::groupName
        (
            turbulenceModel::propertiesName,
            dimensionedInternalField().group()
        )
    );

    jump_ =
        -sign(Un)
        *(
            D_*turbModel.nu(patch().index())
          + I_*0.5*magUn
         )*magUn*length_;

    if (dimensionedInternalField().dimensions() == dimPressure)
    {
        jump_ *= patch().lookupPatchField<volScalarField, scalar>(rhoName_);
    }

    if (debug)
    {
        scalar avePressureJump = gAverage(jump_);
        scalar aveVelocity = gAverage(mag(Un));

        Info<< patch().boundaryMesh().mesh().name() << ':'
            << patch().name() << ':'
            << " Average pressure drop :" << avePressureJump
            << " Average velocity :" << aveVelocity
            << endl;
    }

    fixedJumpFvPatchField<scalar>::updateCoeffs();
}
コード例 #25
0
Foam::tmp<Foam::volScalarField> Foam::SrivastavaSundaresanFrictionalStress::muf
(
    const volScalarField& alpha,
    const volScalarField& Theta,
    const dimensionedScalar& alphaMinFriction,
    const dimensionedScalar& alphaMax,
    const volScalarField& pf,
    const volSymmTensorField& D,
    const dimensionedScalar& phi
) const
{
    const scalar I2Dsmall = 1.0e-35;

    //Creating muf assuming it should be 0 on the boundary which may not be
    // true
    tmp<volScalarField> tmuf
    (
       new volScalarField
       (
          IOobject
          (
             "muf",
             alpha.mesh().time().timeName(),
             alpha.mesh()
          ),
          alpha.mesh(),
          dimensionedScalar("muf", dimensionSet(1, -1, -1, 0, 0), 1e30)
       )
    );
    
    volScalarField& muff = tmuf();
   
      forAll (D, celli)
    {
        if (alpha[celli] >= alphaMinFriction.value())
        {
            muff[celli] =
                0.5*pf[celli]*sin(phi.value())
               /(
                    sqrt(1.0/6.0*(sqr(D[celli].xx() - D[celli].yy())
                  + sqr(D[celli].yy() - D[celli].zz())
                  + sqr(D[celli].zz() - D[celli].xx()))
                  + sqr(D[celli].xy()) + sqr(D[celli].xz())
                  + sqr(D[celli].yz())) + I2Dsmall
                );
        }
        if (alpha[celli] < alphaMinFriction.value())
        {
            muff[celli] = 0.0;
        }
    }

    muff.correctBoundaryConditions();

    return tmuf;
}
コード例 #26
0
Foam::fv::meanSupVelocityForce::meanSupVelocityForce
(
    const word& sourceName,
    const word& modelType,
    const dictionary& dict,
    const fvMesh& mesh
)
:
    meanVelocityForce(sourceName, modelType, dict, mesh),
    twoPhase_( coeffs_.lookupOrDefault("twoPhase",false) ),
    alpha_
    (   
        IOobject
        (
            "voidfractionPrev",
            mesh_.time().timeName(),
            mesh_,
            IOobject::NO_READ,//MUST_READ,
            IOobject::NO_WRITE
        ),
        mesh_,
        dimensionedScalar("ones", dimensionSet(0,0,0,0,0), 1)
    ),
    coupled_( coeffs_.lookupOrDefault("coupled",false) ),
    voidfraction_
    (   
        IOobject
        (
            "voidfractionPrev",
            mesh_.time().timeName(),
            mesh_,
            IOobject::NO_READ,//MUST_READ,
            IOobject::NO_WRITE
        ),
        mesh_,
        dimensionedScalar("ones", dimensionSet(0,0,0,0,0), 1)
    ),
    modelName_(modelType),
    alphaMin_(coeffs_.lookupOrDefault("alphaMin",0.0))

{
    Warning << "THE FVOPTION meanSupVelocityForce has not been tested/validated!!! " << endl;
}
コード例 #27
0
Foam::tmp<Foam::volScalarField>
Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::nu
(
    const volScalarField& alpha1,
    const dimensionedScalar& alphaMax,
    const volScalarField& pf,
    const volSymmTensorField& D
) const
{
    const scalar I2Dsmall = 1.0e-15;

    // Creating nu assuming it should be 0 on the boundary which may not be
    // true
    tmp<volScalarField> tnu
    (
        new volScalarField
        (
            IOobject
            (
                "Schaeffer:nu",
                alpha1.mesh().time().timeName(),
                alpha1.mesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE,
                false
            ),
            alpha1.mesh(),
            dimensionedScalar("nu", dimensionSet(0, 2, -1, 0, 0), 0.0)
        )
    );

    volScalarField& nuf = tnu();

    forAll (D, celli)
    {
        if (alpha1[celli] > alphaMax.value() - 5e-2)
        {
            nuf[celli] =
                0.5*pf[celli]*sin(phi_.value())
               /(
                    sqrt(1.0/6.0*(sqr(D[celli].xx() - D[celli].yy())
                  + sqr(D[celli].yy() - D[celli].zz())
                  + sqr(D[celli].zz() - D[celli].xx()))
                  + sqr(D[celli].xy()) + sqr(D[celli].xz())
                  + sqr(D[celli].yz())) + I2Dsmall
                );
        }
    }

    // Correct coupled BCs
    nuf.correctBoundaryConditions();

    return tnu;
}
コード例 #28
0
void DimensionedField<Type, GeoMesh>::readField
(
    const dictionary& fieldDict,
    const word& fieldDictEntry
)
{
    dimensions_.reset(dimensionSet(fieldDict.lookup("dimensions")));

    Field<Type> f(fieldDictEntry, fieldDict, GeoMesh::size(mesh_));
    this->transfer(f);
}
コード例 #29
0
// Construct from components
gradPForce::gradPForce
(
    const dictionary& dict,
    cfdemCloud& sm
)
:
    forceModel(dict,sm),
    propsDict_(dict.subDict(typeName + "Props")),
    verbose_(false),
    pFieldName_(propsDict_.lookup("pFieldName")),
    p_(sm.mesh().lookupObject<volScalarField> (pFieldName_)),
    velocityFieldName_(propsDict_.lookup("velocityFieldName")),
    U_(sm.mesh().lookupObject<volVectorField> (velocityFieldName_)),
    densityFieldName_(propsDict_.lookup("densityFieldName")),
    rho_(sm.mesh().lookupObject<volScalarField> (densityFieldName_)),
    useRho_(false),
    useU_(false),
    addedMassCoeff_(0.0),
    interpolation_(false)
{
    if (modelType_ == "B")
    {
        FatalError <<"using  model gradPForce with model type B is not valid\n" << abort(FatalError);
    }else
    {
        treatDEM_=true;
        Info << "gradPForce is applied only to DEM side" << endl;
    }
    if (propsDict_.found("verbose")) verbose_=true;
    if (propsDict_.found("treatExplicit")) treatExplicit_=true;
    if (propsDict_.found("useU")) useU_=true;
    if (propsDict_.found("useAddedMass")) 
    {
        addedMassCoeff_ =  readScalar(propsDict_.lookup("useAddedMass"));
        Info << "gradP will also include added mass with coefficient: " << addedMassCoeff_ << endl;
        Info << "WARNING: use fix nve/sphere/addedMass in LIGGGHTS input script to correctly account for added mass effects!" << endl;
    }
    if (propsDict_.found("interpolation"))
    {
        Info << "using interpolated value of pressure gradient." << endl;
        interpolation_=true;
    }

    if(p_.dimensions()==dimensionSet(0,2,-2,0,0))
        useRho_ = true;

    particleCloud_.checkCG(true);

    particleCloud_.probeM().initialize(typeName, "gradP.logDat");
    particleCloud_.probeM().vectorFields_.append("gradPForce"); //first entry must the be the force
    particleCloud_.probeM().scalarFields_.append("Vs");
    particleCloud_.probeM().scalarFields_.append("rho");
    particleCloud_.probeM().writeHeader();
}
コード例 #30
0
ファイル: noLift.C プロジェクト: BarisCumhur/OpenFOAM-2.3.x
Foam::tmp<Foam::volVectorField> Foam::liftModels::noLift::F() const
{
    return
        Cl()
       *dimensionedVector
        (
            "zero",
            dimensionSet(1, -2, -2, 0, 0),
            vector::zero
        );
}