1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
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
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
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/>.
25 Foam::mixedFvPatchField
28 Foam::mixedFvPatchField
33 \*---------------------------------------------------------------------------*/
35 #ifndef mixedFvPatchField_H
36 #define mixedFvPatchField_H
38 #include "fvPatchField.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 /*---------------------------------------------------------------------------*\
46 Class mixedFvPatch Declaration
47 \*---------------------------------------------------------------------------*/
50 class mixedFvPatchField
52 public fvPatchField<Type>
57 Field<Type> refValue_;
59 //- Normal gradient field
62 //- Fraction (0-1) of value used for boundary condition
63 scalarField valueFraction_;
68 //- Runtime type information
74 //- Construct from patch and internal field
78 const DimensionedField<Type, volMesh>&
81 //- Construct from patch, internal field and dictionary
85 const DimensionedField<Type, volMesh>&,
89 //- Construct by mapping the given mixedFvPatchField onto a new patch
92 const mixedFvPatchField<Type>&,
94 const DimensionedField<Type, volMesh>&,
95 const fvPatchFieldMapper&
101 const mixedFvPatchField<Type>&
104 //- Construct and return a clone
105 virtual tmp<fvPatchField<Type> > clone() const
107 return tmp<fvPatchField<Type> >
109 new mixedFvPatchField<Type>(*this)
113 //- Construct as copy setting internal field reference
116 const mixedFvPatchField<Type>&,
117 const DimensionedField<Type, volMesh>&
120 //- Construct and return a clone setting internal field reference
121 virtual tmp<fvPatchField<Type> > clone
123 const DimensionedField<Type, volMesh>& iF
126 return tmp<fvPatchField<Type> >
128 new mixedFvPatchField<Type>(*this, iF)
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
146 // Return defining fields
148 virtual Field<Type>& refValue()
153 virtual const Field<Type>& refValue() const
158 virtual Field<Type>& refGrad()
163 virtual const Field<Type>& refGrad() const
168 virtual scalarField& valueFraction()
170 return valueFraction_;
173 virtual const scalarField& valueFraction() const
175 return valueFraction_;
181 //- Map (and resize as needed) from self given a mapping object
184 const fvPatchFieldMapper&
187 //- Reverse map the given fvPatchField onto this fvPatchField
190 const fvPatchField<Type>&,
195 // Evaluation functions
197 //- Return gradient at boundary
198 virtual tmp<Field<Type> > snGrad() const;
200 //- Evaluate the patch field
201 virtual void evaluate
203 const Pstream::commsTypes commsType=Pstream::blocking
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
210 const tmp<scalarField>&
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
217 const tmp<scalarField>&
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;
230 virtual void write(Ostream&) const;
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 # include "mixedFvPatchField.C"
267 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 // ************************************************************************* //