diff --git a/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C b/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C index 51ed497a26..5fc44fa9c7 100644 --- a/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C +++ b/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.C @@ -53,7 +53,8 @@ Foam::cellCellStencil::cellTypeNames_ Foam::cellCellStencil::cellCellStencil(const fvMesh& mesh) : - mesh_(mesh) + mesh_(mesh), + nonInterpolatedFields_({"zoneID"}) {} @@ -154,6 +155,12 @@ Foam::labelList Foam::cellCellStencil::count } +const Foam::wordHashSet& Foam::cellCellStencil::nonInterpolatedFields() const +{ + return nonInterpolatedFields_; +} + + bool Foam::cellCellStencil::localStencil(const labelUList& slots) const { forAll(slots, i) diff --git a/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.H b/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.H index 4ed54eedd4..4b7a162d4a 100644 --- a/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.H +++ b/src/overset/cellCellStencil/cellCellStencil/cellCellStencil.H @@ -86,6 +86,9 @@ protected: //- Reference to the mesh const fvMesh& mesh_; + //- Set of fields that should not be interpolated + wordHashSet nonInterpolatedFields_; + // Protected Member Functions @@ -177,6 +180,10 @@ public: scalarList& weights ) const = 0; + //- Return the names of any (stencil or mesh specific) fields that + // should not be interpolated + virtual const wordHashSet& nonInterpolatedFields() const; + //- Helper: is stencil fully local bool localStencil(const labelUList&) const; diff --git a/src/overset/cellCellStencil/cellCellStencil/cellCellStencilObject.H b/src/overset/cellCellStencil/cellCellStencil/cellCellStencilObject.H index 33b882bed7..802d8cb8a4 100644 --- a/src/overset/cellCellStencil/cellCellStencil/cellCellStencilObject.H +++ b/src/overset/cellCellStencil/cellCellStencil/cellCellStencilObject.H @@ -170,6 +170,13 @@ public: { stencilPtr_().stencilWeights(sample, donorCcs, weights); } + + //- Return the names of any (stencil or mesh specific) fields that + // should not be interpolated + virtual const wordHashSet& nonInterpolatedFields() const + { + return stencilPtr_().nonInterpolatedFields(); + } }; diff --git a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C index 758edda954..7168900d6c 100644 --- a/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C +++ b/src/overset/cellCellStencil/cellVolumeWeight/cellVolumeWeightCellCellStencil.C @@ -688,6 +688,7 @@ Foam::cellCellStencils::cellVolumeWeight::cellVolumeWeight this->zoneID(); // Read old-time cellTypes + nonInterpolatedFields_.insert("cellTypes"); IOobject io ( "cellTypes", diff --git a/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C b/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C index 640ca27798..5cafe990b1 100644 --- a/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C +++ b/src/overset/cellCellStencil/inverseDistance/inverseDistanceCellCellStencil.C @@ -1639,6 +1639,10 @@ Foam::cellCellStencils::inverseDistance::inverseDistance zeroGradientFvPatchScalarField::typeName ) { + // Protect local fields from interpolation + nonInterpolatedFields_.insert("cellInterpolationWeight"); + nonInterpolatedFields_.insert("cellTypes"); + // Read zoneID this->zoneID(); diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C index d92c2f3075..15cae7cdc2 100644 --- a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2014-2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2014-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -274,6 +274,10 @@ bool Foam::dynamicOversetFvMesh::update() // let demand-driven lduAddr() trigger it but just to make sure. updateAddressing(); + // Addressing and/or weights have changed. Make interpolated cells + // up to date with donors + interpolateFields(); + return true; } @@ -281,6 +285,45 @@ bool Foam::dynamicOversetFvMesh::update() } +Foam::word Foam::dynamicOversetFvMesh::baseName(const word& name) +{ + if (name.endsWith("_0")) + { + return baseName(name.substr(0, name.size()-2)); + } + else + { + return name; + } +} + + +bool Foam::dynamicOversetFvMesh::interpolateFields() +{ + // Add the stencil suppression list + wordHashSet suppressed(Stencil::New(*this).nonInterpolatedFields()); + + // Use whatever the solver has set up as suppression list + const dictionary* dictPtr + ( + this->schemesDict().subDictPtr("oversetInterpolationSuppressed") + ); + if (dictPtr) + { + suppressed.insert(dictPtr->sortedToc()); + } + + interpolate(suppressed); + interpolate(suppressed); + interpolate(suppressed); + interpolate(suppressed); + interpolate(suppressed); + + return true; +} + + + bool Foam::dynamicOversetFvMesh::writeObject ( IOstream::streamFormat fmt, diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C.orig b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C.orig new file mode 100644 index 0000000000..b9d7a816f6 --- /dev/null +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C.orig @@ -0,0 +1,404 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2014-2017 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify i + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "dynamicOversetFvMesh.H" +#include "addToRunTimeSelectionTable.H" +#include "cellCellStencilObject.H" +#include "zeroGradientFvPatchFields.H" +#include "lduPrimitiveProcessorInterface.H" +#include "globalIndex.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(dynamicOversetFvMesh, 0); + addToRunTimeSelectionTable(dynamicFvMesh, dynamicOversetFvMesh, IOobject); +} + + +// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * // + +bool Foam::dynamicOversetFvMesh::updateAddressing() const +{ + const cellCellStencilObject& overlap = Stencil::New(*this); + + // The (processor-local part of the) stencil determines the local + // faces to add to the matrix. tbd: parallel + const labelListList& stencil = overlap.cellStencil(); + + // Get the base addressing + const lduAddressing& baseAddr = dynamicMotionSolverFvMesh::lduAddr(); + + // Add to the base addressing + labelList lowerAddr; + labelList upperAddr; + label nExtraFaces; + + const globalIndex globalNumbering(baseAddr.size()); + labelListList localFaceCells; + labelListList remoteFaceCells; + + labelList globalCellIDs(overlap.cellInterpolationMap().constructSize()); + forAll(baseAddr, cellI) + { + globalCellIDs[cellI] = globalNumbering.toGlobal(cellI); + } + overlap.cellInterpolationMap().distribute(globalCellIDs); + + + reverseFaceMap_ = fvMeshPrimitiveLduAddressing::addAddressing + ( + baseAddr, + stencil, + nExtraFaces, + lowerAddr, + upperAddr, + stencilFaces_, + globalNumbering, + globalCellIDs, + localFaceCells, + remoteFaceCells + ); + + if (debug) + { + Pout<< "dynamicOversetFvMesh::update() : extended addressing from" + << " nFaces:" << baseAddr.lowerAddr().size() + << " to nFaces:" << lowerAddr.size() + << " nExtraFaces:" << nExtraFaces << endl; + } + + // Extract relevant remote processors + labelList nbrProcs(localFaceCells.size()); + { + label nbrI = 0; + forAll(localFaceCells, procI) + { + if (localFaceCells[procI].size()) + { + //Pout<< " from proc:" << procI + // << " want its local cells " << remoteFaceCells[procI] + // << " to add to my local cells:" << localFaceCells[procI] + // << endl; + nbrProcs[nbrI++] = procI; + } + } + nbrProcs.setSize(nbrI); + } + + // Construct interfaces + remoteStencilInterfaces_.setSize(nbrProcs.size()); + forAll(nbrProcs, i) + { + label procI = nbrProcs[i]; + remoteStencilInterfaces_.set + ( + i, + new lduPrimitiveProcessorInterface + ( + localFaceCells[procI], + Pstream::myProcNo(), + procI, + tensorField(0), + Pstream::msgType() + ) + ); + } + + + // Get addressing and interfaces of all interfaces + + + List patchAddr; + { + const fvBoundaryMesh& fvp = boundary(); + + patchAddr.setSize(fvp.size() + remoteStencilInterfaces_.size()); + + allInterfaces_ = dynamicMotionSolverFvMesh::interfaces(); + allInterfaces_.setSize(patchAddr.size()); + + forAll(fvp, patchI) + { + patchAddr[patchI] = &fvp[patchI].faceCells(); + } + forAll(remoteStencilInterfaces_, i) + { + label patchI = fvp.size()+i; + const lduPrimitiveProcessorInterface& pp = + remoteStencilInterfaces_[i]; + + //Pout<< "at patch:" << patchI + // << " have procPatch:" << pp.type() + // << " from:" << pp.myProcNo() + // << " to:" << pp.neighbProcNo() + // << " with fc:" << pp.faceCells().size() << endl; + + patchAddr[patchI] = &pp.faceCells(); + allInterfaces_.set(patchI, &pp); + } + } + const lduSchedule ps + ( + lduPrimitiveMesh::nonBlockingSchedule + ( + allInterfaces_ + ) + ); + + lduPtr_.reset + ( + new fvMeshPrimitiveLduAddressing + ( + nCells(), + std::move(lowerAddr), + std::move(upperAddr), + patchAddr, + ps + ) + ); + + + // Check + if (debug) + { + const lduAddressing& addr = lduPtr_(); //this->lduAddr(); + + Pout<< "Adapted addressing:" + << " lower:" << addr.lowerAddr().size() + << " upper:" << addr.upperAddr().size() << endl; + + lduInterfacePtrsList iFaces = this->interfaces(); + // Using lduAddressing::patch + forAll(patchAddr, patchI) + { + Pout<< " " << patchI << "\tpatchAddr:" + << addr.patchAddr(patchI).size() + << endl; + } + + // Using interfaces + Pout<< "iFaces:" << iFaces.size() << endl; + forAll(iFaces, patchI) + { + if (iFaces.set(patchI)) + { + Pout<< " " << patchI << "\tiFace:" << iFaces[patchI].type() + << endl; + } + } + + Pout<< "end of printing." << endl; + } + + return true; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::dynamicOversetFvMesh::dynamicOversetFvMesh(const IOobject& io) +: + dynamicMotionSolverFvMesh(io), + active_(false) +{ + // Load stencil (but do not update) + (void)Stencil::New(*this, false); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dynamicOversetFvMesh::~dynamicOversetFvMesh() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::lduAddressing& Foam::dynamicOversetFvMesh::lduAddr() const +{ + if (!active_) + { + return dynamicMotionSolverFvMesh::lduAddr(); + } + if (lduPtr_.empty()) + { + // Build extended addressing + updateAddressing(); + } + return *lduPtr_; +} + + +const Foam::fvMeshPrimitiveLduAddressing& +Foam::dynamicOversetFvMesh::primitiveLduAddr() const +{ + if (lduPtr_.empty()) + { + FatalErrorInFunction + << "Extended addressing not allocated" << abort(FatalError); + } + + return *lduPtr_; +} + + +bool Foam::dynamicOversetFvMesh::update() +{ + if (dynamicMotionSolverFvMesh::update()) + { + // Calculate the local extra faces for the interpolation. Note: could + // let demand-driven lduAddr() trigger it but just to make sure. + updateAddressing(); + + // This should be done when there is actually a changed in + // the new addressing. This sshould no update old fields. + interpolateFields(); + + return true; + } + + return false; +} + + +bool Foam::dynamicOversetFvMesh::interpolateFields() +{ + { + auto flds(this->lookupClass()); + for (auto fldPtr : flds) + { + auto& fld = *fldPtr; + if + ( + fld.name() != "cellMask" + && fld.name() != "cellMask_0" + && fld.name() != "interpolatedCells" + && fld.name() != "k_0" + && fld.name() != "epsilon_0" + && fld.name() != "alpha.water_0" + && fld.name() != "rho_0" + ) + { + Pout << "Interpolating : " << fld.name() << endl; + interpolate(fld.primitiveFieldRef()); + } + } + } + + { + auto flds(this->lookupClass()); + for (auto fldPtr : flds) + { + auto& fld = *fldPtr; + if + ( + fld.name() != "cellDisplacement" + && fld.name() != "U_0" + ) + { + Pout << "Interpolating : " << fld.name() << endl; + interpolate(fld.primitiveFieldRef()); + } + } + } + + return true; +} + + + +bool Foam::dynamicOversetFvMesh::writeObject +( + IOstream::streamFormat fmt, + IOstream::versionNumber ver, + IOstream::compressionType cmp, + const bool valid +) const +{ + bool ok = dynamicMotionSolverFvMesh::writeObject(fmt, ver, cmp, valid); + + // For postprocessing : write cellTypes and zoneID + { + const cellCellStencilObject& overlap = Stencil::New(*this); + + const labelUList& cellTypes = overlap.cellTypes(); + + volScalarField volTypes + ( + IOobject + ( + "cellTypes", + this->time().timeName(), + *this, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + *this, + dimensionedScalar(dimless, Zero), + zeroGradientFvPatchScalarField::typeName + ); + + forAll(volTypes.internalField(), cellI) + { + volTypes[cellI] = cellTypes[cellI]; + } + volTypes.correctBoundaryConditions(); + volTypes.writeObject(fmt, ver, cmp, valid); + } + { + volScalarField volZoneID + ( + IOobject + ( + "zoneID", + this->time().timeName(), + *this, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + *this, + dimensionedScalar(dimless, Zero), + zeroGradientFvPatchScalarField::typeName + ); + + const cellCellStencilObject& overlap = Stencil::New(*this); + const labelIOList& zoneID = overlap.zoneID(); + + forAll(zoneID, cellI) + { + volZoneID[cellI] = zoneID[cellI]; + } + volZoneID.correctBoundaryConditions(); + volZoneID.writeObject(fmt, ver, cmp, valid); + } + return ok; +} + + +// ************************************************************************* // diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.H b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.H index e040617884..6d325e32ba 100644 --- a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.H +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.H @@ -102,6 +102,14 @@ protected: template void interpolate(GeoField& psi) const; + //- Helper: strip off trailing _0 + static word baseName(const word& name); + + //- Explicit interpolation of all registered fields. Excludes + // selected fields (and their old-time fields) + template + void interpolate(const wordHashSet& suppressed); + //- Freeze values at holes template void freezeHoles(fvMatrix&) const; @@ -299,6 +307,9 @@ public: //- Update the mesh for both mesh motion and topology change virtual bool update(); + //- Update fields when mesh is updated + virtual bool interpolateFields(); + //- Write using given format, version and compression virtual bool writeObject ( diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.H.orig b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.H.orig new file mode 100644 index 0000000000..e040617884 --- /dev/null +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.H.orig @@ -0,0 +1,331 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015-2017 OpenCFD Ltd. + \\/ 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 3 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, see . + +Class + Foam::dynamicOversetFvMesh + +Description + dynamicFvMesh with support for overset meshes. + +SourceFiles + dynamicOversetFvMesh.C + +\*---------------------------------------------------------------------------*/ + +#ifndef dynamicOversetFvMesh_H +#define dynamicOversetFvMesh_H + +#include "dynamicMotionSolverFvMesh.H" +#include "labelIOList.H" +#include "fvMeshPrimitiveLduAddressing.H" +#include "lduInterfaceFieldPtrsList.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class mapDistribute; +class lduPrimitiveProcessorInterface; + +/*---------------------------------------------------------------------------*\ + Class dynamicOversetFvMesh Declaration +\*---------------------------------------------------------------------------*/ + +class dynamicOversetFvMesh +: + public dynamicMotionSolverFvMesh +{ +protected: + + // Protected data + + //- Select base addressing (false) or locally stored extended + // lduAddressing (true) + mutable bool active_; + + //- Extended addressing (extended with local interpolation stencils) + mutable autoPtr lduPtr_; + + //- Added (processor)lduInterfaces for remote bits of stencil. + //PtrList remoteStencilInterfaces_; + mutable PtrList + remoteStencilInterfaces_; + + //- Interfaces for above mesh. Contains both original and + // above added processorLduInterfaces + mutable lduInterfacePtrsList allInterfaces_; + + //- Corresponding faces (in above lduPtr) to the stencil + mutable labelListList stencilFaces_; + + //- From old to new face labels + mutable labelList reverseFaceMap_; + + + // Protected Member Functions + + //- Calculate the extended lduAddressing + virtual bool updateAddressing() const; + + //- Debug: print matrix + template + void write(Ostream&, const fvMatrix&, const lduAddressing&) const; + + //- Explicit interpolation of acceptor cells from donor cells + template + void interpolate(Field& psi) const; + + //- Explicit interpolation of acceptor cells from donor cells with + // boundary condition handling + template + void interpolate(GeoField& psi) const; + + //- Freeze values at holes + template + void freezeHoles(fvMatrix&) const; + + //- Get scalar interfaces of certain type + template + lduInterfaceFieldPtrsList scalarInterfaces(const GeoField& psi) const; + + //- Add interpolation to matrix (coefficients) + template + void addInterpolation(fvMatrix&) const; + + //- Solve given dictionary with settings + template + SolverPerformance solve(fvMatrix&, const dictionary&) const; + + //- Debug: correct coupled bc + template + static void correctCoupledBoundaryConditions(GeoField& fld); + + +private: + + // Private Member Functions + + //- No copy construct + dynamicOversetFvMesh(const dynamicOversetFvMesh&) = delete; + + //- No copy assignment + void operator=(const dynamicOversetFvMesh&) = delete; + + +public: + + //- Runtime type information + TypeName("dynamicOversetFvMesh"); + + + // Constructors + + //- Construct from IOobject + dynamicOversetFvMesh(const IOobject& io); + + + //- Destructor + virtual ~dynamicOversetFvMesh(); + + + // Member Functions + + + // Extended addressing + + //- Return extended ldu addressing + const fvMeshPrimitiveLduAddressing& primitiveLduAddr() const; + + //- Return ldu addressing. If active: is (extended) + // primitiveLduAddr + virtual const lduAddressing& lduAddr() const; + + //- Return old to new face addressing + const labelList& reverseFaceMap() const + { + return reverseFaceMap_; + } + + //- Return true if using extended addressing + bool active() const + { + return active_; + } + + //- Enable/disable extended addressing + void active(const bool f) const + { + active_ = f; + + if (active_) + { + DebugInfo<< "Switching to extended addressing with nFaces:" + << primitiveLduAddr().lowerAddr().size() + << endl; + } + else + { + DebugInfo<< "Switching to base addressing with nFaces:" + << fvMesh::lduAddr().lowerAddr().size() + << endl; + } + } + + + // Overset + + // Explicit interpolation + + virtual void interpolate(scalarField& psi) const + { + interpolate(psi); + } + + virtual void interpolate(vectorField& psi) const + { + interpolate(psi); + } + + virtual void interpolate(sphericalTensorField& psi) const + { + interpolate(psi); + } + + virtual void interpolate(symmTensorField& psi) const + { + interpolate(psi); + } + + virtual void interpolate(tensorField& psi) const + { + interpolate(psi); + } + + virtual void interpolate(volScalarField& psi) const + { + interpolate(psi); + } + + virtual void interpolate(volVectorField& psi) const + { + interpolate(psi); + } + + virtual void interpolate(volSphericalTensorField& psi) const + { + interpolate(psi); + } + + virtual void interpolate(volSymmTensorField& psi) const + { + interpolate(psi); + } + + virtual void interpolate(volTensorField& psi) const + { + interpolate(psi); + } + + + // Implicit interpolation (matrix manipulation) + + //- Solve returning the solution statistics given convergence + // tolerance. Use the given solver controls + virtual SolverPerformance solve + ( + fvMatrix& m, + const dictionary& dict + ) const + { + return solve(m, dict); + } + + //- Solve returning the solution statistics given convergence + // tolerance. Use the given solver controls + virtual SolverPerformance solve + ( + fvMatrix& m, + const dictionary& dict + ) const + { + return solve(m, dict); + } + + //- Solve returning the solution statistics given convergence + // tolerance. Use the given solver controls + virtual SolverPerformance solve + ( + fvMatrix& m, + const dictionary& dict + ) const + { + return solve(m, dict); + } + + //- Solve returning the solution statistics given convergence + // tolerance. Use the given solver controls + virtual SolverPerformance solve + ( + fvMatrix& m, + const dictionary& dict + ) const + { + return solve(m, dict); + } + + + //- Update the mesh for both mesh motion and topology change + virtual bool update(); + + //- Write using given format, version and compression + virtual bool writeObject + ( + IOstream::streamFormat, + IOstream::versionNumber, + IOstream::compressionType, + const bool valid + ) const; + + //- Debug: check halo swap is ok + template + static void checkCoupledBC(const GeoField& fld); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "dynamicOversetFvMeshTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C index 59cbf08c69..bfb2288cf6 100644 --- a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C @@ -78,6 +78,34 @@ void Foam::dynamicOversetFvMesh::interpolate(GeoField& psi) const } +template +void Foam::dynamicOversetFvMesh::interpolate(const wordHashSet& suppressed) +{ + auto flds(this->lookupClass()); + for (auto fldPtr : flds) + { + const word& name = fldPtr->name(); + if (!suppressed.found(baseName(name))) + { + if (debug) + { + Pout<< "dynamicOversetFvMesh::interpolate: interpolating : " + << name << endl; + } + interpolate(fldPtr->primitiveFieldRef()); + } + else + { + if (debug) + { + Pout<< "dynamicOversetFvMesh::interpolate: skipping : " << name + << endl; + } + } + } +} + + template Foam::lduInterfaceFieldPtrsList Foam::dynamicOversetFvMesh::scalarInterfaces(const GeoField& psi) const diff --git a/src/overset/oversetPolyPatch/oversetFvPatchField.C b/src/overset/oversetPolyPatch/oversetFvPatchField.C index da288827af..91d31a4001 100644 --- a/src/overset/oversetPolyPatch/oversetFvPatchField.C +++ b/src/overset/oversetPolyPatch/oversetFvPatchField.C @@ -115,15 +115,46 @@ void Foam::oversetFvPatchField::initEvaluate else if ( !fvSchemes.found("oversetInterpolation") - || !fvSchemes.found("oversetInterpolationRequired") + || ( + fvSchemes.found("oversetInterpolationRequired") + == fvSchemes.found("oversetInterpolationSuppressed") + ) ) { IOWarningInFunction(fvSchemes) << "Missing required dictionary entries" << " 'oversetInterpolation' and 'oversetInterpolationRequired'" + << " or 'oversetInterpolationSuppressed'" << ". Skipping overset interpolation for field " << fldName << endl; } + else if (fvSchemes.found("oversetInterpolationSuppressed")) + { + const dictionary& intDict = fvSchemes.subDict + ( + "oversetInterpolationSuppressed" + ); + if (!intDict.found(fldName)) + { + if (debug) + { + Info<< "Interpolating non-suppressed field " << fldName + << endl; + } + mesh.interpolate + ( + const_cast&> + ( + this->primitiveField() + ) + ); + } + else if (debug) + { + Info<< "Skipping suppressed overset interpolation for field " + << fldName << endl; + } + } else { const dictionary& intDict = fvSchemes.subDict