void EigenExecutionerBase::postExecute() { if (getParam<bool>("output_before_normalization")) { _problem.timeStep()++; Real t = _problem.time(); _problem.time() = _problem.timeStep(); _problem.outputStep(EXEC_TIMESTEP_END); _problem.time() = t; } Real s = 1.0; if (_norm_execflag & EXEC_CUSTOM) { _console << " Cannot let the normalization postprocessor on custom." << std::endl; _console << " Normalization is abandoned!" << std::endl; } else { s = normalizeSolution(_norm_execflag & (EXEC_TIMESTEP_END | EXEC_LINEAR)); if (std::fabs(s-1.0)>std::numeric_limits<Real>::epsilon()) _console << " Solution is rescaled with factor " << s << " for normalization!" << std::endl; } if ((!getParam<bool>("output_before_normalization")) || std::fabs(s-1.0)>std::numeric_limits<Real>::epsilon()) { _problem.timeStep()++; Real t = _problem.time(); _problem.time() = _problem.timeStep(); _problem.outputStep(EXEC_TIMESTEP_END); _problem.time() = t; } }
void EigenExecutionerBase::postExecute() { if (!getParam<bool>("output_on_final")) { _problem.timeStep()++; Real t = _problem.time(); _problem.time() = _problem.timeStep(); _output_warehouse.outputStep(); _problem.time() = t; } Real s = 1.0; if (_norm_execflag==EXEC_CUSTOM) { Moose::out << " Cannot let the normalization postprocessor on custom." << std::endl; Moose::out << " Normalization is abandoned!" << std::endl; } else { s = normalizeSolution(_norm_execflag!=EXEC_TIMESTEP && _norm_execflag!=EXEC_RESIDUAL); if (std::fabs(s-1.0)>std::numeric_limits<Real>::epsilon()) Moose::out << " Solution is rescaled with factor " << s << " for normalization!" << std::endl; } if (getParam<bool>("output_on_final") || std::fabs(s-1.0)>std::numeric_limits<Real>::epsilon()) { _problem.timeStep()++; Real t = _problem.time(); _problem.time() = _problem.timeStep(); _output_warehouse.outputStep(); _problem.time() = t; } }
void Mesh :: updateDeformation( void ) { int t0 = clock(); // solve eigenvalue problem for local similarity transformation lambda buildEigenvalueProblem(); EigenSolver::solve( E, lambda ); // solve Poisson problem for new vertex positions // (we assume the final degree of freedom equals zero // in order to get a strictly positive-definite matrix) buildPoissonProblem(); int nV = vertices.size(); vector<Quaternion> v( nV-1 ); LinearSolver::solve( L, v, omega ); for( int i = 0; i < nV-1; i++ ) { newVertices[i] = v[i]; } newVertices[nV-1] = 0.; normalizeSolution(); int t1 = clock(); cout << "time: " << (t1-t0)/(double) CLOCKS_PER_SEC << "s" << endl; }
void Mesh :: resetDeformation( void ) { // copy original mesh vertices to current mesh for( size_t i = 0; i < vertices.size(); i++ ) { newVertices[i] = vertices[i]; } normalizeSolution(); }
void NonlinearEigen::execute() { preExecute(); // save the initial guess _problem.copyOldSolutions(); Real initial_res = 0.0; if (_free_iter>0) { // free power iterations Moose::out << std::endl << " Free power iteration starts" << std::endl; inversePowerIteration(_free_iter, _free_iter, _pfactor, false, std::numeric_limits<Real>::min(), std::numeric_limits<Real>::max(), true, _output_pi, 0.0, _eigenvalue, initial_res); } if (!getParam<bool>("output_on_final")) { _problem.timeStep() = POWERITERATION_END; Real t = _problem.time(); _problem.time() = _problem.timeStep(); _output_warehouse.outputStep(); _problem.time() = t; } Moose::out << " Nonlinear iteration starts" << std::endl; _problem.timestepSetup(); _problem.copyOldSolutions(); Real rel_tol = _rel_tol; Real abs_tol = _abs_tol; if (_free_iter>0) { Moose::out << " Initial |R| = " << initial_res << std::endl; abs_tol = _rel_tol*initial_res; if (abs_tol<_abs_tol) abs_tol = _abs_tol; rel_tol = 1e-50; } // nonlinear solve preSolve(); nonlinearSolve(rel_tol, abs_tol, _pfactor, _eigenvalue); postSolve(); _problem.computeUserObjects(EXEC_TIMESTEP, UserObjectWarehouse::PRE_AUX); _problem.onTimestepEnd(); _problem.computeAuxiliaryKernels(EXEC_TIMESTEP); _problem.computeUserObjects(EXEC_TIMESTEP, UserObjectWarehouse::POST_AUX); if (_run_custom_uo) _problem.computeUserObjects(EXEC_CUSTOM); if (!getParam<bool>("output_on_final")) { _problem.timeStep() = NONLINEAR_SOLVE_END; Real t = _problem.time(); _problem.time() = _problem.timeStep(); _output_warehouse.outputStep(); _problem.time() = t; } Real s = normalizeSolution(_norm_execflag!=EXEC_CUSTOM && _norm_execflag!=EXEC_TIMESTEP && _norm_execflag!=EXEC_RESIDUAL); Moose::out << " Solution is rescaled with factor " << s << " for normalization!" << std::endl; if (getParam<bool>("output_on_final") || std::fabs(s-1.0)>std::numeric_limits<Real>::epsilon()) { _problem.timeStep() = FINAL; Real t = _problem.time(); _problem.time() = _problem.timeStep(); _output_warehouse.outputStep(); _problem.time() = t; } postExecute(); }