void TimeStepping::initializeNewtonLoop() { DEBUG_BEGIN("TimeStepping::initializeNewtonLoop()\n"); double tkp1 = getTkp1(); assert(!isnan(tkp1)); for (OSIIterator it = _allOSI->begin(); it != _allOSI->end() ; ++it) { (*it)->computeInitialNewtonState(); (*it)->computeResidu(); } // Predictive contact -- update initial contacts after updating DS positions updateWorldFromDS(); updateInteractions(); // Changes in updateInteractions may require initialization initializeNSDSChangelog(); SP::InteractionsGraph indexSet0 = _nsds->topology()->indexSet0(); if (indexSet0->size()>0) { for (OSIIterator itOSI = _allOSI->begin(); itOSI != _allOSI->end() ; ++itOSI) { (*itOSI)->updateOutput(nextTime()); (*itOSI)->updateInput(nextTime()); } } SP::DynamicalSystemsGraph dsGraph = _nsds->dynamicalSystems(); for (DynamicalSystemsGraph::VIterator vi = dsGraph->begin(); vi != dsGraph->end(); ++vi) { dsGraph->bundle(*vi)->updatePlugins(tkp1); } for (OSIIterator it = _allOSI->begin(); it != _allOSI->end() ; ++it) (*it)->computeResidu(); if (_computeResiduY) { for (OSIIterator itOSI = _allOSI->begin(); itOSI != _allOSI->end() ; ++itOSI) { (*itOSI)->computeResiduOutput(tkp1, indexSet0); } } DEBUG_END("TimeStepping::initializeNewtonLoop()\n"); }
void Simulation::processEvents() { _eventsManager->processEvents(*this); if (_eventsManager->hasNextEvent()) { // For TimeStepping Scheme, need to update IndexSets, but not for EventDriven scheme if (Type::value(*this) != Type::EventDriven) { updateIndexSets(); } } /* should be evaluated only if needed */ SP::DynamicalSystemsGraph dsGraph = _nsds->dynamicalSystems(); for (DynamicalSystemsGraph::VIterator vi = dsGraph->begin(); vi != dsGraph->end(); ++vi) { dsGraph->bundle(*vi)->endStep(); } }
void Hem5OSI::fprob(integer* IFCN, integer* NQ, integer* NV, integer* NU, integer* NL, integer* LDG, integer* LDF, integer* LDA, integer* NBLK, integer* NMRC, integer* NPGP, integer* NPFL, integer* INDGR, integer* INDGC, integer * INDFLR, integer * INDFLC, doublereal* time, doublereal* q, doublereal* v, doublereal* u, doublereal* xl, doublereal* G, doublereal* GQ, doublereal * F, doublereal* GQQ, doublereal* GT, doublereal * FL, doublereal* QDOT, doublereal* UDOT, doublereal * AM) { DEBUG_PRINTF("Hem5OSI::fprob(integer* IFCN,...) with IFCN = %i \n", (int)*IFCN); DEBUG_PRINTF("NQ = %i\t NV = %i \t NU = %i, NL = %i \n", (int)*NQ, (int)*NV, (int)*NU, (int)*NL); DEBUG_PRINTF("LDG = %i\t LDF = %i \t LDA = %i \n", (int)*LDG, (int)*LDF, (int)*LDA); // fill in xWork vector (ie all the x of the ds of this osi) with x fillqWork(NQ, q); fillvWork(NV, v); double t = *time; simulationLink->model()->setCurrentTime(t); SP::DynamicalSystemsGraph dsGraph = simulationLink->model()->nonSmoothDynamicalSystem()->dynamicalSystems(); int ifcn = (int)(*IFCN); if ((ifcn == 1) || (ifcn >= 7)) // compute Mass AM { unsigned int pos=0; for (DynamicalSystemsGraph::VIterator vi = dsGraph->begin(); vi != dsGraph->end(); ++vi) { SP::DynamicalSystem ds = dsGraph->bundle(*vi); if (Type::value(*ds) == Type::LagrangianDS || Type::value(*ds) == Type::LagrangianLinearTIDS) { LagrangianDS& lds = *std11::static_pointer_cast<LagrangianDS>(ds); lds.computeMass(); for (unsigned int ii =pos ; ii < ((unsigned int)(*NV)+pos); ii ++) { for (unsigned int jj =pos ; jj < ((unsigned int)(*NV)+pos); jj ++) { AM[ii + jj*(int)(*NV)] = lds.mass()->getValue(ii,jj) ; } } pos += lds.getDim(); } else { RuntimeException::selfThrow("Hem5OSI::fprob(), Only integration of Lagrangian DS is allowed"); } DEBUG_EXPR( for (int kk =0 ; kk < (int)(*NV)* (int)(*NV); kk ++) { std::cout << AM[kk] << std::endl; } ); }