From 8b4bd214b622ff7acda33eef4a2b647b6d6c0290 Mon Sep 17 00:00:00 2001 From: Malachi Date: Mon, 27 Jul 2020 11:46:35 -0500 Subject: [PATCH] Enable usage of residual projection for velocity solvers (#122) (#123) --- src/core/insSetup.cpp | 3 +++ src/core/parReader.cpp | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/core/insSetup.cpp b/src/core/insSetup.cpp index 5535a10ad..5bb457586 100644 --- a/src/core/insSetup.cpp +++ b/src/core/insSetup.cpp @@ -317,6 +317,9 @@ ins_t* insSetup(MPI_Comm comm, occa::device device, setupAide &options, int buil ins->vOptions.setArgs("DISCRETIZATION", options.getArgs("VELOCITY DISCRETIZATION")); ins->vOptions.setArgs("BASIS", options.getArgs("VELOCITY BASIS")); ins->vOptions.setArgs("PRECONDITIONER", options.getArgs("VELOCITY PRECONDITIONER")); + ins->vOptions.setArgs("RESIDUAL PROJECTION", options.getArgs("VELOCITY RESIDUAL PROJECTION")); + ins->vOptions.setArgs("RESIDUAL PROJECTION VECTORS", options.getArgs("VELOCITY RESIDUAL PROJECTION VECTORS")); + ins->vOptions.setArgs("RESIDUAL PROJECTION START", options.getArgs("VELOCITY RESIDUAL PROJECTION START")); ins->vOptions.setArgs("MULTIGRID COARSENING", options.getArgs("VELOCITY MULTIGRID COARSENING")); ins->vOptions.setArgs("MULTIGRID SMOOTHER", options.getArgs("VELOCITY MULTIGRID SMOOTHER")); ins->vOptions.setArgs("MULTIGRID CHEBYSHEV DEGREE", diff --git a/src/core/parReader.cpp b/src/core/parReader.cpp index 3c64b1b36..39b9bddcd 100644 --- a/src/core/parReader.cpp +++ b/src/core/parReader.cpp @@ -53,6 +53,9 @@ void setDefaultSettings(libParanumal::setupAide &options, string casename, int r options.setArgs("VELOCITY BASIS", "NODAL"); options.setArgs("VELOCITY PRECONDITIONER", "JACOBI"); options.setArgs("VELOCITY DISCRETIZATION", "CONTINUOUS"); + options.setArgs("VELOCITY RESIDUAL PROJECTION", "FALSE"); + options.setArgs("VELOCITY RESIDUAL PROJECTION VECTORS", "8"); + options.setArgs("VELOCITY RESIDUAL PROJECTION START", "5"); options.setArgs("VARIABLE VISCOSITY", "FALSE"); options.setArgs("LOWMACH", "FALSE"); @@ -452,12 +455,28 @@ libParanumal::setupAide parRead(std::string &setupFile, MPI_Comm comm) string vsolver; int flow = 1; + bool v_rproj; + if(ini.extract("velocity", "residualproj", v_rproj)) { + if(v_rproj) + options.setArgs("VELOCITY RESIDUAL PROJECTION", "TRUE"); + else + options.setArgs("VELOCITY RESIDUAL PROJECTION", "FALSE"); + + int v_nProjVec; + if(ini.extract("velocity", "residualprojectionvectors", v_nProjVec)) + options.setArgs("VELOCITY RESIDUAL PROJECTION VECTORS", std::to_string(v_nProjVec)); + int v_nProjStep; + if(ini.extract("velocity", "residualprojectionstart", v_nProjStep)) + options.setArgs("VELOCITY RESIDUAL PROJECTION START", std::to_string(v_nProjStep)); + } ini.extract("velocity", "solver", vsolver); if(vsolver == "none") { options.setArgs("VELOCITY SOLVER", "NONE"); flow = 0; } else if(std::strstr(vsolver.c_str(), "block")) { options.setArgs("VELOCITY BLOCK SOLVER", "TRUE"); + if(options.compareArgs("VELOCITY RESIDUAL PROJECTION","TRUE")) + exit("Residual projection is not enabled for the velocity block solver!", EXIT_FAILURE); } double v_residualTol;