5 #ifndef _MOMENTUMPRESSUREGRADIENTDISCRETIZATION_H_
6 #define _MOMENTUMPRESSUREGRADIENTDISCRETIZATION_H_
83 for(
int f=0; f<nFaces; f++)
85 const int c0 = faceCells(f,0);
86 const int c1 = faceCells(f,1);
87 pGradCell[c0].accumulate(faceArea[f],facePressure[f]);
88 pGradCell[c1].accumulate(faceArea[f],-facePressure[f]);
91 for(
int c=0; c<nCells; c++)
92 pGradCell[c] /= cellVolume[c];
100 const int faceCount = faces.
getCount();
106 const TArray& faceAreaMag =
108 for(
int f=0; f<faceCount; f++)
110 const int c0 = faceCells(f,0);
111 const int c1 = faceCells(f,1);
112 const VectorT3 en = faceArea[f]/faceAreaMag[f];
118 for(
int f=0; f<faceCount; f++)
120 const int c0 = faceCells(f,0);
121 const int c1 = faceCells(f,1);
123 pGradCell[c1] = pGradCell[c0];
129 for(
int c=0; c<nCells; c++)
131 rCell[c][0] -= cellVolume[c]*pGradCell[c][0];
132 rCell[c][1] -= cellVolume[c]*pGradCell[c][1];
133 rCell[c][2] -= cellVolume[c]*pGradCell[c][2];
143 dynamic_cast<VPMatrix&
>(mfmatrix.
getMatrix(vIndex,pIndex));
157 for(
int c=0; c<nCells; c++)
159 for(
int nnb=row[c]; nnb<row[c+1]; nnb++)
161 const VPCoeff& coeff = gradMatrixCoeffs[nnb];
162 vpDiag[c] += coeff*cellVolume[c];
163 vpOffDiag[nnb] -= coeff*cellVolume[c];
Vector< T_Scalar, 3 > VectorT3
const FaceGroupList & getBoundaryFaceGroups() const
const Array< int > & getRow() const
Matrix & getMatrix(const Index &rowIndex, const Index &colIndex)
shared_ptr< FaceGroup > FaceGroupPtr
GradMatrix::Coord VPCoeff
NumTypeTraits< X >::T_Scalar T_Scalar
void reflectGradient(Gradient< T > &gr, const Gradient< T > &g0, const Vector< T, 3 > &en)
bool hasMatrix(const Index &rowIndex, const Index &colIndex) const
GradientMatrix< X > GradMatrix
MomentumPressureGradientDiscretization(const MeshList &meshes, const GeomFields &geomFields, FlowFields &flowFields, GradientModel< X > &pressureGradientModel)
const CRConnectivity & getAllFaceCells() const
Array< Coord > & getCoeffs()
const GeomFields & _geomFields
pair< const Field *, const StorageSite * > ArrayIndex
const StorageSite & getFaces() const
const StorageSite & getCells() const
void discretize(const Mesh &mesh, MultiFieldMatrix &mfmatrix, MultiField &, MultiField &rField)
const CRConnectivity & getFaceCells(const StorageSite &site) const
MatrixTraitHelper< X >::T_Matrix CCMatrix
Array< VectorT3 > VectorT3Array
GradientModel< X > & _pressureGradientModel
vector< Mesh * > MeshList