6 #ifndef _TIMEDERIVATIVESTRUCTUREDISCRETIZATION_H_
7 #define _TIMEDERIVATIVESTRUCTUREDISCRETIZATION_H_
17 template<
class X,
class Diag,
class OffDiag>
37 const Field& densityField,
38 const Field& volume0Field,
39 const bool& variableTimeStep,
69 const TArray& cellVolume0 =
81 XArray& rCell =
dynamic_cast<XArray&
>(rField[cVarIndex]);
100 for(
int c=0; c<nCells; c++)
102 const T_Scalar rhoVbydT2 = density[c]*cellVolume0[c]/_dT2;
103 rCell[c] -= rhoVbydT2*(two*x[c] - five*xN1[c] + four*xN2[c]
105 diag[c] -= two*rhoVbydT2;
110 for(
int c=0; c<nCells; c++)
112 const T_Scalar rhoVbydT2 = density[c]*cellVolume0[c]/_dT2;
113 rCell[c] -= rhoVbydT2*(x[c]- two*xN1[c]
115 diag[c] -= rhoVbydT2;
126 T_Scalar c1 = (two*a*b*(pow(a,two)-pow(b,two))+two*b*(pow(b,two)-one)-two*a*(pow(a,two)-one))/
127 (a*b*(a-one)*(b-one)*(a-b));
128 T_Scalar c2 = -two*(a+b)/((a-1)*(b-1));
129 T_Scalar c3 = -two*(b+one)/(a*(a-b)*(a-one));
130 T_Scalar c4 = two*(a+one)/(b*(a-b)*(b-one));
132 for(
int c=0; c<nCells; c++)
134 const T_Scalar rhoVbydT2 = density[c]*cellVolume0[c]/_dT2;
135 rCell[c] -= rhoVbydT2*(c1*x[c] + c2*xN1[c] + c3*xN2[c]
137 diag[c] -= c1*rhoVbydT2;
145 for(
int c=0; c<nCells; c++)
147 const T_Scalar rhoVbydT2 = density[c]*cellVolume0[c]/_dT2;
148 rCell[c] -= rhoVbydT2*(c1*x[c] + c2*xN1[c]
150 diag[c] -= c1*rhoVbydT2;
172 const TArray& cellVolume0 =
181 XArray& rCell =
dynamic_cast<XArray&
>(rField[cVarIndex]);
182 XArray& deltaCell =
dynamic_cast<XArray&
>(deltaField[cVarIndex]);
199 for(
int c=0; c<nCells; c++)
201 const T_Scalar rhoVbydT2 = density[c]*cellVolume0[c]/_dT2;
202 rCell[c] -= rhoVbydT2*(two*x[c] - five*xN1[c] + four*xN2[c]
206 deltaCell[c] = -rCell[c]/diag;
211 for(
int c=0; c<nCells; c++)
213 const T_Scalar rhoVbydT2 = density[c]*cellVolume0[c]/_dT2;
214 rCell[c] -= rhoVbydT2*(x[c]- two*xN1[c]
217 deltaCell[c] = -rCell[c]/diag;
Matrix & getMatrix(const Index &rowIndex, const Index &colIndex)
TimeDerivativeStructureDiscretization(const MeshList &meshes, const GeomFields &geomFields, Field &varField, Field &varN1Field, Field &varN2Field, Field &varN3Field, const Field &densityField, const Field &volume0Field, const bool &variableTimeStep, const T_Scalar dT, const T_Scalar dTN1, const T_Scalar dTN2)
bool hasArray(const StorageSite &s) const
CRMatrix< Diag, OffDiag, X > CCMatrix
Array< Diag > & getDiag()
void discretize(const Mesh &mesh, MultiFieldMatrix &mfmatrix, MultiField &xField, MultiField &rField)
const Field & _densityField
CCMatrix::DiagArray DiagArray
CCMatrix::PairWiseAssembler CCAssembler
NumTypeTraits< X >::T_Scalar T_Scalar
pair< const Field *, const StorageSite * > ArrayIndex
const Field & _varN1Field
const Field & _varN3Field
void explicitAdvance(const Mesh &mesh, MultiField &xField, MultiField &rField, MultiField &deltaField)
const StorageSite & getCells() const
const Field & _varN2Field
const Field & _volume0Field
const bool _variableTimeStep
const GeomFields & _geomFields
vector< Mesh * > MeshList