diff --git a/NumLib/ODESolver/TimeDiscretization.cpp b/NumLib/ODESolver/TimeDiscretization.cpp index 8eda8c3c8be5d73ac3a7c6296a1859fd4daa4d73..9a7d414f873fe2546bdb75ca789b70ddf79a4ee9 100644 --- a/NumLib/ODESolver/TimeDiscretization.cpp +++ b/NumLib/ODESolver/TimeDiscretization.cpp @@ -15,8 +15,9 @@ namespace NumLib { + double computeRelativeNorm(GlobalVector const& x, - GlobalVector const& x_prev, + GlobalVector const& y, MathLib::VecNormType norm_type) { if (norm_type == MathLib::VecNormType::INVALID) @@ -28,8 +29,8 @@ double computeRelativeNorm(GlobalVector const& x, GlobalVector dx; MathLib::LinAlg::copy(x, dx); // copy x to dx. - // dx = x - x_prev --> x - dx --> dx - MathLib::LinAlg::axpy(dx, -1.0, x_prev); + // dx = x - y --> x - dx --> dx + MathLib::LinAlg::axpy(dx, -1.0, y); const double norm_dx = MathLib::LinAlg::norm(dx, norm_type); const double norm_x = MathLib::LinAlg::norm(x, norm_type); diff --git a/NumLib/ODESolver/TimeDiscretization.h b/NumLib/ODESolver/TimeDiscretization.h index d86e368a4dc22f03c4f8f45871961aecc969509b..4e1363e9c5c1631ae2bfdb57c9b2b93e0c0648bc 100644 --- a/NumLib/ODESolver/TimeDiscretization.h +++ b/NumLib/ODESolver/TimeDiscretization.h @@ -19,16 +19,14 @@ namespace NumLib { /** - * Compute and return the relative norm of solutions between two - * successive time steps by \f$ \|u^{n+1}-u^{n}\|/\|u^{n+1}\| \f$. + * Compute the relative norm between two vectors by \f$ \|x-y\|/\|x\| \f$. * - * \param x The current solution - * \param x_prev The previous solution + * \param x Vector x + * \param y Vector y * \param norm_type The norm type of global vector - * \return \f$ \|u^{n+1}-u^{n}\|/\|u^{n+1}\| \f$. + * \return \f$ \|x-y\|/\|x\| \f$. */ -double computeRelativeNorm(GlobalVector const& x, - GlobalVector const& x_prev, +double computeRelativeNorm(GlobalVector const& x, GlobalVector const& y, MathLib::VecNormType norm_type); //! \addtogroup ODESolver