1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
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
53 const fanFvPatchField<Type>& ptf,
55 const DimensionedField<Type, volMesh>& iF,
56 const fvPatchFieldMapper& mapper
59 jumpCyclicFvPatchField<Type>(ptf, p, iF, mapper),
61 jump_(ptf.jump_, mapper)
66 fanFvPatchField<Type>::fanFvPatchField
69 const DimensionedField<Type, volMesh>& iF,
70 const dictionary& dict
73 jumpCyclicFvPatchField<Type>(p, iF),
75 jump_(this->size()/2, 0.0)
78 Istream& is = dict.lookup("f");
79 is.format(IOstream::ASCII);
83 if (dict.found("value"))
85 fvPatchField<Type>::operator=
87 Field<Type>("value", dict, p.size())
92 this->evaluate(Pstream::blocking);
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() && 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() && 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") << "cyclic" << token::END_STATEMENT << nl;
186 IOstream::streamFormat fmt0 = os.format(IOstream::ASCII);
187 os.writeKeyword("f") << f_ << token::END_STATEMENT << nl;
190 this->writeEntry("value", os);
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 } // End namespace Foam
198 // ************************************************************************* //