47 template <
class vector_type>
48 void stiff (
const Real sigma_l,
const Real sigma_t,
const vector_type& cos, MatrixElemental& elmat,
const CurrentFE& fe,
const DOF& dof,
UInt iblock,
UInt jblock);
50 template <
class reduced_sigma,
class vector_type>
51 void stiff (
const reduced_sigma& red_sigma,
const Real sigma_l,
const Real sigma_t,
const vector_type& cos, MatrixElemental& elmat,
const CurrentFE& fe,
const DOF& dof,
UInt iblock,
UInt jblock,
ID id = 0);
53 template <
class reduced_sigma>
54 void stiff ( reduced_sigma red_sigma,
const Real D, MatrixElemental& elmat,
const CurrentFE& fe,
const DOF& dof,
UInt iblock,
UInt jblock,
ID id = 0);
56 template <
class vector_type>
58 const DOF& dof,
UInt iblock,
UInt jblock,
const Real beta);
64 template <
class vector_type>
65 void stiffNL (
const vector_type& U,
const Real sigma_l,
const Real sigma_t,
66 const vector_type& cos, MatrixElemental& elmat,
const CurrentFE& fe,
67 const DOF& dof,
UInt iblock,
UInt jblock,
const Real beta);
69 template <
class vector_type>
70 void stiff (
const Real sigma_l,
const Real sigma_t,
const vector_type& cos, MatrixElemental& elmat,
const CurrentFE& fe,
const DOF& dof,
UInt iblock,
UInt jblock)
75 MatrixElemental::matrix_view mat = elmat.block ( iblock, jblock );
77 UInt i, icoor, jcoor, ig;
80 UInt dim = dof.numTotalDof();
89 u_x[ig] = u_y[ig] = u_z[ig] = 0;
92 u_x[ig] += cos[dof.localToGlobalMap (eleId, i)] * fe.phi (i, ig);
93 u_y[ig] += cos[dof.localToGlobalMap (eleId, i) + dim] * fe.phi (i, ig);
94 u_z[ig] += cos[dof.localToGlobalMap (eleId, i) + 2 * dim] * fe.phi (i, ig);
110 Real norm = std::sqrt (a_l[0] * a_l[0] + a_l[1] * a_l[1] + a_l[2] * a_l[2]);
111 a_l[0] = a_l[0] / norm;
112 a_l[1] = a_l[1] / norm;
113 a_l[2] = a_l[2] / norm;
120 for ( jcoor = 0; jcoor < fe.nbLocalCoor(); jcoor++ )
121 s += fe.phiDer ( iloc, icoor, ig ) * fe.phiDer ( iloc, jcoor, ig ) *
122 fe.weightDet ( ig ) * (sigma_l - sigma_t) * a_l[icoor] * a_l[jcoor];
126 mat ( iloc, iloc ) += s;
144 Real norm = std::sqrt (a_l[0] * a_l[0] + a_l[1] * a_l[1] + a_l[2] * a_l[2]);
145 a_l[0] = a_l[0] / norm;
146 a_l[1] = a_l[1] / norm;
147 a_l[2] = a_l[2] / norm;
153 for ( jcoor = 0; jcoor < fe.nbLocalCoor(); jcoor++ )
154 s += fe.phiDer ( iloc, icoor, ig ) * fe.phiDer ( jloc, jcoor, ig ) *
155 fe.weightDet ( ig ) * (sigma_l - sigma_t) * a_l[icoor] * a_l[jcoor];
159 mat ( iloc, jloc ) += s;
160 mat ( jloc, iloc ) += s;
165 template <
class reduced_sigma,
class vector_type>
166 void stiff (
const reduced_sigma& red_sigma,
const Real sigma_l,
const Real sigma_t,
const vector_type& cos, MatrixElemental& elmat,
const CurrentFE& fe,
const DOF& dof,
UInt iblock,
UInt jblock,
ID id)
170 MatrixElemental::matrix_view mat = elmat.block ( iblock, jblock );
172 UInt i, icoor, jcoor, ig;
179 UInt dim = dof.numTotalDof();
186 u_x[ig] = u_y[ig] = u_z[ig] = 0;
189 u_x[ig] += cos[dof.localToGlobalMap (eleId, i)] * fe.phi (i, ig);
190 u_y[ig] += cos[dim + dof.localToGlobalMap (eleId, i)] * fe.phi (i, ig);
191 u_z[ig] += cos[2 * dim + dof.localToGlobalMap (eleId, i)] * fe.phi (i, ig);
207 Real norm = std::sqrt (a_l[0] * a_l[0] + a_l[1] * a_l[1] + a_l[2] * a_l[2]);
208 a_l[0] = a_l[0] / norm;
209 a_l[1] = a_l[1] / norm;
210 a_l[2] = a_l[2] / norm;
217 fe
.weightDet ( ig
) * red_sigma (x, y, z, 0, id, sigma_t);
218 for ( jcoor = 0; jcoor < fe.nbLocalCoor(); jcoor++ )
219 s += fe.phiDer ( iloc, icoor, ig ) * fe.phiDer ( iloc, jcoor, ig ) *
220 fe.weightDet ( ig ) * (red_sigma (x, y, z, 0, id, sigma_l) - red_sigma (x, y, z, 0, id, sigma_t) ) * a_l[icoor] * a_l[jcoor];
224 mat ( iloc, iloc ) += s;
240 Real norm = std::sqrt (a_l[0] * a_l[0] + a_l[1] * a_l[1] + a_l[2] * a_l[2]);
241 a_l[0] = a_l[0] / norm;
242 a_l[1] = a_l[1] / norm;
243 a_l[2] = a_l[2] / norm;
249 fe
.weightDet ( ig
) * red_sigma (x, y, z, 0, id, sigma_t);
250 for ( jcoor = 0; jcoor < fe.nbLocalCoor(); jcoor++ )
251 s += fe.phiDer ( iloc, icoor, ig ) * fe.phiDer ( jloc, jcoor, ig ) *
252 fe.weightDet ( ig ) * (red_sigma (x, y, z, 0, id, sigma_l) - red_sigma (x, y, z, 0, id, sigma_t) ) * a_l[icoor] * a_l[jcoor];
256 mat ( iloc, jloc ) += s;
257 mat ( jloc, iloc ) += s;
262 template <
class reduced_sigma>
268 MatrixElemental::matrix_view mat = elmat.block ( iblock, jblock );
285 mat ( iloc, iloc ) += s;
306 mat ( iloc, jloc ) += s;
307 mat ( jloc, iloc ) += s;
312 template <
class vector_type>
314 const DOF& dof,
UInt iblock,
UInt jblock,
const Real beta)
316 MatrixElemental::matrix_view mat = elmat.block ( iblock, jblock );
317 Int iloc, jloc, i, icoor, jcoor, ig;
320 UInt dim = dof.numTotalDof();
322 std::vector<Real> locU (fe.nbFEDof() );
323 std::vector<Real> MM_l (fe.nbLocalCoor() );
328 locU[i] = U[dof.localToGlobalMap (eleId, i)];
343 bPt += locU[iu] * fe.phi (iu, ig);
345 MM_l[0] = 1.0 / (1.0 + beta * (bPt + 84.0) / (184.0 + bPt) + 0.001 * bPt);
346 MM_l[1] = 1.0 + beta * (bPt + 84.0) / (184.0 + bPt) + 0.001 * bPt;
347 MM_l[2] = 1.0 + beta * (bPt + 84.0) / (184.0 + bPt) + 0.001 * bPt;
351 s += fe.phiDer ( iloc, icoor, ig ) * fe.phiDer ( iloc, icoor, ig ) *
352 fe.weightDet ( ig ) * MM_l[icoor];
355 mat ( iloc, iloc ) += coef * s;
371 bPt += locU[iu] * fe.phi (iu, ig);
373 MM_l[0] = 1.0 / (1.0 + beta * (bPt + 84.0) / (184.0 + bPt) + 0.001 * bPt);
374 MM_l[1] = 1.0 + beta * (bPt + 84.0) / (184.0 + bPt) + 0.001 * bPt;
375 MM_l[2] = 1.0 + beta * (bPt + 84.0) / (184.0 + bPt) + 0.001 * bPt;
379 s += fe.phiDer ( iloc, icoor, ig ) * fe.phiDer ( jloc, icoor, ig ) *
380 fe.weightDet ( ig ) * MM_l[icoor];
384 mat ( iloc, jloc ) += coef_s;
385 mat ( jloc, iloc ) += coef_s;
490 template <
class vector_type>
492 const vector_type& cos, MatrixElemental& elmat,
const CurrentFE& fe,
493 const DOF& dof,
UInt iblock,
UInt jblock,
const Real beta)
495 MatrixElemental::matrix_view mat = elmat.block ( iblock, jblock );
497 UInt i, icoor, jcoor, ig;
500 UInt dim = dof.numTotalDof();
512 u_x[ig] = u_y[ig] = u_z[ig] = 0;
515 locU[i] = U[dof.localToGlobalMap (eleId, i)];
516 u_x[ig] += cos[dof.localToGlobalMap (eleId, i)] * fe.phi (i, ig);
517 u_y[ig] += cos[dof.localToGlobalMap (eleId, i) + dim] * fe.phi (i, ig);
518 u_z[ig] += cos[dof.localToGlobalMap (eleId, i) + 2 * dim] * fe.phi (i, ig);
534 bPt += locU[iu] * fe.phi (iu, ig);
536 MM_l[0] = 1.0 / (1.0 + beta * (bPt + 84.0) / (184.0 + bPt) + 0.001 * bPt);
537 MM_l[1] = 1.0 + beta * (bPt + 84.0) / (184.0 + bPt) + 0.001 * bPt;
538 MM_l[2] = 1.0 + beta * (bPt + 84.0) / (184.0 + bPt) + 0.001 * bPt;
542 Real norm = std::sqrt (a_l[0] * a_l[0] + a_l[1] * a_l[1] + a_l[2] * a_l[2]);
543 a_l[0] = a_l[0] / norm;
544 a_l[1] = a_l[1] / norm;
545 a_l[2] = a_l[2] / norm;
550 s += fe.phiDer ( iloc, icoor, ig ) * fe.phiDer ( iloc, icoor, ig ) *
551 fe.weightDet ( ig ) * sigma_t * MM_l[icoor];
552 for ( jcoor = 0; jcoor < fe.nbLocalCoor(); jcoor++ )
553 s += fe.phiDer ( iloc, icoor, ig ) * fe.phiDer ( iloc, jcoor, ig ) *
554 fe.weightDet ( ig ) * (sigma_l - sigma_t) * a_l[icoor] * a_l[jcoor];
558 mat ( iloc, iloc ) += s;
576 bPt += locU[iu] * fe.phi (iu, ig);
578 MM_l[0] = 1.0 / (1.0 + beta * (bPt + 84.0) / (184.0 + bPt) + 0.001 * bPt);
579 MM_l[1] = 1.0 + beta * (bPt + 84.0) / (184.0 + bPt) + 0.001 * bPt;
580 MM_l[2] = 1.0 + beta * (bPt + 84.0) / (184.0 + bPt) + 0.001 * bPt;
584 Real norm = std::sqrt (a_l[0] * a_l[0] + a_l[1] * a_l[1] + a_l[2] * a_l[2]);
585 a_l[0] = a_l[0] / norm;
586 a_l[1] = a_l[1] / norm;
587 a_l[2] = a_l[2] / norm;
591 s += fe.phiDer ( iloc, icoor, ig ) * fe.phiDer ( jloc, icoor, ig ) *
592 fe.weightDet ( ig ) * sigma_t * MM_l[icoor];
593 for ( jcoor = 0; jcoor < fe.nbLocalCoor(); jcoor++ )
594 s += fe.phiDer ( iloc, icoor, ig ) * fe.phiDer ( jloc, jcoor, ig ) *
595 fe.weightDet ( ig ) * (sigma_l - sigma_t) * a_l[icoor] * a_l[jcoor];
599 mat ( iloc, jloc ) += s;
600 mat ( jloc, iloc ) += s;
int patternFirst(int i) const
patternFirst(i): row index in the element matrix of the i-th term of the pattern
void stiffNL(vector_type &U, Real coef, MatrixElemental &elmat, const CurrentFE &fe, const DOF &dof, UInt iblock, UInt jblock, const Real beta)
void stiff(const reduced_sigma &red_sigma, const Real sigma_l, const Real sigma_t, const vector_type &cos, MatrixElemental &elmat, const CurrentFE &fe, const DOF &dof, UInt iblock, UInt jblock, ID id=0)
int32_type Int
Generic integer data.
UInt nbUpper() const
Getter for the number of entries in the pattern.
UInt nbDiag() const
Getter for the diagonal entries in the pattern.
UInt nbLocalCoor() const
Getter for the number of local coordinates.
void stiff(reduced_sigma red_sigma, const Real D, MatrixElemental &elmat, const CurrentFE &fe, const DOF &dof, UInt iblock, UInt jblock, ID id=0)
Real phiDer(UInt node, UInt derivative, UInt quadNode) const
Old accessor, use dphi instead.
void stiff(const Real sigma_l, const Real sigma_t, const vector_type &cos, MatrixElemental &elmat, const CurrentFE &fe, const DOF &dof, UInt iblock, UInt jblock)
void coorQuadPt(Real &x, Real &y, Real &z, int ig) const
void stiffNL(const vector_type &U, const Real sigma_l, const Real sigma_t, const vector_type &cos, MatrixElemental &elmat, const CurrentFE &fe, const DOF &dof, UInt iblock, UInt jblock, const Real beta)
double Real
Generic real data.
CurrentFE - A primordial class for the assembly of the local matrices/vectors retaining the values on...
UInt nbFEDof() const
Getter for the number of nodes.
int patternSecond(int i) const
patternSecond(i): column index in the element matrix of the i-th term of the pattern ...
UInt currentLocalId() const
Getter for the local ID of the current cell.
Real weightDet(UInt quadNode) const
Old accessor, use wDetJacobian instead.
UInt nbQuadPt() const
Getter for the number of quadrature nodes.
uint32_type UInt
generic unsigned integer (used mainly for addressing)