1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM 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 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "fanFvPatchField.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
38 fanFvPatchField<Type>::fanFvPatchField
41 const DimensionedField<Type, volMesh>& iF
44 jumpCyclicFvPatchField<Type>(p, iF),
46 jump_(this->size()/2, 0.0)
51 fanFvPatchField<Type>::fanFvPatchField
54 const DimensionedField<Type, volMesh>& iF,
55 const dictionary& dict
58 jumpCyclicFvPatchField<Type>(p, iF),
60 jump_(this->size()/2, 0.0)
63 Istream& is = dict.lookup("f");
64 is.format(IOstream::ASCII);
68 if (dict.found("value"))
70 fvPatchField<Type>::operator=
72 Field<Type>("value", dict, p.size())
77 this->evaluate(Pstream::blocking);
83 fanFvPatchField<Type>::fanFvPatchField
85 const fanFvPatchField<Type>& ptf,
87 const DimensionedField<Type, volMesh>& iF,
88 const fvPatchFieldMapper& mapper
91 jumpCyclicFvPatchField<Type>(ptf, p, iF, mapper),
93 jump_(ptf.jump_, mapper)
98 fanFvPatchField<Type>::fanFvPatchField
100 const fanFvPatchField<Type>& ptf
103 cyclicLduInterfaceField(),
104 jumpCyclicFvPatchField<Type>(ptf),
111 fanFvPatchField<Type>::fanFvPatchField
113 const fanFvPatchField<Type>& ptf,
114 const DimensionedField<Type, volMesh>& iF
117 jumpCyclicFvPatchField<Type>(ptf, iF),
123 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
126 void fanFvPatchField<Type>::autoMap
128 const fvPatchFieldMapper& m
131 jumpCyclicFvPatchField<Type>::autoMap(m);
133 // Jump is half size. Expand to full size, map and truncate.
134 if (jump_.size() > 0 && jump_.size() == this->size()/2)
136 label oldSize = jump_.size();
137 jump_.setSize(this->size());
139 for (label i = oldSize; i < jump_.size(); i++)
141 jump_[i] = jump_[i-oldSize];
145 jump_.setSize(oldSize);
151 void fanFvPatchField<Type>::rmap
153 const fvPatchField<Type>& ptf,
154 const labelList& addr
157 jumpCyclicFvPatchField<Type>::rmap(ptf, addr);
159 // Jump is half size. Expand to full size, map and truncate.
160 if (jump_.size() > 0 && jump_.size() == this->size()/2)
162 label oldSize = jump_.size();
163 jump_.setSize(this->size());
165 for (label i = oldSize; i < jump_.size(); i++)
167 jump_[i] = jump_[i-oldSize];
170 const fanFvPatchField<Type>& tiptf =
171 refCast<const fanFvPatchField<Type> >(ptf);
173 jump_.rmap(tiptf.jump_, addr);
175 jump_.setSize(oldSize);
181 void fanFvPatchField<Type>::write(Ostream& os) const
183 fvPatchField<Type>::write(os);
184 os.writeKeyword("patchType")
185 << cyclicFvPatch::typeName << token::END_STATEMENT << nl;
187 IOstream::streamFormat fmt0 = os.format(IOstream::ASCII);
188 os.writeKeyword("f") << f_ << token::END_STATEMENT << nl;
191 this->writeEntry("value", os);
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 } // End namespace Foam
199 // ************************************************************************* //