Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / finiteVolume / fields / fvPatchFields / basic / mixed / mixedFvPatchField.H
blob34b99268c875bb2430462c9defcf03bb624227b9
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 Class
25     Foam::mixedFvPatchField
27 Description
28     Foam::mixedFvPatchField
30 SourceFiles
31     mixedFvPatchField.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef mixedFvPatchField_H
36 #define mixedFvPatchField_H
38 #include "fvPatchField.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 namespace Foam
45 /*---------------------------------------------------------------------------*\
46                            Class mixedFvPatch Declaration
47 \*---------------------------------------------------------------------------*/
49 template<class Type>
50 class mixedFvPatchField
52     public fvPatchField<Type>
54     // Private data
56         //- Value field
57         Field<Type> refValue_;
59         //- Normal gradient field
60         Field<Type> refGrad_;
62         //- Fraction (0-1) of value used for boundary condition
63         scalarField valueFraction_;
66 public:
68     //- Runtime type information
69     TypeName("mixed");
72     // Constructors
74         //- Construct from patch and internal field
75         mixedFvPatchField
76         (
77             const fvPatch&,
78             const DimensionedField<Type, volMesh>&
79         );
81         //- Construct from patch, internal field and dictionary
82         mixedFvPatchField
83         (
84             const fvPatch&,
85             const DimensionedField<Type, volMesh>&,
86             const dictionary&
87         );
89         //- Construct by mapping the given mixedFvPatchField onto a new patch
90         mixedFvPatchField
91         (
92             const mixedFvPatchField<Type>&,
93             const fvPatch&,
94             const DimensionedField<Type, volMesh>&,
95             const fvPatchFieldMapper&
96         );
98         //- Construct as copy
99         mixedFvPatchField
100         (
101             const mixedFvPatchField<Type>&
102         );
104         //- Construct and return a clone
105         virtual tmp<fvPatchField<Type> > clone() const
106         {
107             return tmp<fvPatchField<Type> >
108             (
109                 new mixedFvPatchField<Type>(*this)
110             );
111         }
113         //- Construct as copy setting internal field reference
114         mixedFvPatchField
115         (
116             const mixedFvPatchField<Type>&,
117             const DimensionedField<Type, volMesh>&
118         );
120         //- Construct and return a clone setting internal field reference
121         virtual tmp<fvPatchField<Type> > clone
122         (
123             const DimensionedField<Type, volMesh>& iF
124         ) const
125         {
126             return tmp<fvPatchField<Type> >
127             (
128                 new mixedFvPatchField<Type>(*this, iF)
129             );
130         }
133     // Member functions
135         // Access
137             //- Return true if this patch field fixes a value.
138             //  Needed to check if a level has to be specified while solving
139             //  Poissons equations.
140             virtual bool fixesValue() const
141             {
142                 return true;
143             }
146         // Return defining fields
148             virtual Field<Type>& refValue()
149             {
150                 return refValue_;
151             }
153             virtual const Field<Type>& refValue() const
154             {
155                 return refValue_;
156             }
158             virtual Field<Type>& refGrad()
159             {
160                 return refGrad_;
161             }
163             virtual const Field<Type>& refGrad() const
164             {
165                 return refGrad_;
166             }
168             virtual scalarField& valueFraction()
169             {
170                 return valueFraction_;
171             }
173             virtual const scalarField& valueFraction() const
174             {
175                 return valueFraction_;
176             }
179         // Mapping functions
181             //- Map (and resize as needed) from self given a mapping object
182             virtual void autoMap
183             (
184                 const fvPatchFieldMapper&
185             );
187             //- Reverse map the given fvPatchField onto this fvPatchField
188             virtual void rmap
189             (
190                 const fvPatchField<Type>&,
191                 const labelList&
192             );
195         // Evaluation functions
197             //- Return gradient at boundary
198             virtual tmp<Field<Type> > snGrad() const;
200             //- Evaluate the patch field
201             virtual void evaluate
202             (
203                 const Pstream::commsTypes commsType=Pstream::blocking
204             );
206             //- Return the matrix diagonal coefficients corresponding to the
207             //  evaluation of the value of this patchField with given weights
208             virtual tmp<Field<Type> > valueInternalCoeffs
209             (
210                 const tmp<scalarField>&
211             ) const;
213             //- Return the matrix source coefficients corresponding to the
214             //  evaluation of the value of this patchField with given weights
215             virtual tmp<Field<Type> > valueBoundaryCoeffs
216             (
217                 const tmp<scalarField>&
218             ) const;
220             //- Return the matrix diagonal coefficients corresponding to the
221             //  evaluation of the gradient of this patchField
222             virtual tmp<Field<Type> > gradientInternalCoeffs() const;
224             //- Return the matrix source coefficients corresponding to the
225             //  evaluation of the gradient of this patchField
226             virtual tmp<Field<Type> > gradientBoundaryCoeffs() const;
229         //- Write
230         virtual void write(Ostream&) const;
233     // Member operators
235         virtual void operator=(const UList<Type>&) {}
237         virtual void operator=(const fvPatchField<Type>&) {}
238         virtual void operator+=(const fvPatchField<Type>&) {}
239         virtual void operator-=(const fvPatchField<Type>&) {}
240         virtual void operator*=(const fvPatchField<scalar>&) {}
241         virtual void operator/=(const fvPatchField<scalar>&) {}
243         virtual void operator+=(const Field<Type>&) {}
244         virtual void operator-=(const Field<Type>&) {}
246         virtual void operator*=(const Field<scalar>&) {}
247         virtual void operator/=(const Field<scalar>&) {}
249         virtual void operator=(const Type&) {}
250         virtual void operator+=(const Type&) {}
251         virtual void operator-=(const Type&) {}
252         virtual void operator*=(const scalar) {}
253         virtual void operator/=(const scalar) {}
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 } // End namespace Foam
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 #ifdef NoRepository
264 #   include "mixedFvPatchField.C"
265 #endif
267 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269 #endif
271 // ************************************************************************* //