Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / finiteVolume / fields / fvPatchFields / basic / coupled / coupledFvPatchField.C
blobdef6527302e0702b17f3b1907960da7c87521099
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2010 OpenCFD Ltd.
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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "coupledFvPatchField.H"
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 namespace Foam
33 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
35 template<class Type>
36 coupledFvPatchField<Type>::coupledFvPatchField
38     const fvPatch& p,
39     const DimensionedField<Type, volMesh>& iF
42     lduInterfaceField(refCast<const lduInterface>(p)),
43     fvPatchField<Type>(p, iF)
47 template<class Type>
48 coupledFvPatchField<Type>::coupledFvPatchField
50     const fvPatch& p,
51     const DimensionedField<Type, volMesh>& iF,
52     const Field<Type>& f
55     lduInterfaceField(refCast<const lduInterface>(p)),
56     fvPatchField<Type>(p, iF, f)
60 template<class Type>
61 coupledFvPatchField<Type>::coupledFvPatchField
63     const coupledFvPatchField<Type>& ptf,
64     const fvPatch& p,
65     const DimensionedField<Type, volMesh>& iF,
66     const fvPatchFieldMapper& mapper
69     lduInterfaceField(refCast<const lduInterface>(p)),
70     fvPatchField<Type>(ptf, p, iF, mapper)
74 template<class Type>
75 coupledFvPatchField<Type>::coupledFvPatchField
77     const fvPatch& p,
78     const DimensionedField<Type, volMesh>& iF,
79     const dictionary& dict
82     lduInterfaceField(refCast<const lduInterface>(p)),
83     fvPatchField<Type>(p, iF, dict)
87 template<class Type>
88 coupledFvPatchField<Type>::coupledFvPatchField
90     const coupledFvPatchField<Type>& ptf
93     lduInterfaceField(refCast<const lduInterface>(ptf.patch())),
94     fvPatchField<Type>(ptf)
98 template<class Type>
99 coupledFvPatchField<Type>::coupledFvPatchField
101     const coupledFvPatchField<Type>& ptf,
102     const DimensionedField<Type, volMesh>& iF
105     lduInterfaceField(refCast<const lduInterface>(ptf.patch())),
106     fvPatchField<Type>(ptf, iF)
110 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
112 template<class Type>
113 tmp<Field<Type> > coupledFvPatchField<Type>::snGrad() const
115     return
116         (this->patchNeighbourField() - this->patchInternalField())
117        *this->patch().deltaCoeffs();
121 template<class Type>
122 void coupledFvPatchField<Type>::initEvaluate(const Pstream::commsTypes)
124     if (!this->updated())
125     {
126         this->updateCoeffs();
127     }
131 template<class Type>
132 void coupledFvPatchField<Type>::evaluate(const Pstream::commsTypes)
134     if (!this->updated())
135     {
136         this->updateCoeffs();
137     }
139     Field<Type>::operator=
140     (
141         this->patch().weights()*this->patchInternalField()
142       + (1.0 - this->patch().weights())*this->patchNeighbourField()
143     );
145     fvPatchField<Type>::evaluate();
149 template<class Type>
150 tmp<Field<Type> > coupledFvPatchField<Type>::valueInternalCoeffs
152     const tmp<scalarField>& w
153 ) const
155     return Type(pTraits<Type>::one)*w;
158 template<class Type>
159 tmp<Field<Type> > coupledFvPatchField<Type>::valueBoundaryCoeffs
161     const tmp<scalarField>& w
162 ) const
164     return Type(pTraits<Type>::one)*(1.0 - w);
167 template<class Type>
168 tmp<Field<Type> > coupledFvPatchField<Type>::gradientInternalCoeffs() const
170     return -Type(pTraits<Type>::one)*this->patch().deltaCoeffs();
174 template<class Type>
175 tmp<Field<Type> > coupledFvPatchField<Type>::gradientBoundaryCoeffs() const
177     return -this->gradientInternalCoeffs();
181 template<class Type>
182 void coupledFvPatchField<Type>::write(Ostream& os) const
184     fvPatchField<Type>::write(os);
185     this->writeEntry("value", os);
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 } // End namespace Foam
193 // ************************************************************************* //