changed: default preconditioner to 'asm' in parallel simulations

This commit is contained in:
Arne Morten Kvarving 2019-04-12 14:55:42 +02:00
parent 695e7cfefd
commit de9ba8912b
2 changed files with 10 additions and 3 deletions

View File

@ -65,7 +65,7 @@ bool SettingMap::hasValue(const std::string& key) const
LinSolParams::BlockParams::BlockParams() :
basis(1), comps(0)
{
addValue("pc", "ilu");
addValue("pc", "default");
addValue("multigrid_ksp", "defrichardson");
}

View File

@ -32,6 +32,9 @@ void PETScSolParams::setupPC(PC& pc,
{
// Set preconditioner
std::string prec = params.getBlock(block).getStringValue("pc");
if (prec == "default")
prec = adm.getNoProcs() > 1 ? "asm" : "ilu";
if (prec == "compositedir") {
Mat mat;
Mat Pmat;
@ -297,8 +300,12 @@ void PETScSolParams::setupSmoothers(PC& pc, size_t iBlock,
noSmooth = params.getBlock(iBlock).getIntValue("multigrid_no_smooth");;
}
if (smoother.empty())
smoother = "ilu";
if (smoother.empty()) {
if (adm.getNoProcs() > 1)
smoother = "asm";
else
smoother = "ilu";
}
KSPSetTolerances(preksp,PETSC_DEFAULT,PETSC_DEFAULT,PETSC_DEFAULT,noSmooth);
KSPGetPC(preksp,&prepc);