ENH: change uniformGradient from Function1 to PatchFunction1

This commit is contained in:
Mark Olesen
2020-09-24 16:30:39 +02:00
parent 0dfdeb36d4
commit ea42a7a6d4
4 changed files with 30 additions and 27 deletions

View File

@ -38,7 +38,7 @@ Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
) )
: :
fixedGradientFvPatchField<Type>(p, iF), fixedGradientFvPatchField<Type>(p, iF),
uniformGradient_() uniformGradient_(nullptr)
{} {}
@ -51,7 +51,7 @@ Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
) )
: :
fixedGradientFvPatchField<Type>(p, iF, fld), fixedGradientFvPatchField<Type>(p, iF, fld),
uniformGradient_() uniformGradient_(nullptr)
{} {}
@ -64,7 +64,10 @@ Foam::uniformFixedGradientFvPatchField<Type>::uniformFixedGradientFvPatchField
) )
: :
fixedGradientFvPatchField<Type>(p, iF), fixedGradientFvPatchField<Type>(p, iF),
uniformGradient_(Function1<Type>::New("uniformGradient", dict)) uniformGradient_
(
PatchFunction1<Type>::New(p.patch(), "uniformGradient", dict)
)
{ {
this->patchType() = dict.getOrDefault<word>("patchType", word::null); this->patchType() = dict.getOrDefault<word>("patchType", word::null);
this->evaluate(); this->evaluate();

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -34,8 +35,8 @@ Description
Usage Usage
\table \table
Property | Description | Required | Default value Property | Description | Required | Default
uniformGradient | uniform gradient | yes | uniformGradient | uniform gradient | yes |
\endtable \endtable
Example of the boundary condition specification: Example of the boundary condition specification:
@ -48,9 +49,9 @@ Usage
\endverbatim \endverbatim
Note Note
The uniformGradient entry is a Function1 type, able to describe time The uniformGradient entry is a PatchFunction1 type,
varying functions. The example above gives the usage for supplying a able to describe time and spatial varying functions.
constant value. The example above gives the usage for supplying a constant value.
See also See also
Foam::Function1Types Foam::Function1Types
@ -65,7 +66,7 @@ SourceFiles
#define uniformFixedGradientFvPatchField_H #define uniformFixedGradientFvPatchField_H
#include "fixedGradientFvPatchFields.H" #include "fixedGradientFvPatchFields.H"
#include "Function1.H" #include "PatchFunction1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -81,10 +82,10 @@ class uniformFixedGradientFvPatchField
: :
public fixedGradientFvPatchField<Type> public fixedGradientFvPatchField<Type>
{ {
// Private data // Private Data
//- Gradient //- Gradient
autoPtr<Function1<Type>> uniformGradient_; autoPtr<PatchFunction1<Type>> uniformGradient_;
public: public:
@ -118,8 +119,7 @@ public:
const dictionary& const dictionary&
); );
//- Construct by mapping given uniformFixedGradientFvPatchField //- Construct by mapping onto a new patch
// onto a new patch
uniformFixedGradientFvPatchField uniformFixedGradientFvPatchField
( (
const uniformFixedGradientFvPatchField<Type>&, const uniformFixedGradientFvPatchField<Type>&,
@ -169,7 +169,7 @@ public:
virtual void updateCoeffs(); virtual void updateCoeffs();
//- Write //- Write
virtual void write(Ostream&) const; virtual void write(Ostream& os) const;
}; };

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -38,7 +38,7 @@ Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
) )
: :
fixedValueFvPatchField<Type>(p, iF), fixedValueFvPatchField<Type>(p, iF),
uniformValue_() uniformValue_(nullptr)
{} {}
@ -51,7 +51,7 @@ Foam::uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
) )
: :
fixedValueFvPatchField<Type>(p, iF, fld), fixedValueFvPatchField<Type>(p, iF, fld),
uniformValue_() uniformValue_(nullptr)
{} {}

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -35,8 +35,8 @@ Description
Usage Usage
\table \table
Property | Description | Required | Default value Property | Description | Required | Default
uniformValue | uniform value | yes | uniformValue | uniform value | yes |
\endtable \endtable
Example of the boundary condition specification: Example of the boundary condition specification:
@ -49,9 +49,9 @@ Usage
\endverbatim \endverbatim
Note Note
The uniformValue entry is a Function1 type, able to describe time The uniformValue entry is a PatchFunction1 type,
varying functions. The example above gives the usage for supplying a able to describe time and spatial varying functions.
constant value. The example above gives the usage for supplying a constant value.
See also See also
Foam::Function1Types Foam::Function1Types
@ -82,8 +82,9 @@ class uniformFixedValueFvPatchField
: :
public fixedValueFvPatchField<Type> public fixedValueFvPatchField<Type>
{ {
// Private data // Private Data
//- Value
autoPtr<PatchFunction1<Type>> uniformValue_; autoPtr<PatchFunction1<Type>> uniformValue_;
@ -118,8 +119,7 @@ public:
const dictionary& const dictionary&
); );
//- Construct by mapping given uniformFixedValueFvPatchField //- Construct by mapping onto a new patch
// onto a new patch
uniformFixedValueFvPatchField uniformFixedValueFvPatchField
( (
const uniformFixedValueFvPatchField<Type>&, const uniformFixedValueFvPatchField<Type>&,
@ -185,7 +185,7 @@ public:
virtual void updateCoeffs(); virtual void updateCoeffs();
//- Write //- Write
virtual void write(Ostream&) const; virtual void write(Ostream& os) const;
}; };