FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::processorFvPatchField
00026 
00027 Description
00028     Foam::processorFvPatchField
00029 
00030 SourceFiles
00031     processorFvPatchField.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef processorFvPatchField_H
00036 #define processorFvPatchField_H
00037 
00038 #include <finiteVolume/coupledFvPatchField.H>
00039 #include <OpenFOAM/processorLduInterfaceField.H>
00040 #include <finiteVolume/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 Pstream::commsTypes commsType);
00165 
00166             //- Evaluate the patch field
00167             virtual void evaluate(const Pstream::commsTypes commsType);
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 Pstream::commsTypes commsType
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 Pstream::commsTypes commsType
00192             ) const;
00193 
00194         //- Processor coupled interface functions
00195 
00196             //- Return processor number
00197             virtual int myProcNo() const
00198             {
00199                 return procPatch_.myProcNo();
00200             }
00201 
00202             //- Return neigbour processor number
00203             virtual int neighbProcNo() const
00204             {
00205                 return procPatch_.neighbProcNo();
00206             }
00207 
00208             //- Does the patch field perform the transfromation
00209             virtual bool doTransform() const
00210             {
00211                 return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
00212             }
00213 
00214             //- Return face transformation tensor
00215             virtual const tensorField& forwardT() const
00216             {
00217                 return procPatch_.forwardT();
00218             }
00219 
00220             //- Return rank of component for transform
00221             virtual int rank() const
00222             {
00223                 return pTraits<Type>::rank;
00224             }
00225 };
00226 
00227 
00228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00229 
00230 } // End namespace Foam
00231 
00232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00233 
00234 #ifdef NoRepository
00235 #   include <finiteVolume/processorFvPatchField.C>
00236 #endif
00237 
00238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00239 
00240 #endif
00241 
00242 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines