OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

processorFvPatchField.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-2009 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     Foam::processorFvPatchField
00027 
00028 Description
00029     Foam::processorFvPatchField
00030 
00031 SourceFiles
00032     processorFvPatchField.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef processorFvPatchField_H
00037 #define processorFvPatchField_H
00038 
00039 #include "coupledFvPatchField.H"
00040 #include "processorLduInterfaceField.H"
00041 #include "processorFvPatch.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                       Class processorFvPatch Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 template<class Type>
00053 class processorFvPatchField
00054 :
00055     public processorLduInterfaceField,
00056     public coupledFvPatchField<Type>
00057 {
00058     // Private data
00059 
00060         //- Local reference cast into the processor patch
00061         const processorFvPatch& procPatch_;
00062 
00063 
00064 public:
00065 
00066     //- Runtime type information
00067     TypeName(processorFvPatch::typeName_());
00068 
00069 
00070     // Constructors
00071 
00072         //- Construct from patch and internal field
00073         processorFvPatchField
00074         (
00075             const fvPatch&,
00076             const DimensionedField<Type, volMesh>&
00077         );
00078 
00079         //- Construct from patch and internal field and patch field
00080         processorFvPatchField
00081         (
00082             const fvPatch&,
00083             const DimensionedField<Type, volMesh>&,
00084             const Field<Type>&
00085         );
00086 
00087         //- Construct from patch, internal field and dictionary
00088         processorFvPatchField
00089         (
00090             const fvPatch&,
00091             const DimensionedField<Type, volMesh>&,
00092             const dictionary&
00093         );
00094 
00095         //- Construct by mapping given processorFvPatchField onto a new patch
00096         processorFvPatchField
00097         (
00098             const processorFvPatchField<Type>&,
00099             const fvPatch&,
00100             const DimensionedField<Type, volMesh>&,
00101             const fvPatchFieldMapper&
00102         );
00103 
00104         //- Construct as copy
00105         processorFvPatchField(const processorFvPatchField<Type>&);
00106 
00107         //- Construct and return a clone
00108         virtual tmp<fvPatchField<Type> > clone() const
00109         {
00110             return tmp<fvPatchField<Type> >
00111             (
00112                 new processorFvPatchField<Type>(*this)
00113             );
00114         }
00115 
00116         //- Construct as copy setting internal field reference
00117         processorFvPatchField
00118         (
00119             const processorFvPatchField<Type>&,
00120             const DimensionedField<Type, volMesh>&
00121         );
00122 
00123         //- Construct and return a clone setting internal field reference
00124         virtual tmp<fvPatchField<Type> > clone
00125         (
00126             const DimensionedField<Type, volMesh>& iF
00127         ) const
00128         {
00129             return tmp<fvPatchField<Type> >
00130             (
00131                 new processorFvPatchField<Type>(*this, iF)
00132             );
00133         }
00134 
00135 
00136     // Destructor
00137 
00138         ~processorFvPatchField();
00139 
00140 
00141     // Member functions
00142 
00143         // Access
00144 
00145             //- Return true if running parallel
00146             virtual bool coupled() const
00147             {
00148                 if (Pstream::parRun())
00149                 {
00150                     return true;
00151                 }
00152                 else
00153                 {
00154                     return false;
00155                 }
00156             }
00157 
00158             //- Return neighbour field given internal field
00159             tmp<Field<Type> > patchNeighbourField() const;
00160 
00161 
00162         // Evaluation functions
00163 
00164             //- Initialise the evaluation of the patch field
00165             virtual void initEvaluate(const Pstream::commsTypes commsType);
00166 
00167             //- Evaluate the patch field
00168             virtual void evaluate(const Pstream::commsTypes commsType);
00169 
00170             //- Return patch-normal gradient
00171             virtual tmp<Field<Type> > snGrad() const;
00172 
00173             //- Initialise neighbour matrix update
00174             virtual void initInterfaceMatrixUpdate
00175             (
00176                 const scalarField& psiInternal,
00177                 scalarField& result,
00178                 const lduMatrix& m,
00179                 const scalarField& coeffs,
00180                 const direction cmpt,
00181                 const Pstream::commsTypes commsType
00182             ) const;
00183 
00184             //- Update result field based on interface functionality
00185             virtual void updateInterfaceMatrix
00186             (
00187                 const scalarField& psiInternal,
00188                 scalarField& result,
00189                 const lduMatrix& m,
00190                 const scalarField& coeffs,
00191                 const direction cmpt,
00192                 const Pstream::commsTypes commsType
00193             ) const;
00194 
00195         //- Processor coupled interface functions
00196 
00197             //- Return processor number
00198             virtual int myProcNo() const
00199             {
00200                 return procPatch_.myProcNo();
00201             }
00202 
00203             //- Return neigbour processor number
00204             virtual int neighbProcNo() const
00205             {
00206                 return procPatch_.neighbProcNo();
00207             }
00208 
00209             //- Does the patch field perform the transfromation
00210             virtual bool doTransform() const
00211             {
00212                 return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
00213             }
00214 
00215             //- Return face transformation tensor
00216             virtual const tensorField& forwardT() const
00217             {
00218                 return procPatch_.forwardT();
00219             }
00220 
00221             //- Return rank of component for transform
00222             virtual int rank() const
00223             {
00224                 return pTraits<Type>::rank;
00225             }
00226 };
00227 
00228 
00229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00230 
00231 } // End namespace Foam
00232 
00233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00234 
00235 #ifdef NoRepository
00236 #   include "processorFvPatchField.C"
00237 #endif
00238 
00239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00240 
00241 #endif
00242 
00243 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd