ENH: replace finiteArea timeVaryingUniformFixedValue with Function1 version

- timeVaryingUniformFixedValue -> uniformFixedValue

- allows a variety of functions (eg, coded, expressions, tables, ...)

- more similarity to finiteVolume patch type

STYLE: remove unused timeVarying... from etc/controlDict
This commit is contained in:
Mark Olesen
2020-09-25 16:05:51 +02:00
parent bb3660b9a5
commit 12b68e1151
8 changed files with 86 additions and 108 deletions

View File

@ -903,10 +903,7 @@ DebugSwitches
thermophysicalFunction 0; thermophysicalFunction 0;
time 0; time 0;
timeVaryingAlphaContactAngle 0; timeVaryingAlphaContactAngle 0;
timeVaryingFlowRateInletVelocity 0;
timeVaryingMappedFixedValue 0; timeVaryingMappedFixedValue 0;
timeVaryingTotalPressure 0;
timeVaryingUniformFixedValue 0;
timer 0; timer 0;
topoAction 0; topoAction 0;
topoCellLooper 0; topoCellLooper 0;

View File

@ -48,7 +48,7 @@ $(derivedFaPatchFields)/fixedValueOutflow/fixedValueOutflowFaPatchFields.C
$(derivedFaPatchFields)/inletOutlet/inletOutletFaPatchFields.C $(derivedFaPatchFields)/inletOutlet/inletOutletFaPatchFields.C
$(derivedFaPatchFields)/slip/slipFaPatchFields.C $(derivedFaPatchFields)/slip/slipFaPatchFields.C
$(derivedFaPatchFields)/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.C $(derivedFaPatchFields)/edgeNormalFixedValue/edgeNormalFixedValueFaPatchVectorField.C
$(derivedFaPatchFields)/timeVaryingUniformFixedValue/timeVaryingUniformFixedValueFaPatchFields.C $(derivedFaPatchFields)/uniformFixedValue/uniformFixedValueFaPatchFields.C
faePatchFields = fields/faePatchFields faePatchFields = fields/faePatchFields
$(faePatchFields)/faePatchField/faePatchFields.C $(faePatchFields)/faePatchField/faePatchFields.C

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,27 +25,24 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "timeVaryingUniformFixedValueFaPatchField.H" #include "uniformFixedValueFaPatchField.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::timeVaryingUniformFixedValueFaPatchField<Type>:: Foam::uniformFixedValueFaPatchField<Type>::uniformFixedValueFaPatchField
timeVaryingUniformFixedValueFaPatchField
( (
const faPatch& p, const faPatch& p,
const DimensionedField<Type, areaMesh>& iF const DimensionedField<Type, areaMesh>& iF
) )
: :
fixedValueFaPatchField<Type>(p, iF), fixedValueFaPatchField<Type>(p, iF),
timeSeries_() uniformValue_(nullptr)
{} {}
template<class Type> template<class Type>
Foam::timeVaryingUniformFixedValueFaPatchField<Type>:: Foam::uniformFixedValueFaPatchField<Type>::uniformFixedValueFaPatchField
timeVaryingUniformFixedValueFaPatchField
( (
const faPatch& p, const faPatch& p,
const DimensionedField<Type, areaMesh>& iF, const DimensionedField<Type, areaMesh>& iF,
@ -53,85 +50,83 @@ timeVaryingUniformFixedValueFaPatchField
) )
: :
fixedValueFaPatchField<Type>(p, iF), fixedValueFaPatchField<Type>(p, iF),
timeSeries_(dict) uniformValue_(Function1<Type>::New("uniformValue", dict))
{ {
if (dict.found("value")) if (dict.found("value"))
{ {
faPatchField<Type>::operator==(Field<Type>("value", dict, p.size())); faPatchField<Type>::operator==
(
Field<Type>("value", dict, p.size())
);
} }
else else
{ {
updateCoeffs(); this->evaluate();
} }
} }
template<class Type> template<class Type>
Foam::timeVaryingUniformFixedValueFaPatchField<Type>:: Foam::uniformFixedValueFaPatchField<Type>::uniformFixedValueFaPatchField
timeVaryingUniformFixedValueFaPatchField
( (
const timeVaryingUniformFixedValueFaPatchField<Type>& ptf, const uniformFixedValueFaPatchField<Type>& ptf,
const faPatch& p, const faPatch& p,
const DimensionedField<Type, areaMesh>& iF, const DimensionedField<Type, areaMesh>& iF,
const faPatchFieldMapper& mapper const faPatchFieldMapper& mapper
) )
: :
fixedValueFaPatchField<Type>(ptf, p, iF, mapper), fixedValueFaPatchField<Type>(ptf, p, iF, mapper),
timeSeries_(ptf.timeSeries_) uniformValue_(ptf.uniformValue_.clone())
{} {}
template<class Type> template<class Type>
Foam::timeVaryingUniformFixedValueFaPatchField<Type>:: Foam::uniformFixedValueFaPatchField<Type>::uniformFixedValueFaPatchField
timeVaryingUniformFixedValueFaPatchField
( (
const timeVaryingUniformFixedValueFaPatchField<Type>& ptf const uniformFixedValueFaPatchField<Type>& ptf
) )
: :
fixedValueFaPatchField<Type>(ptf), fixedValueFaPatchField<Type>(ptf),
timeSeries_(ptf.timeSeries_) uniformValue_(ptf.uniformValue_.clone())
{} {}
template<class Type> template<class Type>
Foam::timeVaryingUniformFixedValueFaPatchField<Type>:: Foam::uniformFixedValueFaPatchField<Type>::uniformFixedValueFaPatchField
timeVaryingUniformFixedValueFaPatchField
( (
const timeVaryingUniformFixedValueFaPatchField<Type>& ptf, const uniformFixedValueFaPatchField<Type>& ptf,
const DimensionedField<Type, areaMesh>& iF const DimensionedField<Type, areaMesh>& iF
) )
: :
fixedValueFaPatchField<Type>(ptf, iF), fixedValueFaPatchField<Type>(ptf, iF),
timeSeries_(ptf.timeSeries_) uniformValue_(ptf.uniformValue_.clone())
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::timeVaryingUniformFixedValueFaPatchField<Type>::updateCoeffs() void Foam::uniformFixedValueFaPatchField<Type>::updateCoeffs()
{ {
if (this->updated()) if (this->updated())
{ {
return; return;
} }
faPatchField<Type>::operator== const scalar t = this->db().time().timeOutputValue();
( faPatchField<Type>::operator==(uniformValue_->value(t));
timeSeries_(this->db().time().timeOutputValue())
);
fixedValueFaPatchField<Type>::updateCoeffs(); fixedValueFaPatchField<Type>::updateCoeffs();
} }
template<class Type> template<class Type>
void Foam::timeVaryingUniformFixedValueFaPatchField<Type>::write void Foam::uniformFixedValueFaPatchField<Type>::write
( (
Ostream& os Ostream& os
) const ) const
{ {
faPatchField<Type>::write(os); faPatchField<Type>::write(os);
timeSeries_.write(os); uniformValue_->writeData(os);
this->writeEntry("value", os); this->writeEntry("value", os);
} }

