1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "engineTimeVaryingUniformFixedValueFvPatchField.H"
29 #include "interpolateXY.H"
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
39 engineTimeVaryingUniformFixedValueFvPatchField<Type>::
40 engineTimeVaryingUniformFixedValueFvPatchField
43 const DimensionedField<Type, volMesh>& iF
46 fixedValueFvPatchField<Type>(p, iF),
48 engineDB_((refCast<const engineTime>(this->db().time())))
53 engineTimeVaryingUniformFixedValueFvPatchField<Type>::
54 engineTimeVaryingUniformFixedValueFvPatchField
56 const engineTimeVaryingUniformFixedValueFvPatchField<Type>& ptf,
58 const DimensionedField<Type, volMesh>& iF,
59 const fvPatchFieldMapper& mapper
62 fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
63 timeDataFileName_(ptf.timeDataFileName_),
65 engineDB_((refCast<const engineTime>(this->db().time())))
70 engineTimeVaryingUniformFixedValueFvPatchField<Type>::
71 engineTimeVaryingUniformFixedValueFvPatchField
74 const DimensionedField<Type, volMesh>& iF,
75 const dictionary& dict
78 fixedValueFvPatchField<Type>(p, iF),
79 timeDataFileName_(fileName(dict.lookup("timeDataFileName")).expand()),
81 engineDB_((refCast<const engineTime>(this->db().time())))
83 if (dict.found("value"))
85 fvPatchField<Type>::operator==(Field<Type>("value", dict, p.size()));
95 engineTimeVaryingUniformFixedValueFvPatchField<Type>::
96 engineTimeVaryingUniformFixedValueFvPatchField
98 const engineTimeVaryingUniformFixedValueFvPatchField<Type>& ptf
101 fixedValueFvPatchField<Type>(ptf),
102 timeDataFileName_(ptf.timeDataFileName_),
104 engineDB_((refCast<const engineTime>(this->db().time())))
109 engineTimeVaryingUniformFixedValueFvPatchField<Type>::
110 engineTimeVaryingUniformFixedValueFvPatchField
112 const engineTimeVaryingUniformFixedValueFvPatchField<Type>& ptf,
113 const DimensionedField<Type, volMesh>& iF
116 fixedValueFvPatchField<Type>(ptf, iF),
117 timeDataFileName_(ptf.timeDataFileName_),
119 engineDB_((refCast<const engineTime>(this->db().time())))
123 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
126 void engineTimeVaryingUniformFixedValueFvPatchField<Type>::checkTable()
128 if (!timeDataPtr_.valid())
132 new graph("title", "x", "y", IFstream(timeDataFileName_)())
136 // if (this->db().time().value() < min(timeDataPtr_().x()))
137 if (engineDB_.theta() < min(timeDataPtr_().x()))
141 "engineTimeVaryingUniformFixedValueFvPatchField<Type>::updateCoeffs()"
142 ) << "current time (" << engineDB_.theta()
143 << ") is less than the minimum in the data table ("
144 << min(timeDataPtr_().x()) << ')' << endl
145 << " Continuing with the value for the smallest time"
149 // if (this->db().time().value() > max(timeDataPtr_().x()))
150 if (engineDB_.theta() < min(timeDataPtr_().x()))
154 "engineTimeVaryingUniformFixedValueFvPatchField<Type>::updateCoeffs()"
155 ) << "current time (" << engineDB_.theta()
156 << ") is greater than the maximum in the data table ("
157 << max(timeDataPtr_().x()) << ')' << endl
158 << " Continuing with the value for the largest time"
165 void engineTimeVaryingUniformFixedValueFvPatchField<Type>::write(Ostream& os) const
167 fvPatchField<Type>::write(os);
168 os.writeKeyword("timeDataFileName")
169 << timeDataFileName_ << token::END_STATEMENT << nl;
170 this->writeEntry("value", os);
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 } // End namespace Foam
178 // ************************************************************************* //