diff --git a/NumLib/ODESolver/NonlinearSolver.cpp b/NumLib/ODESolver/NonlinearSolver.cpp index 360d2cde086f232630d3f7a905ef9d932633f72e..6e0971a54aadc01d07bc632ee00fee36b4d49506 100644 --- a/NumLib/ODESolver/NonlinearSolver.cpp +++ b/NumLib/ODESolver/NonlinearSolver.cpp @@ -448,4 +448,21 @@ createNonlinearSolver(GlobalLinearSolver& linear_solver, #endif OGS_FATAL("Unsupported nonlinear solver type '{:s}'.", type.c_str()); } + +NonlinearSolver<NonlinearSolverTag::Picard>::~NonlinearSolver() +{ + if (_r_neq != nullptr) + { + NumLib::GlobalVectorProvider::provider.releaseVector(*_r_neq); + } +} + +NonlinearSolver<NonlinearSolverTag::Newton>::~NonlinearSolver() +{ + if (_r_neq != nullptr) + { + NumLib::GlobalVectorProvider::provider.releaseVector(*_r_neq); + } +} + } // namespace NumLib diff --git a/NumLib/ODESolver/NonlinearSolver.h b/NumLib/ODESolver/NonlinearSolver.h index 26f2c94d228fa91dda5ad1f7b0add34a5a8e7079..deac528509cb1de372969706f9aabf5fed4c3901 100644 --- a/NumLib/ODESolver/NonlinearSolver.h +++ b/NumLib/ODESolver/NonlinearSolver.h @@ -94,6 +94,8 @@ public: { } + ~NonlinearSolver(); + //! Set the nonlinear equation system that will be solved. //! TODO doc void setEquationSystem(System& eq, ConvergenceCriterion& conv_crit) @@ -172,6 +174,8 @@ public: { } + ~NonlinearSolver(); + //! Set the nonlinear equation system that will be solved. //! TODO doc void setEquationSystem(System& eq, ConvergenceCriterion& conv_crit)