OpenFOAM logo
Open Source CFD Toolkit

coupledFaPatch.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     coupledFaPatch
00027 
00028 Description
00029     coupledFaPatch is an abstract base class for patches that couple regions
00030     of the computational domain e.g. cyclic, arbitrary interfaces, sliding
00031     interfaces and processor-processor links.
00032 
00033 SourceFiles
00034     coupledFaPatch.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef coupledFaPatch_H
00039 #define coupledFaPatch_H
00040 
00041 #include "faPatch.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                          Class coupledFaPatch Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 class coupledFaPatch
00053 :
00054     public faPatch
00055 {
00056     // Private data
00057 
00058         //- offset (distance) vector from one side of the couple to the other
00059         mutable vectorField separation_;
00060 
00061         //- Face transformation tensor
00062         mutable tensorField forwardT_;
00063 
00064         //- Neighbour-cell transformation tensor
00065         mutable tensorField reverseT_;
00066 
00067 
00068 protected:
00069 
00070         //- Calculate the uniform transformation tensors
00071         void calcTransformTensors
00072         (
00073             const vector& Cf,
00074             const vector& Cr,
00075             const vector& nf,
00076             const vector& nr
00077         ) const;
00078 
00079         //- Calculate the transformation tensors
00080         void calcTransformTensors
00081         (
00082             const vectorField& Cf,
00083             const vectorField& Cr,
00084             const vectorField& nf,
00085             const vectorField& nr
00086         ) const;
00087 
00088 
00089 public:
00090 
00091     //- Runtime type information
00092     TypeName("coupled");
00093 
00094 
00095     // Constructors
00096 
00097         //- Construct from dictionary
00098         coupledFaPatch
00099         (
00100             const word& name,
00101             const dictionary& dict,
00102             const label index,
00103             const faBoundaryMesh& bm
00104         )
00105         :
00106             faPatch(name, dict, index, bm)
00107         {}
00108 
00109 
00110     // Destructor
00111 
00112         virtual ~coupledFaPatch();
00113 
00114 
00115     // Member Functions
00116 
00117         // Access
00118 
00119             //- Return true because this patch is coupled
00120             virtual bool coupled() const
00121             {
00122                 return true;
00123             }
00124 
00125 
00126             //- Are the coupled planes separated
00127             bool separated() const
00128             {
00129                 return separation_.size();
00130             }
00131 
00132             //- Return the offset (distance) vector from one side of the couple
00133             //  to the other
00134             const vectorField& separation() const
00135             {
00136                 if (!separation_.size())
00137                 {
00138                     FatalErrorIn("coupledFaPatch::separation() const")
00139                         << "Coupled patches are not separated"
00140                         << abort(FatalError);
00141                 }
00142 
00143                 return separation_;
00144             }
00145 
00146 
00147             //- Are the cyclic planes parallel
00148             bool parallel() const
00149             {
00150                 return forwardT_.size() == 0;
00151             }
00152 
00153             //- Return face transformation tensor
00154             const tensorField& forwardT() const
00155             {
00156                 if (!forwardT_.size())
00157                 {
00158                     FatalErrorIn("coupledFaPatch::forwardT() const")
00159                         << "Coupled planes do not need transformation"
00160                         << abort(FatalError);
00161                 }
00162 
00163                 return forwardT_;
00164             }
00165 
00166             //- Return neighbour-cell transformation tensor
00167             const tensorField& reverseT() const
00168             {
00169                 if (!reverseT_.size())
00170                 {
00171                     FatalErrorIn("coupledFaPatch::forwardT() const")
00172                         << "Coupled planes do not need transformation"
00173                         << abort(FatalError);
00174                 }
00175 
00176                 return reverseT_;
00177             }
00178 
00179         //- Initialise the calculation of the patch geometry
00180         virtual void initGeometry() = 0;
00181 
00182         //- Calculate the patch geometry
00183         virtual void calcGeometry() = 0;
00184 
00185         //- Initialise the patches for moving points
00186         virtual void initMovePoints(const pointField&) = 0;
00187 
00188         //- Correct patches after moving points
00189         virtual void movePoints(const pointField&) = 0;
00190 
00191 
00192         // Access functions for demand driven data
00193 
00194             //- Make patch face - neighbour cell distances
00195             virtual void makeDeltaCoeffs(scalarField&) const = 0;
00196 
00197             //- Return delta (P to N) vectors across coupled patch
00198             virtual tmp<vectorField> delta() const = 0;
00199 };
00200 
00201 
00202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00203 
00204 } // End namespace Foam
00205 
00206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00207 
00208 #endif
00209 
00210 // ************************************************************************* //
For further information go to www.openfoam.org