本文整理汇总了C++中FEProblem::es方法的典型用法代码示例。如果您正苦于以下问题:C++ FEProblem::es方法的具体用法?C++ FEProblem::es怎么用?C++ FEProblem::es使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FEProblem
的用法示例。
在下文中一共展示了FEProblem::es方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
MultiAppProjectionTransfer::projectSolution(FEProblem & to_problem, unsigned int app)
{
EquationSystems & proj_es = to_problem.es();
LinearImplicitSystem & ls = *_proj_sys[app];
// activate the current transfer
proj_es.parameters.set<MultiAppProjectionTransfer *>("transfer") = this;
proj_es.parameters.set<unsigned int>("app") = app;
// TODO: specify solver params in an input file
// solver tolerance
Real tol = proj_es.parameters.get<Real>("linear solver tolerance");
proj_es.parameters.set<Real>("linear solver tolerance") = 1e-10; // set our tolerance
// solve it
ls.solve();
proj_es.parameters.set<Real>("linear solver tolerance") = tol; // restore the original tolerance
// copy projected solution into target es
MeshBase & to_mesh = proj_es.get_mesh();
MooseVariable & to_var = to_problem.getVariable(0, _to_var_name);
System & to_sys = to_var.sys().system();
NumericVector<Number> * to_solution = to_sys.solution.get();
{
MeshBase::const_node_iterator it = to_mesh.local_nodes_begin();
const MeshBase::const_node_iterator end_it = to_mesh.local_nodes_end();
for ( ; it != end_it; ++it)
{
const Node * node = *it;
if (node->n_comp(to_sys.number(), to_var.number()) > 0)
{
const dof_id_type proj_index = node->dof_number(ls.number(), _proj_var_num, 0);
const dof_id_type to_index = node->dof_number(to_sys.number(), to_var.number(), 0);
to_solution->set(to_index, (*ls.solution)(proj_index));
}
}
}
{
MeshBase::const_element_iterator it = to_mesh.active_local_elements_begin();
const MeshBase::const_element_iterator end_it = to_mesh.active_local_elements_end();
for ( ; it != end_it; ++it)
{
const Elem * elem = *it;
if (elem->n_comp(to_sys.number(), to_var.number()) > 0)
{
const dof_id_type proj_index = elem->dof_number(ls.number(), _proj_var_num, 0);
const dof_id_type to_index = elem->dof_number(to_sys.number(), to_var.number(), 0);
to_solution->set(to_index, (*ls.solution)(proj_index));
}
}
}
to_solution->close();
to_sys.update();
}