View File

@ -5,8 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,43 +24,42 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::timeVaryingUniformFixedValueFaPatchField Foam::uniformFixedValueFaPatchField
Description Description
A time-varying form of a uniform fixed value finite area This finiteArea boundary condition
boundary condition. provides a uniform fixed value condition, which can also be time-varying.
Usage
\table
Property | Description | Required | Default
uniformValue | uniform value | yes |
\endtable
Example of the boundary condition specification: Example of the boundary condition specification:
\verbatim \verbatim
inlet <patchName>
{ {
type timeVaryingUniformFixedValue; type uniformFixedValue;
fileName "<case>/time-series"; uniformValue constant 0.2;
outOfBounds clamp; // (error|warn|clamp|repeat)
} }
\endverbatim \endverbatim
Author See also
Zeljko Tukovic, FMENA Foam::Function1Types
Hrvoje Jasak, Wikki Ltd. Foam::fixedValueFvPatchField
Foam::uniformFixedValueFvPatchField.C
Note
This class is derived directly from a fixedValue patch rather than from
a uniformFixedValue patch.
See Also
Foam::interpolationTable and Foam::fixedValueFaPatchField
SourceFiles SourceFiles
timeVaryingUniformFixedValueFaPatchField.C uniformFixedValueFaPatchField.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef timeVaryingUniformFixedValueFaPatchField_H #ifndef uniformFixedValueFaPatchField_H
#define timeVaryingUniformFixedValueFaPatchField_H #define uniformFixedValueFaPatchField_H
#include "fixedValueFaPatchField.H" #include "fixedValueFaPatchField.H"
#include "interpolationTable.H" #include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -69,56 +67,56 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class timeVaryingUniformFixedValueFaPatch Declaration Class uniformFixedValueFaPatch Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
class timeVaryingUniformFixedValueFaPatchField class uniformFixedValueFaPatchField
: :
public fixedValueFaPatchField<Type> public fixedValueFaPatchField<Type>
{ {
// Private data // Private Data
//- The time series being used, including the bounding treatment //- Value
interpolationTable<Type> timeSeries_; autoPtr<Function1<Type>> uniformValue_;
public: public:
//- Runtime type information //- Runtime type information
TypeName("timeVaryingUniformFixedValue"); TypeName("uniformFixedValue");
// Constructors // Constructors
//- Construct from patch and internal field //- Construct from patch and internal field
timeVaryingUniformFixedValueFaPatchField uniformFixedValueFaPatchField
( (
const faPatch&, const faPatch&,
const DimensionedField<Type, areaMesh>& const DimensionedField<Type, areaMesh>&
); );
//- Construct from patch, internal field and dictionary //- Construct from patch, internal field and dictionary
timeVaryingUniformFixedValueFaPatchField uniformFixedValueFaPatchField
( (
const faPatch&, const faPatch&,
const DimensionedField<Type, areaMesh>&, const DimensionedField<Type, areaMesh>&,
const dictionary& const dictionary&
); );
//- Construct by mapping given patch field onto a new patch //- Construct by mapping onto a new patch
timeVaryingUniformFixedValueFaPatchField uniformFixedValueFaPatchField
( (
const timeVaryingUniformFixedValueFaPatchField<Type>&, const uniformFixedValueFaPatchField<Type>&,
const faPatch&, const faPatch&,
const DimensionedField<Type, areaMesh>&, const DimensionedField<Type, areaMesh>&,
const faPatchFieldMapper& const faPatchFieldMapper&
); );
//- Construct as copy //- Copy construct
timeVaryingUniformFixedValueFaPatchField uniformFixedValueFaPatchField
( (
const timeVaryingUniformFixedValueFaPatchField<Type>& const uniformFixedValueFaPatchField<Type>&
); );
//- Construct and return a clone //- Construct and return a clone
@ -126,14 +124,14 @@ public:
{ {
return tmp<faPatchField<Type>> return tmp<faPatchField<Type>>
( (
new timeVaryingUniformFixedValueFaPatchField<Type>(*this) new uniformFixedValueFaPatchField<Type>(*this)
); );
} }
//- Construct as copy setting internal field reference //- Construct as copy setting internal field reference
timeVaryingUniformFixedValueFaPatchField uniformFixedValueFaPatchField
( (
const timeVaryingUniformFixedValueFaPatchField<Type>&, const uniformFixedValueFaPatchField<Type>&,
const DimensionedField<Type, areaMesh>& const DimensionedField<Type, areaMesh>&
); );
@ -145,34 +143,22 @@ public:
{ {
return tmp<faPatchField<Type>> return tmp<faPatchField<Type>>
( (
new timeVaryingUniformFixedValueFaPatchField<Type>(*this, iF) new uniformFixedValueFaPatchField<Type>(*this, iF)
); );
} }
//- Destructor //- Destructor
virtual ~timeVaryingUniformFixedValueFaPatchField() = default; virtual ~uniformFixedValueFaPatchField() = default;
// Member functions // Member Functions
// Access
//- Return the time series used
const interpolationTable<Type>& timeSeries() const
{
return timeSeries_;
}
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write //- Write
virtual void write(Ostream&) const; virtual void write(Ostream& os) const;
}; };
@ -183,7 +169,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
#include "timeVaryingUniformFixedValueFaPatchField.C" #include "uniformFixedValueFaPatchField.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "timeVaryingUniformFixedValueFaPatchFields.H" #include "uniformFixedValueFaPatchFields.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "areaFields.H" #include "areaFields.H"
@ -36,7 +36,7 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFaPatchFields(timeVaryingUniformFixedValue); makeFaPatchFields(uniformFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,10 +25,10 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef timeVaryingUniformFixedValueFaPatchFields_H #ifndef uniformFixedValueFaPatchFields_H
#define timeVaryingUniformFixedValueFaPatchFields_H #define uniformFixedValueFaPatchFields_H
#include "timeVaryingUniformFixedValueFaPatchField.H" #include "uniformFixedValueFaPatchField.H"
#include "fieldTypes.H" #include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -38,7 +38,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFaPatchTypeFieldTypedefs(timeVaryingUniformFixedValue) makeFaPatchTypeFieldTypedefs(uniformFixedValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2016-2017 Wikki Ltd Copyright (C) 2020 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -25,8 +25,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef timeVaryingUniformFixedValueFaPatchFieldsFwd_H #ifndef uniformFixedValueFaPatchFieldsFwd_H
#define timeVaryingUniformFixedValueFaPatchFieldsFwd_H #define uniformFixedValueFaPatchFieldsFwd_H
#include "faPatchField.H" #include "faPatchField.H"
#include "fieldTypes.H" #include "fieldTypes.H"
@ -38,9 +38,9 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class timeVaryingUniformFixedValueFaPatchField; template<class Type> class uniformFixedValueFaPatchField;
makeFaPatchTypeFieldTypedefs(timeVaryingUniformFixedValue); makeFaPatchTypeFieldTypedefs(uniformFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -23,8 +23,8 @@ boundaryField
{ {
inlet inlet
{ {
type fixedValue; type uniformFixedValue;
value uniform 0.000141; uniformValue 0.000141;
} }
outlet outlet