|
|
|
fvPatch.CGo 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 \*---------------------------------------------------------------------------*/ 00026 00027 #include "fvPatch.H" 00028 #include "addToRunTimeSelectionTable.H" 00029 #include "fvBoundaryMesh.H" 00030 #include "fvMesh.H" 00031 #include "primitiveMesh.H" 00032 #include "volFields.H" 00033 #include "surfaceFields.H" 00034 00035 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00036 00037 namespace Foam 00038 { 00039 00040 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // 00041 00042 defineTypeNameAndDebug(fvPatch, 0); 00043 defineRunTimeSelectionTable(fvPatch, polyPatch); 00044 addToRunTimeSelectionTable(fvPatch, fvPatch, polyPatch); 00045 00046 00047 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // 00048 00049 fvPatch::fvPatch(const polyPatch& p, const fvBoundaryMesh& bm) 00050 : 00051 polyPatch_(p), 00052 boundaryMesh_(bm) 00053 {} 00054 00055 00056 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // 00057 00058 fvPatch::~fvPatch() 00059 {} 00060 00061 00062 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // 00063 00064 bool fvPatch::constraintType(const word& pt) 00065 { 00066 return fvPatchField<scalar>::patchConstructorTablePtr_->found(pt); 00067 } 00068 00069 00070 wordList fvPatch::constraintTypes() 00071 { 00072 wordList cTypes(polyPatchConstructorTablePtr_->size()); 00073 00074 label i = 0; 00075 00076 for 00077 ( 00078 polyPatchConstructorTable::iterator cstrIter = 00079 polyPatchConstructorTablePtr_->begin(); 00080 cstrIter != polyPatchConstructorTablePtr_->end(); 00081 ++cstrIter 00082 ) 00083 { 00084 if (constraintType(cstrIter.key())) 00085 { 00086 cTypes[i++] = cstrIter.key(); 00087 } 00088 } 00089 00090 cTypes.setSize(i); 00091 00092 return cTypes; 00093 } 00094 00095 00096 const unallocLabelList& fvPatch::faceCells() const 00097 { 00098 return polyPatch_.faceCells(); 00099 } 00100 00101 00102 const vectorField& fvPatch::Cf() const 00103 { 00104 return boundaryMesh().mesh().Cf().boundaryField()[index()]; 00105 } 00106 00107 00108 tmp<vectorField> fvPatch::Cn() const 00109 { 00110 tmp<vectorField> tcc(new vectorField(size())); 00111 vectorField& cc = tcc(); 00112 00113 const unallocLabelList& faceCells = this->faceCells(); 00114 00115 // get reference to global cell centres 00116 const vectorField& gcc = boundaryMesh().mesh().cellCentres(); 00117 00118 forAll (faceCells, faceI) 00119 { 00120 cc[faceI] = gcc[faceCells[faceI]]; 00121 } 00122 00123 return tcc; 00124 } 00125 00126 00127 tmp<vectorField> fvPatch::nf() const 00128 { 00129 return Sf()/magSf(); 00130 } 00131 00132 00133 const vectorField& fvPatch::Sf() const 00134 { 00135 return boundaryMesh().mesh().Sf().boundaryField()[index()]; 00136 } 00137 00138 00139 const scalarField& fvPatch::magSf() const 00140 { 00141 return boundaryMesh().mesh().magSf().boundaryField()[index()]; 00142 } 00143 00144 00145 tmp<vectorField> fvPatch::delta() const 00146 { 00147 return Cf() - Cn(); 00148 } 00149 00150 00151 void fvPatch::makeWeights(scalarField& w) const 00152 { 00153 w = 1.0; 00154 } 00155 00156 00157 void fvPatch::makeDeltaCoeffs(scalarField& dc) const 00158 { 00159 dc = 1.0/(nf() & delta()); 00160 } 00161 00162 00163 void fvPatch::initMovePoints() 00164 {} 00165 00166 00167 void fvPatch::movePoints() 00168 {} 00169 00170 00171 const scalarField& fvPatch::deltaCoeffs() const 00172 { 00173 return boundaryMesh().mesh().deltaCoeffs().boundaryField()[index()]; 00174 } 00175 00176 00177 const scalarField& fvPatch::weights() const 00178 { 00179 return boundaryMesh().mesh().weights().boundaryField()[index()]; 00180 } 00181 00182 00183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00184 00185 } // End namespace Foam 00186 00187 // ************************************************************************* // |