36 #define ELEMOPER_CPP 1
38 #include <lifev/core/fem/AssemblyElemental.hpp> 39 #include <boost/multi_array.hpp> 48 const Real& coefficient,
58 for (
UInt iDof (0); iDof < nbFEDof; ++iDof)
61 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
63 localValue += massCFE
.phi (iDof
, iQuadPt
) 67 localValue *= coefficient;
70 mat_tmp (iDof, iDof) = localValue;
74 for (
UInt iDof (0); iDof < nbFEDof; ++iDof)
78 for (
UInt jDof (0); jDof < iDof; ++jDof)
83 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
85 localValue += massCFE
.phi (iDof
, iQuadPt
) 90 localValue *= coefficient;
93 mat_tmp (iDof, jDof) = localValue;
94 mat_tmp (jDof, iDof) = localValue;
99 for (
UInt iDim (0); iDim < fieldDim; ++iDim)
108 const Real& coefficient,
109 const UInt& fieldDim)
118 for (
UInt iDof (0); iDof < nbFEDof; ++iDof)
123 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
127 localValue += stiffCFE
.dphi (iDof
, iDim
, iQuadPt
) 132 localValue *= coefficient;
135 mat_tmp (iDof, iDof) = localValue;
139 for (
UInt iDof (0); iDof < nbFEDof ; ++iDof)
141 for (
UInt jDof (0); jDof < iDof; ++jDof)
146 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
150 localValue += stiffCFE
.dphi (iDof
, iDim
, iQuadPt
) 157 localValue *= coefficient;
160 mat_tmp (iDof, jDof) = localValue;
161 mat_tmp (jDof, iDof) = localValue;
166 for (
UInt iDim (0); iDim < fieldDim; ++iDim)
175 int iblock,
int jblock )
177 Real sum, sumDerivative;
193 sumDerivative += velicoor ( k ) * fe.dphi ( k, jblock, iq );
199 mat_icomp ( i, j ) += sum * coef;
207 const UInt& fieldDim)
214 for (
UInt iFDim (0); iFDim < fieldDim; ++iFDim)
218 for (
UInt iDofP (0); iDofP < nbPFEDof; ++iDofP)
220 for (
UInt iDofU (0); iDofU < nbUFEDof; ++iDofU)
223 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
225 localValue += uCFE
.dphi (iDofU
, iFDim
, iQuadPt
) 229 localView (iDofU, iDofP) -= localValue;
238 const UInt& fieldDim,
239 const Real& coefficient)
246 for (
UInt iFDim (0); iFDim < fieldDim; ++iFDim)
250 for (
UInt iDofP (0); iDofP < nbPFEDof; ++iDofP)
252 for (
UInt iDofU (0); iDofU < nbUFEDof; ++iDofU)
255 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
257 localValue += uCFE
.dphi (iDofU
, iFDim
, iQuadPt
) 261 localView (iDofP, iDofU) -= coefficient * localValue;
269 const Real& coefficient,
270 const UInt& fieldDim)
275 const Real newCoefficient (coefficient * 0.5);
279 for (
UInt iFDim (0); iFDim < fieldDim; ++iFDim )
281 for (
UInt jFDim (0); jFDim < fieldDim; ++jFDim )
285 for (
UInt iDof (0); iDof < nbFEDof; ++iDof )
287 for (
UInt jDof (0); jDof < nbFEDof; ++jDof )
290 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt )
292 localValue += stiffCFE
.dphi ( iDof
, jFDim
, iQuadPt
) 296 localView ( iDof, jDof ) += newCoefficient * localValue;
307 const UInt& fieldDim)
312 std::vector<Real> fValues (nbQuadPt, 0.0);
313 Real localValue (0.0);
316 for (
UInt iterFDim (0); iterFDim < fieldDim; ++iterFDim)
321 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
323 fValues[iQuadPt] = fun (t,
324 massRhsCFE.quadNode (iQuadPt, 0),
325 massRhsCFE.quadNode (iQuadPt, 1),
326 massRhsCFE.quadNode (iQuadPt, 2),
331 for (
UInt iDof (0); iDof < nbFEDof ; ++iDof)
336 for (
UInt iQuadPt (0); iQuadPt < nbQuadPt; ++iQuadPt)
338 localValue += fValues[iQuadPt]
339 * massRhsCFE.phi (iDof, iQuadPt)
340 * massRhsCFE.wDetJacobian (iQuadPt);
344 localView (iDof) = localValue;
363 int iblock,
int jblock )
383 mat ( iloc, iloc ) += coef * s;
398 mat ( iloc, jloc ) += coef_s;
399 mat ( jloc, iloc ) += coef_s;
406 int iblock,
int jblock,
UInt nb )
411 Matrix mat_tmp ( fe.nbFEDof(), fe.nbFEDof() );
415 mat_tmp = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
427 mat_tmp ( iloc, iloc ) += coef * s;
442 mat_tmp ( iloc, jloc ) += coef_s;
443 mat_tmp ( jloc, iloc ) += coef_s;
446 for (
UInt icomp = 0; icomp < nb; icomp++ )
452 mat_icomp ( iloc, iloc ) += mat_tmp ( iloc, iloc );
458 mat_icomp ( iloc, jloc ) += mat_tmp ( iloc, jloc );
459 mat_icomp ( jloc, iloc ) += mat_tmp ( jloc, iloc );
468 int iblock,
int jblock,
UInt nb )
473 Matrix mat_tmp ( fe.nbFEDof(), fe.nbFEDof() );
477 mat_tmp = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
487 s += coef[ig] * fe.phi ( iloc, ig ) * fe.phi ( iloc, ig ) * fe.weightDet ( ig );
489 mat_tmp ( iloc, iloc ) = s;
501 s += coef[ig] * fe.phi ( iloc, ig ) * fe.phi ( jloc, ig ) * fe.weightDet ( ig );
503 mat_tmp ( iloc, jloc ) += s;
504 mat_tmp ( jloc, iloc ) += s;
507 for (
UInt icomp = 0; icomp < nb; icomp++ )
513 mat_icomp ( iloc, iloc ) += mat_tmp ( iloc, iloc );
519 mat_icomp ( iloc, jloc ) += mat_tmp ( iloc, jloc );
520 mat_icomp ( jloc, iloc ) += mat_tmp ( jloc, iloc );
535 std::vector<Real> duk (fe.nbQuadPt() );
547 s += fe.phiDer ( i, icoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
566 s += duk[ ig ] * fe.phiDer ( i, k, ig ) * fe.phiDer ( j, k, ig ) * fe.weightDet ( ig );
569 mat_tmp ( i, j ) = coef * s;
586 boost::multi_array<Real, 3> guk (boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbQuadPt()]);
600 s += fe.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
602 guk[ icoor ][ jcoor ][ ig ] = s;
625 s += fe.phiDer ( j, jcoor, ig ) * guk[ icoor ][ k ][ ig ] * fe.phiDer ( i, k, ig ) * fe.weightDet ( ig );
627 mat ( i, j ) += coef * s;
639 std::vector<Real> gguk (fe.nbQuadPt() );
653 s1 += fe.phiDer ( i, l, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
672 s += gguk[ ig ] * fe.phiDer ( i, k, ig ) * fe.phiDer ( j, k, ig ) * fe.weightDet ( ig );
675 mat_tmp ( i, j ) = coef * s;
691 boost::multi_array<Real, 3> guk (
692 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbQuadPt()]);
706 s += fe.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
708 guk[ icoor ][ jcoor ][ ig ] = s;
730 s += guk[ jcoor ][ l ][ ig ] * fe.phiDer ( j, l, ig ) * guk[ icoor ][ k ][ ig ] * fe.phiDer (i, k, ig ) * fe.weightDet ( ig );
734 mat ( i, j ) += coef * s;
746 boost::multi_array<Real, 3> guk (
747 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbQuadPt()]);
763 s += fe.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
765 guk[ icoor ][ jcoor ][ ig ] = s;
789 s += guk[ icoor ][ jcoor ][ ig ] * fe.phiDer ( i, k, ig ) * fe.phiDer ( j, k, ig ) * fe.weightDet ( ig );
792 mat ( i, j ) += coef * s;
804 boost::multi_array<Real, 3> guk (
805 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbQuadPt()]);
821 s += fe.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
823 guk[ icoor ][ jcoor ][ ig ] = s;
847 s += guk[ icoor ][ k ][ ig ] * fe.phiDer ( j, k, ig ) * fe.phiDer ( i, jcoor, ig ) * fe.weightDet ( ig );
850 mat ( i, j ) += coef * s;
862 boost::multi_array<Real, 3> guk (
863 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbQuadPt()]);
879 s += fe.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
881 guk[ icoor ][ jcoor ][ ig ] = s;
901 s += guk[ l ][ k ][ ig ] * fe.phiDer ( i, k, ig ) * fe.phiDer ( j, l, ig ) * fe.weightDet ( ig );
905 mat_tmp ( i, j ) = coef * s;
921 boost::multi_array<Real, 3> guk (
922 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbQuadPt()]);
938 s += fe.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
940 guk[ icoor ][ jcoor ][ ig ] = s;
960 s += guk[ k ][ l ][ ig ] * fe.phiDer ( i, k, ig ) * fe.phiDer ( j, l, ig ) * fe.weightDet ( ig );
964 mat_tmp ( i, j ) = coef * s;
980 boost::multi_array<Real, 3> guk_gukT (
981 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbQuadPt()]);
1001 s += fe.phiDer ( i, n, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ] * fe.phiDer ( j, n, ig ) * uk_loc.vec() [ j + jcoor * fe.nbFEDof() ] ;
1005 guk_gukT[ icoor ][ jcoor ][ ig ] = s;
1028 s += fe.phiDer ( i, k, ig ) * guk_gukT[ icoor ][ jcoor ][ ig ] * fe.phiDer ( j, k, ig ) * fe.weightDet ( ig );
1030 mat ( i, j ) += coef * s;
1042 boost::multi_array<Real, 3> guk (
1043 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbQuadPt()]);
1059 s += fe.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
1061 guk[ icoor ][ jcoor ][ ig ] = s;
1087 s += guk[ icoor ][ l ][ ig ] * guk[ jcoor ][ k ][ ig ] * fe.phiDer ( i, k, ig ) * fe.phiDer ( j, l, ig ) * fe.weightDet ( ig );
1091 mat ( i, j ) += coef * s;
1103 boost::multi_array<Real, 3> guk_gukT (
1104 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbQuadPt()]);
1125 s += fe.phiDer ( i, n, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ] * fe.phiDer ( j, n, ig ) * uk_loc.vec() [ j + jcoor * fe.nbFEDof() ] ;
1129 guk_gukT[ icoor ][ jcoor ][ ig ] = s;
1150 s += guk_gukT[ k ][ l ][ ig ] * fe.phiDer ( i, k, ig ) * fe.phiDer ( j, l, ig ) * fe.weightDet ( ig );
1154 mat_tmp ( i, j ) = coef * s;
1176 int iblock,
int jblock )
1186 Real sum, sum1, sum2;
1187 UInt icoor, jcoor, i, j;
1189 Real x[ 3 ], rx1[ 3 ], drp1[ 3 ], rx2[ 3 ], drp2[ 3 ];
1191 boost::multi_array<Real, 3> phid1 (
1192 boost::extents[fe1.nbFEDof()][fe1.nbLocalCoor()][bdfe.nbQuadPt()]);
1193 boost::multi_array<Real, 3> phid2 (
1194 boost::extents[fe2.nbFEDof()][fe2.nbLocalCoor()][bdfe.nbQuadPt()]);
1196 Real b1[ 3 ], b2[ 3 ];
1201 for ( UInt ig = 0; ig < bdfe.nbQuadPt(); ++ig )
1204 bdfe.coorQuadPt ( x[ 0 ], x[ 1 ], x[ 2 ], ig );
1207 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1211 for ( jcoor = 0; jcoor < fe1.nbLocalCoor(); ++jcoor )
1213 sum1 += fe1.tInvJac ( jcoor, icoor, 0 ) * ( x[ jcoor ] - b1[ jcoor ] );
1214 sum2 += fe2.tInvJac ( jcoor, icoor, 0 ) * ( x[ jcoor ] - b2[ jcoor ] );
1216 rx1[ icoor ] = sum1;
1217 rx2[ icoor ] = sum2;
1220 for ( i = 0; i < fe1.nbFEDof(); ++i )
1224 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1226 drp1[ icoor ] = fe1.refFE().dPhi ( i, icoor, rx1[ 0 ], rx1[ 1 ], rx1[ 2 ] );
1227 drp2[ icoor ] = fe2.refFE().dPhi ( i, icoor, rx2[ 0 ], rx2[ 1 ], rx2[ 2 ] );
1231 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1235 for ( jcoor = 0; jcoor < fe1.nbLocalCoor(); ++jcoor )
1237 sum1 += fe1.tInvJac ( icoor, jcoor, 0 ) * drp1[ jcoor ];
1238 sum2 += fe2.tInvJac ( icoor, jcoor, 0 ) * drp2[ jcoor ];
1240 phid1[ i ][ icoor ][ ig ] = sum1;
1241 phid2[ i ][ icoor ][ ig ] = sum2;
1256 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1257 for ( ig = 0; ig < bdfe.nbQuadPt() ; ++ig )
1259 sum += phid1[ i ][ icoor ][ ig ] * phid2[ j ][ icoor ][ ig ] * bdfe.wRootDetMetric ( ig );
1261 mat ( i, j ) += coef * sum;
1277 int iblock,
int jblock,
1288 Real sum, sum1, sum2;
1289 UInt icoor, jcoor, i, j;
1291 Real x[ 3 ], rx1[ 3 ], drp1[ 3 ], rx2[ 3 ], drp2[ 3 ];
1293 boost::multi_array<Real, 3> phid1 (
1294 boost::extents[fe1.nbFEDof()][fe1.nbLocalCoor()][bdfe.nbQuadPt()]);
1295 boost::multi_array<Real, 3> phid2 (
1296 boost::extents[fe2.nbFEDof()][fe2.nbLocalCoor()][bdfe.nbQuadPt()]);
1298 Real b1[ 3 ], b2[ 3 ];
1303 for ( UInt ig = 0; ig < bdfe.nbQuadPt(); ++ig )
1306 bdfe.coorQuadPt ( x[ 0 ], x[ 1 ], x[ 2 ], ig );
1309 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1313 for ( jcoor = 0; jcoor < fe1.nbLocalCoor(); ++jcoor )
1315 sum1 += fe1.tInvJac ( jcoor, icoor, 0 ) * ( x[ jcoor ] - b1[ jcoor ] );
1316 sum2 += fe2.tInvJac ( jcoor, icoor, 0 ) * ( x[ jcoor ] - b2[ jcoor ] );
1318 rx1[ icoor ] = sum1;
1319 rx2[ icoor ] = sum2;
1322 for ( i = 0; i < fe1.nbFEDof(); ++i )
1326 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1328 drp1[ icoor ] = fe1.refFE().dPhi ( i, icoor, rx1[ 0 ], rx1[ 1 ], rx1[ 2 ] );
1329 drp2[ icoor ] = fe2.refFE().dPhi ( i, icoor, rx2[ 0 ], rx2[ 1 ], rx2[ 2 ] );
1333 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1337 for ( jcoor = 0; jcoor < fe1.nbLocalCoor(); ++jcoor )
1339 sum1 += fe1.tInvJac ( icoor, jcoor, 0 ) * drp1[ jcoor ];
1340 sum2 += fe2.tInvJac ( icoor, jcoor, 0 ) * drp2[ jcoor ];
1342 phid1[ i ][ icoor ][ ig ] = sum1;
1343 phid2[ i ][ icoor ][ ig ] = sum2;
1357 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1358 for ( ig = 0; ig < bdfe.nbQuadPt() ; ++ig )
1360 sum += phid1[ i ][ icoor ][ ig ] * phid2[ j ][ icoor ][ ig ] * bdfe.wRootDetMetric ( ig );
1362 mat_tmp ( i, j ) = coef * sum;
1368 for (
int icomp = 0; icomp < nb; icomp++ )
1371 mat_icomp += mat_tmp;
1385 int iblock,
int jblock,
1394 Real sum, sum1, sum2;
1402 boost::multi_array<Real, 2> b (
1403 boost::extents[fe1.nbLocalCoor()][bdfe.nbQuadPt()]);
1407 for ( ig = 0; ig < bdfe.nbQuadPt(); ig++ )
1410 for ( i = 0; i < bdfe.nbFEDof(); ++i )
1412 sum += bdfe.phi ( i, ig ) * beta.vec() [ icoor * bdfe.nbLocalCoor() + i ];
1414 b[ icoor ][ ig ] = sum;
1425 Real x[ 3 ], rx1[ 3 ], drp1[ 3 ], rx2[ 3 ], drp2[ 3 ];
1427 boost::multi_array<Real, 3> phid1 (
1428 boost::extents[fe1.nbFEDof()][fe1.nbLocalCoor()][bdfe.nbQuadPt()]);
1429 boost::multi_array<Real, 3> phid2 (
1430 boost::extents[fe2.nbFEDof()][fe2.nbLocalCoor()][bdfe.nbQuadPt()]);
1432 Real b1[ 3 ], b2[ 3 ];
1437 for ( UInt ig = 0; ig < bdfe.nbQuadPt(); ++ig )
1440 bdfe.coorQuadPt ( x[ 0 ], x[ 1 ], x[ 2 ], ig );
1443 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1447 for ( jcoor = 0; jcoor < fe1.nbLocalCoor(); ++jcoor )
1449 sum1 += fe1.tInvJac ( jcoor, icoor, 0 ) * ( x[ jcoor ] - b1[ jcoor ] );
1450 sum2 += fe2.tInvJac ( jcoor, icoor, 0 ) * ( x[ jcoor ] - b2[ jcoor ] );
1452 rx1[ icoor ] = sum1;
1453 rx2[ icoor ] = sum2;
1456 for ( i = 0; i < fe1.nbFEDof(); ++i )
1460 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1462 drp1[ icoor ] = fe1.refFE().dPhi ( i, icoor, rx1[ 0 ], rx1[ 1 ], rx1[ 2 ] );
1463 drp2[ icoor ] = fe2.refFE().dPhi ( i, icoor, rx2[ 0 ], rx2[ 1 ], rx2[ 2 ] );
1467 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1471 for ( jcoor = 0; jcoor < fe1.nbLocalCoor(); ++jcoor )
1473 sum1 += fe1.tInvJac ( icoor, jcoor, 0 ) * drp1[ jcoor ];
1474 sum2 += fe2.tInvJac ( icoor, jcoor, 0 ) * drp2[ jcoor ];
1476 phid1[ i ][ icoor ][ ig ] = sum1;
1477 phid2[ i ][ icoor ][ ig ] = sum2;
1490 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1491 for ( jcoor = 0; jcoor < fe1.nbLocalCoor(); ++jcoor )
1492 for ( ig = 0; ig < bdfe.nbQuadPt(); ig++ )
1493 sum += phid1[ i ][ icoor ][ ig ] * phid2[ j ][ jcoor ][ ig ]
1494 * b[ icoor ][ ig ] * b[ jcoor ][ ig ]
1495 * bdfe.wRootDetMetric ( ig );
1496 mat_tmp ( i, j ) = coef * sum;
1501 for (
int icomp = 0; icomp < nb; icomp++ )
1504 mat_icomp += mat_tmp;
1520 Real sum, sum1, sum2;
1521 UInt i, j, icoor, jcoor;
1523 Real x[ 3 ], rx1[ 3 ], drp1[ 3 ], rx2[ 3 ], drp2[ 3 ];
1525 boost::multi_array<Real, 3> phid1 (
1526 boost::extents[fe1.nbFEDof()][fe1.nbLocalCoor()][bdfe.nbQuadPt()]);
1527 boost::multi_array<Real, 3> phid2 (
1528 boost::extents[fe2.nbFEDof()][fe2.nbLocalCoor()][bdfe.nbQuadPt()]);
1530 Real b1[ 3 ], b2[ 3 ];
1535 for ( UInt ig = 0; ig < bdfe.nbQuadPt(); ++ig )
1538 bdfe.coorQuadPt ( x[ 0 ], x[ 1 ], x[ 2 ], ig );
1541 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1545 for ( jcoor = 0; jcoor < fe1.nbLocalCoor(); ++jcoor )
1547 sum1 += fe1.tInvJac ( jcoor, icoor, 0 ) * ( x[ jcoor ] - b1[ jcoor ] );
1548 sum2 += fe2.tInvJac ( jcoor, icoor, 0 ) * ( x[ jcoor ] - b2[ jcoor ] );
1550 rx1[ icoor ] = sum1;
1551 rx2[ icoor ] = sum2;
1554 for ( i = 0; i < fe1.nbFEDof(); ++i )
1558 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1560 drp1[ icoor ] = fe1.refFE().dPhi ( i, icoor, rx1[ 0 ], rx1[ 1 ], rx1[ 2 ] );
1561 drp2[ icoor ] = fe2.refFE().dPhi ( i, icoor, rx2[ 0 ], rx2[ 1 ], rx2[ 2 ] );
1565 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1569 for ( jcoor = 0; jcoor < fe1.nbLocalCoor(); ++jcoor )
1571 sum1 += fe1.tInvJac ( icoor, jcoor, 0 ) * drp1[ jcoor ];
1572 sum2 += fe2.tInvJac ( icoor, jcoor, 0 ) * drp2[ jcoor ];
1574 phid1[ i ][ icoor ][ ig ] = sum1;
1575 phid2[ i ][ icoor ][ ig ] = sum2;
1592 for ( ig = 0; ig < bdfe.nbQuadPt(); ig++ )
1594 sum += phid1[ i ][ icoor ][ ig ] * phid2[ j ][ jcoor ][ ig ] * bdfe.wRootDetMetric ( ig );
1596 mat_icomp ( i, j ) += coef * sum;
1607 int iblock,
int jblock )
1615 Real sum, sum1, sum2;
1619 boost::multi_array<Real, 3> phid1 (
1620 boost::extents[fe1.nbFEDof()][fe1.nbLocalCoor()][bdfe.nbQuadPt()]);
1621 boost::multi_array<Real, 3> phid2 (
1622 boost::extents[fe2.nbFEDof()][fe2.nbLocalCoor()][bdfe.nbQuadPt()]);
1624 std::vector<Real> x (3), rx1 (3), drp1 (3), rx2 (3), drp2 (3);
1625 std::vector<Real> b1 (3), b2 (3);
1627 fe1.coorMap ( b1[ 0 ], b1[ 1 ], b1[ 2 ], 0, 0, 0 );
1628 fe2.coorMap ( b2[ 0 ], b2[ 1 ], b2[ 2 ], 0, 0, 0 );
1634 std::vector<Real> ba2 (bdfe.nbQuadPt() );
1636 for ( ig = 0; ig < bdfe.nbQuadPt(); ig++ )
1640 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1642 for ( i = 0; i < bdfe.nbLocalCoor(); ++i )
1644 Real betaLoc = bdfe.phi ( i, ig ) *
1645 beta.vec() [ icoor * bdfe.nbLocalCoor() + i ];
1646 sum1 += betaLoc * bdfe.normal (icoor, ig);
1647 sum2 += betaLoc * betaLoc;
1650 ba2[ ig ] = sum2 == 0 ? 0 : sum1 * sum1 / std::pow ( sum2, 0.5 );
1653 for ( UInt ig = 0; ig < bdfe.nbQuadPt(); ++ig )
1656 bdfe.coorQuadPt ( x[ 0 ], x[ 1 ], x[ 2 ], ig );
1659 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1663 for ( jcoor = 0; jcoor < fe1.nbLocalCoor(); ++jcoor )
1665 sum1 += fe1.tInvJac ( jcoor, icoor, 0 ) * ( x[ jcoor ] - b1[ jcoor ] );
1666 sum2 += fe2.tInvJac ( jcoor, icoor, 0 ) * ( x[ jcoor ] - b2[ jcoor ] );
1668 rx1[ icoor ] = sum1;
1669 rx2[ icoor ] = sum2;
1672 for ( i = 0; i < fe1.nbFEDof(); ++i )
1676 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1678 drp1[ icoor ] = fe1.refFE().dPhi ( i, icoor, rx1[ 0 ], rx1[ 1 ], rx1[ 2 ] );
1679 drp2[ icoor ] = fe2.refFE().dPhi ( i, icoor, rx2[ 0 ], rx2[ 1 ], rx2[ 2 ] );
1683 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1687 for ( jcoor = 0; jcoor < fe1.nbLocalCoor(); ++jcoor )
1689 sum1 += fe1.tInvJac ( icoor, jcoor, 0 ) * drp1[ jcoor ];
1690 sum2 += fe2.tInvJac ( icoor, jcoor, 0 ) * drp2[ jcoor ];
1692 phid1[ i ][ icoor ][ ig ] = sum1;
1693 phid2[ i ][ icoor ][ ig ] = sum2;
1708 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1709 for ( ig = 0; ig < bdfe.nbQuadPt() ; ++ig )
1711 phid1[ i ][ icoor ][ ig ] *
1712 phid2[ j ][ icoor ][ ig ] *
1713 bdfe.wRootDetMetric ( ig );
1714 mat ( i, j ) += coef * sum;
1734 int iblock,
int jblock )
1742 Real sum, sum1, sum2;
1746 boost::multi_array<Real, 3> phid1 (
1747 boost::extents[fe1.nbFEDof()][fe1.nbLocalCoor()][bdfe.nbQuadPt()]);
1748 boost::multi_array<Real, 3> phid2 (
1749 boost::extents[fe2.nbFEDof()][fe2.nbLocalCoor()][bdfe.nbQuadPt()]);
1751 std::vector<Real> x (3), rx1 (3), drp1 (3), rx2 (3), drp2 (3);
1752 std::vector<Real> b1 (3), b2 (3);
1754 fe1.coorMap ( b1[ 0 ], b1[ 1 ], b1[ 2 ], 0, 0, 0 );
1755 fe2.coorMap ( b2[ 0 ], b2[ 1 ], b2[ 2 ], 0, 0, 0 );
1761 std::vector<Real> bn (bdfe.nbQuadPt() );
1763 for ( ig = 0; ig < bdfe.nbQuadPt(); ig++ )
1768 for ( icoor = 0; icoor < fe3.nbLocalCoor(); ++icoor )
1770 for ( i = 0; i < fe3.nbFEDof(); ++i )
1772 Real betaLoc = fe3.phi ( i, ig ) *
1773 beta.vec() [ icoor * fe3.nbFEDof() + i ];
1774 sum1 += betaLoc * bdfe.normal (icoor, ig);
1777 bn[ ig ] = std::fabs (sum1);
1780 for ( UInt ig = 0; ig < bdfe.nbQuadPt(); ++ig )
1783 bdfe.coorQuadPt ( x[ 0 ], x[ 1 ], x[ 2 ], ig );
1786 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1790 for ( jcoor = 0; jcoor < fe1.nbLocalCoor(); ++jcoor )
1792 sum1 += fe1.tInvJac ( jcoor, icoor, 0 ) * ( x[ jcoor ] - b1[ jcoor ] );
1793 sum2 += fe2.tInvJac ( jcoor, icoor, 0 ) * ( x[ jcoor ] - b2[ jcoor ] );
1795 rx1[ icoor ] = sum1;
1796 rx2[ icoor ] = sum2;
1799 for ( i = 0; i < fe1.nbFEDof(); ++i )
1803 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1805 drp1[ icoor ] = fe1.refFE().dPhi ( i, icoor, rx1[ 0 ], rx1[ 1 ], rx1[ 2 ] );
1806 drp2[ icoor ] = fe2.refFE().dPhi ( i, icoor, rx2[ 0 ], rx2[ 1 ], rx2[ 2 ] );
1810 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1814 for ( jcoor = 0; jcoor < fe1.nbLocalCoor(); ++jcoor )
1816 sum1 += fe1.tInvJac ( icoor, jcoor, 0 ) * drp1[ jcoor ];
1817 sum2 += fe2.tInvJac ( icoor, jcoor, 0 ) * drp2[ jcoor ];
1819 phid1[ i ][ icoor ][ ig ] = sum1;
1820 phid2[ i ][ icoor ][ ig ] = sum2;
1835 for ( icoor = 0; icoor < fe1.nbLocalCoor(); ++icoor )
1836 for ( ig = 0; ig < bdfe.nbQuadPt() ; ++ig )
1838 phid1[ i ][ icoor ][ ig ] *
1839 phid2[ j ][ icoor ][ ig ] *
1840 bdfe.wRootDetMetric ( ig );
1841 mat ( i, j ) += coef * sum;
1849 int iblock,
int jblock )
1871 mat ( iloc, iloc ) += coef * s;
1888 mat ( iloc, jloc ) += coef_s;
1889 mat ( jloc, iloc ) += coef_s;
1895 const CurrentFE& fe,
int iblock,
int jblock )
1903 double s, coef_s, coef_f;
1918 mat ( iloc, iloc ) += coef * s;
1936 mat ( iloc, jloc ) += coef_s;
1937 mat ( jloc, iloc ) += coef_s;
1943 int iblock,
int jblock,
int nb )
1950 Matrix mat_tmp ( fe.nbFEDof(), fe.nbFEDof() );
1951 mat_tmp = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
1969 mat_tmp ( iloc, iloc ) += coef * s;
1986 mat_tmp ( iloc, jloc ) += coef_s;
1987 mat_tmp ( jloc, iloc ) += coef_s;
1990 for (
int icomp = 0; icomp < nb; icomp++ )
1996 mat_icomp ( iloc, iloc ) += mat_tmp ( iloc, iloc );
2002 mat_icomp ( iloc, jloc ) += mat_tmp ( iloc, jloc );
2003 mat_icomp ( jloc, iloc ) += mat_tmp ( jloc, iloc );
2010 int iblock,
int jblock,
int nb )
2017 Matrix mat_tmp ( fe.nbFEDof(), fe.nbFEDof() );
2018 mat_tmp = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
2032 for ( icoor = 0; icoor < fe.nbLocalCoor(); icoor++ )
2033 s += coef[ig] * fe.phiDer ( iloc, icoor, ig ) * fe.phiDer ( iloc, icoor, ig )
2034 * fe.weightDet ( ig );
2036 mat_tmp ( iloc, iloc ) += s;
2048 for ( icoor = 0; icoor < fe.nbLocalCoor(); icoor++ )
2049 s += coef[ig] * fe.phiDer ( iloc, icoor, ig ) * fe.phiDer ( jloc, icoor, ig ) *
2050 fe.weightDet ( ig );
2052 mat_tmp ( iloc, jloc ) += s;
2053 mat_tmp ( jloc, iloc ) += s;
2056 for (
int icomp = 0; icomp < nb; icomp++ )
2062 mat_icomp ( iloc, iloc ) += mat_tmp ( iloc, iloc );
2068 mat_icomp ( iloc, jloc ) += mat_tmp ( iloc, jloc );
2069 mat_icomp ( jloc, iloc ) += mat_tmp ( jloc, iloc );
2078 int iblock,
int jblock,
int )
2087 Matrix mat_tmp ( fe.nbFEDof(), fe.nbFEDof() );
2088 mat_tmp = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
2089 Matrix mat_tmp11 ( fe.nbFEDof(), fe.nbFEDof() );
2090 mat_tmp11 = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
2091 Matrix mat_tmp12 ( fe.nbFEDof(), fe.nbFEDof() );
2092 mat_tmp12 = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
2093 Matrix mat_tmp13 ( fe.nbFEDof(), fe.nbFEDof() );
2094 mat_tmp13 = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
2095 Matrix mat_tmp21 ( fe.nbFEDof(), fe.nbFEDof() );
2096 mat_tmp21 = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
2097 Matrix mat_tmp22 ( fe.nbFEDof(), fe.nbFEDof() );
2098 mat_tmp22 = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
2099 Matrix mat_tmp23 ( fe.nbFEDof(), fe.nbFEDof() );
2100 mat_tmp23 = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
2101 Matrix mat_tmp31 ( fe.nbFEDof(), fe.nbFEDof() );
2102 mat_tmp31 = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
2103 Matrix mat_tmp32 ( fe.nbFEDof(), fe.nbFEDof() );
2104 mat_tmp32 = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
2105 Matrix mat_tmp33 ( fe.nbFEDof(), fe.nbFEDof() );
2106 mat_tmp33 = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
2125 mat_tmp11 ( iloc, iloc ) += coef * s;
2140 mat_tmp11 ( iloc, jloc ) += coef_s;
2141 mat_tmp11 ( jloc, iloc ) += coef_s;
2154 mat_tmp12 ( iloc, iloc ) -= coef * s;
2168 mat_tmp12 ( iloc, jloc ) -= coef_s;
2169 mat_tmp12 ( jloc, iloc ) -= coef_s;
2182 mat_tmp13 ( iloc, iloc ) -= coef * s;
2196 mat_tmp13 ( iloc, jloc ) -= coef_s;
2197 mat_tmp13 ( jloc, iloc ) -= coef_s;
2210 mat_tmp21 ( iloc, iloc ) -= coef * s;
2224 mat_tmp21 ( iloc, jloc ) -= coef_s;
2225 mat_tmp21 ( jloc, iloc ) -= coef_s;
2239 mat_tmp22 ( iloc, iloc ) += coef * s;
2254 mat_tmp22 ( iloc, jloc ) += coef_s;
2255 mat_tmp22 ( jloc, iloc ) += coef_s;
2268 mat_tmp23 ( iloc, iloc ) -= coef * s;
2282 mat_tmp23 ( iloc, jloc ) -= coef_s;
2283 mat_tmp23 ( jloc, iloc ) -= coef_s;
2296 mat_tmp31 ( iloc, iloc ) -= coef * s;
2310 mat_tmp31 ( iloc, jloc ) -= coef_s;
2311 mat_tmp31 ( jloc, iloc ) -= coef_s;
2324 mat_tmp32 ( iloc, iloc ) -= coef * s;
2338 mat_tmp32 ( iloc, jloc ) -= coef_s;
2339 mat_tmp32 ( jloc, iloc ) -= coef_s;
2353 mat_tmp33 ( iloc, iloc ) += coef * s;
2368 mat_tmp33 ( iloc, jloc ) += coef_s;
2369 mat_tmp33 ( jloc, iloc ) += coef_s;
2376 mat_icomp ( iloc, iloc ) += mat_tmp11 ( iloc, iloc );
2382 mat_icomp ( iloc, jloc ) += mat_tmp11 ( iloc, jloc );
2383 mat_icomp ( jloc, iloc ) += mat_tmp11 ( jloc, iloc );
2386 mat_icomp = elmat.block ( iblock + 0, jblock + 1 );
2390 mat_icomp ( iloc, iloc ) -= mat_tmp12 ( iloc, iloc );
2396 mat_icomp ( iloc, jloc ) -= mat_tmp12 ( iloc, jloc );
2397 mat_icomp ( jloc, iloc ) -= mat_tmp12 ( jloc, iloc );
2400 mat_icomp = elmat.block ( iblock + 0, jblock + 2 );
2404 mat_icomp ( iloc, iloc ) -= mat_tmp13 ( iloc, iloc );
2410 mat_icomp ( iloc, jloc ) -= mat_tmp13 ( iloc, jloc );
2411 mat_icomp ( jloc, iloc ) -= mat_tmp13 ( jloc, iloc );
2414 mat_icomp = elmat.block ( iblock + 1, jblock + 0 );
2418 mat_icomp ( iloc, iloc ) -= mat_tmp21 ( iloc, iloc );
2424 mat_icomp ( iloc, jloc ) -= mat_tmp21 ( iloc, jloc );
2425 mat_icomp ( jloc, iloc ) -= mat_tmp21 ( jloc, iloc );
2428 mat_icomp = elmat.block ( iblock + 1, jblock + 1 );
2432 mat_icomp ( iloc, iloc ) += mat_tmp22 ( iloc, iloc );
2438 mat_icomp ( iloc, jloc ) += mat_tmp22 ( iloc, jloc );
2439 mat_icomp ( jloc, iloc ) += mat_tmp22 ( jloc, iloc );
2442 mat_icomp = elmat.block ( iblock + 1, jblock + 2 );
2446 mat_icomp ( iloc, iloc ) -= mat_tmp23 ( iloc, iloc );
2452 mat_icomp ( iloc, jloc ) -= mat_tmp23 ( iloc, jloc );
2453 mat_icomp ( jloc, iloc ) -= mat_tmp23 ( jloc, iloc );
2456 mat_icomp = elmat.block ( iblock + 2, jblock + 0 );
2460 mat_icomp ( iloc, iloc ) -= mat_tmp31 ( iloc, iloc );
2466 mat_icomp ( iloc, jloc ) -= mat_tmp31 ( iloc, jloc );
2467 mat_icomp ( jloc, iloc ) -= mat_tmp31 ( jloc, iloc );
2470 mat_icomp = elmat.block ( iblock + 2, jblock + 1 );
2474 mat_icomp ( iloc, iloc ) -= mat_tmp32 ( iloc, iloc );
2480 mat_icomp ( iloc, jloc ) -= mat_tmp32 ( iloc, jloc );
2481 mat_icomp ( jloc, iloc ) -= mat_tmp32 ( jloc, iloc );
2484 mat_icomp = elmat.block ( iblock + 2, jblock + 2 );
2488 mat_icomp ( iloc, iloc ) += mat_tmp33 ( iloc, iloc );
2494 mat_icomp ( iloc, jloc ) += mat_tmp33 ( iloc, jloc );
2495 mat_icomp ( jloc, iloc ) += mat_tmp ( jloc, iloc );
2527 mat ( i, j ) += coef * s;
2543 boost::multi_array<Real, 3> guk (
2544 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbQuadPt()]);
2560 s += fe.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
2562 guk[ icoor ][ jcoor ][ ig ] = s;
2585 s += fe.phiDer ( i, k, ig ) * guk[ jcoor ][ icoor ][ ig ] * fe.phiDer ( j, k, ig ) * fe.weightDet ( ig );
2587 mat ( i, j ) += coef * s;
2605 boost::multi_array<Real, 3> guk (
2606 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbQuadPt()]);
2622 s += fe.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
2624 guk[ icoor ][ jcoor ][ ig ] = s;
2647 s += fe.phiDer ( i, k, ig ) * ( guk[ jcoor ][ k ][ ig ] * fe.phiDer ( j, icoor, ig )
2648 + guk[ jcoor ][ icoor ][ ig ] * fe.phiDer ( j, k, ig ) ) * fe.weightDet ( ig );
2650 mat ( i, j ) += coef * s;
2667 boost::multi_array<Real, 3> guk (
2668 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbQuadPt()]);
2686 s += fe.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
2688 guk[ icoor ][ jcoor ][ ig ] = s;
2710 s += fe.phiDer ( i, icoor, ig ) * guk[ jcoor ][ k ][ ig ] * fe.phiDer ( j, k, ig ) * fe.weightDet ( ig );
2712 mat ( i, j ) += coef * s;
2728 double tmp = coef * 0.5;
2742 mat_tmp ( i, j ) = tmp * s;
2765 mat ( i, j ) += tmp * s;
2773 int iblock,
int jblock,
UInt nb )
2779 Matrix mat_tmp ( fe.nbFEDof(), fe.nbFEDof() );
2780 mat_tmp = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
2782 UInt i, icomp, ig, icoor, iloc, jloc;
2784 std::vector<Real> divw (fe.nbQuadPt() );
2793 divw[ ig ] += fe.phiDer ( i, icoor, ig ) * w_loc.vec() [ i + icoor * fe.nbFEDof() ];
2806 s += divw[ ig ] * fe.phi ( iloc, ig ) * fe.phi ( iloc, ig ) * fe.weightDet ( ig );
2808 mat_tmp ( iloc, iloc ) += coef * s;
2820 s += divw[ ig ] * fe.phi ( iloc, ig ) * fe.phi ( jloc, ig ) * fe.weightDet ( ig );
2823 mat_tmp ( iloc, jloc ) += coef_s;
2824 mat_tmp ( jloc, iloc ) += coef_s;
2827 for ( icomp = 0; icomp < nb; icomp++ )
2833 mat_icomp ( iloc, iloc ) += mat_tmp ( iloc, iloc );
2839 mat_icomp ( iloc, jloc ) += mat_tmp ( iloc, jloc );
2840 mat_icomp ( jloc, iloc ) += mat_tmp ( jloc, iloc );
2847 int iblock,
int jblock,
UInt nb )
2853 Matrix mat_tmp ( fe.nbFEDof(), fe.nbFEDof() );
2854 mat_tmp = ZeroMatrix ( fe.nbFEDof(), fe.nbFEDof() );
2856 UInt i, icomp, ig, icoor, iloc, jloc;
2858 std::vector<Real> divw (fe.nbQuadPt() );
2867 divw[ ig ] += fe.phiDer ( i, icoor, ig ) * w_loc.vec() [ i + icoor * fe.nbFEDof() ];
2880 s += coef[ig] * divw[ ig ] * fe.phi ( iloc, ig ) * fe.phi ( iloc, ig ) * fe.weightDet ( ig );
2882 mat_tmp ( iloc, iloc ) += s;
2894 s += coef[ig] * divw[ ig ] * fe.phi ( iloc, ig ) * fe.phi ( jloc, ig ) * fe.weightDet ( ig );
2896 mat_tmp ( iloc, jloc ) += s;
2897 mat_tmp ( jloc, iloc ) += s;
2900 for ( icomp = 0; icomp < nb; icomp++ )
2906 mat_icomp ( iloc, iloc ) += mat_tmp ( iloc, iloc );
2912 mat_icomp ( iloc, jloc ) += mat_tmp ( iloc, jloc );
2913 mat_icomp ( jloc, iloc ) += mat_tmp ( jloc, iloc );
2927 UInt ig, icoor, jcoor, i, j;
2930 boost::multi_array<Real, 3> gu0 (
2931 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()][fe.nbLocalCoor()]);
2941 gu0[ ig ][ icoor ][ jcoor ] = 0.0;
2944 gu0[ ig ][ icoor ][ jcoor ] += fe.phiDer ( i, jcoor, ig ) * u0_loc.vec() [ i + icoor * fe.nbFEDof() ];
2965 s += gu0[ ig ][ icoor ][ jcoor ] * fe.phi ( i, ig ) * fe.phi ( j, ig ) * fe.weightDet ( ig );
2967 mat ( i, j ) += coef * s;
2981 int iblock,
int jblock,
int nb )
2988 UInt i, icoor, ig, jcoor;
2989 std::vector<Real> coef_v (fe.nbLocalCoor() );
3005 coef_v[ icoor ] = 0.;
3011 for (
UInt iloc = 0; iloc < nbN2; iloc++ )
3013 coef_v[ icoor ] += vec_loc.vec() [ iloc + icoor * nbN2 ] * fe2.phi ( iloc, ig );
3021 s += coef_v[ icoor ] * fe.phiDer ( iloc, icoor, ig ) * coef_v[ jcoor ] * fe.phiDer ( iloc, jcoor, ig )
3022 * fe.weightDet ( ig );
3026 mat ( iloc, iloc ) += coef * s;
3040 coef_v[ icoor ] = 0.;
3045 for (
UInt iloc = 0; iloc < nbN2; iloc++ )
3047 coef_v[ icoor ] += vec_loc.vec() [ iloc + icoor * nbN2 ] * fe2.phi ( iloc, ig );
3055 s += coef_v[ icoor ] * fe.phiDer ( iloc, icoor, ig ) * coef_v[ jcoor ] * fe.phiDer ( jloc, jcoor, ig )
3056 * fe.weightDet ( ig );
3061 mat ( iloc, jloc ) += coef_s;
3062 mat ( jloc, iloc ) += coef_s;
3065 for (
int icomp = 1; icomp < nb; icomp++ )
3071 mat_icomp ( iloc, iloc ) += mat ( iloc, iloc );
3077 mat_icomp ( iloc, jloc ) += mat ( iloc, jloc );
3078 mat_icomp ( jloc, iloc ) += mat ( jloc, iloc );
3087 int iblock,
int jblock )
3101 for ( ig = 0; ig < fe_u.nbQuadPt(); ig++ )
3107 s -= fe_p.refFE().phi ( j, fe_u.quadRule().quadPointCoor ( ig, 0 ), fe_u.quadRule().quadPointCoor ( ig, 1 ),
3108 fe_u.quadRule().quadPointCoor ( ig, 2 ) ) * fe_u.phiDer ( i, icoor, ig ) * fe_u.weightDet ( ig );
3109 mat ( i, j ) += coef * s;
3116 int iblock,
int jblock )
3134 mat ( i, j ) += coef * s;
3161 mat_grad ( i, j ) += coef_grad * s;
3162 mat_div ( j, i ) += coef_div * s;
3173 Real fh2 = coef_stab * h * h / ( 2 * visc );
3186 mat ( i, j ) -= fh2 * s;
3197 Matrix mat_tmp ( fe.nbFEDof(), fe.nbFEDof() );
3199 Matrix v ( fe.nbQuadPt(), fe.nbLocalCoor() );
3210 s += velicoor ( k ) * fe.phi ( k, iq );
3227 v_grad += v (iq, icoor) * fe.phiDer ( j, icoor, iq );
3232 mat_tmp ( i, j ) = s * coef;
3237 for (
int icomp = 0; icomp < nb; icomp++ )
3244 mat_icomp ( i, j ) += mat_tmp ( i, j );
3252 int iblock,
int jblock )
3260 if ( iblock == jblock )
3266 for ( i = 0; i < nbN1; i++ )
3274 for (
UInt iloc = 0; iloc < nbN1; iloc++ )
3276 coef += vec_loc.vec() [ iloc + icoor * nbN1 ] * fe1.phi ( iloc, iq );
3295 int iblock,
int jblock )
3303 if ( iblock == jblock )
3307 double s, coef, coef_div;
3309 for ( i = 0; i < nbN1; i++ )
3319 for (
UInt iloc = 0; iloc < nbN1; iloc++ )
3321 coef += vec_loc.vec() [ iloc + icoor * nbN1 ] * fe1.phi ( iloc, iq );
3322 coef_div += vec_loc.vec() [ iloc + icoor * nbN1 ] * fe1.phiDer ( iloc, icoor, iq );
3346 int iblock,
int jblock )
3354 if ( iblock == jblock )
3362 for ( i = 0; i < nbN1; i++ )
3371 for (
UInt iloc = 0; iloc < nbN3; iloc++ )
3373 coef += vec_loc.vec() [iloc + icoor * nbN3] * fe3.phi (iloc, iq);
3389 const std::vector<Real>& localVector,
3399 if ( iblock == jblock )
3410 double coef (localVector[icoor * currentFE1.nbQuadPt() + iq]);
3418 mat (iNode1, jNode2) += sum;
3495 vec ( i ) += constant * s;
3500 int fblock,
int eblock )
3518 f_ig += vecf ( i ) * fe.phi ( i, ig );
3522 vec ( i ) += coef * f_ig * fe.phi ( i, ig ) * fe.weightDet ( ig );
3531 for (
UInt iterNode (0); iterNode < currentFe
.nbFEDof(); ++iterNode )
3533 for (
UInt iterQuadNode (0); iterQuadNode < currentFe
.nbQuadPt(); iterQuadNode++ )
3535 vec (iterNode) += constant[iterQuadNode]
3536 * currentFe.phi ( iterNode, iterQuadNode )
3537 * currentFe.weightDet ( iterQuadNode );
3546 for (
UInt iterNode (0); iterNode < currentFe
.nbFEDof(); ++iterNode )
3548 for (
UInt iterQuadNode (0); iterQuadNode < nbQuadPt; iterQuadNode++ )
3552 vec (iterNode) += constant[iterQuadNode + iterGradComp * nbQuadPt]
3553 * currentFe.phiDer ( iterNode, iterGradComp, iterQuadNode )
3554 * currentFe.weightDet ( iterQuadNode );
3575 s += uLoc[ic * fe_u.nbFEDof() + j] * fe_u.phiDer (j, ic, iq) * fe_p.phi (i, iq) * fe_p.weightDet ( iq );
3578 vec ( i ) += s * alpha;
3595 s += pLoc[j] * fe_p.phiDer (j, iblock, iq) * fe_u.phi (i, iq) * fe_u.weightDet ( iq );
3597 vec ( i ) += s * alpha;
3605 int fblock,
int eblock )
3624 f_ig += vecu ( i ) * fe.phi ( i, ig );
3628 vec ( i ) += coef_f * f_ig * ( 1 - f_ig ) * ( f_ig - coef_a ) * fe.phi ( i, ig ) * fe.weightDet ( ig );
3638 boost::multi_array<Real, 2> guk (
3639 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()]);
3640 boost::multi_array<Real, 2> conv (
3641 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()]);
3642 std::vector<Real> beta (fe.nbLocalCoor() );
3646 UInt ig, icoor, jcoor, i;
3659 s += fe.phi ( i, ig ) * beta_loc.vec() [ i + icoor * fe.nbFEDof() ];
3675 s += fe.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
3677 guk[ icoor ][ jcoor ] = s;
3687 s += beta[ icoor ] * guk[ jcoor ][ icoor ];
3689 conv[ ig ][ jcoor ] = s;
3711 s += conv[ ig ][ icoor ] * fe.phi ( i, ig ) * fe.wDetJacobian ( ig );
3713 vec ( i ) += coefficient * s;
3726 boost::multi_array<Real, 2> A (
3727 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()]);
3728 boost::multi_array<Real, 2> B (
3729 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()]);
3730 boost::multi_array<Real, 2> uk (
3731 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()]);
3732 boost::multi_array<Real, 3> guk (
3733 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()][fe.nbLocalCoor()]);
3734 std::vector<Real> dw (fe.nbLocalCoor() );
3735 std::vector<Real> aux (fe.nbQuadPt() );
3736 std::vector<Real> convect (fe.nbLocalCoor() );
3737 boost::multi_array<Real, 2> convect_A (
3738 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()]);
3743 UInt icoor, jcoor, ig, i;
3756 s += fe.phi ( i, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
3758 uk[ ig ][ icoor ] = s;
3764 s += fe.phi ( i, ig ) * convect_loc.vec() [ i + icoor * fe.nbFEDof() ];
3766 convect[ icoor ] = s;
3777 sG += fe.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
3778 sB -= fe.phiDer ( i, jcoor, ig ) * wk_loc.vec() [ i + icoor * fe.nbFEDof() ];
3779 sA -= fe.phiDer ( i, icoor, ig ) * d_loc.vec() [ i + jcoor * fe.nbFEDof() ];
3781 guk[ ig ][ icoor ][ jcoor ] = sG;
3782 B[ icoor ][ jcoor ] = sB;
3783 A[ icoor ][ jcoor ] = sA;
3790 s -= A[ jcoor ][ jcoor ];
3795 A[ jcoor ][ jcoor ] += s;
3802 s += B[ icoor ][ jcoor ] * A[ icoor ][ jcoor ];
3811 s += convect[ icoor ] * A[ icoor ][ jcoor ];
3813 convect_A[ ig ][ jcoor ] = s;
3852 s += aux[ ig ] * uk[ ig ][ icoor ] * fe.phi ( i, ig ) * fe.weightDet ( ig );
3857 s += convect_A[ ig ][ jcoor ] * guk[ ig ][ icoor ][ jcoor ] * fe.phi ( i, ig ) * fe.weightDet ( ig );
3860 vec ( i ) += coef * s;
3875 boost::multi_array<Real, 2> guk (
3876 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()]);
3877 std::vector<Real> dw (fe.nbLocalCoor() );
3878 boost::multi_array<Real, 2> aux (
3879 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()]);
3883 UInt ig, icoor, jcoor, i;
3897 s += fe.phi ( i, ig ) * dw_loc.vec() [ i + icoor * fe.nbFEDof() ];
3907 s += fe.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
3909 guk[ icoor ][ jcoor ] = s;
3919 s += guk[ icoor ][ jcoor ] * dw[ jcoor ];
3921 aux[ ig ][ icoor ] = s;
3943 s += aux[ ig ][ icoor ] * fe.phi ( i, ig ) * fe.weightDet ( ig );
3945 vec ( i ) += coef * s;
3960 boost::multi_array<Real, 2> B (
3961 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()]);
3962 boost::multi_array<Real, 2> A (
3963 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()]);
3964 boost::multi_array<Real, 2> uk (
3965 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()]);
3966 std::vector<Real> aux (fe.nbQuadPt() );
3971 UInt icoor, jcoor, ig, i;
3984 s += fe.phi ( i, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
3986 uk[ ig ][ icoor ] = s;
3996 sB += fe.phiDer ( i, jcoor, ig ) * un_loc.vec() [ i + icoor * fe.nbFEDof() ];
3997 sA -= fe.phiDer ( i, icoor, ig ) * d_loc.vec() [ i + jcoor * fe.nbFEDof() ];
3999 B[ icoor ][ jcoor ] = sB;
4000 A[ icoor ][ jcoor ] = sA;
4007 s -= A[ jcoor ][ jcoor ];
4012 A[ jcoor ][ jcoor ] += 2 * s;
4019 s += B[ icoor ][ jcoor ] * A[ icoor ][ jcoor ];
4048 s += aux[ ig ] * uk[ ig ][ icoor ] * fe.phi ( i, ig ) * fe.weightDet ( ig );
4050 vec ( i ) += coef * s;
4068 boost::multi_array<Real, 3> B (
4069 boost::extents[fe_u.nbQuadPt()][fe_u.nbLocalCoor()][fe_u.nbLocalCoor()]);
4070 boost::multi_array<Real, 2> A (
4071 boost::extents[fe_u.nbLocalCoor()][fe_u.nbLocalCoor()]);
4072 boost::multi_array<Real, 2> guk (
4073 boost::extents[fe_u.nbLocalCoor()][fe_u.nbLocalCoor()]);
4074 boost::multi_array<Real, 2> sigma (
4075 boost::extents[fe_u.nbLocalCoor()][fe_u.nbLocalCoor()]);
4079 UInt icoor, jcoor, kcoor, ig, i;
4096 sG += fe_u.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe_u.nbFEDof() ];
4097 sA -= fe_u.phiDer ( i, icoor, ig ) * d_loc.vec() [ i + jcoor * fe_u.nbFEDof() ];
4099 guk[ icoor ][ jcoor ] = sG;
4100 A[ icoor ][ jcoor ] = sA;
4107 s -= A[ jcoor ][ jcoor ];
4114 A[ jcoor ][ jcoor ] += s;
4120 pk += fe_p.phi ( i, ig ) * pk_loc.vec() [ i ];
4129 sigma[ icoor ][ jcoor ] = mu * ( guk[ icoor ][ jcoor ] + guk[ jcoor ][ icoor ] );
4131 sigma[ icoor ][ icoor ] -= pk;
4141 s += sigma[ icoor ][ kcoor ] * A[ kcoor ][ jcoor ];
4143 B[ ig ][ icoor ][ jcoor ] = s;
4182 s += B[ ig ][ icoor ][ jcoor ] * fe_u.phiDer ( i, jcoor, ig ) * fe_u.weightDet ( ig );
4184 vec ( i ) += coef * s;
4197 boost::multi_array<Real, 3> A (
4198 boost::extents[fe_u.nbQuadPt()][fe_u.nbLocalCoor()][fe_u.nbLocalCoor()]);
4199 boost::multi_array<Real, 2> guk (
4200 boost::extents[fe_u.nbLocalCoor()][fe_u.nbLocalCoor()]);
4201 boost::multi_array<Real, 2> gd (
4202 boost::extents[fe_u.nbLocalCoor()][fe_u.nbLocalCoor()]);
4206 UInt icoor, jcoor, kcoor, ig, i;
4223 su += fe_u.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe_u.nbFEDof() ];
4224 sd += fe_u.phiDer ( i, jcoor, ig ) * d_loc.vec() [ i + icoor * fe_u.nbFEDof() ];
4226 guk[ icoor ][ jcoor ] = su;
4227 gd[ icoor ][ jcoor ] = sd;
4239 s += guk[ icoor ][ kcoor ] * gd[ kcoor ][ jcoor ] + gd[ kcoor ][ icoor ] * guk[ jcoor ][ kcoor ];
4241 A[ ig ][ icoor ][ jcoor ] = s;
4276 s += fe_u.phiDer ( i, jcoor, ig ) * A[ ig ][ icoor ][ jcoor ] * fe_u.weightDet ( ig );
4278 vec ( i ) += coef * s;
4293 boost::multi_array<Real, 2> A (
4294 boost::extents[fe_u.nbLocalCoor()][fe_u.nbLocalCoor()]);
4295 boost::multi_array<Real, 2> guk (
4296 boost::extents[fe_u.nbLocalCoor()][fe_u.nbLocalCoor()]);
4297 std::vector<Real> aux (fe_u.nbQuadPt() );
4302 UInt icoor, jcoor, ig, i;
4320 sG += fe_u.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe_u.nbFEDof() ];
4321 sA -= fe_u.phiDer ( i, icoor, ig ) * d_loc.vec() [ i + jcoor * fe_u.nbFEDof() ];
4323 guk[ icoor ][ jcoor ] = sG;
4324 A[ icoor ][ jcoor ] = sA;
4331 s -= A[ jcoor ][ jcoor ];
4336 A[ jcoor ][ jcoor ] += s;
4343 s += guk[ icoor ][ jcoor ] * A[ icoor ][ jcoor ];
4361 s += aux[ ig ] * fe_p.phi ( i, ig ) * fe_u.weightDet ( ig );
4363 vec [ i ] += coef * s;
4374 boost::multi_array<Real, 2> A (
4375 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()]);
4376 boost::multi_array<Real, 2> B (
4377 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()]);
4378 boost::multi_array<Real, 2> aux (
4379 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()]);
4380 std::vector<Real> gpk (fe.nbLocalCoor() );
4385 UInt icoor, jcoor, ig, i;
4400 sG += fe.phiDer ( i, icoor, ig ) * p_loc.vec() [ i ];
4410 sA -= fe.phiDer ( i, icoor, ig ) * d_loc.vec() [ i + jcoor * fe.nbFEDof() ];
4412 A[ icoor ][ jcoor ] = sA;
4413 B[ jcoor ][ icoor ] = sA;
4420 s -= A[ jcoor ][ jcoor ];
4425 A[ jcoor ][ jcoor ] += s;
4431 A[ icoor ][ jcoor ] += B[ icoor ][ jcoor ];
4439 s += A[ icoor ][ jcoor ] * gpk[jcoor];
4441 aux[ ig ][icoor] = s;
4458 s += aux[ ig ][icoor] * fe.phiDer ( i, icoor, ig ) * fe.weightDet ( ig );
4460 vec [ i ] += coef * s;
4476 for ( i = 0; i < n; i++ )
4478 for ( j = i; j < n; j++ )
4480 for ( sum = a ( i, j ), k = i - 1; k >= 0; k-- )
4482 sum -= a ( i, k ) * a ( j, k );
4486 p ( i ) = std::sqrt ( sum );
4490 a ( j, i ) = sum / p ( i );
4503 for ( i = 0; i < n; i++ )
4505 for ( sum = b ( i ), k = i - 1; k >= 0; k-- )
4507 sum -= a ( i, k ) * x ( k );
4509 x ( i ) = sum / p ( i );
4511 for ( i = n - 1; i >= 0; i-- )
4513 for ( sum = x ( i ), k = i + 1; k < n; k++ )
4515 sum -= a ( k, i ) * x ( k );
4517 x ( i ) = sum / p ( i );
4527 boost::multi_array<Real, 4> A (
4528 boost::extents[fe_u.nbLocalCoor()][fe_u.nbLocalCoor()][fe_u.nbFEDof()][fe_u.nbLocalCoor()]);
4529 boost::multi_array<Real, 2> guk (
4530 boost::extents[fe_u.nbLocalCoor()][fe_u.nbLocalCoor()]);
4531 boost::multi_array<Real, 3> aux (
4532 boost::extents[fe_u.nbQuadPt()][fe_u.nbFEDof()][fe_u.nbLocalCoor()]);
4535 UInt icoor, jcoor, ig;
4576 sG += fe_u.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe_u.nbFEDof() ];
4578 A[ icoor ][ jcoor ][i][jcoor] = sA;
4580 guk[ icoor ][ jcoor ] = sG;
4588 std::vector<Real> z (fe_u.nbLocalCoor() );
4595 z[ jcoor ] = A[ jcoor ][ jcoor ][i][jcoor];
4603 A[ jcoor ][ jcoor ][i][kcoor] -= z[ kcoor ];
4647 l += guk[ icoor ][ jcoor ] * A[ icoor ][ jcoor ][i][kcoor];
4650 aux[ ig ][i][kcoor] = l;
4666 for (
UInt j = 0; j < mmDim; j++ )
4673 for (
UInt j = 0; j < mmDim; j++ )
4681 l += aux[ ig ][j][kcoor] * fe_p.phi ( i, ig ) * fe_u.weightDet ( ig );
4683 mat ( i , j) += coef * l;
4731 std::shared_ptr<MatrixElemental> elmat_convect
4735 boost::multi_array<Real, 4> eta (
4736 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbFEDof()][fe.nbLocalCoor()]);
4738 boost::multi_array<Real, 4> etaMass3 (
4739 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbFEDof()][fe.nbLocalCoor()]);
4741 boost::multi_array<Real, 2> uk (
4742 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()]);
4744 boost::multi_array<Real, 3> guk (
4745 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()][fe.nbLocalCoor()]);
4747 std::vector<Real> duk (fe.nbQuadPt() );
4749 boost::multi_array<Real, 3> gun (
4750 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()][fe.nbLocalCoor()]);
4752 std::vector<Real> convect (fe.nbLocalCoor() );
4754 boost::multi_array<Real, 4> convect_eta (
4755 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()][fe.nbFEDof()][fe.nbLocalCoor()]);
4757 boost::multi_array<Real, 2> sigma (
4758 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()]);
4760 boost::multi_array<Real, 5> B (
4761 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbFEDof()][fe.nbLocalCoor()]);
4763 boost::multi_array<Real, 4> gd (
4764 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbFEDof()][fe.nbLocalCoor()]);
4766 boost::multi_array<Real, 5> A2 (
4767 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()][fe.nbLocalCoor()][fe.nbFEDof()][fe.nbLocalCoor()]);
4769 boost::multi_array<Real, 4> aux (
4770 boost::extents[fe.nbQuadPt()][fe.nbLocalCoor()][fe.nbFEDof()][fe.nbLocalCoor()]);
4771 boost::multi_array<Real, 2> BMass (
4772 boost::extents[fe.nbLocalCoor()][fe.nbLocalCoor()]);
4773 boost::multi_array<Real, 3> auxMass (
4774 boost::extents[fe.nbQuadPt()][fe.nbFEDof()][fe.nbLocalCoor()]);
4775 boost::multi_array<Real, 3> auxMass3 (
4776 boost::extents[fe.nbQuadPt()][fe.nbFEDof()][fe.nbLocalCoor()]);
4778 Real s, sA, sB, sGk, sGn, pk;
4780 UInt icoor, jcoor, ig, kcoor, i, j;
4799 auxMass[ ig ][d][q] = 0.;
4800 auxMass3[ ig ][d][q] = 0.;
4801 aux[ig][p][d][q] = 0.;
4802 convect_eta[ig][p][d][q] = 0.;
4805 gd[p][q][d][e] = 0.;
4806 eta[p][q][d][e] = 0.;
4807 etaMass3[p][q][d][e] = 0.;
4808 A2[ig][p][q][d][e] = 0.;
4809 B[ig][p][q][d][e] = 0.;
4824 s += fe.phi ( i, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
4826 uk[ ig ][ icoor ] = s;
4832 s += fe.phi ( i, ig ) * convect_loc.vec() [ i + icoor * fe.nbFEDof() ];
4834 convect[ icoor ] = s;
4845 gd[ icoor ][ jcoor ][i][jcoor] = fe.phiDer ( i, jcoor, ig ) ;
4847 sGk += fe.phiDer ( i, jcoor, ig ) * uk_loc.vec() [ i + icoor * fe.nbFEDof() ];
4848 sGn += fe.phiDer ( i, jcoor, ig ) * un_loc.vec() [ i + icoor * fe.nbFEDof() ];
4849 sB -= fe.phiDer ( i, jcoor, ig ) * wk_loc.vec() [ i + icoor * fe.nbFEDof() ];
4851 eta[ icoor ][ jcoor ][i][ jcoor ] = sA;
4852 etaMass3[ icoor ][ jcoor ][i][ jcoor ] = sA;
4854 guk[ ig ][ icoor ][ jcoor ] = sGk;
4855 gun[ ig ][ icoor ][ jcoor ] = sGn;
4856 BMass[ icoor ][ jcoor ] = sB;
4864 pk += fe_p.phi ( i, ig ) * pk_loc.vec() [ i ];
4872 sigma[ icoor ][ jcoor ] = mu * ( guk[ig][ icoor ][ jcoor ] + guk[ig][ jcoor ][ icoor ] );
4874 sigma[ icoor ][ icoor ] -= pk;
4881 std::vector<Real> z (fe.nbLocalCoor() );
4885 z[ jcoor ] = eta[ jcoor ][ jcoor ][i][jcoor];
4891 eta[ jcoor ][ jcoor ][i][kcoor] -= z[kcoor];
4903 s += BMass[ icoor ][ jcoor ] * eta[ icoor ][ jcoor ][i][kcoor];
4905 auxMass[ ig ][i][kcoor] = s;
4912 s += convect[ icoor ] * eta[ icoor ][ jcoor ][i][kcoor];
4914 convect_eta[ ig ][ jcoor ][i][kcoor] = s;
4928 s += sigma[ icoor ][ zcoor ] * eta[ zcoor ][ jcoor ][i][kcoor];
4930 B[ ig ][ icoor ][ jcoor ][i][kcoor] = s;
4947 s += guk[ig][ icoor ][ zcoor ] * gd[ zcoor ][ jcoor ][i][kcoor] + gd[ zcoor ][ icoor ][i][kcoor] * guk[ig][ jcoor ][ zcoor ];
4949 A2[ ig ][ icoor ][ jcoor ][i][kcoor] = s;
4961 aux[ ig ][ icoor ][i][jcoor] = guk[ig][ icoor ][ jcoor ] * fe.phi ( i, ig ) ;
4967 duk[ig] += guk[ig][ jcoor ][ jcoor ];
4986 etaMass3[ icoor ][ jcoor ][i][kcoor] -= 2 * z[kcoor];
4996 s += gun[ig][ icoor ][ jcoor ] * etaMass3[ icoor ][ jcoor ][i][kcoor];
4998 auxMass3[ ig ][i][kcoor] = s;
5021 std::shared_ptr<MatrixElemental::matrix_view> mat_convect;
5023 if (elmat_convect.get() )
5025 mat_convect.reset (
new MatrixElemental::matrix_view (elmat_convect->block ( icoor, kcoor ) ) );
5043 s += convect_eta[ ig ][ jcoor ][j][kcoor] * guk[ ig ][ icoor ][jcoor] * fe.phi ( i, ig ) * fe.weightDet ( ig ) * rho;
5045 s += B[ ig ][ icoor ][ jcoor ][j][kcoor] * fe.phiDer ( i, jcoor, ig ) * fe.weightDet ( ig );
5047 s -= fe.phiDer ( i, jcoor, ig ) * A2[ ig ][ icoor ][ jcoor ][j][kcoor] * fe.weightDet ( ig ) * mu;
5052 s += auxMass[ ig ][j][kcoor] * uk[ ig ][ icoor ] * fe.phi ( i, ig ) * fe.weightDet ( ig ) * rho;
5055 s += 0.5 * auxMass3[ ig ][j][kcoor] * uk[ ig ][ icoor ] * fe.phi ( i, ig ) * fe.weightDet ( ig ) * rho;
5060 s -= aux[ ig ][ icoor ][j][kcoor] * fe.phi ( i, ig ) * fe.weightDet ( ig ) * rho * alpha;
5062 g += aux[ ig ][ icoor ][j][kcoor] * fe.phi ( i, ig ) * fe.weightDet ( ig ) * rho;
5066 if (wImplicit && mat_convect.get() )
5068 (*mat_convect) ( i , j ) += g;
5082 Real sumdivphi (0.);
5098 mat ( i, j ) += coef * sumdivphi;
5108 Real sumdivphi (0.);
5124 mat ( j, i ) += coef * sumdivphi;
5145 nbnode = boundaryElementHybridFE.nbFEDof();
5148 for (
UInt i (0); i < nbnode; ++i )
5151 for (
UInt j (0); j < nbnode; ++j )
5155 for ( UInt ig (0); ig < boundaryElementHybridFE.nbQuadPt(); ++ig )
5158 sum += boundaryElementHybridFE.phi ( j , ig ) *
5159 boundaryElementDualDotNFE.phi ( i , ig ) *
5160 boundaryElementHybridFE.wRootDetMetric ( ig );
5163 mat ( nf * nbnode + i, nf * nbnode + j ) += sum * coef;
5182 nbnode = boundaryElementHybridFE.nbFEDof();
5185 for (
UInt i (0); i < nbnode; ++i )
5188 for (
UInt j (0); j < nbnode; ++j )
5192 for ( UInt ig (0); ig < boundaryElementHybridFE.nbQuadPt() ; ++ig )
5194 sum += boundaryElementHybridFE.phi ( j , ig ) *
5195 boundaryElementHybridFE.phi ( i , ig ) *
5196 boundaryElementHybridFE.wRootDetMetric ( ig );
5199 mat ( nf * nbnode + i, nf * nbnode + j ) += sum * coef;
5230 mat ( i, j ) += sum * coef;
5240 Real partialSum (0.), sum (0.);
5263 partialSum += ( Invperm ( icoor, jcoor ) *
5264 dualFE.phi ( j, jcoor, ig ) *
5265 dualFE.phi ( i, icoor, ig ) );
5270 mat ( i, j ) += sum ;
5281 Real sum (0.), x (0.), y (0.), z (0.);
5302 sum += InvpermFun ( x, y, z ) *
5308 mat ( i, j ) += sum;
5332 sum += source ( icoor ) * dualFE.phi ( i, icoor, ig );
5336 vec ( i ) += sum * dualFE.wDetJacobian ( ig );
void source_gradpv(Real alpha, VectorElemental &pLoc, VectorElemental &elvec, const CurrentFE &fe_p, const CurrentFE &fe_u, int iblock)
void grad_ss(const int icoor, const VectorElemental &vec_loc, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, int iblock, int jblock)
Convective term with a local vector coefficient for Navier-Stokes problem in Skew-Symmetric form...
void advection(Real coef, VectorElemental &vel, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, int nb)
const Real & weight(const UInt &ig) const
weight(ig) is the ig-th quadrature weight
int patternFirst(int i) const
patternFirst(i): row index in the element matrix of the i-th term of the pattern
void stiff_curl(Real coef, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, int)
void mass(Real coef, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock)
coef(t,x,y,z,u)
void stiff_gradgrad(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void mass(MatrixElemental &localMass, const CurrentFE &massCFE, const Real &coefficient, const UInt &fieldDim)
Elementary mass for constant mass coefficient.
void stiff(Real coef, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, int nb)
void ipstab_bagrad(const Real coef, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, const CurrentFE &fe3, const VectorElemental &beta, const CurrentFEManifold &bdfe, int iblock, int jblock)
p1 lives in fe1 q2 lives in fe2 beta lives in fe3
void cholsl(KNM< Real > &a, KN< Real > &p, KN< Real > &b, KN< Real > &x)
void source_advection(const Real &coefficient, const VectorElemental &beta_loc, const VectorElemental &uk_loc, VectorElemental &elvec, const CurrentFE &fe)
void ipstab_grad(const Real coef, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, const CurrentFEManifold &bdfe, int iblock, int jblock, int nb)
void stiff_gradgradTr_gradbis_2(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void ipstab_bagrad(const Real coef, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, const VectorElemental &beta, const CurrentFEManifold &bdfe, int iblock, int jblock)
A class for a finite element on a manifold.
void source_fhn(Real coef_f, Real coef_a, VectorElemental &u, VectorElemental &elvec, const CurrentFE &fe, int fblock, int eblock)
void mass(const std::vector< Real > &coef, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, UInt nb)
Mass term with coefficients given for each quadrature point.
void TP_VdotN_Hdiv(Real coef, MatrixElemental &elmat, const ReferenceFEHybrid &hybridFE, const ReferenceFEHybrid &dualDotNFE, int iblock, int jblock)
void source_mass2(Real coef, const VectorElemental &uk_loc, const VectorElemental &dw_loc, VectorElemental &elvec, const CurrentFE &fe)
for Newton FSI
void source_divuq(Real alpha, VectorElemental &uLoc, VectorElemental &elvec, const CurrentFE &fe_u, const CurrentFE &fe_p, int iblock)
void stiff_divgrad_2(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void stiff_sd(Real coef, const VectorElemental &vec_loc, MatrixElemental &elmat, const CurrentFE &fe, const CurrentFE &fe2, int iblock, int jblock, int nb)
StreamLine Diffusion.
void stiff_dergrad(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
for Newton on St-Venant
void stiff_div(Real coef, MatrixElemental &elmat, const CurrentFE &fe)
Real phi(UInt node, UInt component, UInt quadNode) const
Getter for basis function values (vectorial FE case)
void stiff_dergradbis(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void grad(const int &icoor, const std::vector< Real > &localVector, MatrixElemental &elmat, const CurrentFE ¤tFE1, const CurrentFE ¤tFE2, const int &iblock, const int &jblock)
Conective term with a local vector given by quadrature node.
void stiff_dergrad_gradbis_Tr_2(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void advectionNewton(Real coef, VectorElemental &vel, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock)
Assemble the term .
void stiff(const std::vector< Real > &coef, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, int nb)
Stiff term with coefficient given for each quadrature node.
void shape_terms(Real rho, Real mu, const VectorElemental &un_loc, const VectorElemental &uk_loc, const VectorElemental &wk_loc, const VectorElemental &convect_loc, const VectorElemental &pk_loc, MatrixElemental &elmat, const CurrentFE &fe, const CurrentFE &fe_p, ID, MatrixElemental &, int, bool wImplicit, Real alpha, std::shared_ptr< MatrixElemental > elmat_convect)
Shape terms for the CE system in FSI Newton.
void ipstab_grad(const Real coef, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, const CurrentFEManifold &bdfe, int iblock, int jblock)
void mass_Hdiv(Real coef, MatrixElemental &elmat, const CurrentFE &dualFE, int iblock, int jblock)
void stiff_gradgradTr_gradbis_3(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
UInt nbUpper() const
Getter for the number of entries in the pattern.
UInt nbDiag() const
Getter for the diagonal entries in the pattern.
void stab_stokes(Real visc, Real coef_stab, MatrixElemental &elmat, const CurrentFE &fe, int block_pres)
void mass_divw(Real coef, const VectorElemental &w_loc, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, UInt nb)
void updateInverseJacobian(const UInt &iQuadPt)
void source(Real coef, VectorElemental &f, VectorElemental &elvec, const CurrentFE &fe, int fblock, int eblock)
void source_Hdiv(const Vector &source, VectorElemental &elvec, const CurrentFE &dualFE, int iblock)
void mass_Hdiv(Matrix const &Invperm, MatrixElemental &elmat, const CurrentFE &dualFE, int iblock, int jblock)
void stiff_dergrad_gradbis_2(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void source_mass1(Real coef, const VectorElemental &uk_loc, const VectorElemental &wk_loc, const VectorElemental &convect_loc, const VectorElemental &d_loc, VectorElemental &elvec, const CurrentFE &fe)
for Newton FSI
void grad_div(Real coef_grad, Real coef_div, MatrixElemental &elmat, const CurrentFE &fe_u, const CurrentFE &fe_p, int block_pres)
void grad(const int icoor, const VectorElemental &vec_loc, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, int iblock, int jblock)
Convective term with a local vector coefficient (useful for Navier-Stokes problem) ...
UInt nbLocalCoor() const
Getter for the number of local coordinates.
void ipstab_bgrad(const Real coef, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, const VectorElemental &beta, const CurrentFEManifold &bdfe, int iblock, int jblock, int nb)
void bodyForces(VectorElemental &localForce, const CurrentFE &massRhsCFE, const function_Type &fun, const Real &t, const UInt &fieldDim)
Real phiDer(UInt node, UInt derivative, UInt quadNode) const
Old accessor, use dphi instead.
Real dphi(UInt node, UInt derivative, UInt quadNode) const
Getter for the derivatives of the basis functions.
void mass(Real coef, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, UInt nb)
void stiff_gradgrad_2(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void source_stiff(const std::vector< Real > &constant, VectorElemental &elvec, const CurrentFE ¤tFe, const int &iblock)
Assembly for the source term where is a given by the values in the quadrature nodes.
void grad(const int icoor, Real coef, MatrixElemental &elmat, const CurrentFE &fe_u, const CurrentFE &fe_p, int iblock, int jblock)
const QuadratureRule & quadRule() const
Getter for the quadrature rule.
void stiffStrain(MatrixElemental &localStiff, const CurrentFE &stiffCFE, const Real &coefficient, const UInt &fieldDim)
void stiff_strain(Real coef, MatrixElemental &elmat, const CurrentFE &fe)
void stiff_derdiv(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
for Newton on St-Venant
std::function< const Real(const Real &, const Real &, const Real &, const Real &, const ID &) > function_Type
Use the portable syntax of the boost function.
void TP_TP_Hdiv(Real coef, MatrixElemental &elmat, const ReferenceFEHybrid &hybridFE, int iblock, int jblock)
void mass_Hdiv(Real(*InvpermFun)(const Real &, const Real &, const Real &), MatrixElemental &elmat, const CurrentFE &dualFE, int iblock, int jblock)
Real diameter() const
return the diameter of the element in the 1-norm
Real quadNode(UInt node, UInt coordinate) const
Getter for the quadrature nodes.
void stiff_gradgradTr_gradbis(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
double Real
Generic real data.
CurrentFE - A primordial class for the assembly of the local matrices/vectors retaining the values on...
void ipstab_div(const Real coef, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, const CurrentFEManifold &bdfe, int iblock, int jblock)
void source_stress2(Real coef, const VectorElemental &uk_loc, const VectorElemental &d_loc, VectorElemental &elvec, const CurrentFE &fe_u)
const CurrentFEManifold & operator[](const ID &i) const
Extracting a CurrentFEManifold from the faces list.
UInt nbFEDof() const
Getter for the number of nodes.
void divergence(MatrixElemental &elmat, const CurrentFE &uCFE, const CurrentFE &pCFE, const UInt &fieldDim, const Real &coefficient)
void div(const int icoor, Real coef, MatrixElemental &elmat, const CurrentFE &fe_u, const CurrentFE &fe_p, int iblock, int jblock)
Real wDetJacobian(UInt quadNode) const
Getter for the weighted jacobian determinant.
void choldc(KNM< Real > &a, KN< Real > &p)
Real phi(UInt node, UInt quadNode) const
Getter for basis function values (scalar FE case)
void source_press(Real coef, const VectorElemental &uk_loc, const VectorElemental &d_loc, VectorElemental &elvec, const CurrentFE &fe_u, const CurrentFE &fe_p, int iblock)
for Newton FSI
void stiff_dergrad_gradbis_Tr(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
void source_press2(Real coef, const VectorElemental &p_loc, const VectorElemental &d_loc, VectorElemental &elvec, const CurrentFE &fe, int iblock)
void stiff(Real coef, Real(*fct)(Real, Real, Real), MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock)
void mass_divw(const std::vector< Real > &coef, const VectorElemental &w_loc, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock, UInt nb)
Idem mass_divw , but with coefficient given by quadrature node.
void stiffness(MatrixElemental &localStiff, const CurrentFE &stiffCFE, const Real &coefficient, const UInt &fieldDim)
Elementary stiffness for constant coefficient.
void stiff_divgrad(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
int patternSecond(int i) const
patternSecond(i): column index in the element matrix of the i-th term of the pattern ...
void grad(const int icoor, const VectorElemental &vec_loc, MatrixElemental &elmat, const CurrentFE &fe1, const CurrentFE &fe2, const CurrentFE &fe3, int iblock, int jblock)
Convective term with a local vector coefficient (useful for Navier-Stokes problem+adv-diff) ...
Real weightDet(UInt quadNode) const
Old accessor, use wDetJacobian instead.
QuadratureRule - The basis class for storing and accessing quadrature rules.
void source_mass(const std::vector< Real > &constant, VectorElemental &elvec, const CurrentFE ¤tFe, const int &iblock)
Assembly for the source term where is a given by the values in the quadrature nodes.
void source_stress(Real coef, Real mu, const VectorElemental &uk_loc, const VectorElemental &pk_loc, const VectorElemental &d_loc, VectorElemental &elvec, const CurrentFE &fe_u, const CurrentFE &fe_p)
for Newton FSI
void grad(MatrixElemental &elmat, const CurrentFE &uCFE, const CurrentFE &pCFE, const UInt &fieldDim)
Real divPhiRef(UInt node, UInt quadNode) const
Getter for the divergence of a vectorial FE in the reference frame.
void mass_gradu(Real coef, const VectorElemental &u0_loc, MatrixElemental &elmat, const CurrentFE &fe)
void grad_Hdiv(Real coef, MatrixElemental &elmat, const CurrentFE &dualFE, const CurrentFE &primalFE, int iblock, int jblock)
void div_Hdiv(Real coef, MatrixElemental &elmat, const CurrentFE &dualFE, const CurrentFE &primalFE, int iblock, int jblock)
void source(Real constant, VectorElemental &elvec, const CurrentFE &fe, int iblock)
UInt nbQuadPt() const
Getter for the number of quadrature nodes.
void stiff(Real coef, MatrixElemental &elmat, const CurrentFE &fe, int iblock, int jblock)
uint32_type UInt
generic unsigned integer (used mainly for addressing)
void source_mass3(Real coef, const VectorElemental &un_loc, const VectorElemental &uk_loc, const VectorElemental &d_loc, VectorElemental &elvec, const CurrentFE &fe)
const UInt & numberBoundaryFE() const
Return the number of boundary elements of the reference element.
boost::numeric::ublas::matrix< Real > Matrix
void coorMap(Real &x, Real &y, Real &z, Real xi, Real eta, Real zeta) const
void source_press(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe_u, const CurrentFE &fe_p, ID mmDim, int iblock)
for Newton FSI
void stiff_dergrad_gradbis(Real coef, const VectorElemental &uk_loc, MatrixElemental &elmat, const CurrentFE &fe)
Real quadPt(UInt node, UInt coordinate) const
Old accessor, use quadNode instead.