5 #ifndef _PHONONCONVECTIONDISCRETIZATION_H_
6 #define _PHONONCONVECTIONDISCRETIZATION_H_
17 template<
class X,
class Diag,
class OffDiag>
41 const bool useCentralDifference=
false) :
71 const XArray& xCell =
dynamic_cast<const XArray&
>(xField[cVarIndex]);
72 XArray& rCell =
dynamic_cast<XArray&
>(rField[cVarIndex]);
84 shared_ptr<TArray> gridFluxPtr(
new TArray(nFaces));
85 TArray& gridFlux = *gridFluxPtr;
88 for(
int f=0; f<nFaces; f++)
90 const int c0 = faceCells(f,0);
91 const int c1 = faceCells(f,1);
99 varFlux = faceCFlux*xCell[c0];
100 diag[c0] -= faceCFlux;
105 varFlux = faceCFlux*xCell[c1];
106 diag[c1] += faceCFlux;
110 rCell[c0] -= varFlux;
111 rCell[c1] += varFlux;
117 for(
int f=0; f<nFaces; f++)
119 const int c0 = faceCells(f,0);
120 const int c1 = faceCells(f,1);
130 X varFlux =0.5*faceCFlux*(xCell[c0] + xCell[c0]);
132 rCell[c0] -= varFlux;
133 rCell[c1] += varFlux;
142 diag[c0] -= 0.5*faceCFlux;
144 diag[c1] += 0.5*faceCFlux;
153 diag[c0] -= faceCFlux;
158 diag[c1] += faceCFlux;
165 for(
int f=0; f<nFaces; f++)
167 const int c0 = faceCells(f,0);
168 const int c1 = faceCells(f,1);
177 varFlux = faceCFlux*xCell[c0];
178 diag[c0] -= faceCFlux;
183 varFlux = faceCFlux*xCell[c1];
184 diag[c1] += faceCFlux;
188 rCell[c0] -= varFlux;
189 rCell[c1] += varFlux;
CRMatrix< Diag, OffDiag, X > CCMatrix
Matrix & getMatrix(const Index &rowIndex, const Index &colIndex)
bool hasArray(const StorageSite &s) const
PhononConvectionDiscretization(const MeshList &meshes, const GeomFields &geomFields, Field &varField, const VectorT3 groupvel, const bool useCentralDifference=false)
CCMatrix::PairWiseAssembler CCAssembler
CCMatrix::DiagArray DiagArray
OffDiag & getCoeff10(const int np)
Array< Diag > & getDiag()
void discretize(const Mesh &mesh, MultiFieldMatrix &mfmatrix, MultiField &xField, MultiField &rField)
const CRConnectivity & getAllFaceCells() const
const bool _useCentralDifference
pair< const Field *, const StorageSite * > ArrayIndex
const StorageSite & getFaces() const
const StorageSite & getCells() const
OffDiag & getCoeff01(const int np)
const GeomFields & _geomFields
PairWiseAssembler & getPairWiseAssembler(const CRConnectivity &pairs)
Array< VectorT3 > VectorT3Array
NumTypeTraits< X >::T_Scalar T_Scalar
Vector< T_Scalar, 3 > VectorT3
vector< Mesh * > MeshList