6 #ifndef _TIMEDERIVATIVEDISCRETIZATION_H_
7 #define _TIMEDERIVATIVEDISCRETIZATION_H_
17 template<
class X,
class Diag,
class OffDiag>
36 const Field& densityField,
68 XArray& rCell =
dynamic_cast<XArray&
>(rField[cVarIndex]);
84 const TArray& cellVolumeN1 =
86 const TArray& cellVolumeN2 =
88 for(
int c=0; c<nCells; c++)
90 const T_Scalar rhoVbydT = density[c]*cellVolume[c]/
_dT;
92 const T_Scalar term1 = onePointFive*cellVolume[c];
93 const T_Scalar term2 = two*cellVolumeN1[c];
94 const T_Scalar term3 = pointFive*cellVolumeN2[c];
95 rCell[c] -= rhobydT*(term1*x[c]- term2*xN1[c]
97 diag[c] -= rhoVbydT*onePointFive;
102 for(
int c=0; c<nCells; c++)
104 const T_Scalar rhoVbydT = density[c]*cellVolume[c]/
_dT;
105 rCell[c] -= rhoVbydT*(onePointFive*x[c]- two*xN1[c]
107 diag[c] -= rhoVbydT*onePointFive;
115 const TArray& cellVolumeN1 =
117 for(
int c=0; c<nCells; c++)
119 const T_Scalar rhoVbydT = density[c]*cellVolume[c]/
_dT;
121 rCell[c] -= rhobydT*(cellVolume[c]*x[c]
122 - cellVolumeN1[c]*xN1[c]);
135 for(
int c=0; c<nCells; c++)
137 const T_Scalar rhoVbydT = density[c]*cellVolume[c]/
_dT;
141 rCell[c] -= rhoVbydT*(x[c] - xN1[c]);
143 rCell[c] -= rhoVbydT*(x[c] );
149 for(
int c=0; c<nCells; c++)
151 const T_Scalar rhoVbydT = density[c]*cellVolume[c]/
_dT;
152 rCell[c] -= rhoVbydT*(x[c]- xN1[c]);
Matrix & getMatrix(const Index &rowIndex, const Index &colIndex)
const Field & _densityField
bool hasArray(const StorageSite &s) const
Array< Diag > & getDiag()
const GeomFields & _geomFields
pair< const Field *, const StorageSite * > ArrayIndex
const Field & _varN2Field
const StorageSite & getCells() const
const Field & _varN1Field
NumTypeTraits< X >::T_Scalar T_Scalar
CCMatrix::DiagArray DiagArray
CRMatrix< Diag, OffDiag, X > CCMatrix
void discretize(const Mesh &mesh, MultiFieldMatrix &mfmatrix, MultiField &xField, MultiField &rField)
TimeDerivativeDiscretization(const MeshList &meshes, const GeomFields &geomFields, Field &varField, Field &varN1Field, Field &varN2Field, const Field &densityField, const T_Scalar dT)
vector< Mesh * > MeshList
CCMatrix::PairWiseAssembler CCAssembler