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

processorFvPatch.C

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 \*---------------------------------------------------------------------------*/
00025 
00026 #include "processorFvPatch.H"
00027 #include <OpenFOAM/addToRunTimeSelectionTable.H>
00028 #include <OpenFOAM/transformField.H>
00029 
00030 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 
00035 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00036 
00037 defineTypeNameAndDebug(processorFvPatch, 0);
00038 addToRunTimeSelectionTable(fvPatch, processorFvPatch, polyPatch);
00039 
00040 
00041 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
00042 
00043 void processorFvPatch::makeWeights(scalarField& w) const
00044 {
00045     if (Pstream::parRun())
00046     {
00047         // The face normals point in the opposite direction on the other side
00048         scalarField neighbFaceCentresCn
00049         (
00050             (
00051                 procPolyPatch_.neighbFaceAreas()
00052                /(mag(procPolyPatch_.neighbFaceAreas()) + VSMALL)
00053             )
00054           & (
00055               procPolyPatch_.neighbFaceCentres()
00056             - procPolyPatch_.neighbFaceCellCentres())
00057         );
00058 
00059         w = neighbFaceCentresCn/((nf()&fvPatch::delta()) + neighbFaceCentresCn);
00060     }
00061     else
00062     {
00063         w = 1.0;
00064     }
00065 }
00066 
00067 
00068 void processorFvPatch::makeDeltaCoeffs(scalarField& dc) const
00069 {
00070     if (Pstream::parRun())
00071     {
00072         dc = (1.0 - weights())/(nf() & fvPatch::delta());
00073     }
00074     else
00075     {
00076         dc = 1.0/(nf() & fvPatch::delta());
00077     }
00078 }
00079 
00080 
00081 tmp<vectorField> processorFvPatch::delta() const
00082 {
00083     if (Pstream::parRun())
00084     {
00085         // To the transformation if necessary
00086         if (parallel())
00087         {
00088             return
00089                 fvPatch::delta()
00090               - (
00091                     procPolyPatch_.neighbFaceCentres()
00092                   - procPolyPatch_.neighbFaceCellCentres()
00093                 );
00094         }
00095         else
00096         {
00097             return
00098                 fvPatch::delta()
00099               - transform
00100                 (
00101                     forwardT(),
00102                     (
00103                         procPolyPatch_.neighbFaceCentres()
00104                       - procPolyPatch_.neighbFaceCellCentres()
00105                     )
00106                 );
00107         }
00108     }
00109     else
00110     {
00111         return fvPatch::delta();
00112     }
00113 }
00114 
00115 
00116 tmp<labelField> processorFvPatch::interfaceInternalField
00117 (
00118     const unallocLabelList& internalData
00119 ) const
00120 {
00121     return patchInternalField(internalData);
00122 }
00123 
00124 
00125 void processorFvPatch::initTransfer
00126 (
00127     const Pstream::commsTypes commsType,
00128     const unallocLabelList& interfaceData
00129 ) const
00130 {
00131     send(commsType, interfaceData);
00132 }
00133 
00134 
00135 tmp<labelField> processorFvPatch::transfer
00136 (
00137     const Pstream::commsTypes commsType,
00138     const unallocLabelList&
00139 ) const
00140 {
00141     return receive<label>(commsType, this->size());
00142 }
00143 
00144 
00145 void processorFvPatch::initInternalFieldTransfer
00146 (
00147     const Pstream::commsTypes commsType,
00148     const unallocLabelList& iF
00149 ) const
00150 {
00151     send(commsType, patchInternalField(iF)());
00152 }
00153 
00154 
00155 tmp<labelField> processorFvPatch::internalFieldTransfer
00156 (
00157     const Pstream::commsTypes commsType,
00158     const unallocLabelList&
00159 ) const
00160 {
00161     return receive<label>(commsType, this->size());
00162 }
00163 
00164 
00165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00166 
00167 } // End namespace Foam
00168 
00169 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines