inverseFaceDistanceDiffusivity.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "inverseFaceDistanceDiffusivity.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 #include "HashSet.H"
00030 #include "wallPoint.H"
00031 #include "MeshWave.H"
00032
00033
00034
00035 namespace Foam
00036 {
00037 defineTypeNameAndDebug(inverseFaceDistanceDiffusivity, 0);
00038
00039 addToRunTimeSelectionTable
00040 (
00041 motionDiffusivity,
00042 inverseFaceDistanceDiffusivity,
00043 Istream
00044 );
00045 }
00046
00047
00048
00049
00050 Foam::inverseFaceDistanceDiffusivity::inverseFaceDistanceDiffusivity
00051 (
00052 const fvMotionSolver& mSolver,
00053 Istream& mdData
00054 )
00055 :
00056 uniformDiffusivity(mSolver, mdData),
00057 patchNames_(mdData)
00058 {
00059 correct();
00060 }
00061
00062
00063
00064
00065 Foam::inverseFaceDistanceDiffusivity::~inverseFaceDistanceDiffusivity()
00066 {}
00067
00068
00069
00070
00071 void Foam::inverseFaceDistanceDiffusivity::correct()
00072 {
00073 const polyMesh& mesh = mSolver().mesh();
00074 const polyBoundaryMesh& bdry = mesh.boundaryMesh();
00075
00076 labelHashSet patchSet(bdry.size());
00077
00078 label nPatchFaces = 0;
00079
00080 forAll (patchNames_, i)
00081 {
00082 label pID = bdry.findPatchID(patchNames_[i]);
00083
00084 if (pID > -1)
00085 {
00086 patchSet.insert(pID);
00087 nPatchFaces += bdry[pID].size();
00088 }
00089 }
00090
00091 List<wallPoint> faceDist(nPatchFaces);
00092 labelList changedFaces(nPatchFaces);
00093
00094 nPatchFaces = 0;
00095
00096 forAllConstIter(labelHashSet, patchSet, iter)
00097 {
00098 const polyPatch& patch = bdry[iter.key()];
00099
00100 const vectorField::subField fc = patch.faceCentres();
00101
00102 forAll(fc, patchFaceI)
00103 {
00104 changedFaces[nPatchFaces] = patch.start() + patchFaceI;
00105
00106 faceDist[nPatchFaces] = wallPoint(fc[patchFaceI], 0);
00107
00108 nPatchFaces++;
00109 }
00110 }
00111 faceDist.setSize(nPatchFaces);
00112 changedFaces.setSize(nPatchFaces);
00113
00114 MeshWave<wallPoint> waveInfo
00115 (
00116 mesh,
00117 changedFaces,
00118 faceDist,
00119 mesh.globalData().nTotalCells()
00120 );
00121
00122 const List<wallPoint>& faceInfo = waveInfo.allFaceInfo();
00123 const List<wallPoint>& cellInfo = waveInfo.allCellInfo();
00124
00125 for (label faceI=0; faceI<mesh.nInternalFaces(); faceI++)
00126 {
00127 scalar dist = faceInfo[faceI].distSqr();
00128
00129 faceDiffusivity_[faceI] = 1.0/sqrt(dist);
00130 }
00131
00132 forAll(faceDiffusivity_.boundaryField(), patchI)
00133 {
00134 fvsPatchScalarField& bfld = faceDiffusivity_.boundaryField()[patchI];
00135
00136 const unallocLabelList& faceCells = bfld.patch().faceCells();
00137
00138 if (patchSet.found(patchI))
00139 {
00140 forAll(bfld, i)
00141 {
00142 scalar dist = cellInfo[faceCells[i]].distSqr();
00143 bfld[i] = 1.0/sqrt(dist);
00144 }
00145 }
00146 else
00147 {
00148 label start = bfld.patch().patch().start();
00149
00150 forAll(bfld, i)
00151 {
00152 scalar dist = faceInfo[start+i].distSqr();
00153 bfld[i] = 1.0/sqrt(dist);
00154 }
00155 }
00156 }
00157 }
00158
00159
00160
Copyright © 2000-2009 OpenCFD Ltd