/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation \\/ 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 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 "expInletFvPatchVectorField.H" #include "addToRunTimeSelectionTable.H" #include "fvPatchFieldMapper.H" #include "volFields.H" #include "surfaceFields.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // Foam::scalar Foam::expInletFvPatchVectorField::t() const { return db().time().timeOutputValue(); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::expInletFvPatchVectorField:: expInletFvPatchVectorField ( const fvPatch& p, const DimensionedField& iF ) : fixedValueFvPatchVectorField(p, iF), scalarData_(0.0), data_(Zero), fieldData_(p.size(), Zero), timeVsData_(), wordData_("wordDefault"), labelData_(-1), boolData_(false) { } Foam::expInletFvPatchVectorField:: expInletFvPatchVectorField ( const fvPatch& p, const DimensionedField& iF, const dictionary& dict ) : fixedValueFvPatchVectorField(p, iF), scalarData_(dict.lookup("scalarData")), data_(pTraits(dict.lookup("data"))), fieldData_("fieldData", dict, p.size()), timeVsData_(Function1::New("timeVsData", dict)), wordData_(dict.lookupOrDefault("wordName", "wordDefault")), labelData_(-1), boolData_(false) { fixedValueFvPatchVectorField::evaluate(); /* // Initialise with the value entry if evaluation is not possible fvPatchVectorField::operator= ( vectorField("value", dict, p.size()) ); */ } Foam::expInletFvPatchVectorField:: expInletFvPatchVectorField ( const expInletFvPatchVectorField& ptf, const fvPatch& p, const DimensionedField& iF, const fvPatchFieldMapper& mapper ) : fixedValueFvPatchVectorField(ptf, p, iF, mapper), scalarData_(ptf.scalarData_), data_(ptf.data_), fieldData_(mapper(ptf.fieldData_)), timeVsData_(ptf.timeVsData_, false), wordData_(ptf.wordData_), labelData_(-1), boolData_(ptf.boolData_) {} Foam::expInletFvPatchVectorField:: expInletFvPatchVectorField ( const expInletFvPatchVectorField& ptf ) : fixedValueFvPatchVectorField(ptf), scalarData_(ptf.scalarData_), data_(ptf.data_), fieldData_(ptf.fieldData_), timeVsData_(ptf.timeVsData_, false), wordData_(ptf.wordData_), labelData_(-1), boolData_(ptf.boolData_) {} Foam::expInletFvPatchVectorField:: expInletFvPatchVectorField ( const expInletFvPatchVectorField& ptf, const DimensionedField& iF ) : fixedValueFvPatchVectorField(ptf, iF), scalarData_(ptf.scalarData_), data_(ptf.data_), fieldData_(ptf.fieldData_), timeVsData_(ptf.timeVsData_, false), wordData_(ptf.wordData_), labelData_(-1), boolData_(ptf.boolData_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void Foam::expInletFvPatchVectorField::autoMap ( const fvPatchFieldMapper& m ) { fixedValueFvPatchVectorField::autoMap(m); m(fieldData_, fieldData_); } void Foam::expInletFvPatchVectorField::rmap ( const fvPatchVectorField& ptf, const labelList& addr ) { fixedValueFvPatchVectorField::rmap(ptf, addr); const expInletFvPatchVectorField& tiptf = refCast(ptf); fieldData_.rmap(tiptf.fieldData_, addr); } void Foam::expInletFvPatchVectorField::updateCoeffs() { if (updated()) { return; } fixedValueFvPatchVectorField::operator== ( data_ + fieldData_ + scalarData_*timeVsData_->value(t()) ); fixedValueFvPatchVectorField::updateCoeffs(); } void Foam::expInletFvPatchVectorField::write ( Ostream& os ) const { fvPatchVectorField::write(os); writeEntry(os, "scalarData", scalarData_); writeEntry(os, "data", data_); writeEntry(os, "fieldData", fieldData_); writeEntry(os, timeVsData_()); writeEntry(os, "wordData", wordData_); writeEntry(os, "value", *this); } // * * * * * * * * * * * * * * Build Macro Function * * * * * * * * * * * * // namespace Foam { makePatchTypeField ( fvPatchVectorField, expInletFvPatchVectorField ); } // ************************************************************************* //