OGS
|
A class designed to manage the solution of coupled equations using the staggered method.
Definition at line 46 of file StaggeredCoupling.h.
#include <StaggeredCoupling.h>
Public Member Functions | |
StaggeredCoupling (const int global_coupling_max_iterations, std::vector< CouplingNodeVariant > &&coupling_nodes) | |
~StaggeredCoupling () | |
void | initializeCoupledSolutions (std::vector< GlobalVector * > const &process_solutions) |
template<typename ProcessData , typename Output > | |
NumLib::NonlinearSolverStatus | execute (const double t, const double dt, const std::size_t timestep_id, std::vector< GlobalVector * > &process_solutions, std::vector< GlobalVector * > const &process_solutions_prev, std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< Output > const &outputs, ProcessSolver< ProcessData, Output > const &solve_one_time_step_one_process) |
Private Types | |
template<typename ProcessData , typename Output > | |
using | ProcessSolver |
using | CouplingNodeVariant = std::variant<CouplingNode, RootCouplingNode> |
Private Member Functions | |
template<typename ProcessData , typename Output > | |
std::tuple< NumLib::NonlinearSolverStatus, bool > | executeConcrete (std::vector< CouplingNodeVariant > &coupling_nodes, const int max_iterations, const double t, const double dt, const std::size_t timestep_id, std::vector< GlobalVector * > &process_solutions, std::vector< GlobalVector * > const &process_solutions_prev, std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< Output > const &outputs, ProcessSolver< ProcessData, Output > const &solve_one_time_step_one_process) |
template<typename ProcessData , typename Output > | |
std::tuple< NumLib::NonlinearSolverStatus, bool > | executeSubCoupling (CouplingNodeVariant &coupling_node, const double t, const double dt, const std::size_t timestep_id, std::vector< GlobalVector * > &process_solutions, std::vector< GlobalVector * > const &process_solutions_prev, std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< Output > const &outputs, ProcessSolver< ProcessData, Output > const &solve_one_time_step_one_process) |
template<typename ProcessData , typename Output > | |
NumLib::NonlinearSolverStatus | executeSingleIteration (int const global_coupling_iteration, CouplingNode const ®ular_coupling_node, const double t, const double dt, const std::size_t timestep_id, std::vector< GlobalVector * > &process_solutions, std::vector< GlobalVector * > const &process_solutions_prev, std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< Output > const &outputs, ProcessSolver< ProcessData, Output > const &solve_one_time_step_one_process) |
void | setFirstIterationIndicator (std::vector< CouplingNodeVariant > const &coupling_nodes) |
Set the indicator of the first staggered coupling iteration be true. | |
void | resetCouplingConvergenceCriteria (std::vector< CouplingNodeVariant > const &coupling_nodes) |
bool | checkCouplingConvergence (const bool convergence_of_last_process, CouplingNode const &coupling_node, GlobalVector const &x) const |
void | updatePreviousSolution (int const process_id, GlobalVector const &x) |
Private Attributes | |
const int | global_coupling_max_iterations_ |
Maximum iteration number of the coupling loop of the staggered scheme. | |
std::vector< CouplingNodeVariant > | coupling_nodes_ |
std::vector< GlobalVector * > | solutions_of_last_cpl_iteration_ |
|
private |
Definition at line 56 of file StaggeredCoupling.h.
|
private |
Definition at line 49 of file StaggeredCoupling.h.
|
inline |
Definition at line 59 of file StaggeredCoupling.h.
NumLib::StaggeredCoupling::~StaggeredCoupling | ( | ) |
Definition at line 23 of file StaggeredCoupling.cpp.
References NumLib::GlobalVectorProvider::provider, NumLib::VectorProvider::releaseVector(), and solutions_of_last_cpl_iteration_.
|
private |
Definition at line 72 of file StaggeredCoupling.cpp.
References MathLib::LinAlg::axpy(), NumLib::CouplingNode::convergence_criterion, INFO(), NumLib::CouplingNode::process_id, NumLib::CouplingNode::process_name, and solutions_of_last_cpl_iteration_.
Referenced by executeConcrete().
NumLib::NonlinearSolverStatus NumLib::StaggeredCoupling::execute | ( | const double | t, |
const double | dt, | ||
const std::size_t | timestep_id, | ||
std::vector< GlobalVector * > & | process_solutions, | ||
std::vector< GlobalVector * > const & | process_solutions_prev, | ||
std::vector< std::unique_ptr< ProcessData > > const & | per_process_data, | ||
std::vector< Output > const & | outputs, | ||
ProcessSolver< ProcessData, Output > const & | solve_one_time_step_one_process ) |
It solves the equations of all coupled processes by the staggered method, and it returns nonlinear solver status.
Definition at line 21 of file StaggeredCoupling-impl.h.
References coupling_nodes_, executeConcrete(), global_coupling_max_iterations_, and WARN().
|
private |
It solves the equation of each coupling process (treated as a coupling node) via function recursion, and it returns nonlinear solver status, and an indicator of coupling iteration convergence.
Definition at line 81 of file StaggeredCoupling-impl.h.
References checkCouplingConvergence(), executeSingleIteration(), executeSubCoupling(), NumLib::CouplingNode::process_id, NumLib::CouplingNode::process_name, resetCouplingConvergenceCriteria(), setFirstIterationIndicator(), updatePreviousSolution(), and WARN().
Referenced by execute(), and executeSubCoupling().
|
private |
Definition at line 47 of file StaggeredCoupling-impl.h.
References BaseLib::RunTime::elapsed(), INFO(), NumLib::CouplingNode::process_id, NumLib::CouplingNode::process_name, and BaseLib::RunTime::start().
Referenced by executeConcrete().
|
private |
Definition at line 172 of file StaggeredCoupling-impl.h.
References executeConcrete(), INFO(), and NumLib::RootCouplingNode::sub_coupling_nodes.
Referenced by executeConcrete().
void NumLib::StaggeredCoupling::initializeCoupledSolutions | ( | std::vector< GlobalVector * > const & | process_solutions | ) |
This function fills the vector of solutions of coupled processes of processes, solutions_of_coupled_processes_, and initializes the vector of solutions of the previous coupling iteration, _solutions_of_last_cpl_iteration.
Definition at line 31 of file StaggeredCoupling.cpp.
References MathLib::LinAlg::copy(), NumLib::VectorProvider::getVector(), NumLib::GlobalVectorProvider::provider, and solutions_of_last_cpl_iteration_.
|
private |
Definition at line 59 of file StaggeredCoupling.cpp.
Referenced by executeConcrete().
|
private |
Set the indicator of the first staggered coupling iteration be true.
Definition at line 45 of file StaggeredCoupling.cpp.
Referenced by executeConcrete().
|
private |
Definition at line 97 of file StaggeredCoupling.cpp.
References MathLib::LinAlg::copy(), and solutions_of_last_cpl_iteration_.
Referenced by executeConcrete().
|
private |
Coupling graph for the staggered scheme. It looks like:
x ... x o o / \ / \ / \ / \ x ... x x ... x
where x represents a coupling node, and o represents a dummy root coupling node.
Definition at line 105 of file StaggeredCoupling.h.
Referenced by execute().
|
private |
Maximum iteration number of the coupling loop of the staggered scheme.
Definition at line 93 of file StaggeredCoupling.h.
Referenced by execute().
|
private |
Solutions of the previous coupling iteration for the convergence criteria of the coupling iteration.
Definition at line 150 of file StaggeredCoupling.h.
Referenced by ~StaggeredCoupling(), checkCouplingConvergence(), initializeCoupledSolutions(), and updatePreviousSolution().