OpenFOAM logo
Open Source CFD Toolkit

MixedPointPatchField.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     MixedPointPatchField. The boundary condition is a mix of a FixedValue and
00027     a ZeroGradient boundary condition.  I am still not sure how to do the
00028     FixedValue-fixedGradient combination. 
00029 
00030 Description
00031 
00032 SourceFiles
00033     MixedPointPatchField.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef MixedPointPatchField_H
00038 #define MixedPointPatchField_H
00039 
00040 #include "ValueStoredPointPatchField.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 /*---------------------------------------------------------------------------*\
00048                       Class MixedPointPatchField Declaration
00049 \*---------------------------------------------------------------------------*/
00050 
00051 template<template<class> class PatchField, class PointPatch, class Type>
00052 class MixedPointPatchField
00053 :
00054     public ValueStoredPointPatchField<PatchField, PointPatch, Type>
00055 {
00056     // Private data
00057 
00058         //- Value field
00059         Field<Type> refValue_;
00060 
00061         //- Fraction (0-1) of value used for boundary condition
00062         scalarField valueFraction_;
00063 
00064     // Private member functions
00065 
00066         void checkFieldSize() const;
00067 
00068 
00069 public:
00070 
00071     //- Runtime type information
00072     TypeName("mixed");
00073 
00074 
00075     // Constructors
00076 
00077         //- Construct from patch and internal field
00078         MixedPointPatchField
00079         (
00080             const PointPatch&,
00081             const Field<Type>&
00082         );
00083 
00084         //- Construct from patch and internal field patch field
00085         // and value fraction
00086         MixedPointPatchField
00087         (
00088             const PointPatch&,
00089             const Field<Type>&,
00090             const Field<Type>&,
00091             const Field<Type>&,
00092             const scalarField&
00093         );
00094 
00095         //- Construct from patch, internal field and dictionary
00096         MixedPointPatchField
00097         (
00098             const PointPatch&,
00099             const Field<Type>&,
00100             const dictionary&
00101         );
00102 
00103         //- Construct by mapping given patchField<Type> onto a new patch
00104         MixedPointPatchField
00105         (
00106             const MixedPointPatchField<PatchField, PointPatch, Type>&,
00107             const PointPatch&,
00108             const Field<Type>&,
00109             const PointPatchFieldMapper&
00110         );
00111 
00112         //- Construct and return a clone
00113         virtual autoPtr<PatchField<Type> > clone() const
00114         {
00115             return autoPtr<PatchField<Type> >
00116             (
00117                 new MixedPointPatchField<PatchField, PointPatch, Type>
00118                 (
00119                     *this
00120                 )
00121             );
00122         }
00123 
00124         //- Construct as copy setting internal field reference
00125         MixedPointPatchField
00126         (
00127             const MixedPointPatchField<PatchField, PointPatch, Type>&,
00128             const Field<Type>&
00129         );
00130 
00131         //- Construct and return a clone setting internal field reference
00132         virtual autoPtr<PatchField<Type> > clone(const Field<Type>& iF) const
00133         {
00134             return autoPtr<PatchField<Type> >
00135             (
00136                 new MixedPointPatchField<PatchField, PointPatch, Type>
00137                 (
00138                     *this,
00139                     iF
00140                 )
00141             );
00142         }
00143 
00144 
00145     // Member functions
00146 
00147         // Return defining fields
00148 
00149             virtual Field<Type>& refValue()
00150             {
00151                 return refValue_;
00152             }
00153 
00154             virtual const Field<Type>& refValue() const
00155             {
00156                 return refValue_;
00157             }
00158 
00159             virtual scalarField& valueFraction()
00160             {
00161                 return valueFraction_;
00162             }
00163 
00164             virtual const scalarField& valueFraction() const
00165             {
00166                 return valueFraction_;
00167             }
00168 
00169 
00170         // Mapping functions
00171 
00172             //- Map (and resize as needed) from self given a mapping object
00173             virtual void autoMap
00174             (
00175                 const PointPatchFieldMapper&
00176             );
00177 
00178             //- Reverse map the given PointPatchField onto
00179             //  this PointPatchField
00180             virtual void rmap
00181             (
00182                 const PointPatchField<PatchField, PointPatch, Type>&,
00183                 const labelList&
00184             );
00185 
00186 
00187         // Evaluation functions
00188 
00189             //- Update the patch field
00190             virtual void updateBoundaryField();
00191 
00192 
00193         //- Write
00194         virtual void write(Ostream&) const;
00195 };
00196 
00197 
00198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00199 
00200 } // End namespace Foam
00201 
00202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00203 
00204 #ifdef NoRepository
00205 #    include "MixedPointPatchField.C"
00206 #endif
00207 
00208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00209 
00210 #endif
00211 
00212 // ************************************************************************* //
For further information go to www.openfoam.org