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