diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C index 650bf920a7..63cc806366 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFilmFoam/VoFPatchTransfer/VoFPatchTransfer.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -83,7 +83,7 @@ VoFPatchTransfer::VoFPatchTransfer pbm.size() - film.regionMesh().globalData().processorPatches().size() ); - wordReList patchNames; + wordRes patchNames; if (coeffDict_.readIfPresent("patches", patchNames)) { patchIDs_ = pbm.patchSet(patchNames).sortedToc(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C index 508e584948..97863afc1b 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,7 +29,6 @@ License #include "fixedNormalSlipFvPatchField.H" #include "symmTransformField.H" - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -39,8 +38,9 @@ Foam::fixedNormalSlipFvPatchField::fixedNormalSlipFvPatchField const DimensionedField& iF ) : - transformFvPatchField(p, iF), - fixedValue_(p.size(), Zero) + parent_bctype(p, iF), + fixedValue_(p.size(), Zero), + writeValue_(false) {} @@ -53,8 +53,9 @@ Foam::fixedNormalSlipFvPatchField::fixedNormalSlipFvPatchField const fvPatchFieldMapper& mapper ) : - transformFvPatchField(ptf, p, iF, mapper), - fixedValue_(ptf.fixedValue_, mapper) + parent_bctype(ptf, p, iF, mapper), + fixedValue_(ptf.fixedValue_, mapper), + writeValue_(ptf.writeValue_) {} @@ -66,8 +67,9 @@ Foam::fixedNormalSlipFvPatchField::fixedNormalSlipFvPatchField const dictionary& dict ) : - transformFvPatchField(p, iF), - fixedValue_("fixedValue", dict, p.size()) + parent_bctype(p, iF), + fixedValue_("fixedValue", dict, p.size()), + writeValue_(dict.getOrDefault("writeValue", false)) { this->patchType() = dict.getOrDefault("patchType", word::null); evaluate(); @@ -80,8 +82,9 @@ Foam::fixedNormalSlipFvPatchField::fixedNormalSlipFvPatchField const fixedNormalSlipFvPatchField& ptf ) : - transformFvPatchField(ptf), - fixedValue_(ptf.fixedValue_) + parent_bctype(ptf), + fixedValue_(ptf.fixedValue_), + writeValue_(ptf.writeValue_) {} @@ -92,8 +95,9 @@ Foam::fixedNormalSlipFvPatchField::fixedNormalSlipFvPatchField const DimensionedField& iF ) : - transformFvPatchField(ptf, iF), - fixedValue_(ptf.fixedValue_) + parent_bctype(ptf, iF), + fixedValue_(ptf.fixedValue_), + writeValue_(ptf.writeValue_) {} @@ -105,7 +109,7 @@ void Foam::fixedNormalSlipFvPatchField::autoMap const fvPatchFieldMapper& m ) { - transformFvPatchField::autoMap(m); + parent_bctype::autoMap(m); fixedValue_.autoMap(m); } @@ -117,9 +121,9 @@ void Foam::fixedNormalSlipFvPatchField::rmap const labelList& addr ) { - transformFvPatchField::rmap(ptf, addr); + parent_bctype::rmap(ptf, addr); - const fixedNormalSlipFvPatchField& dmptf = + const auto& dmptf = refCast>(ptf); fixedValue_.rmap(dmptf.fixedValue_, addr); @@ -159,7 +163,7 @@ void Foam::fixedNormalSlipFvPatchField::evaluate + transform(I - sqr(nHat), this->patchInternalField()) ); - transformFvPatchField::evaluate(); + this->parent_bctype::evaluate(); } @@ -181,8 +185,14 @@ Foam::fixedNormalSlipFvPatchField::snGradTransformDiag() const template void Foam::fixedNormalSlipFvPatchField::write(Ostream& os) const { - transformFvPatchField::write(os); + this->parent_bctype::write(os); fixedValue_.writeEntry("fixedValue", os); + + if (writeValue_) + { + os.writeEntry("writeValue", "true"); + this->writeEntry("value", os); + } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H index be651bc33f..1588c53328 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,28 +31,48 @@ Group grpGenericBoundaryConditions grpWallBoundaryConditions Description - This boundary condition sets the patch-normal component to a fixed value. + This boundary condition sets the patch-normal component to the field (vector + or tensor) to the patch-normal component of a user specified field. + The tangential component is treated as slip, i.e. copied from the internal + field. Usage - \table - Property | Description | Required | Default value - fixedValue | fixed value | yes | - \endtable - Example of the boundary condition specification: \verbatim { + // Mandatory entries (unmodifiable) type fixedNormalSlip; - fixedValue uniform 0; // example entry for a scalar field + fixedValue uniform (1 0 0); // example entry for a vector field + + // Optional entries + writeValue false; + + // Mandatory/Optional (inherited) entries + ... } \endverbatim + where the entries mean: + \table + Property | Description | Type | Reqd | Deflt + type | Type name: fixedNormalSlip | word | yes | - + fixedValue | User-defined value the normal component of which the boundary is set to | vectorField/tensorField | yes | - + writeValue | Output patch values (eg, ParaView) | bool | no | false + \endtable + + The inherited entries are elaborated in: + - \link transformFvPatchField.H \endlink + - \link fvPatchField.H \endlink + See also Foam::transformFvPatchField SourceFiles fixedNormalSlipFvPatchField.C + fixedNormalSlipFvPatchFields.C \*---------------------------------------------------------------------------*/ @@ -74,11 +95,18 @@ class fixedNormalSlipFvPatchField : public transformFvPatchField { - // Private data + //- The parent boundary condition type + typedef transformFvPatchField parent_bctype; + + + // Private Data //- Value the normal component of which the boundary is set to Field fixedValue_; + //- Flag to output patch values (e.g. for ParaView) + bool writeValue_; + public: @@ -104,7 +132,7 @@ public: ); //- Construct by mapping given fixedNormalSlipFvPatchField - // onto a new patch + //- onto a new patch fixedNormalSlipFvPatchField ( const fixedNormalSlipFvPatchField&, @@ -148,47 +176,46 @@ public: } - // Member functions + // Member Functions // Access - //- Return false: this patch field is not altered by assignment + //- This patch field is not altered by assignment virtual bool assignable() const { return false; } - - // Mapping functions - - //- Map (and resize as needed) from self given a mapping object - virtual void autoMap - ( - const fvPatchFieldMapper& - ); - - //- Reverse map the given fvPatchField onto this fvPatchField - virtual void rmap - ( - const fvPatchField&, - const labelList& - ); - - - // Return defining fields - + //- User-defined input field (modifiable field) virtual Field& fixedValue() { return fixedValue_; } + //- User-defined input field (const field) virtual const Field& fixedValue() const { return fixedValue_; } - // Evaluation functions + // Mapping + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& m + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchField& ptf, + const labelList& addr + ); + + + // Evaluation //- Return gradient at boundary virtual tmp> snGrad() const; @@ -208,7 +235,7 @@ public: virtual void write(Ostream&) const; - // Member operators + // Member Operators virtual void operator=(const UList&) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C index 50e24b1f63..f8d43846f5 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -38,9 +38,10 @@ Foam::partialSlipFvPatchField::partialSlipFvPatchField const DimensionedField& iF ) : - transformFvPatchField(p, iF), - refValue_(p.size()), - valueFraction_(p.size(), 1.0) + parent_bctype(p, iF), + refValue_(p.size(), Zero), + valueFraction_(p.size(), 1.0), + writeValue_(false) {} @@ -53,9 +54,10 @@ Foam::partialSlipFvPatchField::partialSlipFvPatchField const fvPatchFieldMapper& mapper ) : - transformFvPatchField(ptf, p, iF, mapper), + parent_bctype(ptf, p, iF, mapper), refValue_(ptf.refValue_, mapper), - valueFraction_(ptf.valueFraction_, mapper) + valueFraction_(ptf.valueFraction_, mapper), + writeValue_(ptf.writeValue_) {} @@ -67,9 +69,10 @@ Foam::partialSlipFvPatchField::partialSlipFvPatchField const dictionary& dict ) : - transformFvPatchField(p, iF), + parent_bctype(p, iF), refValue_(p.size(), Zero), - valueFraction_("valueFraction", dict, p.size()) + valueFraction_("valueFraction", dict, p.size()), + writeValue_(dict.getOrDefault("writeValue", false)) { this->patchType() = dict.getOrDefault("patchType", word::null); @@ -89,9 +92,10 @@ Foam::partialSlipFvPatchField::partialSlipFvPatchField const partialSlipFvPatchField& ptf ) : - transformFvPatchField(ptf), + parent_bctype(ptf), refValue_(ptf.refValue_), - valueFraction_(ptf.valueFraction_) + valueFraction_(ptf.valueFraction_), + writeValue_(ptf.writeValue_) {} @@ -102,9 +106,10 @@ Foam::partialSlipFvPatchField::partialSlipFvPatchField const DimensionedField& iF ) : - transformFvPatchField(ptf, iF), + parent_bctype(ptf, iF), refValue_(ptf.refValue_), - valueFraction_(ptf.valueFraction_) + valueFraction_(ptf.valueFraction_), + writeValue_(ptf.writeValue_) {} @@ -116,7 +121,7 @@ void Foam::partialSlipFvPatchField::autoMap const fvPatchFieldMapper& m ) { - transformFvPatchField::autoMap(m); + parent_bctype::autoMap(m); refValue_.autoMap(m); valueFraction_.autoMap(m); } @@ -129,9 +134,9 @@ void Foam::partialSlipFvPatchField::rmap const labelList& addr ) { - transformFvPatchField::rmap(ptf, addr); + parent_bctype::rmap(ptf, addr); - const partialSlipFvPatchField& dmptf = + const auto& dmptf = refCast>(ptf); refValue_.rmap(dmptf.refValue_, addr); @@ -175,7 +180,7 @@ void Foam::partialSlipFvPatchField::evaluate *transform(I - sqr(nHat), this->patchInternalField()) ); - transformFvPatchField::evaluate(); + parent_bctype::evaluate(); } @@ -200,9 +205,15 @@ Foam::partialSlipFvPatchField::snGradTransformDiag() const template void Foam::partialSlipFvPatchField::write(Ostream& os) const { - transformFvPatchField::write(os); + this->parent_bctype::write(os); refValue_.writeEntry("refValue", os); valueFraction_.writeEntry("valueFraction", os); + + if (writeValue_) + { + os.writeEntry("writeValue", "true"); + this->writeEntry("value", os); + } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H index c49db520a5..320e3f313e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/partialSlip/partialSlipFvPatchField.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -35,9 +36,11 @@ Description Usage \table - Property | Description | Required | Default value - refValue | Reference value at zero slip | no | 0 - valueFraction | Fraction of refValue used for boundary [0-1] | yes | + Property | Description | Reqd | Default + type | Type name: partialSlip | yes | - + refValue | Reference value at zero slip | no | 0 + valueFraction | Fraction of refValue used for boundary [0-1] | yes | + writeValue | Output patch value (eg, ParaView) | no | false \endtable Example of the boundary condition specification: @@ -78,7 +81,11 @@ class partialSlipFvPatchField : public transformFvPatchField { - // Private data + //- The parent boundary condition type + typedef transformFvPatchField parent_bctype; + + + // Private Data //- Reference value Field refValue_; @@ -86,6 +93,9 @@ class partialSlipFvPatchField //- Fraction (0-1) of value used for boundary condition scalarField valueFraction_; + //- Flag to output patch values (e.g. for ParaView) + bool writeValue_; + public: @@ -154,35 +164,16 @@ public: } - // Member functions + // Member Functions - // Attributes + // Access/attributes - //- Return false: this patch field is not altered by assignment + //- This patch field is not altered by assignment virtual bool assignable() const { return false; } - - // Mapping functions - - //- Map (and resize as needed) from self given a mapping object - virtual void autoMap - ( - const fvPatchFieldMapper& - ); - - //- Reverse map the given fvPatchField onto this fvPatchField - virtual void rmap - ( - const fvPatchField&, - const labelList& - ); - - - // Return defining fields - virtual Field& refValue() { return refValue_; @@ -204,7 +195,23 @@ public: } - // Evaluation functions + // Mapping + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchField&, + const labelList& + ); + + + // Evaluation //- Return gradient at boundary virtual tmp> snGrad() const; @@ -224,7 +231,7 @@ public: virtual void write(Ostream&) const; - // Member operators + // Member Operators virtual void operator=(const UList&) {}