ENH: fixedNormalSlip BC: add 'value' keyword (#1980, #1981)

DOC: improve header-file content

STYLE: fix stray use of wordReList instead of wordRes

Co-authored-by: Kutalmis Bercin
This commit is contained in:
Johan Roenby 2021-01-13 17:24:20 +00:00 committed by Mark Olesen
parent 86744913f4
commit 100ae5c2bd
5 changed files with 151 additions and 96 deletions

View File

@ -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();

View File

@ -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>
@ -39,8 +38,9 @@ Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
const DimensionedField<Type, volMesh>& iF
)
:
transformFvPatchField<Type>(p, iF),
fixedValue_(p.size(), Zero)
parent_bctype(p, iF),
fixedValue_(p.size(), Zero),
writeValue_(false)
{}
@ -53,8 +53,9 @@ Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
const fvPatchFieldMapper& mapper
)
:
transformFvPatchField<Type>(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<Type>::fixedNormalSlipFvPatchField
const dictionary& dict
)
:
transformFvPatchField<Type>(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<word>("patchType", word::null);
evaluate();
@ -80,8 +82,9 @@ Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
const fixedNormalSlipFvPatchField<Type>& ptf
)
:
transformFvPatchField<Type>(ptf),
fixedValue_(ptf.fixedValue_)
parent_bctype(ptf),
fixedValue_(ptf.fixedValue_),
writeValue_(ptf.writeValue_)
{}
@ -92,8 +95,9 @@ Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
const DimensionedField<Type, volMesh>& iF
)
:
transformFvPatchField<Type>(ptf, iF),
fixedValue_(ptf.fixedValue_)
parent_bctype(ptf, iF),
fixedValue_(ptf.fixedValue_),
writeValue_(ptf.writeValue_)
{}
@ -105,7 +109,7 @@ void Foam::fixedNormalSlipFvPatchField<Type>::autoMap
const fvPatchFieldMapper& m
)
{
transformFvPatchField<Type>::autoMap(m);
parent_bctype::autoMap(m);
fixedValue_.autoMap(m);
}
@ -117,9 +121,9 @@ void Foam::fixedNormalSlipFvPatchField<Type>::rmap
const labelList& addr
)
{
transformFvPatchField<Type>::rmap(ptf, addr);
parent_bctype::rmap(ptf, addr);
const fixedNormalSlipFvPatchField<Type>& dmptf =
const auto& dmptf =
refCast<const fixedNormalSlipFvPatchField<Type>>(ptf);
fixedValue_.rmap(dmptf.fixedValue_, addr);
@ -159,7 +163,7 @@ void Foam::fixedNormalSlipFvPatchField<Type>::evaluate
+ transform(I - sqr(nHat), this->patchInternalField())
);
transformFvPatchField<Type>::evaluate();
this->parent_bctype::evaluate();
}
@ -181,8 +185,14 @@ Foam::fixedNormalSlipFvPatchField<Type>::snGradTransformDiag() const
template<class Type>
void Foam::fixedNormalSlipFvPatchField<Type>::write(Ostream& os) const
{
transformFvPatchField<Type>::write(os);
this->parent_bctype::write(os);
fixedValue_.writeEntry("fixedValue", os);
if (writeValue_)
{
os.writeEntry("writeValue", "true");
this->writeEntry("value", os);
}
}

View File

@ -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
<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 | 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<Type>
{
// Private data
//- The parent boundary condition type
typedef transformFvPatchField<Type> parent_bctype;
// 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 +132,7 @@ public:
);
//- Construct by mapping given fixedNormalSlipFvPatchField
// onto a new patch
//- onto a new patch
fixedNormalSlipFvPatchField
(
const fixedNormalSlipFvPatchField<Type>&,
@ -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<Type>&,
const labelList&
);
// Return defining fields
//- User-defined input field (modifiable field)
virtual Field<Type>& fixedValue()
{
return fixedValue_;
}
//- User-defined input field (const field)
virtual const Field<Type>& 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<Type>& ptf,
const labelList& addr
);
// Evaluation
//- Return gradient at boundary
virtual tmp<Field<Type>> snGrad() const;
@ -208,7 +235,7 @@ public:
virtual void write(Ostream&) const;
// Member operators
// Member Operators
virtual void operator=(const UList<Type>&) {}

View File

@ -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<Type>::partialSlipFvPatchField
const DimensionedField<Type, volMesh>& iF
)
:
transformFvPatchField<Type>(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<Type>::partialSlipFvPatchField
const fvPatchFieldMapper& mapper
)
:
transformFvPatchField<Type>(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<Type>::partialSlipFvPatchField
const dictionary& dict
)
:
transformFvPatchField<Type>(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<word>("patchType", word::null);
@ -89,9 +92,10 @@ Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
const partialSlipFvPatchField<Type>& ptf
)
:
transformFvPatchField<Type>(ptf),
parent_bctype(ptf),
refValue_(ptf.refValue_),
valueFraction_(ptf.valueFraction_)
valueFraction_(ptf.valueFraction_),
writeValue_(ptf.writeValue_)
{}
@ -102,9 +106,10 @@ Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
const DimensionedField<Type, volMesh>& iF
)
:
transformFvPatchField<Type>(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<Type>::autoMap
const fvPatchFieldMapper& m
)
{
transformFvPatchField<Type>::autoMap(m);
parent_bctype::autoMap(m);
refValue_.autoMap(m);
valueFraction_.autoMap(m);
}
@ -129,9 +134,9 @@ void Foam::partialSlipFvPatchField<Type>::rmap
const labelList& addr
)
{
transformFvPatchField<Type>::rmap(ptf, addr);
parent_bctype::rmap(ptf, addr);
const partialSlipFvPatchField<Type>& dmptf =
const auto& dmptf =
refCast<const partialSlipFvPatchField<Type>>(ptf);
refValue_.rmap(dmptf.refValue_, addr);
@ -175,7 +180,7 @@ void Foam::partialSlipFvPatchField<Type>::evaluate
*transform(I - sqr(nHat), this->patchInternalField())
);
transformFvPatchField<Type>::evaluate();
parent_bctype::evaluate();
}
@ -200,9 +205,15 @@ Foam::partialSlipFvPatchField<Type>::snGradTransformDiag() const
template<class Type>
void Foam::partialSlipFvPatchField<Type>::write(Ostream& os) const
{
transformFvPatchField<Type>::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);
}
}

View File

@ -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<Type>
{
// Private data
//- The parent boundary condition type
typedef transformFvPatchField<Type> parent_bctype;
// Private Data
//- Reference value
Field<Type> 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<Type>&,
const labelList&
);
// Return defining fields
virtual Field<Type>& 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<Type>&,
const labelList&
);
// Evaluation
//- Return gradient at boundary
virtual tmp<Field<Type>> snGrad() const;
@ -224,7 +231,7 @@ public:
virtual void write(Ostream&) const;
// Member operators
// Member Operators
virtual void operator=(const UList<Type>&) {}