extendedUpwindCellToFaceStencilTemplates.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 "extendedCellToFaceStencil.H"
00028
00029
00030
00031 template<class Type>
00032 Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >
00033 Foam::extendedUpwindCellToFaceStencil::weightedSum
00034 (
00035 const surfaceScalarField& phi,
00036 const GeometricField<Type, fvPatchField, volMesh>& fld,
00037 const List<List<scalar> >& ownWeights,
00038 const List<List<scalar> >& neiWeights
00039 ) const
00040 {
00041 const fvMesh& mesh = fld.mesh();
00042
00043
00044 List<List<Type> > ownFld;
00045 collectData(ownMap(), ownStencil(), fld, ownFld);
00046 List<List<Type> > neiFld;
00047 collectData(neiMap(), neiStencil(), fld, neiFld);
00048
00049 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > tsfCorr
00050 (
00051 new GeometricField<Type, fvsPatchField, surfaceMesh>
00052 (
00053 IOobject
00054 (
00055 fld.name(),
00056 mesh.time().timeName(),
00057 mesh,
00058 IOobject::NO_READ,
00059 IOobject::NO_WRITE,
00060 false
00061 ),
00062 mesh,
00063 dimensioned<Type>
00064 (
00065 fld.name(),
00066 fld.dimensions(),
00067 pTraits<Type>::zero
00068 )
00069 )
00070 );
00071 GeometricField<Type, fvsPatchField, surfaceMesh>& sf = tsfCorr();
00072
00073
00074 for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
00075 {
00076 if (phi[faceI] > 0)
00077 {
00078
00079 const List<Type>& stField = ownFld[faceI];
00080 const List<scalar>& stWeight = ownWeights[faceI];
00081
00082 forAll(stField, i)
00083 {
00084 sf[faceI] += stField[i]*stWeight[i];
00085 }
00086 }
00087 else
00088 {
00089 const List<Type>& stField = neiFld[faceI];
00090 const List<scalar>& stWeight = neiWeights[faceI];
00091
00092 forAll(stField, i)
00093 {
00094 sf[faceI] += stField[i]*stWeight[i];
00095 }
00096 }
00097 }
00098
00099
00100
00101 typename GeometricField<Type, fvsPatchField, surfaceMesh>::
00102 GeometricBoundaryField& bSfCorr = sf.boundaryField();
00103
00104 forAll(bSfCorr, patchi)
00105 {
00106 fvsPatchField<Type>& pSfCorr = bSfCorr[patchi];
00107
00108 if (pSfCorr.coupled())
00109 {
00110 label faceI = pSfCorr.patch().patch().start();
00111
00112 forAll(pSfCorr, i)
00113 {
00114 if (phi.boundaryField()[patchi][i] > 0)
00115 {
00116
00117 const List<Type>& stField = ownFld[faceI];
00118 const List<scalar>& stWeight = ownWeights[faceI];
00119
00120 forAll(stField, j)
00121 {
00122 pSfCorr[i] += stField[j]*stWeight[j];
00123 }
00124 }
00125 else
00126 {
00127 const List<Type>& stField = neiFld[faceI];
00128 const List<scalar>& stWeight = neiWeights[faceI];
00129
00130 forAll(stField, j)
00131 {
00132 pSfCorr[i] += stField[j]*stWeight[j];
00133 }
00134 }
00135 faceI++;
00136 }
00137 }
00138 }
00139
00140 return tsfCorr;
00141 }
00142
00143
00144
Copyright © 2000-2009 OpenCFD Ltd