/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2023 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 "uniformFixedValueFaPatchField.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template
Foam::uniformFixedValueFaPatchField::uniformFixedValueFaPatchField
(
const faPatch& p,
const DimensionedField& iF
)
:
fixedValueFaPatchField(p, iF),
refValueFunc_(nullptr)
{}
template
Foam::uniformFixedValueFaPatchField::uniformFixedValueFaPatchField
(
const faPatch& p,
const DimensionedField& iF,
const Field& fld
)
:
fixedValueFaPatchField(p, iF, fld),
refValueFunc_(nullptr)
{}
template
Foam::uniformFixedValueFaPatchField::uniformFixedValueFaPatchField
(
const faPatch& p,
const DimensionedField& iF,
const dictionary& dict
)
:
fixedValueFaPatchField(p, iF, dict, IOobjectOption::NO_READ),
refValueFunc_
(
Function1::New
(
/* p.patch(), */
"uniformValue",
dict
)
)
{
if (!this->readValueEntry(dict))
{
// Ensure field has reasonable initial values
this->extrapolateInternal();
// Evaluate to assign a value
this->evaluate();
}
}
template
Foam::uniformFixedValueFaPatchField::uniformFixedValueFaPatchField
(
const uniformFixedValueFaPatchField& ptf,
const faPatch& p,
const DimensionedField& iF,
const faPatchFieldMapper& mapper
)
:
fixedValueFaPatchField(p, iF), // Don't map
refValueFunc_(ptf.refValueFunc_.clone(/*p.patch()*/))
{
if (mapper.direct() && !mapper.hasUnmapped())
{
// Use mapping instead of re-evaluation
this->map(ptf, mapper);
}
else
{
// Evaluate since value not mapped
this->evaluate();
}
}
template
Foam::uniformFixedValueFaPatchField::uniformFixedValueFaPatchField
(
const uniformFixedValueFaPatchField& ptf
)
:
fixedValueFaPatchField(ptf),
refValueFunc_(ptf.refValueFunc_.clone(/*this->patch().patch()*/))
{}
template
Foam::uniformFixedValueFaPatchField::uniformFixedValueFaPatchField
(
const uniformFixedValueFaPatchField& ptf,
const DimensionedField& iF
)
:
fixedValueFaPatchField(ptf, iF),
refValueFunc_(ptf.refValueFunc_.clone(/*this->patch().patch()*/))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template
void Foam::uniformFixedValueFaPatchField::updateCoeffs()
{
if (this->updated())
{
return;
}
const scalar t = this->db().time().timeOutputValue();
faPatchField::operator==(refValueFunc_->value(t));
fixedValueFaPatchField::updateCoeffs();
}
template
void Foam::uniformFixedValueFaPatchField::write(Ostream& os) const
{
faPatchField::write(os);
if (refValueFunc_)
{
refValueFunc_->writeData(os);
}
faPatchField::writeValueEntry(os);
}
// ************************************************************************* //