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
26 Hrvoje Jasak, Wikki Ltd. All rights reserved
28 \*---------------------------------------------------------------------------*/
30 #include "regionCoupleFvsPatchField.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 regionCoupleFvsPatchField<Type>::regionCoupleFvsPatchField
43 const DimensionedField<Type, surfaceMesh>& iF
46 coupledFvsPatchField<Type>(p, iF),
47 regionCouplePatch_(refCast<const regionCoupleFvPatch>(p)),
54 regionCoupleFvsPatchField<Type>::regionCoupleFvsPatchField
57 const DimensionedField<Type, surfaceMesh>& iF,
58 const dictionary& dict
61 coupledFvsPatchField<Type>(p, iF, dict),
62 regionCouplePatch_(refCast<const regionCoupleFvPatch>(p)),
63 remoteFieldName_(dict.lookup("remoteField")),
66 if (!isType<regionCoupleFvPatch>(p))
70 "regionCoupleFvsPatchField<Type>::regionCoupleFvsPatchField\n"
72 " const fvPatch& p,\n"
73 " const DimensionedField<Type, surfaceMesh>& iF,\n"
74 " const dictionary& dict\n"
77 ) << "patch " << this->patch().index() << " not regionCouple type. "
78 << "Patch type = " << p.type()
79 << exit(FatalIOError);
85 regionCoupleFvsPatchField<Type>::regionCoupleFvsPatchField
87 const regionCoupleFvsPatchField<Type>& ptf,
89 const DimensionedField<Type, surfaceMesh>& iF,
90 const fvPatchFieldMapper& mapper
93 coupledFvsPatchField<Type>(ptf, p, iF, mapper),
94 regionCouplePatch_(refCast<const regionCoupleFvPatch>(p)),
95 remoteFieldName_(ptf.remoteFieldName_),
98 if (!isType<regionCoupleFvPatch>(this->patch()))
102 "regionCoupleFvsPatchField<Type>::regionCoupleFvsPatchField\n"
104 " const regionCoupleFvsPatchField<Type>& ptf,\n"
105 " const fvPatch& p,\n"
106 " const DimensionedField<Type, surfaceMesh>& iF,\n"
107 " const fvPatchFieldMapper& mapper\n"
109 ) << "Field type does not correspond to patch type for patch "
110 << this->patch().index() << "." << endl
111 << "Field type: " << typeName << endl
112 << "Patch type: " << this->patch().type()
119 regionCoupleFvsPatchField<Type>::regionCoupleFvsPatchField
121 const regionCoupleFvsPatchField<Type>& ptf,
122 const DimensionedField<Type, surfaceMesh>& iF
125 coupledFvsPatchField<Type>(ptf, iF),
126 regionCouplePatch_(refCast<const regionCoupleFvPatch>(ptf.patch())),
127 remoteFieldName_(ptf.remoteFieldName_),
128 matrixUpdateBuffer_()
132 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
134 // Return neighbour field
136 const regionCoupleFvsPatchField<Type>&
137 regionCoupleFvsPatchField<Type>::shadowPatchField() const
139 // Lookup neighbour field
140 typedef GeometricField<Type, fvsPatchField, surfaceMesh> GeoField;
142 const GeoField& coupleField =
143 regionCouplePatch_.shadowRegion().
144 objectRegistry::lookupObject<GeoField>(remoteFieldName_);
146 return refCast<const regionCoupleFvsPatchField<Type> >
148 coupleField.boundaryField()[regionCouplePatch_.shadowIndex()]
155 void regionCoupleFvsPatchField<Type>::write(Ostream& os) const
157 fvsPatchField<Type>::write(os);
158 os.writeKeyword("remoteField")
159 << remoteFieldName_ << token::END_STATEMENT << nl;
160 this->writeEntry("value", os);
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 } // End namespace Foam
168 // ************************************************************************* //