diff --git a/NumLib/ODESolver/NonlinearSolver.cpp b/NumLib/ODESolver/NonlinearSolver.cpp index 1becfac427713e81148897efa89b0144a27af126..96c899ee32087815a2d4c4801c96c48805a9296d 100644 --- a/NumLib/ODESolver/NonlinearSolver.cpp +++ b/NumLib/ODESolver/NonlinearSolver.cpp @@ -21,14 +21,13 @@ namespace NumLib { void NonlinearSolver<NonlinearSolverTag::Picard>::assemble( - GlobalVector const& x, - ProcessLib::StaggeredCouplingTerm const& coupling_term) const + GlobalVector const& x) const { - _equation_system->assemble(x, coupling_term); + _equation_system->assemble(x); } bool NonlinearSolver<NonlinearSolverTag::Picard>::solve( - GlobalVector& x, ProcessLib::StaggeredCouplingTerm const& coupling_term, + GlobalVector& x, std::function<void(unsigned, GlobalVector const&)> const& postIterationCallback) { namespace LinAlg = MathLib::LinAlg; @@ -59,7 +58,7 @@ bool NonlinearSolver<NonlinearSolverTag::Picard>::solve( BaseLib::RunTime time_assembly; time_assembly.start(); - sys.assemble(x, coupling_term); + sys.assemble(x); sys.getA(A); sys.getRhs(rhs); INFO("[time] Assembly took %g s.", time_assembly.elapsed()); @@ -159,17 +158,16 @@ bool NonlinearSolver<NonlinearSolverTag::Picard>::solve( } void NonlinearSolver<NonlinearSolverTag::Newton>::assemble( - GlobalVector const& x, - ProcessLib::StaggeredCouplingTerm const& coupling_term) const + GlobalVector const& x) const { - _equation_system->assemble(x, coupling_term); + _equation_system->assemble(x); // 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& coupling_term, + GlobalVector& x, std::function<void(unsigned, GlobalVector const&)> const& postIterationCallback) { namespace LinAlg = MathLib::LinAlg; @@ -202,7 +200,7 @@ bool NonlinearSolver<NonlinearSolverTag::Newton>::solve( BaseLib::RunTime time_assembly; time_assembly.start(); - sys.assemble(x, coupling_term); + sys.assemble(x); 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 76fe29f29df3dc9d4f074f9a7d1c98390edff3bb..c725de023aece2293cd7fc3f3cceff96a5057ea4 100644 --- a/NumLib/ODESolver/NonlinearSolver.h +++ b/NumLib/ODESolver/NonlinearSolver.h @@ -22,11 +22,6 @@ namespace BaseLib class ConfigTree; } -namespace ProcessLib -{ - struct StaggeredCouplingTerm; -} - // TODO Document in the ODE solver lib, which matrices and vectors that are // passed around as method arguments are guaranteed to be of the right size // (and zeroed out) and which are not. @@ -47,27 +42,18 @@ public: * * \param x the state at which the equation system will be * assembled. - * \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& coupling_term - ) const = 0; + virtual void assemble(GlobalVector const& x) const = 0; /*! Assemble and solve the equation system. * * \param x in: the initial guess, out: the solution. - * \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. * * \retval true if the equation system could be solved * \retval false otherwise */ virtual bool solve(GlobalVector& x, - ProcessLib::StaggeredCouplingTerm const& coupling_term, std::function<void(unsigned, GlobalVector const&)> const& postIterationCallback) = 0; @@ -117,12 +103,9 @@ public: _convergence_criterion = &conv_crit; } - void assemble(GlobalVector const& x, - ProcessLib::StaggeredCouplingTerm const& coupling_term - ) const override; + void assemble(GlobalVector const& x) const override; bool solve(GlobalVector& x, - ProcessLib::StaggeredCouplingTerm const& coupling_term, std::function<void(unsigned, GlobalVector const&)> const& postIterationCallback) override; @@ -176,12 +159,9 @@ public: _convergence_criterion = &conv_crit; } - void assemble(GlobalVector const& x, - ProcessLib::StaggeredCouplingTerm const& coupling_term - ) const override; + void assemble(GlobalVector const& x) const override; bool solve(GlobalVector& x, - 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 e7cffb1755c1357eb6cc3ab7f1dd26fe9eafcab4..edfa53160ee62e5dcfc6ea7630cf06fe40813610 100644 --- a/NumLib/ODESolver/NonlinearSystem.h +++ b/NumLib/ODESolver/NonlinearSystem.h @@ -12,11 +12,6 @@ #include "EquationSystem.h" #include "Types.h" -namespace ProcessLib -{ - struct StaggeredCouplingTerm; -} - namespace NumLib { //! \addtogroup ODESolver @@ -41,9 +36,7 @@ public: //! Assembles the linearized equation system at the point \c x. //! 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& coupling_term - ) = 0; + virtual void assemble(GlobalVector const& x) = 0; /*! Writes the residual at point \c x to \c res. * @@ -82,9 +75,7 @@ public: //! Assembles the linearized equation system at the point \c x. //! 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& coupling_term - ) = 0; + virtual void assemble(GlobalVector const& x) = 0; //! Writes the linearized equation system matrix to \c A. //! \pre assemble() must have been called before. diff --git a/NumLib/ODESolver/ODESystem.h b/NumLib/ODESolver/ODESystem.h index 598252c594040e201769a159dfbdee5a20425306..b362403f9b547db0410269267dec5cbb2d550565 100644 --- a/NumLib/ODESolver/ODESystem.h +++ b/NumLib/ODESolver/ODESystem.h @@ -15,11 +15,6 @@ #include "EquationSystem.h" #include "Types.h" -namespace ProcessLib -{ -struct StaggeredCouplingTerm; -} - namespace NumLib { //! \addtogroup ODESolver @@ -52,8 +47,7 @@ public: //! 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& coupling_term) = 0; + GlobalVector& b) = 0; using Index = MathLib::MatrixVectorTraits<GlobalMatrix>::Index; @@ -126,8 +120,7 @@ public: 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; + GlobalMatrix& K, GlobalVector& b, GlobalMatrix& Jac) = 0; }; //! @} diff --git a/NumLib/ODESolver/TimeDiscretizedODESystem.cpp b/NumLib/ODESolver/TimeDiscretizedODESystem.cpp index 0684b2657f41d99bead8a27228e17e4b649256aa..a1b6f29685cc0820daf6011fb53fd7615a9f08ae 100644 --- a/NumLib/ODESolver/TimeDiscretizedODESystem.cpp +++ b/NumLib/ODESolver/TimeDiscretizedODESystem.cpp @@ -67,8 +67,7 @@ TimeDiscretizedODESystem< void TimeDiscretizedODESystem<ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Newton>:: - assemble(const GlobalVector& x_new_timestep, - ProcessLib::StaggeredCouplingTerm const& coupling_term) + assemble(const GlobalVector& x_new_timestep) { namespace LinAlg = MathLib::LinAlg; @@ -86,7 +85,7 @@ void TimeDiscretizedODESystem<ODESystemTag::FirstOrderImplicitQuasilinear, _Jac->setZero(); _ode.assembleWithJacobian(t, x_curr, xdot, dxdot_dx, dx_dx, *_M, *_K, *_b, - *_Jac, coupling_term); + *_Jac); LinAlg::finalizeAssembly(*_M); LinAlg::finalizeAssembly(*_K); @@ -176,8 +175,7 @@ TimeDiscretizedODESystem< void TimeDiscretizedODESystem<ODESystemTag::FirstOrderImplicitQuasilinear, NonlinearSolverTag::Picard>:: - assemble(const GlobalVector& x_new_timestep, - ProcessLib::StaggeredCouplingTerm const& coupling_term) + assemble(const GlobalVector& x_new_timestep) { namespace LinAlg = MathLib::LinAlg; @@ -188,7 +186,7 @@ void TimeDiscretizedODESystem<ODESystemTag::FirstOrderImplicitQuasilinear, _K->setZero(); _b->setZero(); - _ode.assemble(t, x_curr, *_M, *_K, *_b, coupling_term); + _ode.assemble(t, x_curr, *_M, *_K, *_b); LinAlg::finalizeAssembly(*_M); LinAlg::finalizeAssembly(*_K); diff --git a/NumLib/ODESolver/TimeDiscretizedODESystem.h b/NumLib/ODESolver/TimeDiscretizedODESystem.h index 122803064fa1e68f4c411ae1a9b32dc296a19e25..cb408e6ee71200863fc7e720ee74c74941453000 100644 --- a/NumLib/ODESolver/TimeDiscretizedODESystem.h +++ b/NumLib/ODESolver/TimeDiscretizedODESystem.h @@ -16,12 +16,6 @@ #include "ODESystem.h" #include "TimeDiscretization.h" - -namespace ProcessLib -{ - struct StaggeredCouplingTerm; -} - namespace NumLib { //! \addtogroup ODESolver @@ -86,8 +80,7 @@ public: ~TimeDiscretizedODESystem() override; - void assemble(const GlobalVector& x_new_timestep, - ProcessLib::StaggeredCouplingTerm const& coupling_term) + void assemble(const GlobalVector& x_new_timestep) override; void getResidual(GlobalVector const& x_new_timestep, @@ -180,8 +173,7 @@ public: ~TimeDiscretizedODESystem() override; - void assemble(const GlobalVector& x_new_timestep, - ProcessLib::StaggeredCouplingTerm const& coupling_term) + void assemble(const GlobalVector& x_new_timestep) override; void getA(GlobalMatrix& A) const override