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

Method updateNodalMasses

SRC/recorder/RemoveRecorder.cpp:1239–1280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1237
1238
1239int
1240RemoveRecorder::updateNodalMasses(int theEleTag, double theEleMass)
1241{
1242 // update the nodal masses and loads if requested
1243 if (theEleMass != 0) {
1244
1245 Element* theEle = theDomain->getElement(theEleTag);
1246 ID endNodes = theEle->getExternalNodes();
1247 for (int k = 0; k<theEle->getNumExternalNodes(); k++) {
1248
1249 Node* theNode=theDomain->getNode(endNodes(k));
1250 Matrix theNodalMass = theNode->getMass();
1251 for (int l = 0; l<theNodalMass.noRows(); l++) {
1252 if (theNodalMass(l,l) != 0)
1253 theNodalMass(l,l) -= 0.5*theEleMass;
1254 }
1255 if (theDomain->setMass(theNodalMass, theNode->getTag()) != 0) {
1256 opserr << "Remove Recorder::WARNING failed to set mass at node " << theNode->getTag() << endln;
1257 }
1258
1259
1260 if (this->gAcc != 0) {
1261 double theEleWeight = theEleMass * gAcc;
1262 Vector theNodalForces(theNode->getNumberDOF());
1263 theNodalForces.Zero();
1264 theNodalForces(gDir-1) = 0.5 * theEleWeight;
1265 bool isLoadConst = true;
1266 opserr<<"eleWeight "<<theEleWeight<<" NodalForces "<<theNodalForces(0)<<" "<<theNodalForces.Size()<<endln;
1267 int nodeLoadTag = 987654 + theEleTag * 30 + k; // big number + many element nodes + current node
1268 NodalLoad* theNodalLoad = new NodalLoad(nodeLoadTag, theNode->getTag(), theNodalForces, isLoadConst);
1269 if (theNodalLoad == 0) {
1270 opserr << "RemoveRecorder::WARNING ran out of memory while updating loads on node " << theNode->getTag();
1271 }
1272 if (theDomain->addNodalLoad(theNodalLoad, gPat) == false) {
1273 opserr << "RemoveRecorder::WARNING could not add updated nodal load to domain\n";
1274 delete theNodalLoad;
1275 }
1276 }
1277 }
1278 }
1279 return 0;
1280}
1281
1282int RemoveRecorder::flush(void) {
1283 if (theFile.is_open() && theFile.good()) {

Callers 1

recordMethod · 0.95

Calls 10

getElementMethod · 0.45
getNumExternalNodesMethod · 0.45
getNodeMethod · 0.45
noRowsMethod · 0.45
setMassMethod · 0.45
getTagMethod · 0.45
getNumberDOFMethod · 0.45
ZeroMethod · 0.45
SizeMethod · 0.45
addNodalLoadMethod · 0.45

Tested by

no test coverage detected