MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / commitSensitivity

Method commitSensitivity

SRC/element/truss/Truss2.cpp:1509–1617  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1507}
1508
1509int
1510 Truss2::commitSensitivity(int gradNumber, int numGrads)
1511{
1512 // Initial declarations
1513 int i;
1514 double strainSensitivity, temp1, temp2;
1515
1516 // Displacement difference between the two ends
1517 double strain = this->computeCurrentStrain();
1518 double dLength = strain*L;
1519
1520 // Displacement sensitivity difference between the two ends
1521 double sens1;
1522 double sens2;
1523 double dSensitivity = 0.0;
1524 for (i=0; i<dimension; i++){
1525 sens1 = theNodes[0]->getDispSensitivity(i+1, gradNumber);
1526 sens2 = theNodes[1]->getDispSensitivity(i+1, gradNumber);
1527 dSensitivity += (sens2-sens1)*cosX[i];
1528 }
1529
1530 strainSensitivity = dSensitivity/L;
1531
1532 // Check if a nodal coordinate is random
1533 int nodeParameterID0 = theNodes[0]->getCrdsSensitivity();
1534 int nodeParameterID1 = theNodes[1]->getCrdsSensitivity();
1535 if (nodeParameterID0 != 0 || nodeParameterID1 != 0) {
1536
1537 double dx = L*cosX[0];
1538 double dy = L*cosX[1];
1539 //double dz = L*cosX[2];
1540
1541 // Compute derivative of transformation matrix (assume 4 dofs)
1542 double dcosXdh[3];
1543
1544 if (nodeParameterID0 == 1) { // here x1 is random
1545 temp1 = (-L+dx*dx/L)/(L*L);
1546 temp2 = dx*dy/(L*L*L);
1547 //dtdh(0) = -temp1;
1548 //dtdh(1) = -temp2;
1549 //dtdh(2) = temp1;
1550 //dtdh(3) = temp2;
1551 dcosXdh[0] = temp1;
1552 dcosXdh[1] = temp2;
1553 dcosXdh[2] = 0.0;
1554 }
1555 if (nodeParameterID0 == 2) { // here y1 is random
1556 temp1 = (-L+dy*dy/L)/(L*L);
1557 temp2 = dx*dy/(L*L*L);
1558 //dtdh(0) = -temp2;
1559 //dtdh(1) = -temp1;
1560 //dtdh(2) = temp2;
1561 //dtdh(3) = temp1;
1562 dcosXdh[0] = temp2;
1563 dcosXdh[1] = temp1;
1564 dcosXdh[2] = 0.0;
1565 }
1566

Callers

nothing calls this directly

Calls 3

computeCurrentStrainMethod · 0.95
getDispSensitivityMethod · 0.45
getCrdsSensitivityMethod · 0.45

Tested by

no test coverage detected