本文整理汇总了C++中Transient::takeStep方法的典型用法代码示例。如果您正苦于以下问题:C++ Transient::takeStep方法的具体用法?C++ Transient::takeStep怎么用?C++ Transient::takeStep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transient
的用法示例。
在下文中一共展示了Transient::takeStep方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: aldit
//.........这里部分代码省略.........
// How far along we are towards the target time:
Real step_percent = (future_time - time_old) / (target_time - time_old);
Real one_minus_step_percent = 1.0 - step_percent;
// Do the interpolation for each variable that was transferred to
FEProblem * problem = appProblem(_first_local_app + i);
AuxiliarySystem & aux_system = problem->getAuxiliarySystem();
System & libmesh_aux_system = aux_system.system();
NumericVector<Number> & solution = *libmesh_aux_system.solution;
NumericVector<Number> & transfer = libmesh_aux_system.get_vector("transfer");
NumericVector<Number> & transfer_old = libmesh_aux_system.get_vector("transfer_old");
solution.close(); // Just to be sure
transfer.close();
transfer_old.close();
std::set<dof_id_type>::iterator it = _transferred_dofs.begin();
std::set<dof_id_type>::iterator end = _transferred_dofs.end();
for(; it != end; ++it)
{
dof_id_type dof = *it;
solution.set(dof, (transfer_old(dof) * one_minus_step_percent) + (transfer(dof) * step_percent));
// solution.set(dof, transfer_old(dof));
// solution.set(dof, transfer(dof));
// solution.set(dof, 1);
}
solution.close();
}
ex->takeStep();
bool converged = ex->lastSolveConverged();
if (!converged)
{
mooseWarning("While sub_cycling "<<_name<<_first_local_app+i<<" failed to converge!"<<std::endl);
_failures++;
if (_failures > _max_failures)
mooseError("While sub_cycling "<<_name<<_first_local_app+i<<" REALLY failed!"<<std::endl);
}
Real solution_change_norm = ex->getSolutionChangeNorm();
if (_detect_steady_state)
Moose::out << "Solution change norm: " << solution_change_norm << std::endl;
if (converged && _detect_steady_state && solution_change_norm < _steady_state_tol)
{
Moose::out << "Detected Steady State! Fast-forwarding to " << target_time << std::endl;
at_steady = true;
// Indicate that the next output call (occurs in ex->endStep()) should output, regarless of intervals etc...
output_warehouse.forceOutput();
// Clean up the end
ex->endStep(target_time-app_time_offset);
}
else
ex->endStep();
}
示例2: swapper
//.........这里部分代码省略.........
Real future_time = ex->getTime() + app_time_offset + ex->getDT();
// How far along we are towards the target time:
Real step_percent = (future_time - time_old) / (target_time - time_old);
Real one_minus_step_percent = 1.0 - step_percent;
// Do the interpolation for each variable that was transferred to
FEProblemBase & problem = appProblemBase(_first_local_app + i);
AuxiliarySystem & aux_system = problem.getAuxiliarySystem();
System & libmesh_aux_system = aux_system.system();
NumericVector<Number> & solution = *libmesh_aux_system.solution;
NumericVector<Number> & transfer = libmesh_aux_system.get_vector("transfer");
NumericVector<Number> & transfer_old = libmesh_aux_system.get_vector("transfer_old");
solution.close(); // Just to be sure
transfer.close();
transfer_old.close();
for (const auto & dof : _transferred_dofs)
{
solution.set(dof,
(transfer_old(dof) * one_minus_step_percent) +
(transfer(dof) * step_percent));
// solution.set(dof, transfer_old(dof));
// solution.set(dof, transfer(dof));
// solution.set(dof, 1);
}
solution.close();
}
ex->takeStep();
bool converged = ex->lastSolveConverged();
if (!converged)
{
mooseWarning(
"While sub_cycling ", name(), _first_local_app + i, " failed to converge!\n");
_failures++;
if (_failures > _max_failures)
{
std::stringstream oss;
oss << "While sub_cycling " << name() << _first_local_app << i << " REALLY failed!";
throw MultiAppSolveFailure(oss.str());
}
}
Real solution_change_norm = ex->getSolutionChangeNorm();
if (_detect_steady_state)
_console << "Solution change norm: " << solution_change_norm << std::endl;
if (converged && _detect_steady_state && solution_change_norm < _steady_state_tol)
{
_console << "Detected Steady State! Fast-forwarding to " << target_time << std::endl;
at_steady = true;
// Indicate that the next output call (occurs in ex->endStep()) should output,
// regardless of intervals etc...
problem.forceOutput();