mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: uniformFixedValue: point variants
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,7 +41,7 @@ uniformFixedValuePointPatchField
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<Type>(p, iF),
|
||||
uniformValue_(pTraits<Type>::zero)
|
||||
uniformValue_()
|
||||
{}
|
||||
|
||||
|
||||
@ -54,10 +54,21 @@ uniformFixedValuePointPatchField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<Type>(p, iF, dict),
|
||||
uniformValue_(pTraits<Type>(dict.lookup("uniformValue")))
|
||||
fixedValuePointPatchField<Type>(p, iF, dict, false),
|
||||
uniformValue_(DataEntry<Type>::New("uniformValue", dict))
|
||||
{
|
||||
Field<Type>::operator=(uniformValue_);
|
||||
if (dict.found("value"))
|
||||
{
|
||||
fixedValuePointPatchField<Type>::operator==
|
||||
(
|
||||
Field<Type>("value", dict, p.size())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
const scalar t = this->db().time().timeOutputValue();
|
||||
fixedValuePointPatchField<Type>::operator=(uniformValue_->value(t));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -72,8 +83,12 @@ uniformFixedValuePointPatchField
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<Type>(ptf, p, iF, mapper),
|
||||
uniformValue_(ptf.uniformValue_)
|
||||
{}
|
||||
uniformValue_(ptf.uniformValue_().clone().ptr())
|
||||
{
|
||||
// For safety re-evaluate
|
||||
const scalar t = this->db().time().timeOutputValue();
|
||||
fixedValuePointPatchField<Type>::operator=(uniformValue_->value(t));
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
@ -84,7 +99,7 @@ uniformFixedValuePointPatchField
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<Type>(ptf),
|
||||
uniformValue_(ptf.uniformValue_)
|
||||
uniformValue_(ptf.uniformValue_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
@ -97,19 +112,38 @@ uniformFixedValuePointPatchField
|
||||
)
|
||||
:
|
||||
fixedValuePointPatchField<Type>(ptf, iF),
|
||||
uniformValue_(ptf.uniformValue_)
|
||||
{}
|
||||
uniformValue_(ptf.uniformValue_().clone().ptr())
|
||||
{
|
||||
// For safety re-evaluate
|
||||
const scalar t = this->db().time().timeOutputValue();
|
||||
fixedValuePointPatchField<Type>::operator==(uniformValue_->value(t));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void uniformFixedValuePointPatchField<Type>::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const scalar t = this->db().time().timeOutputValue();
|
||||
fixedValuePointPatchField<Type>::operator==(uniformValue_->value(t));
|
||||
|
||||
fixedValuePointPatchField<Type>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void uniformFixedValuePointPatchField<Type>::
|
||||
write(Ostream& os) const
|
||||
{
|
||||
pointPatchField<Type>::write(os);
|
||||
os.writeKeyword("uniformValue")
|
||||
<< uniformValue_ << token::END_STATEMENT << nl;
|
||||
// Note: write value
|
||||
fixedValuePointPatchField<Type>::write(os);
|
||||
uniformValue_->writeData(os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -25,7 +25,20 @@ Class
|
||||
Foam::uniformFixedValuePointPatchField
|
||||
|
||||
Description
|
||||
Foam::uniformFixedValuePointPatchField
|
||||
Enables the specification of a uniform fixed value boundary condition.
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
inlet
|
||||
{
|
||||
type uniformFixedValue;
|
||||
uniformValue constant 0.2;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
The uniformValue entry is a DataEntry type, able to describe time
|
||||
varying functions. The example above gives the usage for supplying a
|
||||
constant value.
|
||||
|
||||
SourceFiles
|
||||
uniformFixedValuePointPatchField.C
|
||||
@ -36,6 +49,7 @@ SourceFiles
|
||||
#define uniformFixedValuePointPatchField_H
|
||||
|
||||
#include "fixedValuePointPatchField.H"
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -53,7 +67,7 @@ class uniformFixedValuePointPatchField
|
||||
{
|
||||
// Private data
|
||||
|
||||
Type uniformValue_;
|
||||
autoPtr<DataEntry<Type> > uniformValue_;
|
||||
|
||||
|
||||
public:
|
||||
@ -136,16 +150,15 @@ public:
|
||||
// Access
|
||||
|
||||
//- Return the fluctuation scale
|
||||
const Type& uniformValue() const
|
||||
const DataEntry<Type>& uniformValue() const
|
||||
{
|
||||
return uniformValue_;
|
||||
}
|
||||
|
||||
//- Return reference to the fluctuation scale to allow adjustment
|
||||
Type& uniformValue()
|
||||
{
|
||||
return uniformValue_;
|
||||
}
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
//- Write
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -44,18 +44,32 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const Field<Type>& fld
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(p, iF, fld),
|
||||
uniformValue_()
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
||||
(
|
||||
const uniformFixedValueFvPatchField<Type>& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<Type, volMesh>& iF,
|
||||
const fvPatchFieldMapper&
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(p, iF),
|
||||
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
|
||||
uniformValue_(ptf.uniformValue_().clone().ptr())
|
||||
{
|
||||
// For safety re-evaluate
|
||||
const scalar t = this->db().time().timeOutputValue();
|
||||
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||
}
|
||||
@ -71,10 +85,17 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
||||
:
|
||||
fixedValueFvPatchField<Type>(p, iF),
|
||||
uniformValue_(DataEntry<Type>::New("uniformValue", dict))
|
||||
{
|
||||
if (dict.found("value"))
|
||||
{
|
||||
fvPatchField<Type>::operator==(Field<Type>("value", dict, p.size()));
|
||||
}
|
||||
else
|
||||
{
|
||||
const scalar t = this->db().time().timeOutputValue();
|
||||
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
@ -85,10 +106,7 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf),
|
||||
uniformValue_(ptf.uniformValue_().clone().ptr())
|
||||
{
|
||||
const scalar t = this->db().time().timeOutputValue();
|
||||
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
@ -101,6 +119,7 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
||||
fixedValueFvPatchField<Type>(ptf, iF),
|
||||
uniformValue_(ptf.uniformValue_().clone().ptr())
|
||||
{
|
||||
// For safety re-evaluate
|
||||
const scalar t = this->db().time().timeOutputValue();
|
||||
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||
}
|
||||
@ -108,18 +127,6 @@ uniformFixedValueFvPatchField<Type>::uniformFixedValueFvPatchField
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void uniformFixedValueFvPatchField<Type>::autoMap
|
||||
(
|
||||
const fvPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
this->setSize(m.size());
|
||||
const scalar t = this->db().time().timeOutputValue();
|
||||
fvPatchField<Type>::operator==(uniformValue_->value(t));
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void uniformFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
{
|
||||
@ -138,6 +145,7 @@ void uniformFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
template<class Type>
|
||||
void uniformFixedValueFvPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
// Note: do not write value
|
||||
fvPatchField<Type>::write(os);
|
||||
uniformValue_->writeData(os);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -49,7 +49,6 @@ SourceFiles
|
||||
#ifndef uniformFixedValueFvPatchField_H
|
||||
#define uniformFixedValueFvPatchField_H
|
||||
|
||||
#include "Random.H"
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "DataEntry.H"
|
||||
|
||||
@ -87,6 +86,14 @@ public:
|
||||
const DimensionedField<Type, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch and internal field and patch field
|
||||
uniformFixedValueFvPatchField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<Type, volMesh>&,
|
||||
const Field<Type>& fld
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
uniformFixedValueFvPatchField
|
||||
(
|
||||
@ -142,14 +149,6 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap
|
||||
(
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user