initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / fields / fvPatchFields / basic / coupled / coupledFvPatchField.C
blob0df57f2b9c351dc7739047a267e7eba90e96b476
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 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 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 \*---------------------------------------------------------------------------*/
27 #include "coupledFvPatchField.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 namespace Foam
34 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
36 template<class Type>
37 coupledFvPatchField<Type>::coupledFvPatchField
39     const fvPatch& p,
40     const DimensionedField<Type, volMesh>& iF
43     lduInterfaceField(refCast<const lduInterface>(p)),
44     fvPatchField<Type>(p, iF)
48 template<class Type>
49 coupledFvPatchField<Type>::coupledFvPatchField
51     const fvPatch& p,
52     const DimensionedField<Type, volMesh>& iF,
53     const Field<Type>& f
56     lduInterfaceField(refCast<const lduInterface>(p)),
57     fvPatchField<Type>(p, iF, f)
61 template<class Type>
62 coupledFvPatchField<Type>::coupledFvPatchField
64     const coupledFvPatchField<Type>& ptf,
65     const fvPatch& p,
66     const DimensionedField<Type, volMesh>& iF,
67     const fvPatchFieldMapper& mapper
70     lduInterfaceField(refCast<const lduInterface>(p)),
71     fvPatchField<Type>(ptf, p, iF, mapper)
75 template<class Type>
76 coupledFvPatchField<Type>::coupledFvPatchField
78     const fvPatch& p,
79     const DimensionedField<Type, volMesh>& iF,
80     const dictionary& dict
83     lduInterfaceField(refCast<const lduInterface>(p)),
84     fvPatchField<Type>(p, iF, dict)
88 template<class Type>
89 coupledFvPatchField<Type>::coupledFvPatchField
91     const coupledFvPatchField<Type>& ptf
94     lduInterfaceField(refCast<const lduInterface>(ptf.patch())),
95     fvPatchField<Type>(ptf)
99 template<class Type>
100 coupledFvPatchField<Type>::coupledFvPatchField
102     const coupledFvPatchField<Type>& ptf,
103     const DimensionedField<Type, volMesh>& iF
106     lduInterfaceField(refCast<const lduInterface>(ptf.patch())),
107     fvPatchField<Type>(ptf, iF)
111 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
113 template<class Type>
114 tmp<Field<Type> > coupledFvPatchField<Type>::snGrad() const
116     return
117         (this->patchNeighbourField() - this->patchInternalField())
118        *this->patch().deltaCoeffs();
122 template<class Type>
123 void coupledFvPatchField<Type>::initEvaluate(const Pstream::commsTypes)
125     if (!this->updated())
126     {
127         this->updateCoeffs();
128     }
132 template<class Type>
133 void coupledFvPatchField<Type>::evaluate(const Pstream::commsTypes)
135     if (!this->updated())
136     {
137         this->updateCoeffs();
138     }
140     Field<Type>::operator=
141     (
142         this->patch().weights()*this->patchInternalField()
143       + (1.0 - this->patch().weights())*this->patchNeighbourField()
144     );
146     fvPatchField<Type>::evaluate();
150 template<class Type>
151 tmp<Field<Type> > coupledFvPatchField<Type>::valueInternalCoeffs
153     const tmp<scalarField>& w
154 ) const
156     return Type(pTraits<Type>::one)*w;
159 template<class Type>
160 tmp<Field<Type> > coupledFvPatchField<Type>::valueBoundaryCoeffs
162     const tmp<scalarField>& w
163 ) const
165     return Type(pTraits<Type>::one)*(1.0 - w);
168 template<class Type>
169 tmp<Field<Type> > coupledFvPatchField<Type>::gradientInternalCoeffs() const
171     return -Type(pTraits<Type>::one)*this->patch().deltaCoeffs();
175 template<class Type>
176 tmp<Field<Type> > coupledFvPatchField<Type>::gradientBoundaryCoeffs() const
178     return -this->gradientInternalCoeffs();
182 template<class Type>
183 void coupledFvPatchField<Type>::write(Ostream& os) const
185     fvPatchField<Type>::write(os);
186     this->writeEntry("value", os);
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 } // End namespace Foam
194 // ************************************************************************* //