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