Foam::tmp<Foam::scalarField> Foam::primitiveMesh::movePoints ( const pointField& newPoints, const pointField& oldPoints ) { if (newPoints.size() < nPoints() || oldPoints.size() < nPoints()) { FatalErrorIn ( "primitiveMesh::movePoints(const pointField& newPoints, " "const pointField& oldPoints)" ) << "Cannot move points: size of given point list smaller " << "than the number of active points" << nl << "newPoints: " << newPoints.size() << " oldPoints: " << oldPoints.size() << " nPoints(): " << nPoints() << nl << abort(FatalError); } // Create swept volumes const faceList& f = faces(); tmp<scalarField> tsweptVols(new scalarField(f.size())); scalarField& sweptVols = tsweptVols(); forAll(f, faceI) { sweptVols[faceI] = f[faceI].sweptVol(oldPoints, newPoints); }
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; }
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; }