Exemple #1
0
void Foam::fvMesh::updateGeomNotOldVol()
{
    bool haveV = (VPtr_ != NULL);
    bool haveSf = (SfPtr_ != NULL);
    bool haveMagSf = (magSfPtr_ != NULL);
    bool haveCP = (CPtr_ != NULL);
    bool haveCf = (CfPtr_ != NULL);

    clearGeomNotOldVol();

    // Now recreate the fields
    if (haveV)
    {
        (void)V();
    }
    if (haveSf)
    {
        (void)Sf();
    }
    if (haveMagSf)
    {
        (void)magSf();
    }
    if (haveCP)
    {
        (void)C();
    }
    if (haveCf)
    {
        (void)Cf();
    }
}
Exemple #2
0
void Foam::fvMesh::clearGeom()
{
    clearGeomNotOldVol();

    deleteDemandDrivenData(V0Ptr_);
    deleteDemandDrivenData(V00Ptr_);

    // Mesh motion flux cannot be deleted here because the old-time flux
    // needs to be saved.
}
void Foam::fvMesh::clearGeom()
{
    clearGeomNotOldVol();

    deleteDemandDrivenData(V0Ptr_);
    deleteDemandDrivenData(V00Ptr_);

    // Mesh motion flux cannot be deleted here because the old-time flux
    // needs to be saved.

    // Geometry dependent object updated through call-back
    // and handled by polyMesh
    // HJ, 29/Aug/2010
}
void Foam::fvMesh::syncUpdateMesh()
{
    // Update polyMesh. This needs to keep volume existent!
    polyMesh::syncUpdateMesh();

    // Not sure how much clean-up is needed here.  HJ, 27/Nov/2009

    surfaceInterpolation::clearOut();
    clearGeomNotOldVol();

    clearAddressing();

    // handleMorph() should also clear out the surfaceInterpolation.
    // This is a temporary solution
    surfaceInterpolation::movePoints();

    // Function object update moved to polyMesh
    // HJ, 29/Aug/2010
}
Exemple #5
0
void Foam::fvMesh::clearGeom()
{
    clearGeomNotOldVol();

    deleteDemandDrivenData(V0Ptr_);
    deleteDemandDrivenData(V00Ptr_);

    // Mesh motion flux cannot be deleted here because the old-time flux
    // needs to be saved.

    // Things geometry dependent that are not updated.
    volPointInterpolation::Delete(*this);
    extendedLeastSquaresVectors::Delete(*this);
    leastSquaresVectors::Delete(*this);
    CentredFitData<linearFitPolynomial>::Delete(*this);
    CentredFitData<quadraticFitPolynomial>::Delete(*this);
    CentredFitData<quadraticLinearFitPolynomial>::Delete(*this);
    skewCorrectionVectors::Delete(*this);
    //quadraticFitSnGradData::Delete(*this);
}
void Foam::fvMesh::updateMesh(const mapPolyMesh& mpm)
{
    // Update polyMesh. This needs to keep volume existent!
    polyMesh::updateMesh(mpm);

    surfaceInterpolation::clearOut();
    clearGeomNotOldVol();

    // Map all fields
    mapFields(mpm);

    // Map old-volumes
    mapOldVolumes(mpm);

    clearAddressing();

    // Mesh morphing should also clear out the surfaceInterpolation.
    // This is a temporary solution
    surfaceInterpolation::movePoints();

    // Function object update moved to polyMesh
    // HJ, 29/Aug/2010
}
Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p)
{
    // Grab old time volumes if the time has been incremented
    if (curTimeIndex_ < time().timeIndex())
    {
        if (V00Ptr_ && V0Ptr_)
        {
            if (debug)
            {
                InfoIn("void fvMesh::movePoints(const pointField& p)")
                    << "Grabbing old-old cell volumes." << endl;
            }

            *V00Ptr_ = *V0Ptr_;
        }

        if (V0Ptr_)
        {
            if (debug)
            {
                InfoIn("void fvMesh::movePoints(const pointField& p)")
                    << "Grabbing old cell volumes." << endl;
            }

            *V0Ptr_ = V();
        }
        else
        {
            if (debug)
            {
                InfoIn("void fvMesh::movePoints(const pointField& p)")
                    << "Creating old cell volumes." << endl;
            }

            V0Ptr_ = new DimensionedField<scalar, volMesh>
            (
                IOobject
                (
                    "V0",
                    time().timeName(),
                    *this,
                    IOobject::NO_READ,
                    IOobject::NO_WRITE
                ),
                V()
            );
        }

        curTimeIndex_ = time().timeIndex();
    }


    // Delete out of date geometrical information
    clearGeomNotOldVol();


    if (!phiPtr_)
    {
        // Create mesh motion flux
        if (debug)
        {
            InfoIn("tmp<scalarField> fvMesh::movePoints(const pointField& p)")
                << "Creating new mesh motion fluxes" << endl;
        }

        phiPtr_ = new surfaceScalarField
        (
            IOobject
            (
                "meshPhi",
                this->time().timeName(),
                *this,
                IOobject::NO_READ,
                IOobject::AUTO_WRITE
            ),
            *this,
            dimVolume/dimTime
        );
    }
    else
    {
        // Grab old time mesh motion fluxes if the time has been incremented
        if (phiPtr_->timeIndex() < time().timeIndex())
        {
            phiPtr_->oldTime();
        }
    }

    // Move the polyMesh and set the mesh motion fluxes to the swept-volumes
    tmp<scalarField> tsweptVols = polyMesh::movePoints(p);

    updatePhi(tsweptVols());

    boundary_.movePoints();
    surfaceInterpolation::movePoints();

    // Function object update moved to polyMesh
    // HJ, 29/Aug/2010

    return tsweptVols;
}
Exemple #8
0
Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p)
{
    // Grab old time volumes if the time has been incremented
    if (curTimeIndex_ < time().timeIndex())
    {
        if (V00Ptr_ && V0Ptr_)
        {
            *V00Ptr_ = *V0Ptr_;
        }

        if (V0Ptr_)
        {
            *V0Ptr_ = V();
        }
        else
        {
            V0Ptr_ = new DimensionedField<scalar, volMesh>
            (
                IOobject
                (
                    "V0",
                    time().timeName(),
                    *this,
                    IOobject::NO_READ,
                    IOobject::NO_WRITE
                ),
                V()
            );
        }

        curTimeIndex_ = time().timeIndex();
    }


    // delete out of date geometrical information
    clearGeomNotOldVol();


    if (!phiPtr_)
    {
        // Create mesh motion flux
        phiPtr_ = new surfaceScalarField
        (
            IOobject
            (
                "meshPhi",
                this->time().timeName(),
                *this,
                IOobject::NO_READ,
                IOobject::AUTO_WRITE
            ),
            *this,
            dimVolume/dimTime
        );
    }
    else
    {
        // Grab old time mesh motion fluxes if the time has been incremented
        if (phiPtr_->timeIndex() != time().timeIndex())
        {
            phiPtr_->oldTime();
        }
    }

    surfaceScalarField& phi = *phiPtr_;

    // Move the polyMesh and set the mesh motion fluxes to the swept-volumes

    scalar rDeltaT = 1.0/time().deltaT().value();

    tmp<scalarField> tsweptVols = polyMesh::movePoints(p);
    scalarField& sweptVols = tsweptVols();

    phi.internalField() = scalarField::subField(sweptVols, nInternalFaces());
    phi.internalField() *= rDeltaT;

    const fvPatchList& patches = boundary();

    forAll (patches, patchI)
    {
        phi.boundaryField()[patchI] = patches[patchI].patchSlice(sweptVols);
        phi.boundaryField()[patchI] *= rDeltaT;
    }