35 #include "../sm/ErrorEstimators/huertaerrorestimator.h" 36 #include "../sm/EngineeringModels/adaptnlinearstatic.h" 37 #include "../sm/EngineeringModels/adaptlinearstatic.h" 79 #define STIFFNESS_TYPE ElasticStiffnessMatrix 82 #define ERROR_EXCESS 0.1 // 10 % 99 #define USE_INPUT_FILE 106 #define PRINT_COARSE_ERROR 114 static bool wholeFlag =
false, huertaFlag =
false;
116 double exactENorm, coarseUNorm, fineUNorm, mixedNorm;
143 IntArray localNodeIdArray, globalNodeIdArray;
184 if ( dynamic_cast< AdaptiveLinearStatic * >( d->
giveEngngModel() ) ) {
186 }
else if ( dynamic_cast< AdaptiveNonLinearStatic * >( d->
giveEngngModel() ) ) {
200 localNodeIdArray.
zero();
205 if ( exactFlag ==
true ) {
209 exactCoarseError.
resize(nelems);
216 if ( huertaFlag ==
false ) {
223 pe = sqrt( exactENorm / ( exactENorm + coarseUNorm ) );
225 OOFEM_LOG_INFO(
"Exact relative error (coarse): %6.3f%% (L2 norm)\n", pe * 100.0);
229 OOFEM_LOG_INFO(
"Exact relative error (coarse): %6.3f%% (energy norm)\n", pe * 100.0);
232 pe = sqrt(exactENorm / fineUNorm);
234 OOFEM_LOG_INFO(
"Exact relative error (fine): %6.3f%% (L2 norm)\n", pe * 100.0);
238 OOFEM_LOG_INFO(
"Exact relative error (fine): %6.3f%% (energy norm)\n", pe * 100.0);
268 for ( inode = 1; inode <= nnodes; inode++ ) {
272 for ( ielem = 1; ielem <= nelems; ielem++ ) {
276 #ifdef __PARALLEL_MODE 278 double buffer_out [ 4 ], buffer_in [ 4 ];
282 buffer_out [ 2 ] = ( double ) nelems;
285 MPI_Allreduce(buffer_out, buffer_in, 4, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
289 globalNelems = ( int ) ( buffer_in [ 2 ] + 0.1 );
293 globalNelems = nelems;
296 #ifdef PRINT_COARSE_ERROR 298 if ( exactFlag ==
true ) {
300 OOFEM_LOG_DEBUG(
"---------------------------------------------------------\n");
306 for ( ielem = 1; ielem <= nelems; ielem++ ) {
307 if ( exactFlag ==
false ) {
316 if ( fabs( exactCoarseError.
at(ielem) ) > 1.0e-30 && this->
eNorms.
at(ielem) != 0.0 ) {
319 this->
eNorms.
at(ielem) / sqrt( exactCoarseError.
at(ielem) ),
338 if ( elemErrLimit != 0.0 ) {
339 double eerror, iratio;
341 for ( ielem = 1; ielem <= nelems; ielem++ ) {
343 iratio = eerror / elemErrLimit;
347 #ifdef __PARALLEL_MODE 350 MPI_Allreduce(& myGlobalWENorm, &
globalWENorm, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
369 OOFEM_LOG_INFO(
"Relative error estimate [step number %5d]: %6.3f%% (L2 norm)\n",
374 OOFEM_LOG_INFO(
"Relative error estimate [step number %5d]: %6.3f%% (energy norm)\n",
379 OOFEM_LOG_INFO(
"Relative error estimate [step number %5d]: %6.3f%% (weighted)\n",
423 int tStepNumber, curNumber = tStep->
giveNumber();
436 while ( tStepNumber < curNumber ) {
467 if ( exactFlag ==
true ) {
468 #ifdef __PARALLEL_MODE 470 buffer_out [ 0 ] = exactENorm;
471 buffer_out [ 1 ] = coarseUNorm;
472 buffer_out [ 2 ] = mixedNorm;
473 buffer_out [ 3 ] = fineUNorm;
475 MPI_Allreduce(buffer_out, buffer_in, 4, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
477 exactENorm = buffer_in [ 0 ];
478 coarseUNorm = buffer_in [ 1 ];
479 mixedNorm = buffer_in [ 2 ];
480 fineUNorm = buffer_in [ 3 ];
490 pe = sqrt( exactENorm / ( exactENorm + coarseUNorm ) );
492 OOFEM_LOG_INFO(
"Exact relative error (coarse): %6.3f%% (L2 norm)\n", pe * 100.0);
496 OOFEM_LOG_INFO(
"Exact relative error (coarse): %6.3f%% (energy norm)\n", pe * 100.0);
499 pe = sqrt(exactENorm / fineUNorm);
501 OOFEM_LOG_INFO(
"Exact relative error (fine): %6.3f%% (L2 norm)\n", pe * 100.0);
505 OOFEM_LOG_INFO(
"Exact relative error (fine): %6.3f%% (energy norm)\n", pe * 100.0);
561 return this->
rc.get();
569 int n, level, wErrorFlag = 0;
603 if ( wErrorFlag != 0 ) {
607 if ( masterRun ==
true ) {
617 if ( impCSect != 0 && perCSect == 0 ) {
618 OOFEM_ERROR(
"Missing perfect material specification (through cross-section)");
725 #define MAX_COARSE_RATE 2.0 726 #define MAX_REFINE_RATE 5.0 731 int nelem, nnode, elemPolyOrder, skipped;
732 double globValNorm = 0.0, globValErrorNorm = 0.0, globValWErrorNorm = 0.0;
733 double globValNorm2, globValErrorNorm2, globValWErrorNorm2;
734 double eerror, iratio, currDensity, elemSize, elemErrLimit, percentError;
760 #ifndef __PARALLEL_MODE 761 globalNelems = nelem;
764 if ( skipped == globalNelems ) {
780 globValNorm2 = globValNorm * globValNorm;
781 globValErrorNorm2 = globValErrorNorm * globValErrorNorm;
782 globValWErrorNorm2 = globValWErrorNorm * globValWErrorNorm;
784 elemErrLimit = sqrt( ( globValNorm2 + globValErrorNorm2 ) / ( globalNelems - skipped ) ) * this->
requiredError;
785 if ( elemErrLimit == 0.0 ) {
793 std :: vector< int > connectedElems(nnode);
794 for (
int i = 0; i < nnode; i++ ) {
795 connectedElems [ i ] = 0;
798 percentError = sqrt( globValErrorNorm2 / ( globValErrorNorm2 + globValNorm2 ) );
805 for (
int i = 1; i <= nelem; i++ ) {
828 result = ielem->
giveIPValue(val, gp, IST_PrincipalDamageTensor, tStep);
831 maxVal =
max(maxVal, sval);
835 if ( maxVal > 0.75 ) {
836 if ( currDensity > 1.0 ) {
856 if ( percentError >= this->requiredError * 0.5 * this->
refineCoeff || run <= 5 ) {
857 for (
int i = 1; i <= nnode; i++ ) {
867 double pwe = sqrt( globValWErrorNorm2 / ( globValErrorNorm2 + globValNorm2 ) );
869 if ( pwe >= this->requiredError * 0.5 * this->
refineCoeff || run <= 5 ) {
870 for (
int i = 1; i <= nnode; i++ ) {
888 for (
int i = 1; i <= nnode; i++ ) {
896 for (
int i = 1; i <= nelem; i++ ) {
910 iratio = eerror / elemErrLimit;
911 if ( iratio > 1.0 ) {
929 elemSize = currDensity / pow(iratio, 1.0 / elemPolyOrder);
938 result = ielem->
giveIPValue(val, gp, IST_PrincipalDamageTensor, tStep);
941 maxVal =
max(maxVal, sval);
945 if ( maxVal > 0.75 ) {
946 elemSize =
min(elemSize, 1.0);
952 if ( connectedElems [ jnode - 1 ] != 0 ) {
959 connectedElems [ jnode - 1 ]++;
964 for (
int i = 0; i < nnode; i++ ) {
965 if ( connectedElems [ i ] == 0 ) {
972 if ( refine ==
true ) {
991 int noRemeshFlag = 0, wErrorFlag = 0;
997 if ( noRemeshFlag != 0 ) {
1003 if ( wErrorFlag != 0 ) {
1009 if ( coeff > 0.0 && coeff <= 1.0 ) {
1030 for ( i = 1; i <= isize; i++ ) {
1043 for (
int i = 1; i <= isize; i++ ) {
1061 if ( this->refinedMesh.completed == 1 ) {
1066 this->refinedElementList.reserve(nelems);
1068 for (
int ielem = 1; ielem <= nelems; ielem++ ) {
1069 this->refinedElementList.emplace_back(d, ielem, this->refineLevel);
1072 if ( refinedMesh.refineMeshGlobally(d, this->refineLevel, this->refinedElementList) != 0 ) {
1076 this->refinedMesh.completed = 1;
1083 int level,
int nodeId,
IntArray &localNodeIdArray,
IntArray &globalNodeIdArray,
1086 int &localNodeId,
int &localElemId,
int &localBcId,
1090 std :: list< FloatArray >newNodes;
1091 IntArray *connectivity, boundary(1);
1092 int startNode, endNode, pos, nd, bc, dofs;
1094 if ( nodeId != 0 ) {
1095 startNode = endNode = nodeId;
1104 for (
int inode = startNode; inode <= endNode; inode++ ) {
1105 localElemId += ( level + 1 );
1111 for (
int m = 0; m < level + 2; m++, pos++ ) {
1112 nd = connectivity->
at(pos);
1113 if ( localNodeIdArray.
at(nd) == 0 ) {
1114 localNodeIdArray.
at(nd) = ++localNodeId;
1119 if ( nodeId == 0 ) {
1120 if ( m == 0 && boundary.
at(1) == 0 ) {
1124 if ( m == level + 1 ) {
1130 if ( wholeFlag ==
true ) {
1147 double x, y, z, u, du = 1.0 / ( level + 1 );
1148 double xc, yc, zc, xm, ym, zm;
1149 int idof, sideNumBc, bcId, bcDofId;
1150 IntArray sideBcDofId, dofIdArray, *loadArray;
1156 for (
int inode = startNode; inode <= endNode; inode++ ) {
1157 xc = corner [ inode - 1 ]->
at(1);
1158 yc = corner [ inode - 1 ]->
at(2);
1159 zc = corner [ inode - 1 ]->
at(3);
1173 hasBc = refinedElement->
giveBcDofArray1D(inode, element, sideBcDofId, sideNumBc, tStep);
1177 for (
int m = 0; m < level + 2; m++, u += du, pos++ ) {
1178 nd = connectivity->
at(pos);
1179 if ( localNodeIdArray.
at(nd) == 0 ) {
1182 localNodeIdArray.
at(nd) = ++localNodeId;
1183 globalNodeIdArray.
at(localNodeId) = nd;
1185 x = xc * ( 1.0 - u ) + xm * u;
1186 y = yc * ( 1.0 - u ) + ym * u;
1187 z = zc * ( 1.0 - u ) + zm * u;
1197 lcs->
at(2, 1), lcs->
at(2, 2), lcs->
at(2, 3)};
1203 if ( nodeId == 0 ) {
1204 if ( m == 0 && boundary.
at(1) == 0 ) {
1208 if ( m == level + 1 ) {
1214 if ( wholeFlag ==
true ) {
1226 for (
Dof *dof: *node ) {
1234 if ( hasBc ==
true ) {
1239 for (
Dof *nodeDof: *node ) {
1241 if ( nodeDof->hasBc(tStep) != 0 ) {
1242 bcDofId = nodeDof->giveBcId();
1251 if ( ( loadArray = node->giveLoadArray() )->giveSize() != 0 ) {
1255 if ( sideNumBc != 0 ) {
1261 for ( idof = 1; idof <= dofs; idof++ ) {
1263 if ( bcId <= sideNumBc ) {
1265 if ( nodeDof->giveDofID() == dofIdArray.
at(idof) ) {
1271 bcs.
at(idof) = bcDofId;
1281 if ( ( loadArray = node->
giveLoadArray() )->giveSize() != 0 ) {
1296 std :: vector< FloatArray > newNodesVec( newNodes.begin(), newNodes.end() );
1305 for (
int inode = startNode; inode <= endNode; inode++ ) {
1310 for (
int m = 0; m < level + 1; m++ ) {
1317 nd1 = localNodeIdArray.
at( connectivity->
at(nd) );
1318 nd2 = localNodeIdArray.
at( connectivity->
at(nd + 1) );
1322 if ( impCSect != 0 && impCSect == csect ) {
1324 coordinates1 = newNodesVec [ nd1 - 1 ];
1325 coordinates2 = newNodesVec [ nd2 - 1 ];
1328 for (
int i = 1; i <= impPos.
giveSize(); i++ ) {
1329 if ( impPos.
at(i) <
min( coordinates1.
at(i), coordinates2.
at(i) ) ) {
1334 if ( impPos.
at(i) >
max( coordinates1.
at(i), coordinates2.
at(i) ) ) {
1350 if ( hasLoad ==
true ) {
1351 if ( boundaryLoadArray.
giveSize() != 0 ) {
1352 ir->
setField(boundaryLoadArray,
"boundaryloads");
1363 double u, du = 1.0 / ( level + 1 );
1364 double xc, yc, zc, xm, ym, zm;
1375 for (
int inode = startNode; inode <= endNode; inode++ ) {
1376 xc = corner [ inode - 1 ]->
at(1);
1377 yc = corner [ inode - 1 ]->
at(2);
1378 zc = corner [ inode - 1 ]->
at(3);
1392 for (
int m = 0; m < level + 2; m++, u += du, pos++ ) {
1393 nd = connectivity->
at(pos);
1394 if ( localNodeIdArray.
at(nd) > 0 ) {
1395 localNodeIdArray.
at(nd) = -localNodeIdArray.
at(nd);
1399 if ( nodeId == 0 ) {
1400 if ( m == 0 && boundary.
at(1) == 0 ) {
1404 if ( m == level + 1 ) {
1410 if ( wholeFlag ==
true ) {
1417 globCoord.
at(1) = xc * ( 1.0 - u ) + xm * u;
1418 globCoord.
at(2) = yc * ( 1.0 - u ) + ym * u;
1419 globCoord.
at(3) = zc * ( 1.0 - u ) + zm * u;
1424 gp.setNaturalCoordinates(lcoord);
1427 this->HuertaErrorEstimatorI_computeNmatrixAt(&gp, Nmatrix);
1432 for (
int idof = 1; idof <= dofs; idof++ ) {
1445 for (
int inode = startNode; inode <= endNode; inode++ ) {
1450 for (
int m = 0; m < level + 2; m++, pos++ ) {
1451 nd = connectivity->
at(pos);
1452 if ( localNodeIdArray.
at(nd) > 0 ) {
1453 localNodeIdArray.
at(nd) = -localNodeIdArray.
at(nd);
1457 if ( nodeId == 0 ) {
1458 if ( m == 0 && boundary.
at(1) == 0 ) {
1462 if ( m == level + 1 ) {
1468 if ( wholeFlag ==
true ) {
1475 for (
int idof = 1; idof <= dofs; idof++ ) {
1477 controlNode.
at(localBcId) = -localNodeIdArray.
at(nd);
1478 controlDof.
at(localBcId) = idof;
1493 int level,
int nodeId,
IntArray &localNodeIdArray,
IntArray &globalNodeIdArray,
1496 int &localNodeId,
int &localElemId,
int &localBcId,
1500 IntArray *connectivity, boundary(2);
1501 int startNode, endNode, inode, n, m, pos, nd, bc, dofs;
1504 if ( nodeId != 0 ) {
1505 startNode = endNode = nodeId;
1514 for ( inode = startNode; inode <= endNode; inode++ ) {
1515 localElemId += ( level + 1 ) * ( level + 1 );
1521 for ( n = 0; n < level + 2; n++ ) {
1522 for ( m = 0; m < level + 2; m++, pos++ ) {
1523 nd = connectivity->
at(pos);
1524 if ( localNodeIdArray.
at(nd) == 0 ) {
1525 localNodeIdArray.
at(nd) = ++localNodeId;
1529 if ( nodeId == 0 ) {
1530 if ( m == 0 && boundary.
at(1) == 0 ) {
1534 if ( n == 0 && boundary.
at(2) == 0 ) {
1538 if ( n == level + 1 || m == level + 1 ) {
1545 if ( m == 0 && boundary.
at(1) == 0 ) {
1549 if ( n == 0 && boundary.
at(2) == 0 ) {
1557 if ( wholeFlag ==
true ) {
1575 int s1, s2, idof, index;
1576 double x, y, z, u, v, du = 1.0 / ( level + 1 ), dv = 1.0 / ( level + 1 );
1577 double xc, yc, zc, xs1, ys1, zs1, xs2, ys2, zs2, xm, ym, zm;
1579 std::vector< IntArray >sideBcDofIdList;
1580 IntArray sideNumBc(2), dofIdArray, * loadArray;
1586 sideBcDofIdList.resize(2);
1588 for ( inode = startNode; inode <= endNode; inode++ ) {
1590 if ( ( s2 = inode - 1 ) == 0 ) {
1594 xc = corner [ inode - 1 ]->
at(1);
1595 yc = corner [ inode - 1 ]->
at(2);
1596 zc = corner [ inode - 1 ]->
at(3);
1598 xs1 = midSide [ s1 - 1 ].
at(1);
1599 ys1 = midSide [ s1 - 1 ].
at(2);
1600 zs1 = midSide [ s1 - 1 ].
at(3);
1602 xs2 = midSide [ s2 - 1 ].
at(1);
1603 ys2 = midSide [ s2 - 1 ].
at(2);
1604 zs2 = midSide [ s2 - 1 ].
at(3);
1618 hasBc = refinedElement->
giveBcDofArray2D(inode, element, sideBcDofIdList, sideNumBc, tStep);
1622 for ( n = 0; n < level + 2; n++, v += dv ) {
1624 for ( m = 0; m < level + 2; m++, u += du, pos++ ) {
1625 nd = connectivity->
at(pos);
1626 if ( localNodeIdArray.
at(nd) == 0 ) {
1630 localNodeIdArray.
at(nd) = ++localNodeId;
1631 globalNodeIdArray.
at(localNodeId) = nd;
1633 x = ( xc * ( 1.0 - u ) + xs1 * u ) * ( 1.0 - v ) + ( xs2 * ( 1.0 - u ) + xm * u ) * v;
1634 y = ( yc * ( 1.0 - u ) + ys1 * u ) * ( 1.0 - v ) + ( ys2 * ( 1.0 - u ) + ym * u ) * v;
1635 z = ( zc * ( 1.0 - u ) + zs1 * u ) * ( 1.0 - v ) + ( zs2 * ( 1.0 - u ) + zm * u ) * v;
1641 lcs->
at(2, 1), lcs->
at(2, 2), lcs->
at(2, 3)};
1647 if ( nodeId == 0 ) {
1648 if ( m == 0 && boundary.
at(1) == 0 ) {
1652 if ( n == 0 && boundary.
at(2) == 0 ) {
1656 if ( n == level + 1 || m == level + 1 ) {
1663 if ( m == 0 && boundary.
at(1) == 0 ) {
1667 if ( n == 0 && boundary.
at(2) == 0 ) {
1675 if ( wholeFlag ==
true ) {
1687 for ( idof = 0; idof < dofs; idof++ ) {
1688 bcs.
at(idof) = ++localBcId;
1693 if ( hasBc ==
true && ( m == 0 || n == 0 ) ) {
1696 if ( m == 0 && n == 0 ) {
1699 for (
Dof *nodeDof: *node ) {
1701 if ( nodeDof->hasBc(tStep) != 0 ) {
1702 bcDofId = nodeDof->giveBcId();
1713 if ( ( loadArray = node->giveLoadArray() )->giveSize() != 0 ) {
1718 if ( m == 0 && sideNumBc.at(1) != 0 ) {
1722 if ( n == 0 && sideNumBc.at(2) != 0 ) {
1731 const IntArray &sideBcDofId = sideBcDofIdList[index-1];
1733 for ( idof = 1; idof <= dofs; idof++ ) {
1735 if ( bcId <= sideNumBc.at(index) ) {
1737 if ( nodeDof->giveDofID() == dofIdArray.
at(idof) ) {
1743 bcs.
at(idof) = bcDofId;
1751 if ( m == 0 && n == 0 ) {
1752 if ( ( loadArray = node->
giveLoadArray() )->giveSize() != 0 ) {
1769 int csect, iside, index;
1770 int nd1, nd2, nd3, nd4;
1772 std::vector< IntArray >boundaryLoadList;
1777 boundaryLoadList.resize(2);
1779 for ( inode = startNode; inode <= endNode; inode++ ) {
1784 for ( n = 0; n < level + 1; n++ ) {
1785 for ( m = 0; m < level + 1; m++ ) {
1791 nd = n * ( level + 2 ) + m + 1;
1793 nd1 = localNodeIdArray.
at( connectivity->
at(nd) );
1794 nd2 = localNodeIdArray.
at( connectivity->
at(nd + 1) );
1795 nd3 = localNodeIdArray.
at( connectivity->
at(nd + level + 3) );
1796 nd4 = localNodeIdArray.
at( connectivity->
at(nd + level + 2) );
1804 ir->
setField(* loadArray,
"bodyloads");
1809 if ( hasLoad ==
true && ( m == 0 || n == 0 ) ) {
1810 if ( m == 0 && n == 0 ) {
1812 for ( iside = 1; iside <= 2; iside++ ) {
1813 if ( boundary.
at(iside) == 0 ) {
1817 loads += boundaryLoadList[iside-1].giveSize();
1821 for ( iside = 1; iside <= 2; iside++ ) {
1822 if ( boundary.
at(iside) == 0 ) {
1826 if ( boundaryLoadList[iside-1].giveSize() == 0 ) {
1830 ir->
setField(boundaryLoadList[iside-1],
"boundaryloads");
1835 if ( m == 0 && boundary.
at(1) != 0 && boundaryLoadList[0].giveSize() != 0 ) {
1839 if ( n == 0 && boundary.
at(2) != 0 && boundaryLoadList[1].giveSize() != 0 ) {
1844 ir->
setField(boundaryLoadList[index-1],
"boundaryloads");
1860 double u, v, du = 1.0 / ( level + 1 ), dv = 1.0 / ( level + 1 );
1861 double xc, yc, zc, xs1, ys1, zs1, xs2, ys2, zs2, xm, ym, zm;
1871 gp =
new GaussPoint( &ir, 1, {}, 1.0, mmode);
1873 for ( inode = startNode; inode <= endNode; inode++ ) {
1875 if ( ( s2 = inode - 1 ) == 0 ) {
1879 xc = corner [ inode - 1 ]->
at(1);
1880 yc = corner [ inode - 1 ]->
at(2);
1881 zc = corner [ inode - 1 ]->
at(3);
1883 xs1 = midSide [ s1 - 1 ].
at(1);
1884 ys1 = midSide [ s1 - 1 ].
at(2);
1885 zs1 = midSide [ s1 - 1 ].
at(3);
1887 xs2 = midSide [ s2 - 1 ].
at(1);
1888 ys2 = midSide [ s2 - 1 ].
at(2);
1889 zs2 = midSide [ s2 - 1 ].
at(3);
1903 for ( n = 0; n < level + 2; n++, v += dv ) {
1905 for ( m = 0; m < level + 2; m++, u += du, pos++ ) {
1906 nd = connectivity->
at(pos);
1907 if ( localNodeIdArray.
at(nd) > 0 ) {
1908 localNodeIdArray.
at(nd) = -localNodeIdArray.
at(nd);
1912 if ( nodeId == 0 ) {
1913 if ( m == 0 && boundary.
at(1) == 0 ) {
1917 if ( n == 0 && boundary.
at(2) == 0 ) {
1921 if ( n == level + 1 || m == level + 1 ) {
1928 if ( m == 0 && boundary.
at(1) == 0 ) {
1932 if ( n == 0 && boundary.
at(2) == 0 ) {
1940 if ( wholeFlag ==
true ) {
1947 globCoord.
at(1) = ( xc * ( 1.0 - u ) + xs1 * u ) * ( 1.0 - v ) + ( xs2 * ( 1.0 - u ) + xm * u ) * v;
1948 globCoord.
at(2) = ( yc * ( 1.0 - u ) + ys1 * u ) * ( 1.0 - v ) + ( ys2 * ( 1.0 - u ) + ym * u ) * v;
1949 globCoord.
at(3) = ( zc * ( 1.0 - u ) + zs1 * u ) * ( 1.0 - v ) + ( zs2 * ( 1.0 - u ) + zm * u ) * v;
1956 this->HuertaErrorEstimatorI_computeNmatrixAt(gp, Nmatrix);
1961 for ( idof = 1; idof <= dofs; idof++ ) {
1965 ir->
setField(uFine.
at(idof),
"prescribedvalue");
1978 for ( inode = startNode; inode <= endNode; inode++ ) {
1983 for ( n = 0; n < level + 2; n++ ) {
1984 for ( m = 0; m < level + 2; m++, pos++ ) {
1985 nd = connectivity->
at(pos);
1986 if ( localNodeIdArray.
at(nd) > 0 ) {
1987 localNodeIdArray.
at(nd) = -localNodeIdArray.
at(nd);
1991 if ( nodeId == 0 ) {
1992 if ( m == 0 && boundary.
at(1) == 0 ) {
1996 if ( n == 0 && boundary.
at(2) == 0 ) {
2000 if ( n == level + 1 || m == level + 1 ) {
2007 if ( m == 0 && boundary.
at(1) == 0 ) {
2011 if ( n == 0 && boundary.
at(2) == 0 ) {
2019 if ( wholeFlag ==
true ) {
2026 for ( idof = 1; idof <= dofs; idof++ ) {
2028 controlNode.
at(localBcId) = -localNodeIdArray.
at(nd);
2029 controlDof.
at(localBcId) = idof;
2046 int level,
int nodeId,
IntArray &localNodeIdArray,
IntArray &globalNodeIdArray,
2049 int &localNodeId,
int &localElemId,
int &localBcId,
2050 int hexaSideNode [ 1 ] [ 3 ],
int hexaFaceNode [ 1 ] [ 3 ],
2054 IntArray *connectivity, boundary(3);
2055 int startNode, endNode, inode, k, n, m, pos, nd, bc, dofs;
2058 if ( nodeId != 0 ) {
2059 startNode = endNode = nodeId;
2069 if ( nodes / 2 * 2 != nodes ) {
2082 for ( inode = startNode; inode <= endNode; inode++ ) {
2083 localElemId += ( level + 1 ) * ( level + 1 ) * ( level + 1 );
2089 for ( k = 0; k < level + 2; k++ ) {
2090 for ( n = 0; n < level + 2; n++ ) {
2091 for ( m = 0; m < level + 2; m++, pos++ ) {
2092 nd = connectivity->
at(pos);
2093 if ( localNodeIdArray.
at(nd) == 0 ) {
2094 localNodeIdArray.
at(nd) = ++localNodeId;
2098 if ( nodeId == 0 ) {
2099 if ( m == 0 && boundary.
at(1) == 0 ) {
2103 if ( n == 0 && boundary.
at(2) == 0 ) {
2107 if ( k == 0 && boundary.
at(3) == 0 ) {
2111 if ( k == level + 1 || n == level + 1 || m == level + 1 ) {
2118 if ( m == 0 && boundary.
at(1) == 0 ) {
2122 if ( n == 0 && boundary.
at(2) == 0 ) {
2126 if ( k == 0 && boundary.
at(3) == 0 ) {
2134 if ( wholeFlag ==
true ) {
2153 int s1, s2, s3, f1, f2, f3, idof, index;
2154 double x, y, z, u, v, w, du = 1.0 / ( level + 1 ), dv = 1.0 / ( level + 1 ), dw = 1.0 / ( level + 1 );
2155 double xc, yc, zc, xm, ym, zm;
2156 double xs1, ys1, zs1, xs2, ys2, zs2, xs3, ys3, zs3;
2157 double xf1, yf1, zf1, xf2, yf2, zf2, xf3, yf3, zf3;
2159 std::vector < IntArray >sideBcDofIdList, faceBcDofIdList;
2160 IntArray sideNumBc(3), faceNumBc(3), dofIdArray, * loadArray;
2166 sideBcDofIdList.resize(3);
2167 faceBcDofIdList.resize(3);
2169 for ( inode = startNode; inode <= endNode; inode++ ) {
2170 s1 = hexaSideNode [ inode - 1 ] [ 0 ];
2171 s2 = hexaSideNode [ inode - 1 ] [ 1 ];
2172 s3 = hexaSideNode [ inode - 1 ] [ 2 ];
2173 f1 = hexaFaceNode [ inode - 1 ] [ 0 ];
2174 f2 = hexaFaceNode [ inode - 1 ] [ 1 ];
2175 f3 = hexaFaceNode [ inode - 1 ] [ 2 ];
2177 xc = corner [ inode - 1 ]->
at(1);
2178 yc = corner [ inode - 1 ]->
at(2);
2179 zc = corner [ inode - 1 ]->
at(3);
2181 xs1 = midSide [ s1 - 1 ].
at(1);
2182 ys1 = midSide [ s1 - 1 ].
at(2);
2183 zs1 = midSide [ s1 - 1 ].
at(3);
2185 xs2 = midSide [ s2 - 1 ].
at(1);
2186 ys2 = midSide [ s2 - 1 ].
at(2);
2187 zs2 = midSide [ s2 - 1 ].
at(3);
2189 xs3 = midSide [ s3 - 1 ].
at(1);
2190 ys3 = midSide [ s3 - 1 ].
at(2);
2191 zs3 = midSide [ s3 - 1 ].
at(3);
2193 xf1 = midFace [ f1 - 1 ].
at(1);
2194 yf1 = midFace [ f1 - 1 ].
at(2);
2195 zf1 = midFace [ f1 - 1 ].
at(3);
2197 xf2 = midFace [ f2 - 1 ].
at(1);
2198 yf2 = midFace [ f2 - 1 ].
at(2);
2199 zf2 = midFace [ f2 - 1 ].
at(3);
2201 xf3 = midFace [ f3 - 1 ].
at(1);
2202 yf3 = midFace [ f3 - 1 ].
at(2);
2203 zf3 = midFace [ f3 - 1 ].
at(3);
2217 hasBc = refinedElement->
giveBcDofArray3D(inode, element, sideBcDofIdList, sideNumBc,
2218 faceBcDofIdList, faceNumBc, tStep);
2221 for ( k = 0; k < level + 2; k++, w += dw ) {
2223 for ( n = 0; n < level + 2; n++, v += dv ) {
2225 for ( m = 0; m < level + 2; m++, u += du, pos++ ) {
2226 nd = connectivity->
at(pos);
2227 if ( localNodeIdArray.
at(nd) == 0 ) {
2231 localNodeIdArray.
at(nd) = ++localNodeId;
2232 globalNodeIdArray.
at(localNodeId) = nd;
2234 x = ( ( xc * ( 1.0 - u ) + xs1 * u ) * ( 1.0 - v ) + ( xs2 * ( 1.0 - u ) + xf1 * u ) * v ) * ( 1.0 - w )
2235 + ( ( xs3 * ( 1.0 - u ) + xf2 * u ) * ( 1.0 - v ) + ( xf3 * ( 1.0 - u ) + xm * u ) * v ) * w;
2236 y = ( ( yc * ( 1.0 - u ) + ys1 * u ) * ( 1.0 - v ) + ( ys2 * ( 1.0 - u ) + yf1 * u ) * v ) * ( 1.0 - w )
2237 + ( ( ys3 * ( 1.0 - u ) + yf2 * u ) * ( 1.0 - v ) + ( yf3 * ( 1.0 - u ) + ym * u ) * v ) * w;
2238 z = ( ( zc * ( 1.0 - u ) + zs1 * u ) * ( 1.0 - v ) + ( zs2 * ( 1.0 - u ) + zf1 * u ) * v ) * ( 1.0 - w )
2239 + ( ( zs3 * ( 1.0 - u ) + zf2 * u ) * ( 1.0 - v ) + ( zf3 * ( 1.0 - u ) + zm * u ) * v ) * w;
2245 lcs->
at(2, 1), lcs->
at(2, 2), lcs->
at(2, 3)};
2251 if ( nodeId == 0 ) {
2252 if ( m == 0 && boundary.
at(1) == 0 ) {
2256 if ( n == 0 && boundary.
at(2) == 0 ) {
2260 if ( k == 0 && boundary.
at(3) == 0 ) {
2264 if ( k == level + 1 || n == level + 1 || m == level + 1 ) {
2271 if ( m == 0 && boundary.
at(1) == 0 ) {
2275 if ( n == 0 && boundary.
at(2) == 0 ) {
2279 if ( k == 0 && boundary.
at(3) == 0 ) {
2287 if ( wholeFlag ==
true ) {
2299 for ( idof = 0; idof < dofs; idof++ ) {
2300 bcs.
at(idof) = ++localBcId;
2305 if ( hasBc ==
true && ( m == 0 || n == 0 || k == 0 ) ) {
2308 if ( m == 0 && n == 0 && k == 0 ) {
2311 for (
Dof *nodeDof: *node ) {
2313 if ( nodeDof->hasBc(tStep) != 0 ) {
2314 bcDofId = nodeDof->giveBcId();
2325 if ( ( loadArray = node->giveLoadArray() )->giveSize() != 0 ) {
2329 if ( ( m == 0 && n == 0 ) || ( m == 0 && k == 0 ) || ( n == 0 && k == 0 ) ) {
2331 if ( n == 0 && k == 0 && sideNumBc.at(1) != 0 ) {
2335 if ( m == 0 && k == 0 && sideNumBc.at(2) != 0 ) {
2339 if ( m == 0 && n == 0 && sideNumBc.at(3) != 0 ) {
2348 const IntArray &sideBcDofId = sideBcDofIdList[index-1];
2350 for ( idof = 1; idof <= dofs; idof++ ) {
2352 if ( bcId <= sideNumBc.at(index) ) {
2354 if ( nodeDof->
giveDofID() == dofIdArray.
at(idof) ) {
2360 bcs.
at(idof) = bcDofId;
2366 if ( m == 0 && faceNumBc.at(1) != 0 ) {
2370 if ( n == 0 && faceNumBc.at(2) != 0 ) {
2374 if ( k == 0 && faceNumBc.at(3) != 0 ) {
2383 const IntArray &faceBcDofId = faceBcDofIdList[index-1];
2385 for ( idof = 1; idof <= dofs; idof++ ) {
2387 if ( bcId <= faceNumBc.at(index) ) {
2389 if ( nodeDof->
giveDofID() == dofIdArray.
at(idof) ) {
2395 bcs.
at(idof) = bcDofId;
2404 if ( m == 0 && n == 0 ) {
2405 if ( ( loadArray = node->
giveLoadArray() )->giveSize() != 0 ) {
2406 ir->
setField(* loadArray,
"loads");
2424 int nd1, nd2, nd3, nd4, nd5, nd6, nd7, nd8;
2426 std::vector< IntArray >boundaryLoadList;
2431 boundaryLoadList.resize(3);
2433 for ( inode = startNode; inode <= endNode; inode++ ) {
2438 for ( k = 0; k < level + 1; k++ ) {
2439 for ( n = 0; n < level + 1; n++ ) {
2440 for ( m = 0; m < level + 1; m++ ) {
2445 nd = k * ( level + 2 ) * ( level + 2 ) + n * ( level + 2 ) + m + 1;
2447 nd1 = localNodeIdArray.
at( connectivity->
at(nd) );
2448 nd2 = localNodeIdArray.
at( connectivity->
at(nd + 1) );
2449 nd3 = localNodeIdArray.
at( connectivity->
at(nd + level + 3) );
2450 nd4 = localNodeIdArray.
at( connectivity->
at(nd + level + 2) );
2452 nd += ( level + 2 ) * ( level + 2 );
2454 nd5 = localNodeIdArray.
at( connectivity->
at(nd) );
2455 nd6 = localNodeIdArray.
at( connectivity->
at(nd + 1) );
2456 nd7 = localNodeIdArray.
at( connectivity->
at(nd + level + 3) );
2457 nd8 = localNodeIdArray.
at( connectivity->
at(nd + level + 2) );
2466 ir->
setField(* loadArray,
"bodyloads");
2471 if ( hasLoad ==
true && ( m == 0 || n == 0 || k == 0 ) ) {
2473 for ( iside = 1; iside <= 3; iside++ ) {
2474 if ( boundary.
at(iside) == 0 ) {
2478 if ( m != 0 && iside == 1 ) {
2482 if ( n != 0 && iside == 2 ) {
2486 if ( k != 0 && iside == 3 ) {
2490 loads += boundaryLoadList[iside-1].giveSize();
2494 for ( iside = 1; iside <= 3; iside++ ) {
2495 if ( boundary.
at(iside) == 0 ) {
2499 if ( m != 0 && iside == 1 ) {
2503 if ( n != 0 && iside == 2 ) {
2507 if ( k != 0 && iside == 3 ) {
2511 if ( boundaryLoadList[iside-1].giveSize() == 0 ) {
2515 ir->
setField(boundaryLoadList[iside-1],
"boundaryloads");
2531 int s1, s2, s3, f1, f2, f3, idof;
2532 double u, v, w, du = 1.0 / ( level + 1 ), dv = 1.0 / ( level + 1 ), dw = 1.0 / ( level + 1 );
2533 double xc, yc, zc, xm, ym, zm;
2534 double xs1, ys1, zs1, xs2, ys2, zs2, xs3, ys3, zs3;
2535 double xf1, yf1, zf1, xf2, yf2, zf2, xf3, yf3, zf3;
2544 auto gp =
new GaussPoint(&irule, 1, {}, 1.0, mmode);
2545 for ( inode = startNode; inode <= endNode; inode++ ) {
2546 s1 = hexaSideNode [ inode - 1 ] [ 0 ];
2547 s2 = hexaSideNode [ inode - 1 ] [ 1 ];
2548 s3 = hexaSideNode [ inode - 1 ] [ 2 ];
2549 f1 = hexaFaceNode [ inode - 1 ] [ 0 ];
2550 f2 = hexaFaceNode [ inode - 1 ] [ 1 ];
2551 f3 = hexaFaceNode [ inode - 1 ] [ 2 ];
2553 xc = corner [ inode - 1 ]->
at(1);
2554 yc = corner [ inode - 1 ]->
at(2);
2555 zc = corner [ inode - 1 ]->
at(3);
2557 xs1 = midSide [ s1 - 1 ].
at(1);
2558 ys1 = midSide [ s1 - 1 ].
at(2);
2559 zs1 = midSide [ s1 - 1 ].
at(3);
2561 xs2 = midSide [ s2 - 1 ].
at(1);
2562 ys2 = midSide [ s2 - 1 ].
at(2);
2563 zs2 = midSide [ s2 - 1 ].
at(3);
2565 xs3 = midSide [ s3 - 1 ].
at(1);
2566 ys3 = midSide [ s3 - 1 ].
at(2);
2567 zs3 = midSide [ s3 - 1 ].
at(3);
2569 xf1 = midFace [ f1 - 1 ].
at(1);
2570 yf1 = midFace [ f1 - 1 ].
at(2);
2571 zf1 = midFace [ f1 - 1 ].
at(3);
2573 xf2 = midFace [ f2 - 1 ].
at(1);
2574 yf2 = midFace [ f2 - 1 ].
at(2);
2575 zf2 = midFace [ f2 - 1 ].
at(3);
2577 xf3 = midFace [ f3 - 1 ].
at(1);
2578 yf3 = midFace [ f3 - 1 ].
at(2);
2579 zf3 = midFace [ f3 - 1 ].
at(3);
2593 for ( k = 0; k < level + 2; k++, w += dw ) {
2595 for ( n = 0; n < level + 2; n++, v += dv ) {
2597 for ( m = 0; m < level + 2; m++, u += du, pos++ ) {
2598 nd = connectivity->
at(pos);
2599 if ( localNodeIdArray.
at(nd) > 0 ) {
2600 localNodeIdArray.
at(nd) = -localNodeIdArray.
at(nd);
2604 if ( nodeId == 0 ) {
2605 if ( m == 0 && boundary.
at(1) == 0 ) {
2609 if ( n == 0 && boundary.
at(2) == 0 ) {
2613 if ( k == 0 && boundary.
at(3) == 0 ) {
2617 if ( k == level + 1 || n == level + 1 || m == level + 1 ) {
2624 if ( m == 0 && boundary.
at(1) == 0 ) {
2628 if ( n == 0 && boundary.
at(2) == 0 ) {
2632 if ( k == 0 && boundary.
at(3) == 0 ) {
2640 if ( wholeFlag ==
true ) {
2647 globCoord.
at(1) = ( ( xc * ( 1.0 - u ) + xs1 * u ) * ( 1.0 - v ) + ( xs2 * ( 1.0 - u ) + xf1 * u ) * v ) * ( 1.0 - w )
2648 + ( ( xs3 * ( 1.0 - u ) + xf2 * u ) * ( 1.0 - v ) + ( xf3 * ( 1.0 - u ) + xm * u ) * v ) * w;
2649 globCoord.
at(2) = ( ( yc * ( 1.0 - u ) + ys1 * u ) * ( 1.0 - v ) + ( ys2 * ( 1.0 - u ) + yf1 * u ) * v ) * ( 1.0 - w )
2650 + ( ( ys3 * ( 1.0 - u ) + yf2 * u ) * ( 1.0 - v ) + ( yf3 * ( 1.0 - u ) + ym * u ) * v ) * w;
2651 globCoord.
at(3) = ( ( zc * ( 1.0 - u ) + zs1 * u ) * ( 1.0 - v ) + ( zs2 * ( 1.0 - u ) + zf1 * u ) * v ) * ( 1.0 - w )
2652 + ( ( zs3 * ( 1.0 - u ) + zf2 * u ) * ( 1.0 - v ) + ( zf3 * ( 1.0 - u ) + zm * u ) * v ) * w;
2657 gp->setNaturalCoordinates(lcoord);
2659 this->HuertaErrorEstimatorI_computeNmatrixAt(gp, Nmatrix);
2664 for ( idof = 1; idof <= dofs; idof++ ) {
2668 ir->
setField(uFine.
at(idof),
"prescribedvalue");
2681 for ( inode = startNode; inode <= endNode; inode++ ) {
2686 for ( k = 0; k < level + 2; k++ ) {
2687 for ( n = 0; n < level + 2; n++ ) {
2688 for ( m = 0; m < level + 2; m++, pos++ ) {
2689 nd = connectivity->
at(pos);
2690 if ( localNodeIdArray.
at(nd) > 0 ) {
2691 localNodeIdArray.
at(nd) = -localNodeIdArray.
at(nd);
2695 if ( nodeId == 0 ) {
2696 if ( m == 0 && boundary.
at(1) == 0 ) {
2700 if ( n == 0 && boundary.
at(2) == 0 ) {
2704 if ( k == 0 && boundary.
at(3) == 0 ) {
2708 if ( k == level + 1 || n == level + 1 || m == level + 1 ) {
2715 if ( m == 0 && boundary.
at(1) == 0 ) {
2719 if ( n == 0 && boundary.
at(2) == 0 ) {
2723 if ( k == 0 && boundary.
at(3) == 0 ) {
2731 if ( wholeFlag ==
true ) {
2738 for ( idof = 1; idof <= dofs; idof++ ) {
2740 controlNode.
at(localBcId) = -localNodeIdArray.
at(nd);
2741 controlDof.
at(localBcId) = idof;
2763 int contextFlag = 0;
2768 int localNodeId, localElemId, localBcId, localf;
2769 int mats, csects, loads, funcs, nlbarriers;
2770 int inode, idof, dofs, pos, ielem, size;
2772 FloatArray nodeSolution, uCoarse, elementVector, patchVector, coarseVector;
2773 FloatArray elementError, patchError, coarseSolution;
2781 double coeff, elementNorm, patchNorm, mixedNorm, eNorm = 0.0, uNorm = 0.0;
2786 double et_setup, et_init, et_solve, et_error;
2793 this->skippedNelems++;
2794 this->eNorms.at(elemId) = 0.0;
2800 this->skippedNelems++;
2801 this->eNorms.at(elemId) = 0.0;
2812 OOFEM_LOG_DEBUG(
"[%d] Element no %d: estimating error [step number %5d]\n",
2816 refinedElement = &this->refinedElementList[elemId-1];
2818 if ( interface == NULL ) {
2819 OOFEM_ERROR(
"Element has no Huerta error estimator interface defined");
2830 localNodeIdArray.
zero();
2837 localNodeIdArray, globalNodeIdArray,
2839 localNodeId, localElemId, localBcId,
2840 controlNode, controlDof,
2843 if ( this->
mode == HEE_nlinear ) {
2844 controlDof.
resize(localBcId);
2845 controlNode.
resize(localBcId);
2849 localNodeIdArray, globalNodeIdArray,
2851 localNodeId, localElemId, localBcId,
2852 controlNode, controlDof,
2859 setupRefinedProblemProlog(
"element", elemId, localNodeIdArray, localNodeId, localElemId,
2860 mats, csects, loads + localBcId, funcs + localf,
2861 controlNode, controlDof, tStep);
2863 globalNodeIdArray.
resize(localNodeId);
2865 localNodeIdArray.
zero();
2871 localNodeIdArray, globalNodeIdArray,
2873 localNodeId, localElemId, localBcId,
2874 controlNode, controlDof,
2877 localNodeIdArray, globalNodeIdArray,
2879 localNodeId, localElemId, localBcId,
2880 controlNode, controlDof,
2884 setupRefinedProblemEpilog1(csects, mats, loads, nlbarriers);
2886 if ( this->
mode == HEE_linear ) {
2889 localNodeIdArray, globalNodeIdArray,
2891 localNodeId, localElemId, localBcId,
2892 controlNode, controlDof,
2896 setupRefinedProblemEpilog2(funcs);
2906 #ifdef USE_INPUT_FILE 2907 std :: ostringstream fileName;
2908 fileName <<
"/home/dr/Huerta/element_" << elemId <<
".in";
2926 refinedDomain = refinedProblem->
giveDomain(1);
2936 if ( this->
mode == HEE_linear ) {
2944 OOFEM_ERROR(
"Refined problem must be of the type AdaptiveNonLinearStatic");
2958 size = refinedDomain->giveNumberOfDofManagers() * dofs;
2959 coarseSolution.
resize(size);
2960 elementError.
resize(size);
2966 mapper.
mapAndUpdate(uCoarse, VM_Total, domain, refinedDomain, tStep);
2970 for ( inode = 1; inode <= localNodeId; inode++ ) {
2971 node = refinedDomain->giveNode(inode);
2973 for ( idof = 1; idof <= dofs; idof++, pos++ ) {
2974 double sol = nodeSolution.
at(idof);
2976 if ( nodeDof->
hasBc(refinedTStep) == 0 ) {
2983 coarseSolution.
at(pos) = coarseSol;
2984 elementError.
at(pos) = sol - coarseSol;
2985 patchError.
at(pos) = primaryUnknownError.at( ( globalNodeIdArray.
at(inode) - 1 ) * dofs + idof ) - coarseSol;
2999 FloatArray elementVectorGp, patchVectorGp, coarseVectorGp;
3001 eNorm = uNorm = 0.0;
3002 for ( ielem = 1; ielem <= localElemId; ielem++ ) {
3003 element = refinedDomain->giveElement(ielem);
3006 elementNorm = patchNorm = mixedNorm = 0.0;
3012 this->extractVectorFrom(element, elementError, elementVector, dofs, refinedTStep);
3013 elementVectorGp.
beProductOf(Nmatrix, elementVector);
3014 this->extractVectorFrom(element, patchError, patchVector, dofs, refinedTStep);
3016 this->extractVectorFrom(element, coarseSolution, coarseVector, dofs, refinedTStep);
3017 coarseVectorGp.
beProductOf(Nmatrix, coarseVector);
3020 mixedNorm += elementVectorGp.
dotProduct(patchVectorGp) * dV;
3025 if ( fabs(elementNorm) < 1.0e-30 ) {
3026 if ( elementNorm == 0.0 ) {
3029 if ( fabs(mixedNorm) > 1.0e6 * fabs(elementNorm) ) {
3033 coeff = mixedNorm / elementNorm;
3036 coeff = mixedNorm / elementNorm;
3039 eNorm += ( 1.0 + coeff * coeff ) * elementNorm + patchNorm - 2.0 * coeff * mixedNorm;
3044 #ifdef PRINT_FINE_ERROR 3046 if ( exactFlag ==
true ) {
3048 OOFEM_LOG_DEBUG(
"------------------------------------------------------------------------------\n");
3051 OOFEM_LOG_DEBUG(
"-------------------------------------------------------------\n");
3056 eNorm = uNorm = 0.0;
3057 for ( ielem = 1; ielem <= localElemId; ielem++ ) {
3058 element = refinedDomain->giveElement(ielem);
3061 this->extractVectorFrom(element, elementError, elementVector, dofs, refinedTStep);
3062 this->extractVectorFrom(element, patchError, patchVector, dofs, refinedTStep);
3063 this->extractVectorFrom(element, coarseSolution, coarseVector, dofs, refinedTStep);
3066 elementNorm = tmpVector.
dotProduct(elementVector);
3067 mixedNorm = tmpVector.
dotProduct(patchVector);
3070 patchNorm = tmpVector.
dotProduct(patchVector);
3072 if ( fabs(elementNorm) < 1.0e-30 ) {
3073 if ( elementNorm == 0.0 ) {
3076 if ( fabs(mixedNorm) > 1.0e6 * fabs(elementNorm) ) {
3080 coeff = mixedNorm / elementNorm;
3083 coeff = mixedNorm / elementNorm;
3086 eNorm += ( 1.0 + coeff * coeff ) * elementNorm + patchNorm - 2.0 * coeff * mixedNorm;
3091 #ifdef PRINT_FINE_ERROR 3092 double pEnorm = coeff * coeff * elementNorm + patchNorm - 2.0 * coeff * mixedNorm;
3093 if ( exactFlag ==
false ) {
3095 elemId, ielem, elementNorm, pEnorm, elementNorm + pEnorm);
3101 elemId, ielem, elementNorm, pEnorm, elementNorm + pEnorm, exactFineError.
at(++finePos) );
3107 #ifdef PRINT_FINE_ERROR 3124 double eeeNorm = 0.0;
3128 double sval, maxVal;
3134 result = element->
giveIPValue(val, gp, IST_PrincipalDamageTensor, tStep);
3136 sval = sqrt( dotProduct( val, val, val.giveSize() ) );
3137 maxVal =
max(maxVal, sval);
3141 if ( maxVal > 0.25 ) {
3142 double rate, size = 1.0, currDensity;
3144 HuertaRemeshingCriteriaInterface *remeshInterface;
3145 remeshInterface =
static_cast< HuertaRemeshingCriteriaInterface *
>( element->
giveInterface(HuertaRemeshingCriteriaInterfaceType) );
3146 if ( !remeshInterface ) {
3147 OOFEM_ERROR(
"element does not support HuertaRemeshingCriteriaInterface");
3150 currDensity = remeshInterface->HuertaRemeshingCriteriaI_giveCharacteristicSize();
3152 rate = currDensity / size;
3157 OOFEM_LOG_DEBUG(
"koko %d dam %e curr %e rate %e\n", elemId, maxVal, currDensity, rate);
3160 eeeNorm = eNorm * rate;
3165 this->eNorms.at(elemId) = sqrt(eNorm);
3168 this->globalENorm += eNorm + eeeNorm;
3169 this->globalUNorm += uNorm;
3175 OOFEM_LOG_DEBUG(
"HEE info: element %d: user time total %.2f s (setup %.2f s, init %.2f s, solve %.2f s, error %.2f s)\n",
3177 et_setup + et_init + et_solve + et_error,
3184 delete refinedProblem;
3193 int contextFlag = 0;
3198 int localNodeId, localElemId, localBcId, localf;
3199 int mats, csects, loads, funcs, nlbarriers;
3200 int inode, elemId, ielem, elems, skipped = 0;
3212 double et_setup, et_init, et_solve, et_error;
3225 for ( ielem = 1; ielem <= elems; ielem++ ) {
3226 elemId = con->
at(ielem);
3240 if ( skipped == elems ) {
3249 OOFEM_LOG_INFO(
"[%d] Patch no %d: estimating error [step number %5d]\n",
3261 localNodeIdArray.
zero();
3267 for ( ielem = 1; ielem <= elems; ielem++ ) {
3268 elemId = con->
at(ielem);
3276 refinedElement = &this->refinedElementList.at(elemId);
3278 if ( interface == NULL ) {
3279 OOFEM_ERROR(
"Element has no Huerta error estimator interface defined");
3288 localNodeIdArray, globalNodeIdArray,
3290 localNodeId, localElemId, localBcId,
3291 controlNode, controlDof,
3297 if ( this->
mode == HEE_nlinear ) {
3298 controlDof.
resize(localBcId);
3299 controlNode.
resize(localBcId);
3302 for ( ielem = 1; ielem <= elems; ielem++ ) {
3303 elemId = con->
at(ielem);
3311 refinedElement = &this->refinedElementList.at(elemId);
3320 localNodeIdArray, globalNodeIdArray,
3322 localNodeId, localElemId, localBcId,
3323 controlNode, controlDof,
3333 setupRefinedProblemProlog(
"patch", nodeId, localNodeIdArray, localNodeId, localElemId,
3334 mats, csects, loads + localBcId, funcs + localf,
3335 controlNode, controlDof, tStep);
3337 globalNodeIdArray.
resize(localNodeId);
3339 localNodeIdArray.
zero();
3344 for ( ielem = 1; ielem <= elems; ielem++ ) {
3345 elemId = con->
at(ielem);
3353 refinedElement = &this->refinedElementList.at(elemId);
3362 localNodeIdArray, globalNodeIdArray,
3364 localNodeId, localElemId, localBcId,
3365 controlNode, controlDof,
3371 for ( ielem = 1; ielem <= elems; ielem++ ) {
3372 elemId = con->
at(ielem);
3380 refinedElement = &this->refinedElementList.at(elemId);
3389 localNodeIdArray, globalNodeIdArray,
3391 localNodeId, localElemId, localBcId,
3392 controlNode, controlDof,
3398 setupRefinedProblemEpilog1(csects, mats, loads, nlbarriers);
3400 if ( this->
mode == HEE_linear ) {
3402 for ( ielem = 1; ielem <= elems; ielem++ ) {
3403 elemId = con->
at(ielem);
3411 refinedElement = &this->refinedElementList.at(elemId);
3420 localNodeIdArray, globalNodeIdArray,
3422 localNodeId, localElemId, localBcId,
3423 controlNode, controlDof,
3430 setupRefinedProblemEpilog2(funcs);
3440 #ifdef USE_INPUT_FILE 3441 std :: ostringstream fileName;
3442 fileName <<
"/home/dr/Huerta/patch_" << nodeId <<
".in";
3460 refinedDomain = refinedProblem->
giveDomain(1);
3465 if ( this->
mode == HEE_linear ) {
3473 OOFEM_ERROR(
"Refined problem must be of the type AdaptiveNonLinearStatic");
3490 for (
int inode = 1; inode <= localNodeId; inode++ ) {
3491 refinedDomain->giveNode(inode)->giveUnknownVector(nodeSolution, dofIdArray, VM_Total, refinedTStep);
3492 pos = globalNodeIdArray.
at(inode);
3493 for (
int idof = 1; idof <= dofs; idof++ ) {
3494 primaryUnknownError.at( ( pos - 1 ) * dofs + idof ) = nodeSolution.
at(idof);
3502 OOFEM_LOG_DEBUG(
"HEE info: patch %d: user time total %.2f s (setup %.2f s, init %.2f s, solve %.2f s, error %.2f s)\n",
3504 et_setup + et_init + et_solve + et_error,
3511 delete refinedProblem;
3524 int contextFlag = 0;
3529 int localNodeId, localElemId, localBcId, localf;
3530 int mats, csects, loads, funcs, nlbarriers;
3531 int inode, idof, dofs, elemId, ielem, elems, size;
3533 FloatArray nodeSolution, uCoarse, errorVector, coarseVector, fineVector;
3534 FloatArray fineSolution, coarseSolution, errorSolution;
3545 double et_setup, et_init, et_solve, et_error;
3561 localNodeIdArray.
zero();
3567 for ( elemId = 1; elemId <= elems; elemId++ ) {
3569 refinedElement = &this->refinedElementList.at(elemId);
3571 if ( interface == NULL ) {
3572 OOFEM_ERROR(
"Element has no Huerta error estimator interface defined");
3576 localNodeIdArray, globalNodeIdArray,
3578 localNodeId, localElemId, localBcId,
3579 controlNode, controlDof,
3583 if ( this->
mode == HEE_nlinear ) {
3584 controlDof.
resize(localBcId);
3585 controlNode.
resize(localBcId);
3588 for ( elemId = 1; elemId <= elems; elemId++ ) {
3590 refinedElement = &this->refinedElementList.at(elemId);
3593 localNodeIdArray, globalNodeIdArray,
3595 localNodeId, localElemId, localBcId,
3596 controlNode, controlDof,
3604 setupRefinedProblemProlog(
"whole", 0, localNodeIdArray, localNodeId, localElemId,
3605 mats, csects, loads + localBcId, funcs + localf,
3606 controlNode, controlDof, tStep);
3608 globalNodeIdArray.
resize(localNodeId);
3610 localNodeIdArray.
zero();
3615 for ( elemId = 1; elemId <= elems; elemId++ ) {
3617 refinedElement = &this->refinedElementList.at(elemId);
3620 localNodeIdArray, globalNodeIdArray,
3622 localNodeId, localElemId, localBcId,
3623 controlNode, controlDof,
3627 for ( elemId = 1; elemId <= elems; elemId++ ) {
3629 refinedElement = &this->refinedElementList.at(elemId);
3632 localNodeIdArray, globalNodeIdArray,
3634 localNodeId, localElemId, localBcId,
3635 controlNode, controlDof,
3639 setupRefinedProblemEpilog1(csects, mats, loads, nlbarriers);
3641 if ( this->
mode == HEE_linear ) {
3643 for ( elemId = 1; elemId <= elems; elemId++ ) {
3645 refinedElement = &this->refinedElementList.at(elemId);
3648 localNodeIdArray, globalNodeIdArray,
3650 localNodeId, localElemId, localBcId,
3651 controlNode, controlDof,
3656 setupRefinedProblemEpilog2(funcs);
3666 #ifdef USE_INPUT_FILE 3667 std :: ostringstream fileName;
3668 fileName <<
"/home/dr/Huerta/whole_" << 0 <<
".in";
3685 refinedDomain = refinedProblem->
giveDomain(1);
3707 size = refinedDomain->giveNumberOfDofManagers() * dofs;
3708 fineSolution.
resize(size);
3709 coarseSolution.
resize(size);
3710 errorSolution.
resize(size);
3715 mapper.
mapAndUpdate(uCoarse, VM_Total, domain, refinedDomain, tStep);
3719 for ( inode = 1; inode <= localNodeId; inode++ ) {
3720 node = refinedDomain->giveNode(inode);
3722 for ( idof = 1; idof <= dofs; idof++, pos++ ) {
3723 fineSolution.
at(pos) = nodeSolution.
at(idof);
3725 if ( nodeDof->
hasBc(refinedTStep) == 0 ) {
3729 coarseSolution.
at(pos) = fineSolution.
at(pos);
3734 errorSolution = fineSolution;
3735 errorSolution.
subtract(coarseSolution);
3739 FloatArray errorVectorGp, coarseVectorGp, fineVectorGp;
3745 exactENorm = coarseUNorm = fineUNorm = mixedNorm = 0.0;
3746 for ( ielem = 1; ielem <= localElemId; ielem++ ) {
3747 element = refinedDomain->giveElement(ielem);
3755 this->extractVectorFrom(element, errorSolution, errorVector, dofs, refinedTStep);
3759 this->extractVectorFrom(element, coarseSolution, coarseVector, dofs, refinedTStep);
3760 coarseVectorGp.
beProductOf(Nmatrix, coarseVector);
3763 mixedNorm += coarseVectorGp.
dotProduct(errorVectorGp) * dV;
3765 this->extractVectorFrom(element, fineSolution, fineVector, dofs, refinedTStep);
3774 double fineENorm, coarseENorm;
3775 int dim, pos, nelems;
3780 nelems = this->refineLevel + 1;
3782 nelems *= this->refineLevel + 1;
3790 exactENorm = coarseUNorm = fineUNorm = mixedNorm = 0.0;
3791 for ( ielem = 1; ielem <= localElemId; ielem++ ) {
3794 exactFineError.
at(ielem) = 0.0;
3795 if ( ++pos == nelems ) {
3796 exactCoarseError.
at(elemId) = coarseENorm;
3797 if ( ielem < localElemId ) {
3801 nelems = this->refineLevel + 1;
3803 nelems *= this->refineLevel + 1;
3817 element = refinedDomain->giveElement(ielem);
3820 this->extractVectorFrom(element, errorSolution, errorVector, dofs, refinedTStep);
3822 exactENorm += tmpVector.
dotProduct(errorVector);
3823 fineENorm = tmpVector.
dotProduct(errorVector);
3824 coarseENorm += fineENorm;
3826 this->extractVectorFrom(element, coarseSolution, coarseVector, dofs, refinedTStep);
3828 coarseUNorm += tmpVector.
dotProduct(coarseVector);
3830 mixedNorm += tmpVector.
dotProduct(errorVector);
3832 this->extractVectorFrom(element, fineSolution, fineVector, dofs, refinedTStep);
3834 fineUNorm += tmpVector.
dotProduct(fineVector);
3837 exactFineError.
at(ielem) = fineENorm;
3838 if ( ++pos == nelems ) {
3839 exactCoarseError.
at(elemId) = coarseENorm;
3840 if ( ielem < localElemId ) {
3844 nelems = this->refineLevel + 1;
3846 nelems *= this->refineLevel + 1;
3865 OOFEM_LOG_DEBUG(
"HEE info: whole 0: user time total %.2f s (setup %.2f s, init %.2f s, solve %.2f s, error %.2f s)\n",
3866 et_setup + et_init + et_solve + et_error,
3873 delete refinedProblem;
3885 int inode, idof, pos, p = 0;
3890 for ( idof = 1; idof <= dofs; idof++ ) {
3891 answer.
at(++p) = vector.
at(pos + idof);
3900 int nodes,
int elems,
int csects,
int mats,
int loads,
int funcs,
3905 int i, nmstep, nsteps = 0;
3906 int ddfunc = 0, ddmSize = 0, ddvSize = 0, hpcSize = 0, hpcwSize = 0, renumber = 1;
3907 int controlMode = 0, hpcMode = 0, stiffMode = 0, maxIter = 30, reqIter = 3, manrmsteps = 0;
3908 double rtolv = -1.0, minStepLength = 0.0, initialStepLength = -1.0, stepLength = -1.0, psi = 1.0;
3913 #if defined ( USE_OUTPUT_FILE ) || defined ( USE_CONTEXT_FILE ) 3914 sprintf(line,
"/home/dr/Huerta/%s_%d.out", problemName, problemId);
3917 sprintf(line,
"/dev/null");
3923 #ifdef USE_CONTEXT_FILE 3924 int contextOutputStep = 1;
3927 sprintf(line,
"Refined problem on %s %d", problemName, problemId);
3930 if ( dynamic_cast< AdaptiveLinearStatic * >(problem) ) {
3935 #ifdef USE_CONTEXT_FILE 3939 }
else if ( dynamic_cast< AdaptiveNonLinearStatic * >(problem) ) {
3947 switch ( controlMode ) {
3955 initialStepLength = stepLength;
3985 if ( problemId != 0 ) {
3988 int bcSize = controlNode.
giveSize(), ddActiveSize = 0;
3990 if ( controlMode == 1 ) {
3992 for ( i = 1; i <= ddmSize; i += 2 ) {
3993 if ( localNodeIdArray.
at( ddm.
at(i) ) == 0 ) {
4006 if ( nmstep == 1 ) {
4015 ir->
setField(reqIter,
"reqiterations");
4016 ir->
setField(minStepLength,
"minsteplength");
4017 ir->
setField(stiffMode,
"stiffmode");
4018 ir->
setField(manrmsteps,
"manrmsteps");
4019 ir->
setField(manrmsteps,
"manrmsteps");
4021 #ifdef USE_CONTEXT_FILE 4029 ir->
setField(0.1,
"requiredError");
4047 #ifdef USE_CONTEXT_FILE 4055 ir->
setField(0.1,
"requiredError");
4065 for ( i = 1; i < nmstep; i++ ) {
4080 ir->
setField(reqIter,
"reqiterations");
4081 ir->
setField(minStepLength,
"minsteplength");
4082 ir->
setField(stiffMode,
"stiffmode");
4083 ir->
setField(manrmsteps,
"manrmsteps");
4089 IntArray ddm_vals( 2 * ( bcSize + ddActiveSize ) );
4091 for ( i = 1; i <= bcSize; i++ ) {
4092 ddm_vals.
at(i * 2 - 1) = controlNode.
at(i);
4093 ddm_vals.
at(i * 2) = controlDof.
at(i);
4096 if ( controlMode == 1 ) {
4098 for ( i = 1; i <= ddmSize; i += 2 ) {
4099 if ( localNodeIdArray.
at( ddm.
at(i) ) == 0 ) {
4103 ddm_vals.
at(bcSize * 2 + i * 2 - 1) = -localNodeIdArray.
at( ddm.
at(i) );
4104 ddm_vals.
at(bcSize * 2 + i * 2) = ddm.
at(i + 1);
4112 for ( i = 1; i <= bcSize; i++ ) {
4113 ddv_vals.
at(i) = 0.;
4116 if ( controlMode == 1 ) {
4118 for ( i = 1; i <= ddvSize; i++ ) {
4119 if ( localNodeIdArray.
at( ddm.
at(2 * i - 1) ) == 0 ) {
4123 ddv_vals.
at(bcSize + i) = ddv.
at(i);
4146 ir->
setField(renumber,
"renumber");
4149 ir->
setField(reqIter,
"reqiterations");
4150 ir->
setField(minStepLength,
"minsteplength");
4151 ir->
setField(stiffMode,
"stiffmode");
4152 ir->
setField(manrmsteps,
"manrmsteps");
4154 ir->
setField(controlMode,
"controlmode");
4155 #ifdef USE_CONTEXT_FILE 4159 switch ( controlMode ) {
4161 ir->
setField(stepLength,
"stepLength");
4162 ir->
setField(initialStepLength,
"initialStepLength");
4166 if ( hpcSize != 0 ) {
4169 for ( i = 1; i <= hpcSize; i += 2 ) {
4170 hpc_vals.
at(i * 2 - 1) = -localNodeIdArray.
at( hpc.
at(i) );
4171 hpc_vals.
at(i * 2) = hpc.
at(i + 1);
4176 if ( hpcwSize != 0 ) {
4182 if ( ddmSize != 0 ) {
4185 for ( i = 1; i <= ddmSize; i += 2 ) {
4186 ddm_vals.
at(i * 2 - 1) = -localNodeIdArray.
at( ddm.
at(i) );
4187 ddm_vals.
at(i * 2) = ddm.
at(i + 1);
4192 if ( ddvSize != 0 ) {
4218 #ifdef USE_OUTPUT_FILE 4246 for (
int i = 1; i <= csects; i++ ) {
4252 for (
int i = 1; i <= mats; i++ ) {
4258 for (
int i = 1; i <= loads; i++ ) {
4274 for (
int i = 1; i <= funcs; i++ ) {
4280 if ( this->
mode == HEE_nlinear ) {
CrossSection * giveCrossSection()
#define _IFT_HuertaErrorEstimator_normtype
void setupRefinedProblemEpilog1(int csects, int mats, int loads, int nlbarriers)
#define _IFT_HuertaErrorEstimator_initialskipsteps
#define _IFT_Domain_nfunct
The base class for all remeshing criteria.
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
The representation of EngngModel default unknown numbering.
The class representing Huerta remeshing criteria.
void subtract(const FloatArray &src)
Subtracts array src to receiver.
DofManager in active domain is shared only by remote elements (these are only introduced for nonlocal...
std::string giveContextFileName(int tStepNumber, int stepVersion) const
Returns the filename for the context file for the given step and version.
#define _IFT_CylindricalALM_minsteplength
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
Returns the integration point corresponding value in full form.
void extractVectorFrom(Element *element, FloatArray &vector, FloatArray &answer, int dofs, TimeStep *tStep)
Extracts nodal vector from global vector for each dof of all element nodes.
#define _IFT_LinearStatic_Name
RefinedMesh refinedMesh
Mesh refinement.
Implementation of FileDataStream representing DataStream interface to file i/o.
#define _IFT_OutputManager_tstepall
void computeVectorOf(ValueModeType u, TimeStep *tStep, FloatArray &answer)
Returns local vector of unknowns.
virtual IntegrationRule * giveDefaultIntegrationRulePtr()
Access method for default integration rule.
virtual int giveNumberOfDomainEquations(int di, const UnknownNumberingScheme &num)
Returns number of equations for given domain in active (current time step) time step.
#define _IFT_HuertaRemeshingCriteria_noremesh
Class representing the implementation of a dynamic data reader for in-code use.
#define _IFT_AdaptiveNonLinearStatic_Name
static DynamicDataReader refinedReader("huerta")
Domain * domain
Link to domain object, useful for communicating with other FEM components.
#define _IFT_HuertaRemeshingCriteria_refinecoeff
double computeMeanSize()
Computes the size of the element defined as its length.
int giveNumberOfDofManagers() const
Returns number of dof managers in domain.
#define _IFT_NRSolver_manrmsteps
virtual double giveElementError(EE_ErrorType type, Element *elem, TimeStep *tStep)
Returns the element error.
void solveRefinedWholeProblem(IntArray &localNodeIdArray, IntArray &globalNodeIdArray, TimeStep *tStep)
Solves the refined whole problem.
#define _IFT_CylindricalALM_reqiterations
virtual double giveRequiredDofManDensity(int num, TimeStep *tStep, int relative=0)
Returns the required mesh size n given dof manager.
The class implementing the primary unknown mapper using element interpolation functions.
REGISTER_ErrorEstimator(CombinedZZSIErrorEstimator, EET_CZZSI)
virtual int estimateError(EE_ErrorMode err_mode, TimeStep *tStep)
Estimates the error on associated domain at given time step.
int giveNumberOfBoundaryConditions() const
Returns number of boundary conditions in domain.
FloatMatrix * giveLocalCoordinateTriplet()
Returns pointer to local coordinate triplet in node.
std::unique_ptr< RemeshingCriteria > rc
HuertaRemeshingCriteriaModeType mode
Mode of receiver.
#define _IFT_HuertaErrorEstimator_refinelevel
#define _IFT_CylindricalALM_initialsteplength
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
contextIOResultType storeYourself(DataStream &stream) const
void zero()
Sets all component to zero.
AnalysisMode
Mode of analysis.
double & at(int i)
Coefficient access function.
int max(int i, int j)
Returns bigger value form two given decimals.
double globalWENorm
Global weighted error norm.
MetaStep * giveMetaStep(int i)
Returns the i-th meta step.
#define _IFT_NRSolver_ddm
int giveInterpolationOrder()
Returns the interpolation order.
#define _IFT_CylindricalALM_psi
double globalErrorEstimate
Global error estimate (relative)
#define _IFT_HuertaErrorEstimator_exact
#define _IFT_CylindricalALM_hpc
ConnectivityTable * giveConnectivityTable()
Returns receiver's associated connectivity table.
bool isAxisymmetric()
Returns true of axisymmetry is in effect.
void setupRefinedElementProblem3D(Element *element, RefinedElement *refinedElement, int level, int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray, HuertaErrorEstimatorInterface::SetupMode mode, TimeStep *tStep, int nodes, FloatArray **corner, FloatArray *midSide, FloatArray *midFace, FloatArray &midNode, int &localNodeId, int &localElemId, int &localBcId, int hexaSideNode[1][3], int hexaFaceNode[1][3], IntArray &controlNode, IntArray &controlDof, HuertaErrorEstimator::AnalysisMode aMode, const char *hexatype)
StateCounterType stateCounter
Actual values (densities) state counter.
IntArray * giveFineNodeArray(int node)
EngngModel * giveEngngModel()
Returns engineering model to which receiver is associated.
#define _IFT_CylindricalALM_hpcmode
#define _IFT_NRSolver_rtolv
#define _IFT_DofManager_dofidmask
double giveTargetTime()
Returns target time.
void incrementStateCounter()
Updates solution state counter.
Abstract base class for all finite elements.
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
bool giveBoundaryLoadArray3D(int inode, Element *element, std::vector< IntArray > &boundaryLoadList)
EE_ErrorType
Type characterizing different type of element errors.
virtual void solveYourself()
Starts solution process.
#define _IFT_HeavisideTimeFunction_origin
virtual int __giveEquationNumber() const =0
Returns equation number of receiver, usually assigned by emodel.
int giveNumberOfElements() const
Returns number of elements in domain.
virtual RemeshingStrategy giveRemeshingStrategy(TimeStep *tStep)
Determines, if the remeshing is needed, and if needed, the type of strategy used. ...
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
virtual void giveCharacteristicMatrix(FloatMatrix &answer, CharType type, TimeStep *tStep)
Computes characteristic matrix of receiver of requested type in given time step.
void writeToFile(const char *fileName)
Writes all input records to file.
int giveNumberOfSpatialDimensions()
Returns number of spatial dimensions.
MaterialMode
Type representing material mode of integration point.
#define _IFT_NRSolver_maxiter
#define OOFEM_LOG_DEBUG(...)
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
Class implementing an array of integers.
int & at(int i)
Coefficient access function.
virtual int read(int *data, int count)=0
Reads count integer values into array pointed by data.
void solveRefinedPatchProblem(int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray, TimeStep *tStep)
Solves the refined patch problem.
#define _IFT_OutputManager_dofmanall
double requiredError
Required error to obtain.
#define _IFT_OutputManager_elementall
virtual int giveNumberOfDofManagers() const
virtual FEInterpolation * giveInterpolation() const
dofManagerParallelMode
In parallel mode, this type indicates the mode of DofManager.
StateCounterType stateCounter
Actual state counter.
Abstract base class representing integration rule.
NormType normType
Type of norm used.
#define _IFT_BoundaryCondition_Name
#define OOFEM_LOG_RELEVANT(...)
#define _IFT_DofManager_bc
virtual void HuertaErrorEstimatorI_computeNmatrixAt(GaussPoint *gp, FloatMatrix &answer)=0
virtual int estimateMeshDensities(TimeStep *tStep)
Estimates the nodal densities.
ErrorEstimatorType giveErrorEstimatorType() const
Returns error estimation type of receiver.
#define _IFT_GeneralBoundaryCondition_timeFunct
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual int giveNumberOfNodes() const
Returns number of nodes of receiver.
#define _IFT_NonLinearStatic_stiffmode
virtual int write(const int *data, int count)=0
Writes count integer values from array pointed by data.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
bool wError
Weighted error flag.
EngngModel * InstanciateProblem(DataReader &dr, problemMode mode, int contextFlag, EngngModel *_master, bool parallelFlag)
Instanciates the new problem.
CrossSection * giveCrossSection(int n)
Service for accessing particular domain cross section model.
#define _IFT_CylindricalALM_maxiter
virtual double computeVolumeAround(GaussPoint *gp)
Returns volume related to given integration point.
void giveUnknownVector(FloatArray &answer, const IntArray &dofMask, ValueModeType mode, TimeStep *tStep, bool padding=false)
Assembles the vector of unknowns in global c.s for given dofs of receiver.
virtual int giveBcId()=0
Returns the id of associated boundary condition, if there is any.
#define _IFT_Domain_nelem
#define OOFEM_LOG_INFO(...)
int giveNumber()
Returns receiver's number.
int giveNumberOfDofs() const
Material * giveMaterial(int n)
Service for accessing particular domain material model.
Element * giveElement(int n)
Service for accessing particular domain fe element.
double dotProduct(const FloatArray &x) const
Computes the dot product (or inner product) of receiver and argument.
The element interface corresponding to HuertaErrorEstimator.
StateCounterType giveSolutionStateCounter()
Returns current solution state counter.
bool wError
Weighted error flag.
#define _IFT_CylindricalALM_rtolv
int skippedNelems
Number of skipped elements.
virtual RemeshingCriteria * giveRemeshingCrit()
Returns reference to associated remeshing criteria.
AnalysisMode mode
Linear analysis flag.
virtual void finish()
Allows to detach all data connections.
void solveRefinedElementProblem(int elemId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray, TimeStep *tStep)
Solves the refined element problem.
void setupRefinedProblemEpilog2(int tfuncs)
void setupRefinedProblemProlog(const char *problemName, int problemId, IntArray &localNodeIdArray, int nodes, int elems, int csects, int mats, int loads, int funcs, IntArray &controlNode, IntArray &controlDof, TimeStep *tStep)
double computeSquaredNorm() const
Computes the square of the norm.
int giveNumberOfSkippedElements()
Returns number of elements skipped in error estimation.
FloatArray nodalDensities
Array of nodal mesh densities.
#define _IFT_Domain_ndofman
bool giveBcDofArray1D(int inode, Element *element, IntArray &sideBcDofId, int &sideNumBc, TimeStep *tStep)
void setupRefinedElementProblem1D(Element *element, RefinedElement *refinedElement, int level, int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray, HuertaErrorEstimatorInterface::SetupMode mode, TimeStep *tStep, int nodes, FloatArray **corner, FloatArray &midNode, int &localNodeId, int &localElemId, int &localBcId, IntArray &controlNode, IntArray &controlDof, HuertaErrorEstimator::AnalysisMode aMode, const char *edgetype)
#define _IFT_Domain_axisymmetric
SetupMode
Mode for problem setup.
contextIOResultType restoreYourself(DataStream &stream)
DofIDItem giveDofID() const
Returns DofID value of receiver, which determines type of of unknown connected to receiver (e...
int giveNumberOfCrossSectionModels() const
Returns number of cross section models in domain.
Class representing connectivity table.
int giveNumberOfMaterialModels() const
Returns number of material models in domain.
IntArray * giveBodyLoadArray()
Returns array containing load numbers of loads acting on element.
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
Receiver becomes the result of the product of aMatrix and anArray.
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
virtual void giveInputRecord(DynamicInputRecord &input)
Setups the input record string of receiver.
#define _IFT_EngngModel_contextoutputstep
double globalENorm
Global error norm.
#define _IFT_NRSolver_ddv
bool giveBoundaryLoadArray2D(int inode, Element *element, std::vector< IntArray > &boundaryLoadList)
#define _IFT_EngngModel_nsteps
virtual void giveElementDofIDMask(IntArray &answer) const
Returns element dof mask for node.
double at(int i, int j) const
Coefficient access function.
#define _IFT_EngngModel_renumberFlag
#define _IFT_Domain_ncrosssect
void resize(int n)
Checks size of receiver towards requested bounds.
FloatArray primaryUnknownError
Primary unknown nodal error.
bool giveBcDofArray3D(int inode, Element *element, std::vector< IntArray > &sideBcDofIdList, IntArray &sideNumBc, std::vector< IntArray > &faceBcDofIdList, IntArray &faceNumBc, TimeStep *tStep)
#define _IFT_HuertaErrorEstimator_impPos
#define _IFT_HuertaRemeshingCriteria_werror
Function * giveFunction(int n)
Service for accessing particular domain load time function.
#define _IFT_HuertaErrorEstimator_skipsteps
The base class for all error estimation or error indicator algorithms.
void terminateAnalysis()
Performs analysis termination after finishing analysis.
#define _IFT_HuertaErrorEstimator_requirederror
Initializes the variable VERBOSE, in order to get a few intermediate messages on screen: beginning an...
Class representing vector of real numbers.
virtual double giveValue(EE_ValueType type, TimeStep *tStep)
Returns the characteristic value of given type.
RemeshingStrategy
Type representing the remeshing strategy.
elementParallelMode giveParallelMode() const
Return elementParallelMode of receiver.
virtual contextIOResultType saveContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Stores receiver state to output stream.
virtual int checkConsistency()
Allows programmer to test some receiver's internal data, before computation begins.
virtual int giveSpatialDimension()
Returns the element spatial dimension (1, 2, or 3).
Implementation of matrix containing floating point numbers.
void buildRefinedMesh()
Builds refined mesh.
const IntArray * giveDofManConnectivityArray(int dofman)
EE_ErrorMode
Type determining whether temporary or equilibrated variables are used for error evaluation.
IRResultType
Type defining the return values of InputRecord reading operations.
GaussPoint * getIntegrationPoint(int n)
Access particular integration point of receiver.
void setupRefinedElementProblem2D(Element *element, RefinedElement *refinedElement, int level, int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray, HuertaErrorEstimatorInterface::SetupMode mode, TimeStep *tStep, int nodes, FloatArray **corner, FloatArray *midSide, FloatArray &midNode, int &localNodeId, int &localElemId, int &localBcId, IntArray &controlNode, IntArray &controlDof, HuertaErrorEstimator::AnalysisMode aMode, const char *quadtype)
#define _IFT_HuertaErrorEstimator_impCSect
bool noRemesh
Remeshing flag.
FloatArray eNorms
Cache storing element norms.
double minElemSize
Minimum element size alloved.
int giveMetaStepNumber()
Returns receiver's meta step number.
void setNaturalCoordinates(const FloatArray &c)
#define _IFT_NonLinearStatic_controlmode
double computeNorm() const
Computes the norm (or length) of the vector.
bool skipRegion(int reg)
Returns nonzero if region has been skipped in error estimation (user option).
int giveNumberOfFunctions() const
Returns number of load time functions in domain.
virtual double giveValue(EE_ValueType type, TimeStep *tStep)=0
Returns the characteristic value of given type.
virtual int mapAndUpdate(FloatArray &answer, ValueModeType mode, Domain *oldd, Domain *newd, TimeStep *tStep)
Maps and updates the vector(s) of primary unknowns from old mesh oldd to new mesh newd...
double refineCoeff
Refinement coefficient.
Dof * giveDofWithID(int dofID) const
Returns DOF with given dofID; issues error if not present.
void followedBy(const IntArray &b, int allocChunk=0)
Appends array b at the end of receiver.
void zero()
Zeroes all coefficients of receiver.
Class implementing single timer, providing wall clock and user time capabilities. ...
int giveRank() const
Returns domain rank in a group of collaborating processes (0..groupSize-1)
bool giveBcDofArray2D(int inode, Element *element, std::vector< IntArray > &sideBcDofIdList, IntArray &sideNumBc, TimeStep *tStep)
int giveNumberOfNonlocalBarriers() const
Returns number of nonlocal integration barriers.
virtual Interface * giveInterface(InterfaceType t)
Interface requesting service.
#define _IFT_OutputManager_Name
#define _IFT_HuertaRemeshingCriteria_requirederror
virtual bool computeLocalCoordinates(FloatArray &answer, const FloatArray &gcoords)
Computes the element local coordinates from given global coordinates.
long ContextMode
Context mode (mask), defining the type of information written/read to/from context.
Element in active domain is only mirror of some remote element.
#define _IFT_BoundaryCondition_PrescribedValue
[rn,optional] Prescribed value of all DOFs
IntArray * giveLoadArray()
Returns the array containing applied loadings of the receiver.
#define _IFT_HeavisideTimeFunction_value
EE_ValueType
Type characterizing different type of errors.
virtual bool hasBc(TimeStep *tStep)=0
Test if Dof has active boundary condition.
Domain * giveDomain() const
virtual void HuertaErrorEstimatorI_setupRefinedElementProblem(RefinedElement *refinedElement, int level, int nodeId, IntArray &localNodeIdArray, IntArray &globalNodeIdArray, HuertaErrorEstimatorInterface::SetupMode mode, TimeStep *tStep, int &localNodeId, int &localElemId, int &localBcId, IntArray &controlNode, IntArray &controlDof, HuertaErrorEstimator::AnalysisMode aMode)=0
int min(int i, int j)
Returns smaller value from two given decimals.
void push_back(const double &iVal)
Add one element.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode, void *obj=NULL)
Restores the receiver state previously written in stream.
HuertaRemeshingCriteria(int n, ErrorEstimator *e)
Constructor.
double requiredError
Required error to obtain.
Abstract base class representing the "problem" under consideration.
DofManager in active domain is only mirror of some remote DofManager.
virtual TimeStep * giveCurrentStep(bool force=false)
Returns current time step.
int giveSize() const
Returns the size of receiver.
virtual contextIOResultType restoreContext(DataStream &stream, ContextMode mode)
Restores the state of model from output stream.
#define _IFT_EngngModel_nmsteps
#define _IFT_HeavisideTimeFunction_Name
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual double giveElementError(EE_ErrorType type, Element *elem, TimeStep *tStep)=0
Returns the element error.
DofManager * giveDofManager(int i) const
bool giveBoundaryLoadArray1D(int inode, Element *element, IntArray &boundaryLoadArray)
#define _IFT_HuertaRemeshingCriteria_minelemsize
Domain * giveDomain(int n)
Service for accessing particular problem domain.
Class implementing node in finite element mesh.
#define _IFT_NRSolver_ddfunc
#define _IFT_DofManager_load
Abstract class Dof represents Degree Of Freedom in finite element mesh.
#define _IFT_NRSolver_minsteplength
DofManager * giveDofManager(int n)
Service for accessing particular domain dof manager.
#define _IFT_HuertaErrorEstimator_perfectCSect
#define _IFT_CylindricalALM_hpcw
Node * giveNode(int i) const
Returns reference to the i-th node of element.
RemeshingStrategy remeshingStrategy
Remeshing strategy proposed.
Load * giveLoad(int n)
Service for accessing particular domain load.
#define _IFT_HuertaErrorEstimator_werror
Context IO exception class.
double getUtime()
Returns total user time elapsed in seconds.
Class representing integration point in finite element program.
void insertInputRecord(InputRecordType type, InputRecord *record)
Main purpose of this class it the possibility to add new input records in code.
Class representing solution step.
double globalUNorm
Global norm of primary unknown.
DofManager is shared by neighboring partitions, it is necessary to sum contributions from all contrib...
dofManagerParallelMode giveParallelMode() const
Return dofManagerParallelMode of receiver.
This class implements Adaptive Non-LinearStatic Engineering problem.
virtual double giveDofManDensity(int num)
Returns existing mesh size for given dof manager.
#define _IFT_CylindricalALM_manrmsteps
virtual IRResultType initializeFrom(InputRecord *ir)
Initializes receiver according to object description stored in input record.
void setOutputFileName(const std::string &outputFileName)
Sets the output file name.
int refineLevel
Refinement level.
void setDescription(const std::string &description)
Sets the description line.
#define _IFT_Domain_numberOfSpatialDimensions
[in,optional] Specifies how many spatial dimensions the domain has.
IntArray * giveBoundaryFlagArray(void)
#define _IFT_CylindricalALM_steplength
void resize(int s)
Resizes receiver towards requested size.