diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H index 54204be715..be057b74fc 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/cyclic/cyclicPointPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -115,15 +115,6 @@ public: // Member Functions - // Constraint handling - - //- Return the constraint type this pointPatchField implements - virtual const word& constraintType() const - { - return cyclicPointPatch::typeName; - } - - // Cyclic coupled interface functions //- Return transformation between the coupled patches diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/empty/emptyPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/empty/emptyPointPatchField.H index 5a55dc43cc..3f326338d0 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/empty/emptyPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/empty/emptyPointPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,17 +107,6 @@ public: ) ); } - - // Member Functions - - //- Constraint handling - - //- Return the constraint type this pointPatchField implements - virtual const word& constraintType() const - { - return type(); - } - }; diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/internal/internalPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/internal/internalPointPatchField.H index b55b0dedf4..132d65eb04 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/internal/internalPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/internal/internalPointPatchField.H @@ -108,15 +108,6 @@ public: ) ); } - - - // Member Functions - - //- Return the constraint type this pointPatchField implements - virtual const word& constraintType() const - { - return internalPointPatch::typeName; - } }; diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H index 1a69382bc4..2a6ca6ba0e 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/processor/processorPointPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -135,15 +135,6 @@ public: } - // Constraint handling - - //- Return the constraint type this pointPatchField implements - virtual const word& constraintType() const - { - return type(); - } - - // Evaluation functions //- Evaluate the patch field diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/symmetry/symmetryPointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/symmetry/symmetryPointPatchField.H index ee0126b055..630f4b9a77 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/symmetry/symmetryPointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/symmetry/symmetryPointPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,16 +107,6 @@ public: ) ); } - - - // Member Functions - - //- Return the constraint type this pointPatchField implements - virtual const word& constraintType() const - { - return symmetryPointPatch::typeName; - } - }; diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/symmetryPlane/symmetryPlanePointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/symmetryPlane/symmetryPlanePointPatchField.H index b3a0bb59c9..f6d6dd6af2 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/symmetryPlane/symmetryPlanePointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/symmetryPlane/symmetryPlanePointPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -116,12 +116,6 @@ public: // Member Functions - //- Return the constraint type this pointPatchField implements - virtual const word& constraintType() const - { - return symmetryPlanePointPatch::typeName; - } - //- Update the patch field virtual void evaluate ( diff --git a/src/OpenFOAM/fields/pointPatchFields/constraint/wedge/wedgePointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/constraint/wedge/wedgePointPatchField.H index 4f471740cd..f8fe8d4906 100644 --- a/src/OpenFOAM/fields/pointPatchFields/constraint/wedge/wedgePointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/constraint/wedge/wedgePointPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -110,12 +110,6 @@ public: // Member Functions - //- Return the constraint type this pointPatchField implements - virtual const word& constraintType() const - { - return type(); - } - //- Update the patch field virtual void evaluate ( diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H index d09aad3e79..e2d9eb047f 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H @@ -283,16 +283,10 @@ public: return false; } - //- Return the constraint type this pointPatchField implements. - virtual const word& constraintType() const - { - return word::null; - } - //- Return true if this overrides the underlying constraint type bool overridesConstraint() const { - if (constraintType() == patch_.constraintType()) + if (type() == patch_.type()) { return false; } diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldNew.C b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldNew.C index 2058f44a78..a6d841eb7a 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldNew.C +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchFieldNew.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // template Foam::autoPtr> Foam::pointPatchField::New @@ -36,7 +36,11 @@ Foam::autoPtr> Foam::pointPatchField::New { if (debug) { - InfoInFunction << "Constructing pointPatchField" << endl; + InfoInFunction + << "patchFieldType = " << patchFieldType + << ", actualPatchType = " << actualPatchType + << ", patchType = " << p.type() + << endl; } typename pointPatchConstructorTable::iterator cstrIter = @@ -45,41 +49,35 @@ Foam::autoPtr> Foam::pointPatchField::New if (cstrIter == pointPatchConstructorTablePtr_->end()) { FatalErrorInFunction - << "Unknown patchFieldType type " + << "Unknown patchField type " << patchFieldType << nl << nl << "Valid patchField types are :" << endl << pointPatchConstructorTablePtr_->sortedToc() << exit(FatalError); } - autoPtr> pfPtr(cstrIter()(p, iF)); - if ( actualPatchType == word::null || actualPatchType != p.type() ) { - if (pfPtr().constraintType() != p.constraintType()) + typename pointPatchConstructorTable::iterator patchTypeCstrIter = + pointPatchConstructorTablePtr_->find(p.type()); + + if (patchTypeCstrIter != pointPatchConstructorTablePtr_->end()) { - // Use default constraint type - typename pointPatchConstructorTable::iterator patchTypeCstrIter = - pointPatchConstructorTablePtr_->find(p.type()); - - if (patchTypeCstrIter == pointPatchConstructorTablePtr_->end()) - { - FatalErrorInFunction - << "inconsistent patch and patchField types for \n" - << " patch type " << p.type() - << " and patchField type " << patchFieldType - << exit(FatalError); - } - return patchTypeCstrIter()(p, iF); } + else + { + return cstrIter()(p, iF); + } + } + else + { + return cstrIter()(p, iF); } - - return pfPtr; } @@ -103,13 +101,18 @@ Foam::autoPtr> Foam::pointPatchField::New const dictionary& dict ) { + word patchFieldType(dict.lookup("type")); + if (debug) { - InfoInFunction << "Constructing pointPatchField" << endl; + InfoInFunction + << "patchFieldType = " << patchFieldType + << ", actualPatchType = " + << dict.lookupOrDefault("patchType", word::null) + << ", patchType = " << p.type() + << endl; } - word patchFieldType(dict.lookup("type")); - typename dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(patchFieldType); @@ -133,38 +136,28 @@ Foam::autoPtr> Foam::pointPatchField::New } } - // Construct (but not necessarily returned) - autoPtr> pfPtr(cstrIter()(p, iF, dict)); - if ( !dict.found("patchType") || word(dict.lookup("patchType")) != p.type() ) { - if (pfPtr().constraintType() == p.constraintType()) - { - // Compatible (constraint-wise) with the patch type - return pfPtr; - } - else - { - // Use default constraint type - typename dictionaryConstructorTable::iterator patchTypeCstrIter - = dictionaryConstructorTablePtr_->find(p.type()); + typename dictionaryConstructorTable::iterator patchTypeCstrIter = + dictionaryConstructorTablePtr_->find(p.type()); - if (patchTypeCstrIter == dictionaryConstructorTablePtr_->end()) - { - FatalIOErrorInFunction - ( - dict - ) << "inconsistent patch and patchField types for \n" - << " patch type " << p.type() - << " and patchField type " << patchFieldType - << exit(FatalIOError); - } - - return patchTypeCstrIter()(p, iF, dict); + if + ( + patchTypeCstrIter != dictionaryConstructorTablePtr_->end() + && patchTypeCstrIter() != cstrIter() + ) + { + FatalIOErrorInFunction + ( + dict + ) << "inconsistent patch and patchField types for \n" + << " patch type " << p.type() + << " and patchField type " << patchFieldType + << exit(FatalIOError); } } @@ -192,8 +185,7 @@ Foam::autoPtr> Foam::pointPatchField::New if (cstrIter == patchMapperConstructorTablePtr_->end()) { FatalErrorInFunction - << "Unknown patchField type " - << ptf.type() << nl << nl + << "Unknown patchField type " << ptf.type() << nl << nl << "Valid patchField types are :" << endl << patchMapperConstructorTablePtr_->sortedToc() << exit(FatalError); diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H index 64b2dd57a1..f3ea14973f 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclic/cyclicPointPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -112,12 +112,6 @@ public: // Access - //- Return the constraint type this pointPatch implements. - virtual const word& constraintType() const - { - return type(); - } - //- Return the underlying cyclicPolyPatch const cyclicPolyPatch& cyclicPatch() const { diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/empty/emptyPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/empty/emptyPointPatch.H index cc78f42485..f5859f90e8 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/empty/emptyPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/empty/emptyPointPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -73,12 +73,6 @@ public: // Member Functions - //- Return the constraint type this pointPatch implements. - virtual const word& constraintType() const - { - return type(); - } - //- Accumulate the effect of constraint direction of this patch virtual void applyConstraint ( diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/internal/internalPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/internal/internalPointPatch.H index 225b62f97a..574b4e924e 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/internal/internalPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/internal/internalPointPatch.H @@ -72,15 +72,6 @@ public: : facePointPatch(patch, bm) {} - - - // Member Functions - - //- Return the constraint type this pointPatch implements. - virtual const word& constraintType() const - { - return type(); - } }; diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H index 77bea97580..30c1259caf 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -127,12 +127,6 @@ public: return procPolyPatch_.comm(); } - //- Return the constraint type this pointPatch implements. - virtual const word& constraintType() const - { - return type(); - } - //- Return processor number int myProcNo() const { diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/symmetry/symmetryPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/symmetry/symmetryPointPatch.H index 9d49813a14..f7766ca6ca 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/symmetry/symmetryPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/symmetry/symmetryPointPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -76,12 +76,6 @@ public: // Member Functions - //- Return the constraint type this pointPatch implements. - virtual const word& constraintType() const - { - return type(); - } - //- Accumulate the effect of constraint direction of this patch virtual void applyConstraint ( diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/symmetryPlane/symmetryPlanePointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/symmetryPlane/symmetryPlanePointPatch.H index 75bcf9a1a3..720d4acfae 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/symmetryPlane/symmetryPlanePointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/symmetryPlane/symmetryPlanePointPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,12 +75,6 @@ public: // Member Functions - //- Return the constraint type this pointPatch implements. - virtual const word& constraintType() const - { - return type(); - } - //- Accumulate the effect of constraint direction of this patch virtual void applyConstraint ( diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/wedge/wedgePointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/wedge/wedgePointPatch.H index a2a90d9f93..45abff378f 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/wedge/wedgePointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/wedge/wedgePointPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,12 +75,6 @@ public: // Member Functions - //- Return the constraint type this pointPatch implements. - virtual const word& constraintType() const - { - return type(); - } - //- Accumulate the effect of constraint direction of this patch virtual void applyConstraint ( diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H index 735f8846a1..6677bfdf5e 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -151,12 +151,6 @@ public: //- Return point normals virtual const vectorField& pointNormals() const = 0; - //- Return the constraint type this pointPatch implements. - virtual const word& constraintType() const - { - return word::null; - } - //- Accumulate the effect of constraint direction of this patch virtual void applyConstraint ( diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C index 78a9140e80..88b508e40e 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchFieldNew.C @@ -38,7 +38,8 @@ Foam::tmp> Foam::fvPatchField::New { InfoInFunction << "patchFieldType = " << patchFieldType - << " : " << p.type() + << ", actualPatchType = " << actualPatchType + << ", patchType = " << p.type() << endl; } @@ -106,6 +107,9 @@ Foam::tmp> Foam::fvPatchField::New { InfoInFunction << "patchFieldType = " << patchFieldType + << ", actualPatchType = " + << dict.lookupOrDefault("patchType", word::null) + << ", patchType = " << p.type() << endl; } diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C index 51a1761420..b5c3658411 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -161,6 +161,12 @@ template void Foam::fvsPatchField::write(Ostream& os) const { writeEntry(os, "type", type()); + + if (overridesConstraint()) + { + writeEntry(os, "patchType", patch().type()); + } + writeEntry(os, "value", *this); } diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H index 09bb975d1c..97115025d8 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H @@ -282,6 +282,42 @@ public: // Member Functions + // Attributes + + //- Return the type of the calculated for of fvsPatchField + static const word& calculatedType(); + + //- Return true if this patch field fixes a value. + // Needed to check if a level has to be specified while solving + // Poissons equations. + virtual bool fixesValue() const + { + return false; + } + + //- Return true if this patch field is coupled + virtual bool coupled() const + { + return false; + } + + //- Return true if this overrides the underlying constraint type + bool overridesConstraint() const + { + if (type() == patch_.type()) + { + return false; + } + + typename patchConstructorTable::iterator patchTypeCstrIter + = patchConstructorTablePtr_->find(patch_.type()); + + return + patchTypeCstrIter + != patchConstructorTablePtr_->end(); + } + + // Access //- Return local objectRegistry @@ -306,23 +342,6 @@ public: return internalField_; } - //- Return the type of the calculated for of fvsPatchField - static const word& calculatedType(); - - //- Return true if this patch field fixes a value. - // Needed to check if a level has to be specified while solving - // Poissons equations. - virtual bool fixesValue() const - { - return false; - } - - //- Return true if this patch field is coupled - virtual bool coupled() const - { - return false; - } - // Mapping functions diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldNew.C b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldNew.C index d4548c6dd8..11b6219109 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldNew.C +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchFieldNew.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,11 @@ Foam::tmp> Foam::fvsPatchField::New { if (debug) { - InfoInFunction << "Constructing fvsPatchField" << endl; + InfoInFunction + << "patchFieldType = " << patchFieldType + << ", actualPatchType = " << actualPatchType + << ", patchType = " << p.type() + << endl; } typename patchConstructorTable::iterator cstrIter = @@ -97,13 +101,18 @@ Foam::tmp> Foam::fvsPatchField::New const dictionary& dict ) { + const word patchFieldType(dict.lookup("type")); + if (debug) { - InfoInFunction << "Constructing fvsPatchField" << endl; + InfoInFunction + << "patchFieldType = " << patchFieldType + << ", actualPatchType = " + << dict.lookupOrDefault("patchType", word::null) + << ", patchType = " << p.type() + << endl; } - const word patchFieldType(dict.lookup("type")); - typename dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(patchFieldType); @@ -129,7 +138,7 @@ Foam::tmp> Foam::fvsPatchField::New if ( - !dict.found("patchType") + !dict.found("patchType") || word(dict.lookup("patchType")) != p.type() ) { @@ -182,17 +191,7 @@ Foam::tmp> Foam::fvsPatchField::New << exit(FatalError); } - typename patchMapperConstructorTable::iterator - patchTypeCstrIter = patchMapperConstructorTablePtr_->find(p.type()); - - if (patchTypeCstrIter != patchMapperConstructorTablePtr_->end()) - { - return patchTypeCstrIter()(ptf, p, iF, pfMapper); - } - else - { - return cstrIter()(ptf, p, iF, pfMapper); - } + return cstrIter()(ptf, p, iF, pfMapper); } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.H index 6157f8a276..49e58532c5 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatch/cyclicAMIPointPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -109,12 +109,6 @@ public: //- Return true if this patch field is coupled virtual bool coupled() const; - //- Return the constraint type this pointPatch implements. - virtual const word& constraintType() const - { - return type(); - } - //- Return the underlying cyclicAMIPolyPatch const cyclicAMIPolyPatch& cyclicAMIPatch() const { diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H index 7fb3b4e6be..69b135e59f 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPointPatchField/cyclicAMIPointPatchField.H @@ -160,15 +160,6 @@ public: // Member Functions - // Constraint handling - - //- Return the constraint type this pointPatchField implements - virtual const word& constraintType() const - { - return type(); - } - - // Cyclic AMI coupled interface functions //- Return transformation between the coupled patches