/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 3 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, see .
\*---------------------------------------------------------------------------*/
#include "timeVaryingMappedFixedValueFvPatchField.H"
#include "Time.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
Foam::timeVaryingMappedFixedValueFvPatchField::
timeVaryingMappedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField& iF
)
:
fixedValueFvPatchField(p, iF),
uniformValue_()
{}
template
Foam::timeVaryingMappedFixedValueFvPatchField::
timeVaryingMappedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField& iF,
const dictionary& dict
)
:
fixedValueFvPatchField(p, iF, dict, IOobjectOption::NO_READ),
uniformValue_
(
new PatchFunction1Types::MappedFile
(
p.patch(),
"uniformValue",
dict,
iF.name(), // field table name
true // face values
)
)
{
if (!this->readValueEntry(dict))
{
// Note: we use evaluate() here to trigger updateCoeffs followed
// by re-setting of fvatchfield::updated_ flag. This is
// so if first use is in the next time step it retriggers
// a new update.
this->evaluate(Pstream::commsTypes::buffered);
}
}
template
Foam::timeVaryingMappedFixedValueFvPatchField::
timeVaryingMappedFixedValueFvPatchField
(
const timeVaryingMappedFixedValueFvPatchField& ptf,
const fvPatch& p,
const DimensionedField& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField(ptf, p, iF, mapper),
uniformValue_
(
new PatchFunction1Types::MappedFile
(
ptf.uniformValue_(),
p.patch()
)
)
{}
template
Foam::timeVaryingMappedFixedValueFvPatchField::
timeVaryingMappedFixedValueFvPatchField
(
const timeVaryingMappedFixedValueFvPatchField& ptf
)
:
fixedValueFvPatchField(ptf),
uniformValue_
(
new PatchFunction1Types::MappedFile
(
ptf.uniformValue_(),
this->patch().patch()
)
)
{}
template
Foam::timeVaryingMappedFixedValueFvPatchField::
timeVaryingMappedFixedValueFvPatchField
(
const timeVaryingMappedFixedValueFvPatchField& ptf,
const DimensionedField& iF
)
:
fixedValueFvPatchField(ptf, iF),
uniformValue_
(
new PatchFunction1Types::MappedFile
(
ptf.uniformValue_(),
this->patch().patch()
)
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
void Foam::timeVaryingMappedFixedValueFvPatchField::autoMap
(
const fvPatchFieldMapper& m
)
{
fixedValueFvPatchField::autoMap(m);
uniformValue_().autoMap(m);
}
template
void Foam::timeVaryingMappedFixedValueFvPatchField::rmap
(
const fvPatchField& ptf,
const labelList& addr
)
{
fixedValueFvPatchField::rmap(ptf, addr);
const timeVaryingMappedFixedValueFvPatchField& tiptf =
refCast>(ptf);
uniformValue_().rmap(tiptf.uniformValue_(), addr);
}
template
void Foam::timeVaryingMappedFixedValueFvPatchField::updateCoeffs()
{
if (this->updated())
{
return;
}
const scalar t = this->db().time().timeOutputValue();
fvPatchField::operator==(uniformValue_->value(t));
if (debug)
{
auto limits = gMinMax(*this);
auto avg = gAverage(*this);
Pout<< "updateCoeffs : set fixedValue to min:" << limits.min()
<< " max:" << limits.max()
<< " avg:" << avg << endl;
}
fixedValueFvPatchField::updateCoeffs();
}
template
void Foam::timeVaryingMappedFixedValueFvPatchField::write
(
Ostream& os
) const
{
fvPatchField::write(os);
uniformValue_->writeData(os);
fvPatchField::writeValueEntry(os);
}
// ************************************************************************* //