mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
time-varying UniformFixedValue and MassFlowRate boundary conditions using new timeSeries template
This commit is contained in:
@ -0,0 +1,191 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2006-07 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "timeVaryingMassFlowRateInletVelocityFvPatchVectorField.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "Time.H"
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
massFlowRateInletVelocityFvPatchVectorField(p, iF)
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const timeVaryingMassFlowRateInletVelocityFvPatchVectorField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
massFlowRateInletVelocityFvPatchVectorField(ptf, p, iF, mapper),
|
||||
timeDataFile_(ptf.timeDataFile_),
|
||||
timeSeries_(ptf.timeBounding())
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
massFlowRateInletVelocityFvPatchVectorField(p, iF, dict),
|
||||
timeDataFile_(fileName(dict.lookup("timeDataFile")).expand()),
|
||||
timeSeries_(word(dict.lookup("timeBounding")))
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const timeVaryingMassFlowRateInletVelocityFvPatchVectorField& ptf
|
||||
)
|
||||
:
|
||||
massFlowRateInletVelocityFvPatchVectorField(ptf),
|
||||
timeDataFile_(ptf.timeDataFile_),
|
||||
timeSeries_(ptf.timeBounding())
|
||||
{}
|
||||
|
||||
|
||||
Foam::
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const timeVaryingMassFlowRateInletVelocityFvPatchVectorField& ptf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
massFlowRateInletVelocityFvPatchVectorField(ptf, iF),
|
||||
timeDataFile_(ptf.timeDataFile_),
|
||||
timeSeries_(ptf.timeBounding())
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::scalar
|
||||
Foam::timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
|
||||
currentValue()
|
||||
{
|
||||
if (timeSeries_.size() == 0)
|
||||
{
|
||||
if (timeDataFile_.size() == 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"timeVaryingMassFlowRateInletVelocity"
|
||||
"::currentValue()"
|
||||
) << "timeDataFile not specified for Patch "
|
||||
<< this->patch().name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
else
|
||||
{
|
||||
// just in case we change the interface to timeSeries
|
||||
word boundType = timeBounding();
|
||||
|
||||
IFstream(timeDataFile_)() >> timeSeries_;
|
||||
timeSeries_.bounding(boundType);
|
||||
|
||||
// be a bit paranoid and check that the list is okay
|
||||
timeSeries_.check();
|
||||
}
|
||||
|
||||
if (timeSeries_.size() == 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"timeVaryingMassFlowRateInletVelocity"
|
||||
"::currentValue()"
|
||||
) << "empty time series for Patch "
|
||||
<< this->patch().name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
return timeSeries_(this->db().time().timeOutputValue());
|
||||
}
|
||||
|
||||
|
||||
void Foam::
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
|
||||
updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
massFlowRate() = currentValue();
|
||||
massFlowRateInletVelocityFvPatchVectorField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField::
|
||||
write(Ostream& os) const
|
||||
{
|
||||
massFlowRateInletVelocityFvPatchVectorField::write(os);
|
||||
os.writeKeyword("timeDataFile")
|
||||
<< timeDataFile_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("timeBounding")
|
||||
<< timeBounding() << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchVectorField,
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,185 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2006-07 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::timeVaryingMassFlowRateInletVelocityFvPatchVectorField
|
||||
|
||||
Description
|
||||
A time-varying form of a massflow normal vector boundary condition.
|
||||
|
||||
Example of the boundary condition specification:
|
||||
@verbatim
|
||||
inlet
|
||||
{
|
||||
type timeVaryingMassFlowRateInletVelocity;
|
||||
massFlowRate 0.2; // Massflow rate [kg/s]
|
||||
value uniform (0 0 0); // placeholder
|
||||
timeDataFile "time-series";
|
||||
timeBounding repeat; // (error|warn|clamp|repeat)
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
Note
|
||||
- The value is positive inwards
|
||||
- may not work correctly for transonic inlets!
|
||||
- strange behaviour with potentialFoam since the U equation is not solved
|
||||
|
||||
See Also
|
||||
Foam::timeSeries and Foam::massFlowRateInletVelocityFvPatchVectorField
|
||||
|
||||
SourceFiles
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef timeVaryingMassFlowRateInletVelocityFvPatchVectorField_H
|
||||
#define timeVaryingMassFlowRateInletVelocityFvPatchVectorField_H
|
||||
|
||||
#include "massFlowRateInletVelocityFvPatchVectorField.H"
|
||||
#include "timeSeries.H"
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class timeVaryingMassFlowRateInletVelocityFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class timeVaryingMassFlowRateInletVelocityFvPatchVectorField
|
||||
:
|
||||
public massFlowRateInletVelocityFvPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- file containing time/massFlowRate
|
||||
fileName timeDataFile_;
|
||||
|
||||
//- the time series being used, including the bounding treatment
|
||||
timeSeries<scalar> timeSeries_;
|
||||
|
||||
//- interpolate the value at the current time
|
||||
scalar currentValue();
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("timeVaryingMassFlowRateInletVelocity");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given patch field onto a new patch
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const timeVaryingMassFlowRateInletVelocityFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const timeVaryingMassFlowRateInletVelocityFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new timeVaryingMassFlowRateInletVelocityFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
timeVaryingMassFlowRateInletVelocityFvPatchVectorField
|
||||
(
|
||||
const timeVaryingMassFlowRateInletVelocityFvPatchVectorField&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchVectorField> clone
|
||||
(
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new timeVaryingMassFlowRateInletVelocityFvPatchVectorField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the out-of-bounds treatment as a word
|
||||
word timeBounding() const
|
||||
{
|
||||
return timeSeries_.bounding();
|
||||
}
|
||||
|
||||
//- Return the time series used
|
||||
const timeSeries<scalar>& timeData() const
|
||||
{
|
||||
return timeSeries_;
|
||||
}
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -26,18 +26,14 @@ License
|
||||
|
||||
#include "timeVaryingUniformFixedValueFvPatchField.H"
|
||||
#include "Time.H"
|
||||
#include "Tuple2.H"
|
||||
#include "IFstream.H"
|
||||
#include "interpolateXY.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::
|
||||
timeVaryingUniformFixedValueFvPatchField<Type>::
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
@ -50,6 +46,7 @@ timeVaryingUniformFixedValueFvPatchField
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::
|
||||
timeVaryingUniformFixedValueFvPatchField<Type>::
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
@ -60,11 +57,13 @@ timeVaryingUniformFixedValueFvPatchField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
|
||||
timeDataFileName_(ptf.timeDataFileName_)
|
||||
timeDataFile_(ptf.timeDataFile_),
|
||||
timeSeries_(ptf.timeBounding())
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::
|
||||
timeVaryingUniformFixedValueFvPatchField<Type>::
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
@ -74,20 +73,22 @@ timeVaryingUniformFixedValueFvPatchField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(p, iF),
|
||||
timeDataFileName_(fileName(dict.lookup("timeDataFileName")).expand())
|
||||
timeDataFile_(fileName(dict.lookup("timeDataFile")).expand()),
|
||||
timeSeries_(word(dict.lookup("timeBounding")))
|
||||
{
|
||||
if (dict.found("value"))
|
||||
{
|
||||
fvPatchField<Type>::operator==(Field<Type>("value", dict, p.size()));
|
||||
}
|
||||
else
|
||||
{
|
||||
updateCoeffs();
|
||||
}
|
||||
if (dict.found("value"))
|
||||
{
|
||||
fvPatchField<Type>::operator==(Field<Type>("value", dict, p.size()));
|
||||
}
|
||||
else
|
||||
{
|
||||
updateCoeffs();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::
|
||||
timeVaryingUniformFixedValueFvPatchField<Type>::
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
@ -95,11 +96,13 @@ timeVaryingUniformFixedValueFvPatchField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf),
|
||||
timeDataFileName_(ptf.timeDataFileName_)
|
||||
timeDataFile_(ptf.timeDataFile_),
|
||||
timeSeries_(ptf.timeBounding())
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::
|
||||
timeVaryingUniformFixedValueFvPatchField<Type>::
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
@ -108,108 +111,83 @@ timeVaryingUniformFixedValueFvPatchField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<Type>(ptf, iF),
|
||||
timeDataFileName_(ptf.timeDataFileName_)
|
||||
timeDataFile_(ptf.timeDataFile_),
|
||||
timeSeries_(ptf.timeBounding())
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void timeVaryingUniformFixedValueFvPatchField<Type>::checkTable()
|
||||
Type
|
||||
Foam::timeVaryingUniformFixedValueFvPatchField<Type>::
|
||||
currentValue()
|
||||
{
|
||||
const Time& tm = this->db().time();
|
||||
|
||||
if (times_.size() == 0)
|
||||
if (timeSeries_.size() == 0)
|
||||
{
|
||||
if (timeDataFileName_.size() == 0)
|
||||
if (timeDataFile_.size() == 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"timeVaryingUniformFixedValueFvPatchField<Type>"
|
||||
"::checkTable()"
|
||||
) << "timeDataFileName not specified for Patch "
|
||||
"timeVaryingUniformFixedValueFvPatchField"
|
||||
"::currentValue()"
|
||||
) << "timeDataFile not specified for Patch "
|
||||
<< this->patch().name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
else
|
||||
{
|
||||
IFstream str(timeDataFileName_);
|
||||
// just in case we change the interface to timeSeries
|
||||
word boundType = timeBounding();
|
||||
|
||||
List<Tuple2<scalar, Type> > timeValues(str);
|
||||
IFstream(timeDataFile_)() >> timeSeries_;
|
||||
timeSeries_.bounding(boundType);
|
||||
|
||||
times_.setSize(timeValues.size());
|
||||
values_.setSize(timeValues.size());
|
||||
// be a bit paranoid and check that the list is okay
|
||||
timeSeries_.check();
|
||||
}
|
||||
|
||||
forAll(timeValues, i)
|
||||
{
|
||||
times_[i] = timeValues[i].first();
|
||||
values_[i] = timeValues[i].second();
|
||||
}
|
||||
if (timeSeries_.size() == 0)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"timeVaryingUniformFixedValueFvPatchField"
|
||||
"::currentValue()"
|
||||
) << "empty time series for Patch "
|
||||
<< this->patch().name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
if (tm.value() < times_[0])
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"timeVaryingUniformFixedValueFvPatchField<Type>::checkTable()"
|
||||
) << "current time (" << tm.value()
|
||||
<< ") is less than the minimum in the data table ("
|
||||
<< times_[0] << ')' << endl
|
||||
<< " Continuing with the value for the smallest time"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (tm.value() > times_[times_.size()-1])
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"timeVaryingUniformFixedValueFvPatchField<Type>::checkTable()"
|
||||
) << "current time (" << tm.value()
|
||||
<< ") is greater than the maximum in the data table ("
|
||||
<< times_[times_.size()-1] << ')' << endl
|
||||
<< " Continuing with the value for the largest time"
|
||||
<< endl;
|
||||
}
|
||||
return timeSeries_(this->db().time().timeOutputValue());
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void timeVaryingUniformFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
void Foam::timeVaryingUniformFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
checkTable();
|
||||
|
||||
this->operator==
|
||||
(
|
||||
interpolateXY
|
||||
(
|
||||
this->db().time().value(),
|
||||
times_,
|
||||
values_
|
||||
)
|
||||
);
|
||||
|
||||
fvPatchField<Type>::operator==(currentValue());
|
||||
fixedValueFvPatchField<Type>::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void timeVaryingUniformFixedValueFvPatchField<Type>::write(Ostream& os) const
|
||||
void Foam::timeVaryingUniformFixedValueFvPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
fvPatchField<Type>::write(os);
|
||||
os.writeKeyword("timeDataFileName")
|
||||
<< timeDataFileName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("timeDataFile")
|
||||
<< timeDataFile_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("timeBounding")
|
||||
<< timeBounding() << token::END_STATEMENT << nl;
|
||||
this->writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,7 +26,24 @@ Class
|
||||
Foam::timeVaryingUniformFixedValueFvPatchField
|
||||
|
||||
Description
|
||||
Foam::timeVaryingUniformFixedValueFvPatchField
|
||||
A time-varying form of a uniform fixed value boundary condition.
|
||||
|
||||
Example of the boundary condition specification:
|
||||
@verbatim
|
||||
inlet
|
||||
{
|
||||
type timeVaryingUniformFixedValue;
|
||||
timeDataFile "time-series";
|
||||
timeBounding clamp; // (error|warn|clamp|repeat)
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
Note
|
||||
This class is derived directly from a fixedValue patch rather than from
|
||||
a uniformFixedValue patch.
|
||||
|
||||
See Also
|
||||
Foam::timeSeries and Foam::fixedValueFvPatchField
|
||||
|
||||
SourceFiles
|
||||
timeVaryingUniformFixedValueFvPatchField.C
|
||||
@ -36,7 +53,8 @@ SourceFiles
|
||||
#ifndef timeVaryingUniformFixedValueFvPatchField_H
|
||||
#define timeVaryingUniformFixedValueFvPatchField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
#include "fixedValueFvPatchField.H"
|
||||
#include "timeSeries.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -44,7 +62,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class timeVaryingUniformFixedValueFvPatch Declaration
|
||||
Class timeVaryingUniformFixedValueFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
@ -54,13 +72,14 @@ class timeVaryingUniformFixedValueFvPatchField
|
||||
{
|
||||
// Private data
|
||||
|
||||
fileName timeDataFileName_;
|
||||
//- file containing time/uniformFixedValue
|
||||
fileName timeDataFile_;
|
||||
|
||||
scalarField times_;
|
||||
Field<Type> values_;
|
||||
|
||||
void checkTable();
|
||||
//- the time series being used, including the bounding treatment
|
||||
timeSeries<Type> timeSeries_;
|
||||
|
||||
//- interpolate the value at the current time
|
||||
Type currentValue();
|
||||
|
||||
public:
|
||||
|
||||
@ -85,8 +104,7 @@ public:
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given timeVaryingUniformFixedValueFvPatchField
|
||||
// onto a new patch
|
||||
//- Construct by mapping given patch field onto a new patch
|
||||
timeVaryingUniformFixedValueFvPatchField
|
||||
(
|
||||
const timeVaryingUniformFixedValueFvPatchField<Type>&,
|
||||
@ -134,16 +152,16 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the list of times in the interpolation table
|
||||
const scalarField& times() const
|
||||
//- Return the out-of-bounds treatment as a word
|
||||
word timeBounding() const
|
||||
{
|
||||
return times_;
|
||||
return timeSeries_.bounding();
|
||||
}
|
||||
|
||||
//- Return the list of values in the interpolation table
|
||||
const Field<Type>& values()
|
||||
//- Return the time series used
|
||||
const timeSeries<Type>& timeData() const
|
||||
{
|
||||
return values_;
|
||||
return timeSeries_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user