From f787d2adef5cc5acbc80efb2acbcc79e79485725 Mon Sep 17 00:00:00 2001 From: Wenqing Wang <wenqing.wang@ufz.de> Date: Tue, 7 Feb 2017 15:37:00 +0100 Subject: [PATCH] [Coupling] Renamed some names --- NumLib/ODESolver/NonlinearSolver.cpp | 16 ++++---- NumLib/ODESolver/NonlinearSolver.h | 16 ++++---- NumLib/ODESolver/NonlinearSystem.h | 4 +- NumLib/ODESolver/ODESystem.h | 41 ++++++++++--------- NumLib/ODESolver/TimeDiscretizedODESystem.cpp | 8 ++-- NumLib/ODESolver/TimeDiscretizedODESystem.h | 4 +- ProcessLib/AbstractJacobianAssembler.h | 4 +- .../GroundwaterFlowProcess.cpp | 8 ++-- .../GroundwaterFlow/GroundwaterFlowProcess.h | 4 +- ProcessLib/HT/HTProcess.cpp | 8 ++-- ProcessLib/HT/HTProcess.h | 4 +- .../HeatConduction/HeatConductionProcess.cpp | 8 ++-- .../HeatConduction/HeatConductionProcess.h | 4 +- .../HydroMechanics/HydroMechanicsProcess.h | 8 ++-- .../HydroMechanics/HydroMechanicsProcess.h | 8 ++-- .../SmallDeformationProcess.h | 8 ++-- ProcessLib/LiquidFlow/LiquidFlowProcess.cpp | 8 ++-- ProcessLib/LiquidFlow/LiquidFlowProcess.h | 4 +- ProcessLib/LocalAssemblerInterface.cpp | 8 ++-- ProcessLib/LocalAssemblerInterface.h | 6 +-- ProcessLib/Process.cpp | 8 ++-- ProcessLib/Process.h | 8 ++-- .../RichardsFlow/RichardsFlowProcess.cpp | 8 ++-- ProcessLib/RichardsFlow/RichardsFlowProcess.h | 4 +- .../SmallDeformationProcess.h | 8 ++-- ProcessLib/StaggeredCouplingTerm.h | 5 ++- ProcessLib/TES/TESProcess.cpp | 8 ++-- ProcessLib/TES/TESProcess.h | 4 +- .../TwoPhaseFlowWithPPProcess.cpp | 8 ++-- .../TwoPhaseFlowWithPPProcess.h | 4 +- .../TwoPhaseFlowWithPrhoProcess.cpp | 8 ++-- .../TwoPhaseFlowWithPrhoProcess.h | 4 +- ProcessLib/UncoupledProcessesTimeLoop.cpp | 31 +++++++------- ProcessLib/UncoupledProcessesTimeLoop.h | 3 +- ProcessLib/VectorMatrixAssembler.cpp | 26 ++++++------ ProcessLib/VectorMatrixAssembler.h | 4 +- Tests/NumLib/ODEs.h | 18 ++++---- 37 files changed, 172 insertions(+), 166 deletions(-) diff --git a/NumLib/ODESolver/NonlinearSolver.cpp b/NumLib/ODESolver/NonlinearSolver.cpp index 2353746d8cb..fe2139c557c 100644 --- a/NumLib/ODESolver/NonlinearSolver.cpp +++ b/NumLib/ODESolver/NonlinearSolver.cpp @@ -25,13 +25,13 @@ namespace NumLib { void NonlinearSolver<NonlinearSolverTag::Picard>::assemble( GlobalVector const& x, - ProcessLib::StaggeredCouplingTerm const& coupled_term) const + ProcessLib::StaggeredCouplingTerm const& coupling_term) const { - _equation_system->assemble(x, coupled_term); + _equation_system->assemble(x, coupling_term); } bool NonlinearSolver<NonlinearSolverTag::Picard>::solve( - GlobalVector& x, ProcessLib::StaggeredCouplingTerm const& coupled_term, + GlobalVector& x, ProcessLib::StaggeredCouplingTerm const& coupling_term, std::function<void(unsigned, GlobalVector const&)> const& postIterationCallback) { namespace LinAlg = MathLib::LinAlg; @@ -62,7 +62,7 @@ bool NonlinearSolver<NonlinearSolverTag::Picard>::solve( BaseLib::RunTime time_assembly; time_assembly.start(); - sys.assemble(x, coupled_term); + sys.assemble(x, coupling_term); sys.getA(A); sys.getRhs(rhs); INFO("[time] Assembly took %g s.", time_assembly.elapsed()); @@ -163,16 +163,16 @@ bool NonlinearSolver<NonlinearSolverTag::Picard>::solve( void NonlinearSolver<NonlinearSolverTag::Newton>::assemble( GlobalVector const& x, - ProcessLib::StaggeredCouplingTerm const& coupled_term) const + ProcessLib::StaggeredCouplingTerm const& coupling_term) const { - _equation_system->assemble(x, coupled_term); + _equation_system->assemble(x, coupling_term); // TODO if the equation system would be reset to nullptr after each // assemble() or solve() call, the user would be forced to set the // equation every time and could not forget it. } bool NonlinearSolver<NonlinearSolverTag::Newton>::solve( - GlobalVector& x, ProcessLib::StaggeredCouplingTerm const& coupled_term, + GlobalVector& x, ProcessLib::StaggeredCouplingTerm const& coupling_term, std::function<void(unsigned, GlobalVector const&)> const& postIterationCallback) { namespace LinAlg = MathLib::LinAlg; @@ -206,7 +206,7 @@ bool NonlinearSolver<NonlinearSolverTag::Newton>::solve( BaseLib::RunTime time_assembly; time_assembly.start(); - sys.assemble(x, coupled_term); + sys.assemble(x, coupling_term); sys.getResidual(x, res); sys.getJacobian(J); INFO("[time] Assembly took %g s.", time_assembly.elapsed()); diff --git a/NumLib/ODESolver/NonlinearSolver.h b/NumLib/ODESolver/NonlinearSolver.h index bccd33a08ad..76fe29f29df 100644 --- a/NumLib/ODESolver/NonlinearSolver.h +++ b/NumLib/ODESolver/NonlinearSolver.h @@ -47,18 +47,18 @@ public: * * \param x the state at which the equation system will be * assembled. - * \param coupled_term the coupled term including the reference of the + * \param coupling_term the coupled term including the reference of the * coupled processes and solutions of the equations of * the coupled processes. */ virtual void assemble(GlobalVector const& x, - ProcessLib::StaggeredCouplingTerm const& coupled_term + ProcessLib::StaggeredCouplingTerm const& coupling_term ) const = 0; /*! Assemble and solve the equation system. * * \param x in: the initial guess, out: the solution. - * \param coupled_term the coupled term including the reference of the + * \param coupling_term the coupled term including the reference of the * coupled processes and solutions of the equations of * the coupled processes. * \param postIterationCallback called after each iteration if set. @@ -67,7 +67,7 @@ public: * \retval false otherwise */ virtual bool solve(GlobalVector& x, - ProcessLib::StaggeredCouplingTerm const& coupled_term, + ProcessLib::StaggeredCouplingTerm const& coupling_term, std::function<void(unsigned, GlobalVector const&)> const& postIterationCallback) = 0; @@ -118,11 +118,11 @@ public: } void assemble(GlobalVector const& x, - ProcessLib::StaggeredCouplingTerm const& coupled_term + ProcessLib::StaggeredCouplingTerm const& coupling_term ) const override; bool solve(GlobalVector& x, - ProcessLib::StaggeredCouplingTerm const& coupled_term, + ProcessLib::StaggeredCouplingTerm const& coupling_term, std::function<void(unsigned, GlobalVector const&)> const& postIterationCallback) override; @@ -177,11 +177,11 @@ public: } void assemble(GlobalVector const& x, - ProcessLib::StaggeredCouplingTerm const& coupled_term + ProcessLib::StaggeredCouplingTerm const& coupling_term ) const override; bool solve(GlobalVector& x, - ProcessLib::StaggeredCouplingTerm const& coupled_term, + ProcessLib::StaggeredCouplingTerm const& coupling_term, std::function<void(unsigned, GlobalVector const&)> const& postIterationCallback) override; diff --git a/NumLib/ODESolver/NonlinearSystem.h b/NumLib/ODESolver/NonlinearSystem.h index d06fb5dda64..e7cffb1755c 100644 --- a/NumLib/ODESolver/NonlinearSystem.h +++ b/NumLib/ODESolver/NonlinearSystem.h @@ -42,7 +42,7 @@ public: //! The linearized system is \f$A(x) \cdot x = b(x)\f$. Here the matrix //! \f$A(x)\f$ and the vector \f$b(x)\f$ are assembled. virtual void assemble(GlobalVector const& x, - ProcessLib::StaggeredCouplingTerm const& coupled_term + ProcessLib::StaggeredCouplingTerm const& coupling_term ) = 0; /*! Writes the residual at point \c x to \c res. @@ -83,7 +83,7 @@ public: //! The linearized system is \f$J(x) \cdot \Delta x = (x)\f$. Here the //! residual vector \f$r(x)\f$ and its Jacobian \f$J(x)\f$ are assembled. virtual void assemble(GlobalVector const& x, - ProcessLib::StaggeredCouplingTerm const& coupled_term + ProcessLib::StaggeredCouplingTerm const& coupling_term ) = 0; //! Writes the linearized equation system matrix to \c A. diff --git a/NumLib/ODESolver/ODESystem.h b/NumLib/ODESolver/ODESystem.h index 6c229b196b8..598252c5940 100644 --- a/NumLib/ODESolver/ODESystem.h +++ b/NumLib/ODESolver/ODESystem.h @@ -17,7 +17,7 @@ namespace ProcessLib { - struct StaggeredCouplingTerm; +struct StaggeredCouplingTerm; } namespace NumLib @@ -50,11 +50,10 @@ public: ODESystemTag::FirstOrderImplicitQuasilinear; //! Assemble \c M, \c K and \c b at the provided state (\c t, \c x). - virtual void assemble(const double t, GlobalVector const& x, - GlobalMatrix& M, GlobalMatrix& K, - GlobalVector& b, - ProcessLib::StaggeredCouplingTerm const& coupled_term) - = 0; + virtual void assemble( + const double t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, + GlobalVector& b, + ProcessLib::StaggeredCouplingTerm const& coupling_term) = 0; using Index = MathLib::MatrixVectorTraits<GlobalMatrix>::Index; @@ -84,7 +83,8 @@ public: * \f$ \mathtt{Jac} := \partial r/\partial x_N \f$ * at the provided state (\c t, \c x). * - * For the meaning of the other parameters refer to the the introductory remarks on + * For the meaning of the other parameters refer to the the introductory + * remarks on * \ref concept_time_discretization "time discretization". * * \remark @@ -97,34 +97,37 @@ public: * + \frac{\partial K}{\partial x_N} \cdot x_N * + \frac{\partial b}{\partial x_N}, * \f] - * where \f$ M \f$, \f$ K \f$ and \f$ b \f$ are matrix-valued (vector-valued, respectively) + * where \f$ M \f$, \f$ K \f$ and \f$ b \f$ are matrix-valued + * (vector-valued, respectively) * functions that depend on \f$ x_C \f$ and \f$ t_C \f$. * - * Due to the arguments provided to this method its implementation only has to + * Due to the arguments provided to this method its implementation only has + * to * compute the derivatives * \f$ \frac{\partial M}{\partial x_N} \cdot \hat x \f$, * \f$ \frac{\partial K}{\partial x_N} \cdot x_N \f$ and * \f$ \frac{\partial b}{\partial x_N} \f$. * The other terms can be readily taken from the method parameters. * - * In particular for the ForwardEuler time discretization scheme the equation will + * In particular for the ForwardEuler time discretization scheme the + * equation will * collapse to * \f$ \mathtt{Jac} = * M \cdot \frac{\partial \hat x}{\partial x_N} * \f$ * since in that scheme \f$ x_N \neq x_C \f$. * - * Of course, the implementation of this method is allowed to compute the Jacobian in a - * different way, as long as that is consistent with the definition of \f$ \mathtt{Jac} \f$. + * Of course, the implementation of this method is allowed to compute the + * Jacobian in a + * different way, as long as that is consistent with the definition of \f$ + * \mathtt{Jac} \f$. * \endparblock */ - virtual void assembleWithJacobian(const double t, GlobalVector const& x, - GlobalVector const& xdot, - const double dxdot_dx, const double dx_dx, - GlobalMatrix& M, GlobalMatrix& K, - GlobalVector& b, GlobalMatrix& Jac, - ProcessLib::StaggeredCouplingTerm - const& coupled_term) = 0; + virtual void assembleWithJacobian( + const double t, GlobalVector const& x, GlobalVector const& xdot, + const double dxdot_dx, const double dx_dx, GlobalMatrix& M, + GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, + ProcessLib::StaggeredCouplingTerm const& coupling_term) = 0; }; //! @} diff --git a/NumLib/ODESolver/TimeDiscretizedODESystem.cpp b/NumLib/ODESolver/TimeDiscretizedODESystem.cpp index 2298e5c0f99..0684b2657f4 100644 --- a/NumLib/ODESolver/TimeDiscretizedODESystem.cpp +++ b/NumLib/ODESolver/TimeDiscretizedODESystem.cpp @@ -68,7 +68,7 @@ TimeDiscretizedODESystem< void TimeDiscretizedODESystem<ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Newton>:: assemble(const GlobalVector& x_new_timestep, - ProcessLib::StaggeredCouplingTerm const& coupled_term) + ProcessLib::StaggeredCouplingTerm const& coupling_term) { namespace LinAlg = MathLib::LinAlg; @@ -86,7 +86,7 @@ void TimeDiscretizedODESystem<ODESystemTag::FirstOrderImplicitQuasilinear, _Jac->setZero(); _ode.assembleWithJacobian(t, x_curr, xdot, dxdot_dx, dx_dx, *_M, *_K, *_b, - *_Jac, coupled_term); + *_Jac, coupling_term); LinAlg::finalizeAssembly(*_M); LinAlg::finalizeAssembly(*_K); @@ -177,7 +177,7 @@ TimeDiscretizedODESystem< void TimeDiscretizedODESystem<ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard>:: assemble(const GlobalVector& x_new_timestep, - ProcessLib::StaggeredCouplingTerm const& coupled_term) + ProcessLib::StaggeredCouplingTerm const& coupling_term) { namespace LinAlg = MathLib::LinAlg; @@ -188,7 +188,7 @@ void TimeDiscretizedODESystem<ODESystemTag::FirstOrderImplicitQuasilinear, _K->setZero(); _b->setZero(); - _ode.assemble(t, x_curr, *_M, *_K, *_b, coupled_term); + _ode.assemble(t, x_curr, *_M, *_K, *_b, coupling_term); LinAlg::finalizeAssembly(*_M); LinAlg::finalizeAssembly(*_K); diff --git a/NumLib/ODESolver/TimeDiscretizedODESystem.h b/NumLib/ODESolver/TimeDiscretizedODESystem.h index 3de0cdec78e..4aa4fcb345c 100644 --- a/NumLib/ODESolver/TimeDiscretizedODESystem.h +++ b/NumLib/ODESolver/TimeDiscretizedODESystem.h @@ -87,7 +87,7 @@ public: ~TimeDiscretizedODESystem(); void assemble(const GlobalVector& x_new_timestep, - ProcessLib::StaggeredCouplingTerm const& coupled_term) + ProcessLib::StaggeredCouplingTerm const& coupling_term) override; void getResidual(GlobalVector const& x_new_timestep, @@ -181,7 +181,7 @@ public: ~TimeDiscretizedODESystem(); void assemble(const GlobalVector& x_new_timestep, - ProcessLib::StaggeredCouplingTerm const& coupled_term) + ProcessLib::StaggeredCouplingTerm const& coupling_term) override; void getA(GlobalMatrix& A) const override diff --git a/ProcessLib/AbstractJacobianAssembler.h b/ProcessLib/AbstractJacobianAssembler.h index b4267fadb7a..4505fc8c6f9 100644 --- a/ProcessLib/AbstractJacobianAssembler.h +++ b/ProcessLib/AbstractJacobianAssembler.h @@ -32,7 +32,7 @@ public: //! Assembles the Jacobian, the matrices \f$M\f$ and \f$K\f$, and the vector //! \f$b\f$ with coupling. - virtual void coupling_assembleWithJacobian( + virtual void assembleWithJacobianAndCouping( LocalAssemblerInterface& /*local_assembler*/, double const /*t*/, std::vector<double> const& /*local_x*/, std::vector<double> const& /*local_xdot*/, const double /*dxdot_dx*/, @@ -40,7 +40,7 @@ public: std::vector<double>& /*local_K_data*/, std::vector<double>& /*local_b_data*/, std::vector<double>& /*local_Jac_data*/, - LocalCouplingTerm const& /*coupled_term*/) {} + LocalCouplingTerm const& /*coupling_term*/) {} virtual ~AbstractJacobianAssembler() = default; }; diff --git a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp index 11370da33e0..68a5c72a375 100644 --- a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp +++ b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.cpp @@ -78,21 +78,21 @@ void GroundwaterFlowProcess::assembleConcreteProcess(const double t, GlobalMatrix& K, GlobalVector& b, StaggeredCouplingTerm - const& coupled_term) + const& coupling_term) { DBUG("Assemble GroundwaterFlowProcess."); // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, coupled_term); + *_local_to_global_index_map, t, x, M, K, b, coupling_term); } void GroundwaterFlowProcess::assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) + StaggeredCouplingTerm const& coupling_term) { DBUG("AssembleWithJacobian GroundwaterFlowProcess."); @@ -100,7 +100,7 @@ void GroundwaterFlowProcess::assembleWithJacobianConcreteProcess( GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, coupled_term); + dx_dx, M, K, b, Jac, coupling_term); } diff --git a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h index a03e466ed81..694a84aa0fd 100644 --- a/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h +++ b/ProcessLib/GroundwaterFlow/GroundwaterFlowProcess.h @@ -99,14 +99,14 @@ private: void assembleConcreteProcess(const double t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - StaggeredCouplingTerm const& coupled_term + StaggeredCouplingTerm const& coupling_term ) override; void assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) override; + StaggeredCouplingTerm const& coupling_term) override; GroundwaterFlowProcessData _process_data; diff --git a/ProcessLib/HT/HTProcess.cpp b/ProcessLib/HT/HTProcess.cpp index a9d0b6d19e1..3cebe46de02 100644 --- a/ProcessLib/HT/HTProcess.cpp +++ b/ProcessLib/HT/HTProcess.cpp @@ -73,21 +73,21 @@ void HTProcess::assembleConcreteProcess(const double t, GlobalMatrix& K, GlobalVector& b, StaggeredCouplingTerm const& - coupled_term) + coupling_term) { DBUG("Assemble HTProcess."); // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, coupled_term); + *_local_to_global_index_map, t, x, M, K, b, coupling_term); } void HTProcess::assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) + StaggeredCouplingTerm const& coupling_term) { DBUG("AssembleWithJacobian HTProcess."); @@ -95,7 +95,7 @@ void HTProcess::assembleWithJacobianConcreteProcess( GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, coupled_term); + dx_dx, M, K, b, Jac, coupling_term); } } // namespace HT diff --git a/ProcessLib/HT/HTProcess.h b/ProcessLib/HT/HTProcess.h index aa48954ed22..a5048e295cd 100644 --- a/ProcessLib/HT/HTProcess.h +++ b/ProcessLib/HT/HTProcess.h @@ -66,14 +66,14 @@ private: void assembleConcreteProcess(const double t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - StaggeredCouplingTerm const& coupled_term + StaggeredCouplingTerm const& coupling_term ) override; void assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) override; + StaggeredCouplingTerm const& coupling_term) override; HTProcessData _process_data; diff --git a/ProcessLib/HeatConduction/HeatConductionProcess.cpp b/ProcessLib/HeatConduction/HeatConductionProcess.cpp index d181c782f10..1f3782e6aa5 100644 --- a/ProcessLib/HeatConduction/HeatConductionProcess.cpp +++ b/ProcessLib/HeatConduction/HeatConductionProcess.cpp @@ -74,21 +74,21 @@ void HeatConductionProcess::assembleConcreteProcess(const double t, GlobalMatrix& K, GlobalVector& b, StaggeredCouplingTerm - const& coupled_term) + const& coupling_term) { DBUG("Assemble HeatConductionProcess."); // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, coupled_term); + *_local_to_global_index_map, t, x, M, K, b, coupling_term); } void HeatConductionProcess::assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) + StaggeredCouplingTerm const& coupling_term) { DBUG("AssembleWithJacobian HeatConductionProcess."); @@ -96,7 +96,7 @@ void HeatConductionProcess::assembleWithJacobianConcreteProcess( GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, coupled_term); + dx_dx, M, K, b, Jac, coupling_term); } void HeatConductionProcess::computeSecondaryVariableConcrete(const double t, diff --git a/ProcessLib/HeatConduction/HeatConductionProcess.h b/ProcessLib/HeatConduction/HeatConductionProcess.h index ae9a4a119a0..c6eaf6b103a 100644 --- a/ProcessLib/HeatConduction/HeatConductionProcess.h +++ b/ProcessLib/HeatConduction/HeatConductionProcess.h @@ -50,14 +50,14 @@ private: void assembleConcreteProcess(const double t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - StaggeredCouplingTerm const& coupled_term + StaggeredCouplingTerm const& coupling_term ) override; void assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) override; + StaggeredCouplingTerm const& coupling_term) override; HeatConductionProcessData _process_data; diff --git a/ProcessLib/HydroMechanics/HydroMechanicsProcess.h b/ProcessLib/HydroMechanics/HydroMechanicsProcess.h index 8b6e072941d..69295332b5d 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsProcess.h +++ b/ProcessLib/HydroMechanics/HydroMechanicsProcess.h @@ -108,7 +108,7 @@ private: GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, StaggeredCouplingTerm const& - coupled_term) override + coupling_term) override { DBUG("Assemble HydroMechanicsProcess."); @@ -116,14 +116,14 @@ private: GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, *_local_to_global_index_map, t, x, M, K, b, - coupled_term); + coupling_term); } void assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) override + StaggeredCouplingTerm const& coupling_term) override { DBUG("AssembleJacobian HydroMechanicsProcess."); @@ -131,7 +131,7 @@ private: GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, *_local_to_global_index_map, t, x, xdot, - dxdot_dx, dx_dx, M, K, b, Jac, coupled_term); + dxdot_dx, dx_dx, M, K, b, Jac, coupling_term); } void preTimestepConcreteProcess(GlobalVector const& x, double const t, diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h index ffcac549958..92a2f3043b8 100644 --- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h +++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.h @@ -69,7 +69,7 @@ private: GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, StaggeredCouplingTerm const& - coupled_term) override + coupling_term) override { DBUG("Assemble HydroMechanicsProcess."); @@ -77,14 +77,14 @@ private: GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, *_local_to_global_index_map, t, x, M, K, b, - coupled_term); + coupling_term); } void assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) override + StaggeredCouplingTerm const& coupling_term) override { DBUG("AssembleWithJacobian HydroMechanicsProcess."); @@ -92,7 +92,7 @@ private: GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, *_local_to_global_index_map, t, x, xdot, - dxdot_dx, dx_dx, M, K, b, Jac, coupled_term); + dxdot_dx, dx_dx, M, K, b, Jac, coupling_term); } void preTimestepConcreteProcess(GlobalVector const& x, double const t, diff --git a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.h b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.h index fec8e1840d0..644388bb7a2 100644 --- a/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.h +++ b/ProcessLib/LIE/SmallDeformation/SmallDeformationProcess.h @@ -67,7 +67,7 @@ private: GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, StaggeredCouplingTerm const& - coupled_term) override + coupling_term) override { DBUG("Assemble SmallDeformationProcess."); @@ -75,14 +75,14 @@ private: GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, *_local_to_global_index_map, t, x, M, K, b, - coupled_term); + coupling_term); } void assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) override + StaggeredCouplingTerm const& coupling_term) override { DBUG("AssembleWithJacobian SmallDeformationProcess."); @@ -90,7 +90,7 @@ private: GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, *_local_to_global_index_map, t, x, xdot, - dxdot_dx, dx_dx, M, K, b, Jac, coupled_term); + dxdot_dx, dx_dx, M, K, b, Jac, coupling_term); } void preTimestepConcreteProcess(GlobalVector const& x, double const t, diff --git a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp index e9598f66f35..6897c23707f 100644 --- a/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp +++ b/ProcessLib/LiquidFlow/LiquidFlowProcess.cpp @@ -94,20 +94,20 @@ void LiquidFlowProcess::assembleConcreteProcess(const double t, GlobalMatrix& K, GlobalVector& b, StaggeredCouplingTerm const& - coupled_term) + coupling_term) { DBUG("Assemble LiquidFlowProcess."); // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, coupled_term); + *_local_to_global_index_map, t, x, M, K, b, coupling_term); } void LiquidFlowProcess::assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) + StaggeredCouplingTerm const& coupling_term) { DBUG("AssembleWithJacobian LiquidFlowProcess."); @@ -115,7 +115,7 @@ void LiquidFlowProcess::assembleWithJacobianConcreteProcess( GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, coupled_term); + dx_dx, M, K, b, Jac, coupling_term); } void LiquidFlowProcess::computeSecondaryVariableConcrete(const double t, diff --git a/ProcessLib/LiquidFlow/LiquidFlowProcess.h b/ProcessLib/LiquidFlow/LiquidFlowProcess.h index 737e6b11501..aae25d9108d 100644 --- a/ProcessLib/LiquidFlow/LiquidFlowProcess.h +++ b/ProcessLib/LiquidFlow/LiquidFlowProcess.h @@ -85,14 +85,14 @@ private: void assembleConcreteProcess(const double t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - StaggeredCouplingTerm const& coupled_term + StaggeredCouplingTerm const& coupling_term ) override; void assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) override; + StaggeredCouplingTerm const& coupling_term) override; const int _gravitational_axis_id; const double _gravitational_acceleration; diff --git a/ProcessLib/LocalAssemblerInterface.cpp b/ProcessLib/LocalAssemblerInterface.cpp index aeaca5e2121..8eb8198e77b 100644 --- a/ProcessLib/LocalAssemblerInterface.cpp +++ b/ProcessLib/LocalAssemblerInterface.cpp @@ -19,7 +19,7 @@ void LocalAssemblerInterface::coupling_assemble( std::vector<double>& /*local_M_data*/, std::vector<double>& /*local_K_data*/, std::vector<double>& /*local_b_data*/, - LocalCouplingTerm const& /*coupled_term*/) + LocalCouplingTerm const& /*coupling_term*/) { OGS_FATAL( "The coupling_assemble() function is not implemented in the local " @@ -39,17 +39,17 @@ void LocalAssemblerInterface::assembleWithJacobian( "assembler."); } -void LocalAssemblerInterface::coupling_assembleWithJacobian( +void LocalAssemblerInterface::assembleWithJacobianAndCouping( double const /*t*/, std::vector<double> const& /*local_x*/, std::vector<double> const& /*local_xdot*/, const double /*dxdot_dx*/, const double /*dx_dx*/, std::vector<double>& /*local_M_data*/, std::vector<double>& /*local_K_data*/, std::vector<double>& /*local_b_data*/, std::vector<double>& /*local_Jac_data*/, - LocalCouplingTerm const& /*coupled_term*/) + LocalCouplingTerm const& /*coupling_term*/) { OGS_FATAL( - "The coupling_assembleWithJacobian() function is not implemented in" + "The assembleWithJacobianAndCouping() function is not implemented in" " the local assembler."); } diff --git a/ProcessLib/LocalAssemblerInterface.h b/ProcessLib/LocalAssemblerInterface.h index 3cb9d7b64da..a70871b4b33 100644 --- a/ProcessLib/LocalAssemblerInterface.h +++ b/ProcessLib/LocalAssemblerInterface.h @@ -41,7 +41,7 @@ public: std::vector<double>& local_M_data, std::vector<double>& local_K_data, std::vector<double>& local_b_data, - LocalCouplingTerm const& coupled_term); + LocalCouplingTerm const& coupling_term); virtual void assembleWithJacobian(double const t, std::vector<double> const& local_x, @@ -52,7 +52,7 @@ public: std::vector<double>& local_b_data, std::vector<double>& local_Jac_data); - virtual void coupling_assembleWithJacobian(double const t, + virtual void assembleWithJacobianAndCouping(double const t, std::vector<double> const& local_x, std::vector<double> const& local_xdot, const double dxdot_dx, const double dx_dx, @@ -60,7 +60,7 @@ public: std::vector<double>& local_K_data, std::vector<double>& local_b_data, std::vector<double>& local_Jac_data, - LocalCouplingTerm const& coupled_term); + LocalCouplingTerm const& coupling_term); virtual void computeSecondaryVariable(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const& dof_table, diff --git a/ProcessLib/Process.cpp b/ProcessLib/Process.cpp index f41e79a61af..addff2becea 100644 --- a/ProcessLib/Process.cpp +++ b/ProcessLib/Process.cpp @@ -120,9 +120,9 @@ MathLib::MatrixSpecifications Process::getMatrixSpecifications() const void Process::assemble(const double t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - StaggeredCouplingTerm const& coupled_term) + StaggeredCouplingTerm const& coupling_term) { - assembleConcreteProcess(t, x, M, K, b, coupled_term); + assembleConcreteProcess(t, x, M, K, b, coupling_term); _boundary_conditions.applyNaturalBC(t, x, K, b); } @@ -132,10 +132,10 @@ void Process::assembleWithJacobian(const double t, GlobalVector const& x, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) + StaggeredCouplingTerm const& coupling_term) { assembleWithJacobianConcreteProcess(t, x, xdot, dxdot_dx, dx_dx, M, K, b, - Jac, coupled_term); + Jac, coupling_term); // TODO apply BCs to Jacobian. _boundary_conditions.applyNaturalBC(t, x, K, b); diff --git a/ProcessLib/Process.h b/ProcessLib/Process.h index 3290e47c65a..7bec88b5785 100644 --- a/ProcessLib/Process.h +++ b/ProcessLib/Process.h @@ -73,7 +73,7 @@ public: void assemble(const double t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - StaggeredCouplingTerm const& coupled_term) + StaggeredCouplingTerm const& coupling_term) override final; void assembleWithJacobian(const double t, GlobalVector const& x, @@ -81,7 +81,7 @@ public: const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) + StaggeredCouplingTerm const& coupling_term) override final; std::vector<NumLib::IndexValueVector<GlobalIndexType>> const* @@ -144,14 +144,14 @@ private: GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, StaggeredCouplingTerm const& - coupled_term) = 0; + coupling_term) = 0; virtual void assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) = 0; + StaggeredCouplingTerm const& coupling_term) = 0; virtual void preTimestepConcreteProcess(GlobalVector const& /*x*/, const double /*t*/, diff --git a/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp b/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp index 7e5858a6dc4..72ccaf7d4ec 100644 --- a/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp +++ b/ProcessLib/RichardsFlow/RichardsFlowProcess.cpp @@ -57,21 +57,21 @@ void RichardsFlowProcess::assembleConcreteProcess(const double t, GlobalMatrix& K, GlobalVector& b, StaggeredCouplingTerm const& - coupled_term) + coupling_term) { DBUG("Assemble RichardsFlowProcess."); // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, coupled_term); + *_local_to_global_index_map, t, x, M, K, b, coupling_term); } void RichardsFlowProcess::assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) + StaggeredCouplingTerm const& coupling_term) { DBUG("AssembleWithJacobian RichardsFlowProcess."); @@ -79,7 +79,7 @@ void RichardsFlowProcess::assembleWithJacobianConcreteProcess( GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, coupled_term); + dx_dx, M, K, b, Jac, coupling_term); } } // namespace RichardsFlow diff --git a/ProcessLib/RichardsFlow/RichardsFlowProcess.h b/ProcessLib/RichardsFlow/RichardsFlowProcess.h index e24395010aa..99a88b7806c 100644 --- a/ProcessLib/RichardsFlow/RichardsFlowProcess.h +++ b/ProcessLib/RichardsFlow/RichardsFlowProcess.h @@ -50,14 +50,14 @@ private: void assembleConcreteProcess(const double t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - StaggeredCouplingTerm const& coupled_term + StaggeredCouplingTerm const& coupling_term ) override; void assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) override; + StaggeredCouplingTerm const& coupling_term) override; RichardsFlowProcessData _process_data; diff --git a/ProcessLib/SmallDeformation/SmallDeformationProcess.h b/ProcessLib/SmallDeformation/SmallDeformationProcess.h index afb5003f633..cdf235b7c44 100644 --- a/ProcessLib/SmallDeformation/SmallDeformationProcess.h +++ b/ProcessLib/SmallDeformation/SmallDeformationProcess.h @@ -145,7 +145,7 @@ private: GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, StaggeredCouplingTerm const& - coupled_term) override + coupling_term) override { DBUG("Assemble SmallDeformationProcess."); @@ -153,14 +153,14 @@ private: GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, *_local_to_global_index_map, t, x, M, K, b, - coupled_term); + coupling_term); } void assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) override + StaggeredCouplingTerm const& coupling_term) override { DBUG("AssembleWithJacobian SmallDeformationProcess."); @@ -168,7 +168,7 @@ private: GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, *_local_to_global_index_map, t, x, xdot, - dxdot_dx, dx_dx, M, K, b, Jac, coupled_term); + dxdot_dx, dx_dx, M, K, b, Jac, coupling_term); } void preTimestepConcreteProcess(GlobalVector const& x, double const t, diff --git a/ProcessLib/StaggeredCouplingTerm.h b/ProcessLib/StaggeredCouplingTerm.h index f8a93d6e08c..8089d0a07e0 100644 --- a/ProcessLib/StaggeredCouplingTerm.h +++ b/ProcessLib/StaggeredCouplingTerm.h @@ -25,8 +25,9 @@ class Process; * A struct to keep the references of the coupled processes and the references * of the current solutions of the equations of the coupled processes. * - * During un-coupling iteration, an instance of this struct is created and - * passed through interfaces to global and local assemblers for each process. + * During staggered coupling iteration, an instance of this struct is created + * and passed through interfaces to global and local assemblers for each + * process. */ struct StaggeredCouplingTerm { diff --git a/ProcessLib/TES/TESProcess.cpp b/ProcessLib/TES/TESProcess.cpp index 1b9c77a9b9b..9ccb2d4f15f 100644 --- a/ProcessLib/TES/TESProcess.cpp +++ b/ProcessLib/TES/TESProcess.cpp @@ -228,26 +228,26 @@ void TESProcess::assembleConcreteProcess(const double t, GlobalMatrix& K, GlobalVector& b, StaggeredCouplingTerm - const& coupled_term) + const& coupling_term) { DBUG("Assemble TESProcess."); // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, coupled_term); + *_local_to_global_index_map, t, x, M, K, b, coupling_term); } void TESProcess::assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) + StaggeredCouplingTerm const& coupling_term) { GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, coupled_term); + dx_dx, M, K, b, Jac, coupling_term); } void TESProcess::preTimestepConcreteProcess(GlobalVector const& x, diff --git a/ProcessLib/TES/TESProcess.h b/ProcessLib/TES/TESProcess.h index ab340d9b776..f75afb5b181 100644 --- a/ProcessLib/TES/TESProcess.h +++ b/ProcessLib/TES/TESProcess.h @@ -57,7 +57,7 @@ private: void assembleConcreteProcess(const double t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - StaggeredCouplingTerm const& coupled_term + StaggeredCouplingTerm const& coupling_term ) override; void initializeSecondaryVariables(); @@ -66,7 +66,7 @@ private: const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) override; + StaggeredCouplingTerm const& coupling_term) override; GlobalVector const& computeVapourPartialPressure( GlobalVector const& x, diff --git a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp index 79b9619105f..2cbb77f5b51 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp +++ b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.cpp @@ -74,20 +74,20 @@ void TwoPhaseFlowWithPPProcess::assembleConcreteProcess(const double t, GlobalMatrix& K, GlobalVector& b, StaggeredCouplingTerm - const& coupled_term) + const& coupling_term) { DBUG("Assemble TwoPhaseFlowWithPPProcess."); // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, coupled_term); + *_local_to_global_index_map, t, x, M, K, b, coupling_term); } void TwoPhaseFlowWithPPProcess::assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) + StaggeredCouplingTerm const& coupling_term) { DBUG("AssembleWithJacobian TwoPhaseFlowWithPPProcess."); @@ -95,7 +95,7 @@ void TwoPhaseFlowWithPPProcess::assembleWithJacobianConcreteProcess( GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, coupled_term); + dx_dx, M, K, b, Jac, coupling_term); } } // end of namespace diff --git a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.h b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.h index dd0f8789033..42854353fe4 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.h +++ b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPProcess.h @@ -61,14 +61,14 @@ private: void assembleConcreteProcess(const double t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - StaggeredCouplingTerm const& coupled_term + StaggeredCouplingTerm const& coupling_term ) override; void assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) override; + StaggeredCouplingTerm const& coupling_term) override; TwoPhaseFlowWithPPProcessData _process_data; diff --git a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp index 9af42f4c48f..e57594d1c20 100644 --- a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp +++ b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.cpp @@ -74,20 +74,20 @@ void TwoPhaseFlowWithPrhoProcess::assembleConcreteProcess(const double t, GlobalMatrix& K, GlobalVector& b, StaggeredCouplingTerm - const& coupled_term) + const& coupling_term) { DBUG("Assemble TwoPhaseFlowWithPrhoProcess."); // Call global assembler for each local assembly item. GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assemble, _local_assemblers, - *_local_to_global_index_map, t, x, M, K, b, coupled_term); + *_local_to_global_index_map, t, x, M, K, b, coupling_term); } void TwoPhaseFlowWithPrhoProcess::assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) + StaggeredCouplingTerm const& coupling_term) { DBUG("AssembleWithJacobian TwoPhaseFlowWithPrhoProcess."); @@ -95,7 +95,7 @@ void TwoPhaseFlowWithPrhoProcess::assembleWithJacobianConcreteProcess( GlobalExecutor::executeMemberDereferenced( _global_assembler, &VectorMatrixAssembler::assembleWithJacobian, _local_assemblers, *_local_to_global_index_map, t, x, xdot, dxdot_dx, - dx_dx, M, K, b, Jac, coupled_term); + dx_dx, M, K, b, Jac, coupling_term); } void TwoPhaseFlowWithPrhoProcess::preTimestepConcreteProcess( GlobalVector const& x, double const t, double const dt) diff --git a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.h b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.h index decfa1103e6..b148a749851 100644 --- a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.h +++ b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoProcess.h @@ -57,13 +57,13 @@ private: void assembleConcreteProcess(const double t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - StaggeredCouplingTerm const& coupled_term) override; + StaggeredCouplingTerm const& coupling_term) override; void assembleWithJacobianConcreteProcess( const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - StaggeredCouplingTerm const& coupled_term) override; + StaggeredCouplingTerm const& coupling_term) override; void preTimestepConcreteProcess(GlobalVector const& x, const double t, const double delta_t) override; diff --git a/ProcessLib/UncoupledProcessesTimeLoop.cpp b/ProcessLib/UncoupledProcessesTimeLoop.cpp index e2dcbe75eab..2612356056c 100644 --- a/ProcessLib/UncoupledProcessesTimeLoop.cpp +++ b/ProcessLib/UncoupledProcessesTimeLoop.cpp @@ -438,7 +438,7 @@ std::vector<GlobalVector*> setInitialConditions( bool solveOneTimeStepOneProcess(GlobalVector& x, std::size_t const timestep, double const t, double const delta_t, SingleProcessData& process_data, - StaggeredCouplingTerm const& coupled_term, + StaggeredCouplingTerm const& coupling_term, Output const& output_control) { auto& process = process_data.process; @@ -466,7 +466,7 @@ bool solveOneTimeStepOneProcess(GlobalVector& x, std::size_t const timestep, }; bool nonlinear_solver_succeeded = - nonlinear_solver.solve(x, coupled_term, post_iteration_callback); + nonlinear_solver.solve(x, coupling_term, post_iteration_callback); auto& mat_strg = *process_data.mat_strg; time_disc.pushState(t, x, mat_strg); @@ -479,17 +479,18 @@ UncoupledProcessesTimeLoop::UncoupledProcessesTimeLoop( std::unique_ptr<Output>&& output, std::vector<std::unique_ptr<SingleProcessData>>&& per_process_data, const unsigned global_coupling_max_iterations, - std::unique_ptr<NumLib::ConvergenceCriterion>&& glb_coupling_conv_crit) + std::unique_ptr<NumLib::ConvergenceCriterion>&& global_coupling_conv_crit) : _timestepper{std::move(timestepper)}, _output(std::move(output)), _per_process_data(std::move(per_process_data)), _global_coupling_max_iterations(global_coupling_max_iterations), - _global_coupling_conv_crit(std::move(glb_coupling_conv_crit)) + _global_coupling_conv_crit(std::move(global_coupling_conv_crit)) { } bool UncoupledProcessesTimeLoop::setCoupledSolutions() { + // Do nothing if process are not coupled if (!_global_coupling_conv_crit && _global_coupling_max_iterations == 1) return false; @@ -497,9 +498,6 @@ bool UncoupledProcessesTimeLoop::setCoupledSolutions() _solutions_of_coupled_processes.reserve(_per_process_data.size()); for (auto& spd : _per_process_data) { - BaseLib::RunTime time_timestep_process; - time_timestep_process.start(); - auto const& coupled_processes = spd->coupled_processes; std::unordered_map<std::type_index, GlobalVector const&> coupled_xs; for (auto const& coupled_process_map : coupled_processes) @@ -538,7 +536,7 @@ bool UncoupledProcessesTimeLoop::setCoupledSolutions() _solutions_of_last_cpl_iteration.emplace_back(x_coupling0); ++pcs_idx; - } + } // end of for (auto& spd : _per_process_data) return true; } @@ -678,7 +676,7 @@ bool UncoupledProcessesTimeLoop::solveUncoupledEquationSystems( } ++pcs_idx; - } + } // end of for (auto& spd : _per_process_data) return true; } @@ -688,7 +686,9 @@ bool UncoupledProcessesTimeLoop::solveCoupledEquationSystemsByStaggeredScheme( { // Coupling iteration bool coupling_iteration_converged = true; - for (unsigned i = 0; i < _global_coupling_max_iterations; i++) + for (unsigned global_coupling_iteration = 0; + global_coupling_iteration < _global_coupling_max_iterations; + global_coupling_iteration++) { // TODO use process name bool nonlinear_solver_succeeded = true; @@ -700,7 +700,7 @@ bool UncoupledProcessesTimeLoop::solveCoupledEquationSystemsByStaggeredScheme( time_timestep_process.start(); auto& x = *_process_solutions[pcs_idx]; - if (i == 0) + if (global_coupling_iteration == 0) { // Copy the solution of the previous time step to a vector that // belongs to process. For some problems, both of the current @@ -716,17 +716,18 @@ bool UncoupledProcessesTimeLoop::solveCoupledEquationSystemsByStaggeredScheme( // Set the flag of the first iteration be false. _global_coupling_conv_crit->setNoFirstIteration(); } - StaggeredCouplingTerm coupled_term( + StaggeredCouplingTerm coupling_term( spd->coupled_processes, _solutions_of_coupled_processes[pcs_idx], dt); const auto nonlinear_solver_succeeded = solveOneTimeStepOneProcess( - x, timestep_id, t, dt, *spd, coupled_term, *_output); + x, timestep_id, t, dt, *spd, coupling_term, *_output); INFO( "[time] Solving process #%u took %g s in time step #%u " " coupling iteration #%u", - pcs_idx, time_timestep_process.elapsed(), timestep_id, i); + pcs_idx, time_timestep_process.elapsed(), timestep_id, + global_coupling_iteration); if (!nonlinear_solver_succeeded) { @@ -755,7 +756,7 @@ bool UncoupledProcessesTimeLoop::solveCoupledEquationSystemsByStaggeredScheme( MathLib::LinAlg::copy(x, x_old); ++pcs_idx; - } + } // end of for (auto& spd : _per_process_data) if (coupling_iteration_converged) break; diff --git a/ProcessLib/UncoupledProcessesTimeLoop.h b/ProcessLib/UncoupledProcessesTimeLoop.h index 8036448a9b2..2c6b1bbb87a 100644 --- a/ProcessLib/UncoupledProcessesTimeLoop.h +++ b/ProcessLib/UncoupledProcessesTimeLoop.h @@ -40,7 +40,8 @@ public: std::unique_ptr<Output>&& output, std::vector<std::unique_ptr<SingleProcessData>>&& per_process_data, const unsigned global_coupling_max_iterations, - std::unique_ptr<NumLib::ConvergenceCriterion>&& glb_coupling_conv_crit); + std::unique_ptr<NumLib::ConvergenceCriterion>&& + global_coupling_conv_crit); bool loop(); diff --git a/ProcessLib/VectorMatrixAssembler.cpp b/ProcessLib/VectorMatrixAssembler.cpp index 32851bf2a87..5e454b28ce1 100644 --- a/ProcessLib/VectorMatrixAssembler.cpp +++ b/ProcessLib/VectorMatrixAssembler.cpp @@ -21,13 +21,13 @@ namespace ProcessLib { static std::unordered_map<std::type_index, const std::vector<double>> getPreviousLocalSolutionsOfCoupledProcesses( - const StaggeredCouplingTerm& coupled_term, + const StaggeredCouplingTerm& coupling_term, const std::vector<GlobalIndexType>& indices) { std::unordered_map<std::type_index, const std::vector<double>> local_coupled_xs0; - for (auto const& coupled_process_map : coupled_term.coupled_processes) + for (auto const& coupled_process_map : coupling_term.coupled_processes) { auto const& coupled_pcs = coupled_process_map.second; auto const prevous_time_x = coupled_pcs.getPreviousTimeStepSolution(); @@ -79,7 +79,7 @@ void VectorMatrixAssembler::assemble( const std::size_t mesh_item_id, LocalAssemblerInterface& local_assembler, const NumLib::LocalToGlobalIndexMap& dof_table, const double t, const GlobalVector& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - const StaggeredCouplingTerm& coupled_term) + const StaggeredCouplingTerm& coupling_term) { auto const indices = NumLib::getIndices(mesh_item_id, dof_table); auto const local_x = x.get(indices); @@ -88,7 +88,7 @@ void VectorMatrixAssembler::assemble( _local_K_data.clear(); _local_b_data.clear(); - if (coupled_term.empty) + if (coupling_term.empty) { local_assembler.assemble(t, local_x, _local_M_data, _local_K_data, _local_b_data); @@ -96,11 +96,11 @@ void VectorMatrixAssembler::assemble( else { auto local_coupled_xs0 = - getPreviousLocalSolutionsOfCoupledProcesses(coupled_term, indices); + getPreviousLocalSolutionsOfCoupledProcesses(coupling_term, indices); auto local_coupled_xs = getCurrentLocalSolutionsOfCoupledProcesses( - coupled_term.coupled_xs, indices); + coupling_term.coupled_xs, indices); ProcessLib::LocalCouplingTerm local_coupling_term( - coupled_term.dt, coupled_term.coupled_processes, + coupling_term.dt, coupling_term.coupled_processes, std::move(local_coupled_xs0), std::move(local_coupled_xs)); local_assembler.coupling_assemble(t, local_x, _local_M_data, @@ -134,7 +134,7 @@ void VectorMatrixAssembler::assembleWithJacobian( NumLib::LocalToGlobalIndexMap const& dof_table, const double t, GlobalVector const& x, GlobalVector const& xdot, const double dxdot_dx, const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - GlobalMatrix& Jac, const StaggeredCouplingTerm& coupled_term) + GlobalMatrix& Jac, const StaggeredCouplingTerm& coupling_term) { auto const indices = NumLib::getIndices(mesh_item_id, dof_table); auto const local_x = x.get(indices); @@ -145,7 +145,7 @@ void VectorMatrixAssembler::assembleWithJacobian( _local_b_data.clear(); _local_Jac_data.clear(); - if (coupled_term.empty) + if (coupling_term.empty) { _jacobian_assembler->assembleWithJacobian( local_assembler, t, local_x, local_xdot, dxdot_dx, dx_dx, @@ -154,14 +154,14 @@ void VectorMatrixAssembler::assembleWithJacobian( else { auto local_coupled_xs0 = - getPreviousLocalSolutionsOfCoupledProcesses(coupled_term, indices); + getPreviousLocalSolutionsOfCoupledProcesses(coupling_term, indices); auto local_coupled_xs = getCurrentLocalSolutionsOfCoupledProcesses( - coupled_term.coupled_xs, indices); + coupling_term.coupled_xs, indices); ProcessLib::LocalCouplingTerm local_coupling_term( - coupled_term.dt, coupled_term.coupled_processes, + coupling_term.dt, coupling_term.coupled_processes, std::move(local_coupled_xs0), std::move(local_coupled_xs)); - _jacobian_assembler->coupling_assembleWithJacobian( + _jacobian_assembler->assembleWithJacobianAndCouping( local_assembler, t, local_x, local_xdot, dxdot_dx, dx_dx, _local_M_data, _local_K_data, _local_b_data, _local_Jac_data, local_coupling_term); diff --git a/ProcessLib/VectorMatrixAssembler.h b/ProcessLib/VectorMatrixAssembler.h index 26046c82ab5..737805a75ef 100644 --- a/ProcessLib/VectorMatrixAssembler.h +++ b/ProcessLib/VectorMatrixAssembler.h @@ -40,7 +40,7 @@ public: NumLib::LocalToGlobalIndexMap const& dof_table, double const t, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - const StaggeredCouplingTerm& coupled_term); + const StaggeredCouplingTerm& coupling_term); //! Assembles \c M, \c K, \c b, and the Jacobian \c Jac of the residual. //! \note The Jacobian must be assembled. @@ -52,7 +52,7 @@ public: const double dx_dx, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, - const StaggeredCouplingTerm& coupled_term); + const StaggeredCouplingTerm& coupling_term); private: // temporary data only stored here in order to avoid frequent memory diff --git a/Tests/NumLib/ODEs.h b/Tests/NumLib/ODEs.h index da01e8c8c06..0350116e052 100644 --- a/Tests/NumLib/ODEs.h +++ b/Tests/NumLib/ODEs.h @@ -29,7 +29,7 @@ class ODE1 final : public NumLib::ODESystem< public: void assemble(const double /*t*/, GlobalVector const& /*x*/, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - ProcessLib::StaggeredCouplingTerm const& /*coupled_term*/ + ProcessLib::StaggeredCouplingTerm const& /*coupling_term*/ ) override { MathLib::setMatrix(M, { 1.0, 0.0, 0.0, 1.0 }); @@ -44,11 +44,11 @@ public: GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, ProcessLib::StaggeredCouplingTerm - const& coupled_term) override + const& coupling_term) override { namespace LinAlg = MathLib::LinAlg; - assemble(t, x_curr, M, K, b, coupled_term); + assemble(t, x_curr, M, K, b, coupling_term); // compute Jac = M*dxdot_dx + dx_dx*K LinAlg::finalizeAssembly(M); @@ -109,7 +109,7 @@ class ODE2 final : public NumLib::ODESystem< public: void assemble(const double /*t*/, GlobalVector const& x, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - ProcessLib::StaggeredCouplingTerm const& /*coupled_term*/ + ProcessLib::StaggeredCouplingTerm const& /*coupling_term*/ ) override { MathLib::setMatrix(M, {1.0}); @@ -123,9 +123,9 @@ public: GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, ProcessLib::StaggeredCouplingTerm const& - coupled_term) override + coupling_term) override { - assemble(t, x, M, K, b, coupled_term); + assemble(t, x, M, K, b, coupling_term); namespace LinAlg = MathLib::LinAlg; @@ -197,7 +197,7 @@ class ODE3 final : public NumLib::ODESystem< public: void assemble(const double /*t*/, GlobalVector const& x_curr, GlobalMatrix& M, GlobalMatrix& K, GlobalVector& b, - ProcessLib::StaggeredCouplingTerm const& /*coupled_term*/ + ProcessLib::StaggeredCouplingTerm const& /*coupling_term*/ ) override { auto const u = x_curr[0]; @@ -215,9 +215,9 @@ public: GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac, ProcessLib::StaggeredCouplingTerm const& - coupled_term) override + coupling_term) override { - assemble(t, x_curr, M, K, b, coupled_term); + assemble(t, x_curr, M, K, b, coupling_term); auto const u = x_curr[0]; auto const v = x_curr[1]; -- GitLab