diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedNormalSlip/fixedNormalSlipFvPatchField.C index 508e584948d78620d16262643cefe68346a88c67..460bce9ca303398355879c4a42a404a5c0066296 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<class Type> @@ -40,7 +39,8 @@ Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField ) : transformFvPatchField<Type>(p, iF), - fixedValue_(p.size(), Zero) + fixedValue_(p.size(), Zero), + writeValue_(false) {} @@ -54,7 +54,8 @@ Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField ) : transformFvPatchField<Type>(ptf, p, iF, mapper), - fixedValue_(ptf.fixedValue_, mapper) + fixedValue_(ptf.fixedValue_, mapper), + writeValue_(ptf.writeValue_) {} @@ -67,7 +68,8 @@ Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField ) : transformFvPatchField<Type>(p, iF), - fixedValue_("fixedValue", dict, p.size()) + fixedValue_("fixedValue", dict, p.size()), + writeValue_(dict.getOrDefault("writeValue", false)) { this->patchType() = dict.getOrDefault<word>("patchType", word::null); evaluate(); @@ -81,7 +83,8 @@ Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField ) : transformFvPatchField<Type>(ptf), - fixedValue_(ptf.fixedValue_) + fixedValue_(ptf.fixedValue_), + writeValue_(ptf.writeValue_) {} @@ -93,7 +96,8 @@ Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField ) : transformFvPatchField<Type>(ptf, iF), - fixedValue_(ptf.fixedValue_) + fixedValue_(ptf.fixedValue_), + writeValue_(ptf.writeValue_) {} @@ -183,6 +187,12 @@ void Foam::fixedNormalSlipFvPatchField<Type>::write(Ostream& os) const { transformFvPatchField<Type>::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 be651bc33ffbc767320f42079acc73a63228c766..8b0198abb62ffe65af1d687fdcc8137828dc264c 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,49 @@ 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 <patchName> { + // 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 | Flag to output patch values (e.g. 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 +96,14 @@ class fixedNormalSlipFvPatchField : public transformFvPatchField<Type> { - // Private data + // Private Data //- Value the normal component of which the boundary is set to Field<Type> fixedValue_; + //- Flag to output patch values (e.g. for ParaView) + bool writeValue_; + public: @@ -104,7 +129,7 @@ public: ); //- Construct by mapping given fixedNormalSlipFvPatchField - // onto a new patch + //- onto a new patch fixedNormalSlipFvPatchField ( const fixedNormalSlipFvPatchField<Type>&, @@ -148,7 +173,7 @@ public: } - // Member functions + // Member Functions // Access @@ -158,37 +183,36 @@ public: return false; } + //- Return user-defined input field + virtual Field<Type>& fixedValue() + { + return fixedValue_; + } + + //- Return user-defined input field as const field + virtual const Field<Type>& fixedValue() const + { + return fixedValue_; + } + - // Mapping functions + // Mapping //- Map (and resize as needed) from self given a mapping object virtual void autoMap ( - const fvPatchFieldMapper& + const fvPatchFieldMapper& m ); //- Reverse map the given fvPatchField onto this fvPatchField virtual void rmap ( - const fvPatchField<Type>&, - const labelList& + const fvPatchField<Type>& ptf, + const labelList& addr ); - // Return defining fields - - virtual Field<Type>& fixedValue() - { - return fixedValue_; - } - - virtual const Field<Type>& fixedValue() const - { - return fixedValue_; - } - - - // Evaluation functions + // Evaluation //- Return gradient at boundary virtual tmp<Field<Type>> snGrad() const; @@ -208,7 +232,7 @@ public: virtual void write(Ostream&) const; - // Member operators + // Member Operators virtual void operator=(const UList<Type>&) {}