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

Method commitSensitivity

SRC/element/truss/TrussSection.cpp:1504–1618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

computeCurrentStrainMethod · 0.95
getDispSensitivityMethod · 0.45
getCrdsSensitivityMethod · 0.45
getOrderMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected