diff --git a/dart/src/wAdjoint.cpp b/dart/src/wAdjoint.cpp index 791ed092136bf5675f49900cd4ca77686b260b74..2a249190091383d95a0725151bfbd6be12bb9a6b 100644 --- a/dart/src/wAdjoint.cpp +++ b/dart/src/wAdjoint.cpp @@ -58,17 +58,23 @@ Adjoint::Adjoint(std::shared_ptr<Newton> _sol, std::shared_ptr<tbox::MshDeform> nthreads = sol->nthreads; verbose = sol->verbose; - // Linear solvers + // Linear solvers (if GMRES, use the same, but with a thighter tolerance) if (sol->linsol->type() == LSOLTYPE::GMRES_ILUT) { - // Use the same GMRES, but with a thighter tolerance std::shared_ptr<Gmres> gmres = std::make_shared<Gmres>(*dynamic_cast<Gmres *>(sol->linsol.get())); gmres->setTolerance(1e-8); alinsol = gmres; } else alinsol = sol->linsol; - mlinsol = morph->linsol; + if (morph->linsol->type() == LSOLTYPE::GMRES_ILUT) + { + std::shared_ptr<Gmres> gmres = std::make_shared<Gmres>(*dynamic_cast<Gmres *>(morph->linsol.get())); + gmres->setTolerance(1e-12); + mlinsol = gmres; + } + else + mlinsol = morph->linsol; // Update element gradients sol->pbl->initGradElems(); @@ -423,7 +429,7 @@ void Adjoint::buildGradientLoadsFlow(Eigen::SparseMatrix<double, Eigen::RowMajor /** * @brief Build gradients of the load coefficients with respect to the flow variables on a given body - * + * * Note: this is essentially the same as buildGradientLoadsFlow, but with an additional projection performed inside the loop for performance */ void Adjoint::buildGradientCoefficientsFlow(Eigen::RowVectorXd &dCl, Eigen::RowVectorXd &dCd, Body const &bnd) @@ -669,7 +675,7 @@ void Adjoint::buildGradientLoadsMesh(Eigen::SparseMatrix<double, Eigen::RowMajor /** * @brief Build gradients of the loads with respect to mesh coordinates on a given body - * + * * Note: this is essentially the same as buildGradientLoadsMesh, but with an additional projection performed inside the loop for performance */ void Adjoint::buildGradientCoefficientsMesh(Eigen::RowVectorXd &dCl, Eigen::RowVectorXd &dCd, Body const &bnd)