Commit 59d323bb authored by Marcel Koch's avatar Marcel Koch
Browse files

[wip] allow to use only petsc/ginkgo cg solver

parent 50d8406e
Pipeline #34657 failed with stages
in 11 minutes and 37 seconds
......@@ -322,11 +322,13 @@ void tokamak( TokamakDomain tokamakDomain,
tokamakDomain.r1,
tokamakDomain.r2 );
WALBERLA_LOG_INFO_ON_ROOT( "[progress] Finished setting up tokamak blending map" )
const auto storage = std::make_shared< PrimitiveStorage >( setupStorage );
WALBERLA_CHECK( storage->hasGlobalCells() )
const auto domainInfo = storage->getGlobalInfo();
const auto domainInfo = storage->getGlobalInfo( true );
WALBERLA_LOG_INFO_ON_ROOT( domainInfo )
WALBERLA_LOG_INFO_ON_ROOT( "DoFs" )
......@@ -545,12 +547,48 @@ void tokamak( TokamakDomain tokamakDomain,
if ( solverSettings.solverType == CG )
{
auto cgSolver = std::make_shared< CGSolver< LaplaceOperator_T > >( storage, minLevel, maxLevel );
if ( solverSettings.cgHytegVerbose )
if ( solverSettings.coarseGridSolverType == COARSE_GRID_CG_PETSC )
{
cgSolver->setPrintInfo( true );
const auto relativeResidualToleranceCoarseGrid = 1e-30;
const auto absoluteResidualToleranceCoarseGrid = 1e-12;
const auto maxIterationsCoarseGrid = static_cast< PetscInt >( solverSettings.maxCoarseGridSolverIterations );
auto cgSolver = std::make_shared< PETScCGSolver< LaplaceOperator_T > >( storage,
minLevel,
relativeResidualToleranceCoarseGrid,
absoluteResidualToleranceCoarseGrid,
maxIterationsCoarseGrid );
if ( solverSettings.cgHytegVerbose )
{
cgSolver->setPrintInfo( true );
}
solver = cgSolver;
}
else if ( solverSettings.coarseGridSolverType == COARSE_GRID_CG_GINKGO )
{
auto exec = get_executor( solverSettings.gkoExecutor );
if ( !exec )
{
WALBERLA_ABORT( "Invalid Ginkgo executor type." );
}
std::ifstream gko_cfg_file( solverSettings.gkoConfig );
rapidjson::IStreamWrapper gko_cfg( gko_cfg_file );
auto cgSolver =
std::make_shared< GinkgoCGSolver< LaplaceOperator_T > >( storage, minLevel, constraints::zero_row, exec, gko_cfg );
if ( solverSettings.cgHytegVerbose )
{
cgSolver->setPrintInfo( true );
}
solver = cgSolver;
}
else
{
auto cgSolver = std::make_shared< CGSolver< LaplaceOperator_T > >( storage, minLevel, maxLevel );
if ( solverSettings.cgHytegVerbose )
{
cgSolver->setPrintInfo( true );
}
solver = cgSolver;
}
solver = cgSolver;
}
else
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment