Skip to content
Snippets Groups Projects
Commit baeb2a2c authored by Adrien Crovato's avatar Adrien Crovato
Browse files

Decrease GMRES tolerance for adjoint mesh morpher, more robust.

parent bcfd5b18
No related branches found
No related tags found
No related merge requests found
Pipeline #7203 passed
...@@ -58,17 +58,23 @@ Adjoint::Adjoint(std::shared_ptr<Newton> _sol, std::shared_ptr<tbox::MshDeform> ...@@ -58,17 +58,23 @@ Adjoint::Adjoint(std::shared_ptr<Newton> _sol, std::shared_ptr<tbox::MshDeform>
nthreads = sol->nthreads; nthreads = sol->nthreads;
verbose = sol->verbose; verbose = sol->verbose;
// Linear solvers // Linear solvers (if GMRES, use the same, but with a thighter tolerance)
if (sol->linsol->type() == LSOLTYPE::GMRES_ILUT) 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())); std::shared_ptr<Gmres> gmres = std::make_shared<Gmres>(*dynamic_cast<Gmres *>(sol->linsol.get()));
gmres->setTolerance(1e-8); gmres->setTolerance(1e-8);
alinsol = gmres; alinsol = gmres;
} }
else else
alinsol = sol->linsol; 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 // Update element gradients
sol->pbl->initGradElems(); sol->pbl->initGradElems();
...@@ -423,7 +429,7 @@ void Adjoint::buildGradientLoadsFlow(Eigen::SparseMatrix<double, Eigen::RowMajor ...@@ -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 * @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 * 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) void Adjoint::buildGradientCoefficientsFlow(Eigen::RowVectorXd &dCl, Eigen::RowVectorXd &dCd, Body const &bnd)
...@@ -669,7 +675,7 @@ void Adjoint::buildGradientLoadsMesh(Eigen::SparseMatrix<double, Eigen::RowMajor ...@@ -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 * @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 * 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) void Adjoint::buildGradientCoefficientsMesh(Eigen::RowVectorXd &dCl, Eigen::RowVectorXd &dCd, Body const &bnd)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment