コード例 #1
0
void Foam::directionalDiffusivity::correct()
{
    const fvMesh& mesh = mSolver().mesh();

    surfaceVectorField n = mesh.Sf()/mesh.magSf();
    faceDiffusivity_ == (n & cmptMultiply(diffusivityVector_, n));
}
コード例 #2
0
void Foam::distortionEnergyDiff::correct()
{
    motionGamma_.internalField() =
        pow(mSolver().totDistortionEnergy()().internalField(), exponent_)
      + SMALL;

    motionGamma_.internalField() /= max(motionGamma_.internalField());
}
コード例 #3
0
void Foam::motionDirectionalDiffusivity::correct()
{
    const fvMesh& mesh = mSolver().mesh();

    static bool first = true;

    if (!first)
    {
        const volVectorField& cellMotionU = 
            mesh.lookupObject<volVectorField>("cellMotionU");

        volVectorField D
        (
            IOobject
            (
                "D",
                mesh.time().timeName(),
                mesh
            ),
            diffusivityVector_.y()*vector::one
          + (diffusivityVector_.x() - diffusivityVector_.y())*cellMotionU
           /(mag(cellMotionU) + dimensionedScalar("small", dimVelocity, SMALL)),
            zeroGradientFvPatchVectorField::typeName
        );
        D.correctBoundaryConditions();

        surfaceVectorField n = mesh.Sf()/mesh.magSf();
        faceDiffusivity_ == (n & cmptMultiply(fvc::interpolate(D), n));
    }
    else
    {
        first = false;
        const_cast<fvMotionSolver&>(mSolver()).solve();
        correct();
    }
}
コード例 #4
0
Foam::tmp<Foam::scalarField> Foam::inverseDistanceDiffusivity::y() const
{
    const polyMesh& mesh = mSolver().mesh();

    labelHashSet patchSet(mesh.boundaryMesh().patchSet(patchNames_));

    if (patchSet.size())
    {
        return tmp<scalarField>
        (
            new scalarField(patchWave(mesh, patchSet, false).distance())
        );
    }
    else
    {
        return tmp<scalarField>(new scalarField(mesh.nCells(), 1.0));
    }
}
void Foam::inverseFaceDistanceDiffusivity::correct()
{
    const polyMesh& mesh = mSolver().mesh();
    const polyBoundaryMesh& bdry = mesh.boundaryMesh();

    labelHashSet patchSet(bdry.size());

    label nPatchFaces = 0;

    forAll (patchNames_, i)
    {
        label pID = bdry.findPatchID(patchNames_[i]);

        if (pID > -1)
        {
            patchSet.insert(pID);
            nPatchFaces += bdry[pID].size();
        }
    }
コード例 #6
0
void Foam::inverseDistanceDiffusivity::correct()
{
    const fvMesh& mesh = mSolver().mesh();

    volScalarField y_
    (
        IOobject
        (
            "y",
            mesh.time().timeName(),
            mesh
        ),
        mesh,
        dimless,
        zeroGradientFvPatchScalarField::typeName
    );
    y_.internalField() = y();
    y_.correctBoundaryConditions();

    faceDiffusivity_ = 1.0/fvc::interpolate(y_);
}
コード例 #7
0
void Foam::inverseFaceDistanceDiffusivity::correct()
{
    const polyMesh& mesh = mSolver().mesh();
    const polyBoundaryMesh& bdry = mesh.boundaryMesh();

    labelHashSet patchSet(bdry.size());

    label nPatchFaces = 0;

    forAll(patchNames_, i)
    {
        const label pID = bdry.findPatchID(patchNames_[i]);

        if (pID > -1)
        {
            patchSet.insert(pID);
            nPatchFaces += bdry[pID].size();
        }
    }

    List<wallPoint> faceDist(nPatchFaces);
    labelList changedFaces(nPatchFaces);

    nPatchFaces = 0;

    forAllConstIter(labelHashSet, patchSet, iter)
    {
        const polyPatch& patch = bdry[iter.key()];

        const vectorField::subField fc(patch.faceCentres());

        forAll(fc, patchFaceI)
        {
            changedFaces[nPatchFaces] = patch.start() + patchFaceI;

            faceDist[nPatchFaces] = wallPoint(fc[patchFaceI], 0);

            nPatchFaces++;
        }
    }
コード例 #8
0
void Foam::inverseVolumeDiffusivity::correct()
{
    const fvMesh& mesh = mSolver().mesh();

    volScalarField V
    (
        IOobject
        (
            "V",
            mesh.time().timeName(),
            mesh
        ),
        mesh,
        dimless,
        zeroGradientFvPatchScalarField::typeName
    );

    V.internalField() = mesh.V();
    V.correctBoundaryConditions();

    faceDiffusivity_ = 1.0/fvc::interpolate(V);
}