Fix tutorials: coupled/conjugateHeatFoam/conjugateCavity: fix Allrun file
[OpenFOAM-1.6-ext.git] / src / finiteVolume / fields / fvsPatchFields / constraint / regionCouple / regionCoupleFvsPatchField.C
blob1401b7d9a85f61bac32cd3f95c046e744112280a
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 Author
26     Hrvoje Jasak, Wikki Ltd.  All rights reserved
28 \*---------------------------------------------------------------------------*/
30 #include "regionCoupleFvsPatchField.H"
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 namespace Foam
37 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
39 template<class Type>
40 regionCoupleFvsPatchField<Type>::regionCoupleFvsPatchField
42     const fvPatch& p,
43     const DimensionedField<Type, surfaceMesh>& iF
46     coupledFvsPatchField<Type>(p, iF),
47     regionCouplePatch_(refCast<const regionCoupleFvPatch>(p)),
48     remoteFieldName_(),
49     matrixUpdateBuffer_()
53 template<class Type>
54 regionCoupleFvsPatchField<Type>::regionCoupleFvsPatchField
56     const fvPatch& p,
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")),
64     matrixUpdateBuffer_()
66     if (!isType<regionCoupleFvPatch>(p))
67     {
68         FatalIOErrorIn
69         (
70             "regionCoupleFvsPatchField<Type>::regionCoupleFvsPatchField\n"
71             "(\n"
72             "    const fvPatch& p,\n"
73             "    const DimensionedField<Type, surfaceMesh>& iF,\n"
74             "    const dictionary& dict\n"
75             ")\n",
76             dict
77         )   << "patch " << this->patch().index() << " not regionCouple type. "
78             << "Patch type = " << p.type()
79             << exit(FatalIOError);
80     }
84 template<class Type>
85 regionCoupleFvsPatchField<Type>::regionCoupleFvsPatchField
87     const regionCoupleFvsPatchField<Type>& ptf,
88     const fvPatch& p,
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_),
96     matrixUpdateBuffer_()
98     if (!isType<regionCoupleFvPatch>(this->patch()))
99     {
100         FatalErrorIn
101         (
102             "regionCoupleFvsPatchField<Type>::regionCoupleFvsPatchField\n"
103             "(\n"
104             "    const regionCoupleFvsPatchField<Type>& ptf,\n"
105             "    const fvPatch& p,\n"
106             "    const DimensionedField<Type, surfaceMesh>& iF,\n"
107             "    const fvPatchFieldMapper& mapper\n"
108             ")\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()
113             << exit(FatalError);
114     }
118 template<class 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
135 template<class Type>
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> >
147     (
148         coupleField.boundaryField()[regionCouplePatch_.shadowIndex()]
149     );
153 // Write
154 template<class Type>
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 // ************************************************************************* //