/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2018-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 "uniformFixedValueFvPatchField.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template Foam::uniformFixedValueFvPatchField::uniformFixedValueFvPatchField ( const fvPatch& p, const DimensionedField& iF ) : fixedValueFvPatchField(p, iF), refValueFunc_(nullptr) {} template Foam::uniformFixedValueFvPatchField::uniformFixedValueFvPatchField ( const fvPatch& p, const DimensionedField& iF, const Field& fld ) : fixedValueFvPatchField(p, iF, fld), refValueFunc_(nullptr) {} template Foam::uniformFixedValueFvPatchField::uniformFixedValueFvPatchField ( const fvPatch& p, const DimensionedField& iF, const dictionary& dict ) : fixedValueFvPatchField(p, iF, dict, IOobjectOption::NO_READ), refValueFunc_(PatchFunction1::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::uniformFixedValueFvPatchField::uniformFixedValueFvPatchField ( const uniformFixedValueFvPatchField& ptf, const fvPatch& p, const DimensionedField& iF, const fvPatchFieldMapper& mapper ) : fixedValueFvPatchField(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::uniformFixedValueFvPatchField::uniformFixedValueFvPatchField ( const uniformFixedValueFvPatchField& ptf ) : fixedValueFvPatchField(ptf), refValueFunc_(ptf.refValueFunc_.clone(this->patch().patch())) {} template Foam::uniformFixedValueFvPatchField::uniformFixedValueFvPatchField ( const uniformFixedValueFvPatchField& ptf, const DimensionedField& iF ) : fixedValueFvPatchField(ptf, iF), refValueFunc_(ptf.refValueFunc_.clone(this->patch().patch())) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template void Foam::uniformFixedValueFvPatchField::autoMap ( const fvPatchFieldMapper& mapper ) { fixedValueFvPatchField::autoMap(mapper); if (refValueFunc_) { refValueFunc_().autoMap(mapper); if (refValueFunc_().constant()) { // If mapper is not dependent on time we're ok to evaluate this->evaluate(); } } } template void Foam::uniformFixedValueFvPatchField::rmap ( const fvPatchField& ptf, const labelList& addr ) { fixedValueFvPatchField::rmap(ptf, addr); const uniformFixedValueFvPatchField& tiptf = refCast(ptf); if (refValueFunc_ && tiptf.refValueFunc_) { refValueFunc_().rmap(tiptf.refValueFunc_(), addr); } } template void Foam::uniformFixedValueFvPatchField::updateCoeffs() { if (this->updated()) { return; } const scalar t = this->db().time().timeOutputValue(); fvPatchField::operator==(refValueFunc_->value(t)); fixedValueFvPatchField::updateCoeffs(); } template void Foam::uniformFixedValueFvPatchField::write(Ostream& os) const { fvPatchField::write(os); if (refValueFunc_) { refValueFunc_->writeData(os); } fvPatchField::writeValueEntry(os); } // ************************************************************************* //