65 const TArray& convectingFlux =
67 const TArray& continuityResidual =
76 CCAssembler& assembler = matrix.getPairWiseAssembler(faceCells);
79 const XArray& xCell =
dynamic_cast<const XArray&
>(xField[cVarIndex]);
80 XArray& rCell =
dynamic_cast<XArray&
>(rField[cVarIndex]);
89 shared_ptr<TArray> gridFluxPtr(
new TArray(nFaces));
90 TArray& gridFlux = *gridFluxPtr;
93 for(
int f=0; f<nFaces; f++)
95 const int c0 = faceCells(f,0);
96 const int c1 = faceCells(f,1);
97 const T_Scalar faceCFlux = convectingFlux[f] - gridFlux[f];
102 varFlux = faceCFlux*xCell[c0];
103 diag[c0] -= faceCFlux;
104 assembler.getCoeff10(f) += faceCFlux;
108 varFlux = faceCFlux*xCell[c1];
109 diag[c1] += faceCFlux;
110 assembler.getCoeff01(f)-= faceCFlux;
113 rCell[c0] -= varFlux;
114 rCell[c1] += varFlux;
120 for(
int f=0; f<nFaces; f++)
122 const int c0 = faceCells(f,0);
123 const int c1 = faceCells(f,1);
124 const T_Scalar faceCFlux = convectingFlux[f];
131 X varFlux =0.5*faceCFlux*(xCell[c0] + xCell[c0]);
133 rCell[c0] -= varFlux;
134 rCell[c1] += varFlux;
143 diag[c0] -= 0.5*faceCFlux;
144 assembler.getCoeff10(f) -= 0.5*faceCFlux;
145 diag[c1] += 0.5*faceCFlux;
146 assembler.getCoeff01(f) += 0.5*faceCFlux;
154 diag[c0] -= faceCFlux;
155 assembler.getCoeff10(f) += faceCFlux;
159 diag[c1] += faceCFlux;
160 assembler.getCoeff01(f)-= faceCFlux;
166 for(
int f=0; f<nFaces; f++)
168 const int c0 = faceCells(f,0);
169 const int c1 = faceCells(f,1);
170 const T_Scalar faceCFlux = convectingFlux[f];
176 varFlux = faceCFlux*xCell[c0];
177 diag[c0] -= faceCFlux;
178 assembler.getCoeff10(f) += faceCFlux;
182 varFlux = faceCFlux*xCell[c1];
183 diag[c1] += faceCFlux;
184 assembler.getCoeff01(f)-= faceCFlux;
187 rCell[c0] -= varFlux;
188 rCell[c1] += varFlux;
195 for(
int c=0;c<nCells;c++)
197 const T_Scalar cImb = continuityResidual[c];
const bool _useCentralDifference
Matrix & getMatrix(const Index &rowIndex, const Index &colIndex)
bool hasArray(const StorageSite &s) const
NumTypeTraits< X >::T_Scalar T_Scalar
const GeomFields & _geomFields
CCMatrix::DiagArray DiagArray
const CRConnectivity & getAllFaceCells() const
pair< const Field *, const StorageSite * > ArrayIndex
CCMatrix::PairWiseAssembler CCAssembler
const StorageSite & getFaces() const
const StorageSite & getCells() const
CRMatrix< Diag, OffDiag, X > CCMatrix
const Field & _convectingFluxField
const Field & _continuityResidualField