From ea42a7a6d4d365357dde6639e182a17edd68c5f3 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 24 Sep 2020 16:30:39 +0200 Subject: [PATCH] ENH: change uniformGradient from Function1 to PatchFunction1 --- .../uniformFixedGradientFvPatchField.C | 9 +++++--- .../uniformFixedGradientFvPatchField.H | 22 +++++++++---------- .../uniformFixedValueFvPatchField.C | 6 ++--- .../uniformFixedValueFvPatchField.H | 20 ++++++++--------- 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C index a2ee30027a..221a553d3e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.C @@ -38,7 +38,7 @@ Foam::uniformFixedGradientFvPatchField::uniformFixedGradientFvPatchField ) : fixedGradientFvPatchField(p, iF), - uniformGradient_() + uniformGradient_(nullptr) {} @@ -51,7 +51,7 @@ Foam::uniformFixedGradientFvPatchField::uniformFixedGradientFvPatchField ) : fixedGradientFvPatchField(p, iF, fld), - uniformGradient_() + uniformGradient_(nullptr) {} @@ -64,7 +64,10 @@ Foam::uniformFixedGradientFvPatchField::uniformFixedGradientFvPatchField ) : fixedGradientFvPatchField(p, iF), - uniformGradient_(Function1::New("uniformGradient", dict)) + uniformGradient_ + ( + PatchFunction1::New(p.patch(), "uniformGradient", dict) + ) { this->patchType() = dict.getOrDefault("patchType", word::null); this->evaluate(); diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H index bf42d2894a..0cce531299 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedGradient/uniformFixedGradientFvPatchField.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,8 +35,8 @@ Description Usage \table - Property | Description | Required | Default value - uniformGradient | uniform gradient | yes | + Property | Description | Required | Default + uniformGradient | uniform gradient | yes | \endtable Example of the boundary condition specification: @@ -48,9 +49,9 @@ Usage \endverbatim Note - The uniformGradient entry is a Function1 type, able to describe time - varying functions. The example above gives the usage for supplying a - constant value. + The uniformGradient entry is a PatchFunction1 type, + able to describe time and spatial varying functions. + The example above gives the usage for supplying a constant value. See also Foam::Function1Types @@ -65,7 +66,7 @@ SourceFiles #define uniformFixedGradientFvPatchField_H #include "fixedGradientFvPatchFields.H" -#include "Function1.H" +#include "PatchFunction1.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -81,10 +82,10 @@ class uniformFixedGradientFvPatchField : public fixedGradientFvPatchField { - // Private data + // Private Data //- Gradient - autoPtr> uniformGradient_; + autoPtr> uniformGradient_; public: @@ -118,8 +119,7 @@ public: const dictionary& ); - //- Construct by mapping given uniformFixedGradientFvPatchField - // onto a new patch + //- Construct by mapping onto a new patch uniformFixedGradientFvPatchField ( const uniformFixedGradientFvPatchField&, @@ -169,7 +169,7 @@ public: virtual void updateCoeffs(); //- Write - virtual void write(Ostream&) const; + virtual void write(Ostream& os) const; }; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C index 26623aa1a5..4b8f236dc3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -38,7 +38,7 @@ Foam::uniformFixedValueFvPatchField::uniformFixedValueFvPatchField ) : fixedValueFvPatchField(p, iF), - uniformValue_() + uniformValue_(nullptr) {} @@ -51,7 +51,7 @@ Foam::uniformFixedValueFvPatchField::uniformFixedValueFvPatchField ) : fixedValueFvPatchField(p, iF, fld), - uniformValue_() + uniformValue_(nullptr) {} diff --git a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H index ce4786477b..440b5ca30e 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue/uniformFixedValueFvPatchField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -35,8 +35,8 @@ Description Usage \table - Property | Description | Required | Default value - uniformValue | uniform value | yes | + Property | Description | Required | Default + uniformValue | uniform value | yes | \endtable Example of the boundary condition specification: @@ -49,9 +49,9 @@ Usage \endverbatim Note - The uniformValue entry is a Function1 type, able to describe time - varying functions. The example above gives the usage for supplying a - constant value. + The uniformValue entry is a PatchFunction1 type, + able to describe time and spatial varying functions. + The example above gives the usage for supplying a constant value. See also Foam::Function1Types @@ -82,8 +82,9 @@ class uniformFixedValueFvPatchField : public fixedValueFvPatchField { - // Private data + // Private Data + //- Value autoPtr> uniformValue_; @@ -118,8 +119,7 @@ public: const dictionary& ); - //- Construct by mapping given uniformFixedValueFvPatchField - // onto a new patch + //- Construct by mapping onto a new patch uniformFixedValueFvPatchField ( const uniformFixedValueFvPatchField&, @@ -185,7 +185,7 @@ public: virtual void updateCoeffs(); //- Write - virtual void write(Ostream&) const; + virtual void write(Ostream& os) const; };