1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend 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 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 newDirectionMixedFvPatchField
28 Doubly mixed fixed value-fixed gradient boundary condition
29 separated into a normal and a tangential component given a
30 direction vector. The mixture is controlled by two separate
31 valueFraction coefficients in the normal and tangential direction.
34 newDirectionMixedFvPatchField.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef newDirectionMixedFvPatchField_H
39 #define newDirectionMixedFvPatchField_H
41 #include "fvPatchField.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 /*---------------------------------------------------------------------------*\
49 Class directionMixedFvPatch Declaration
50 \*---------------------------------------------------------------------------*/
53 class newDirectionMixedFvPatchField
55 public fvPatchField<Type>
60 Field<Type> refValue_;
68 //- Fraction (0-1) of value used for normal component
69 scalarField normalValueFraction_;
71 //- Fraction (0-1) of value used for tangential component
72 scalarField tangentialValueFraction_;
75 // Private Member Functions
77 //- Check and normalize nHat
83 //- Runtime type information
84 TypeName("newDirectionMixed");
89 //- Construct from patch and internal field
90 newDirectionMixedFvPatchField
93 const DimensionedField<Type, volMesh>&
96 //- Construct from patch, internal field and dictionary
97 newDirectionMixedFvPatchField
100 const DimensionedField<Type, volMesh>&,
104 //- Construct by mapping given newDirectionMixedFvPatchField onto
106 newDirectionMixedFvPatchField
108 const newDirectionMixedFvPatchField<Type>&,
110 const DimensionedField<Type, volMesh>&,
111 const fvPatchFieldMapper&
114 //- Construct and return a clone
115 virtual tmp<fvPatchField<Type> > clone() const
117 return tmp<fvPatchField<Type> >
119 new newDirectionMixedFvPatchField<Type>(*this)
123 //- Construct as copy setting internal field reference
124 newDirectionMixedFvPatchField
126 const newDirectionMixedFvPatchField<Type>&,
127 const DimensionedField<Type, volMesh>&
130 //- Construct and return a clone setting internal field reference
131 virtual tmp<fvPatchField<Type> > clone
133 const DimensionedField<Type, volMesh>& iF
136 return tmp<fvPatchField<Type> >
138 new newDirectionMixedFvPatchField<Type>(*this, iF)
147 //- Return true if this patch field fixes a value.
148 // Needed to check if a level has to be specified while solving
149 // Poissons equations.
150 virtual bool fixesValue() const
158 //- Map (and resize as needed) from self given a mapping object
161 const fvPatchFieldMapper&
164 //- Reverse map the given fvPatchField onto this fvPatchField
167 const fvPatchField<Type>&,
172 // Return defining fields
174 virtual Field<Type>& refValue()
179 virtual const Field<Type>& refValue() const
184 virtual Field<Type>& refGrad()
189 virtual const Field<Type>& refGrad() const
194 virtual vectorField& nHat()
199 virtual const vectorField& nHat() const
204 virtual scalarField& normalValueFraction()
206 return normalValueFraction_;
209 virtual const scalarField& normalValueFraction() const
211 return normalValueFraction_;
215 virtual scalarField& tangentialValueFraction()
217 return tangentialValueFraction_;
220 virtual const scalarField& tangentialValueFraction() const
222 return tangentialValueFraction_;
226 // Evaluation functions
228 //- Return gradient at boundary
229 virtual tmp<Field<Type> > snGrad() const;
231 //- Evaluate the patch field
232 virtual void evaluate();
234 //- Return the matrix diagonal coefficients corresponding to the
235 // evaluation of the value of this patchField with given weights
236 virtual tmp<Field<Type> > valueInternalCoeffs
238 const tmp<scalarField>&
241 //- Return the matrix source coefficients corresponding to the
242 // evaluation of the value of this patchField with given weights
243 virtual tmp<Field<Type> > valueBoundaryCoeffs
245 const tmp<scalarField>&
248 //- Return the matrix diagonal coefficients corresponding to the
249 // evaluation of the gradient of this patchField
250 virtual tmp<Field<Type> > gradientInternalCoeffs() const;
252 //- Return the matrix source coefficients corresponding to the
253 // evaluation of the gradient of this patchField
254 virtual tmp<Field<Type> > gradientBoundaryCoeffs() const;
258 virtual void write(Ostream&) const;
263 virtual void operator=(const fvPatchField<Type>&) {}
264 virtual void operator+=(const fvPatchField<Type>&) {}
265 virtual void operator-=(const fvPatchField<Type>&) {}
266 virtual void operator*=(const fvPatchField<Type>&) {}
267 virtual void operator/=(const fvPatchField<Type>&) {}
269 virtual void operator=(const Field<Type>&) {}
270 virtual void operator+=(const Field<Type>&) {}
271 virtual void operator-=(const Field<Type>&) {}
272 virtual void operator*=(const Field<scalar>&) {}
273 virtual void operator/=(const Field<scalar>&) {}
275 virtual void operator=(const Type&) {}
276 virtual void operator+=(const Type&) {}
277 virtual void operator-=(const Type&) {}
278 virtual void operator*=(const scalar) {}
279 virtual void operator/=(const scalar) {}
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285 } // End namespace Foam
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
290 # include "newDirectionMixedFvPatchField.C"
293 # pragma implementation("newDirectionMixedFvPatchField.C")
297 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
301 // ************************************************************************* //