void GCUpdateInfo::onButClick(wxCommandEvent& event) { if (m_butRestartNow->GetId() == event.GetId()) { Close(); doRestart(); } else if (m_butRestartLater->GetId() == event.GetId()) { Close(); } }
void runApplicationSolid() { typedef FeelModels::SolidMechanics< Simplex<FEELPP_DIM,1>, Lagrange<OrderDisp, Vectorial,Continuous,PointSetFekete> > model_type; auto SM = model_type::New("solid"); if ( SM->isStationary() ) { bool algoQuasiStatic = boption(_name="solve-quasi-static"); if ( !algoQuasiStatic ) { SM->init(); SM->printAndSaveInfo(); SM->solve(); SM->exportResults(); } else { SM->init(); SM->printAndSaveInfo(); std::string variableSymbol = soption(_name="solve-quasi-static.variable-symbol"); CHECK( SM->modelProperties().parameters().find(variableSymbol) != SM->modelProperties().parameters().end() ) << "not find symbol " << variableSymbol; double valueFinal = SM->modelProperties().parameters().find(variableSymbol)->second.value(); double valueInitial = doption(_name="solve-quasi-static.variable-initial"); double valueStep = doption(_name="solve-quasi-static.variable-step"); int cptNeed = std::abs(valueFinal-valueInitial)/valueStep; double currentParam = valueInitial; std::string namefileVariableParameters = (fs::path(SM->rootRepository()) / fs::path("paramters-done.data")).string(); std::string saveType = soption(_name="solve-quasi-static.save.file-format"); int cptCurrent=1; if ( SM->doRestart() ) { std::ifstream fileParameter(namefileVariableParameters.c_str()); while ( ! fileParameter.eof() ) { fileParameter >> cptCurrent >> currentParam; } fileParameter.close(); SM->fieldDisplacement().load(_path=SM->rootRepository()+"/"+(boost::format("uSol.field-%1%") %cptCurrent ).str(), _type=saveType ); if ( SM->useDisplacementPressureFormulation() ) SM->fieldPressure().load(_path=SM->rootRepository()+"/"+(boost::format("pSol.field-%1%") %cptCurrent ).str(), _type=saveType ); SM->restartExporters(cptCurrent); ++cptCurrent; } else {
bool NOX::Direction::Broyden::compute(NOX::Abstract::Vector& dir, NOX::Abstract::Group& soln, const NOX::Solver::LineSearchBased& solver) { // Return value for group operations (temp variable) NOX::Abstract::Group::ReturnType status; // Compute F at current solution status = soln.computeF(); if (status != NOX::Abstract::Group::Ok) throwError("compute", "Unable to compute F"); // Check for restart if (doRestart(soln, solver)) { // Reset memory memory.reset(); // Update group if (Teuchos::is_null(oldJacobianGrpPtr)) oldJacobianGrpPtr = soln.clone(NOX::DeepCopy); else // RPP - update the entire group (this grabs state vectors in xyce). // Otherwise, xyce is forced to recalculate F at each iteration. //oldJacobianGrpPtr->setX(soln.getX()); *oldJacobianGrpPtr = soln; // Calcuate new Jacobian if (utils->isPrintType(NOX::Utils::Details)) utils->out() << " Recomputing Jacobian" << endl; status = oldJacobianGrpPtr->computeJacobian(); if (status != NOX::Abstract::Group::Ok) throwError("compute", "Unable to compute Jacobian"); // Reset counter cnt = 0; } // If necesary, scale the s-vector from the last iteration if (!memory.empty()) { double step = solver.getStepSize(); memory[memory.size() - 1].setStep(step); } // --- Calculate the Broyden direction --- // Compute inexact forcing term if requested. inexactNewtonUtils.computeForcingTerm(soln, solver.getPreviousSolutionGroup(), solver.getNumIterations(), solver); // dir = - J_old^{-1} * F cnt ++; status = oldJacobianGrpPtr->applyJacobianInverse(*lsParamsPtr, soln.getF(), dir); if (status != NOX::Abstract::Group::Ok) throwError("compute", "Unable to apply Jacobian inverse"); dir.scale(-1.0); // Apply the Broyden modifications to the old Jacobian (implicitly) if (!memory.empty()) { // Number of elements in the memory int m = memory.size(); // Information corresponding to index i double step; Teuchos::RCP<const NOX::Abstract::Vector> sPtr; // Information corresponding to index i + 1 // (initialized for i = -1) double stepNext = memory[0].step(); Teuchos::RCP<const NOX::Abstract::Vector> sPtrNext = memory[0].sPtr(); // Intermediate storage double a, b, c, denom; for (int i = 0; i < m-1; i ++) { step = stepNext; sPtr = sPtrNext; stepNext = memory[i+1].step(); sPtrNext = memory[i+1].sPtr(); a = step / stepNext; b = step - 1; c = sPtr->innerProduct(dir) / memory[i].sNormSqr(); dir.update(a * c, *sPtrNext, b * c, *sPtr, 1.0); } step = stepNext; sPtr = sPtrNext; a = sPtr->innerProduct(dir); // <s,z> b = memory[m-1].sNormSqr(); // ||s||^2 c = (step - 1) * a; // (\lambda-1) <s,z> denom = b - step * a; // ||s||^2 - \lambda <s,z> dir.update(c / denom, *sPtr, b / denom); } //! Add this direction to the memory memory.push(dir); return true; }