Skip to content

Commit

Permalink
Enable usage of residual projection for velocity solvers (#122) (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
MalachiTimothyPhillips authored Jul 27, 2020
1 parent b120bc5 commit 0ba6afb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/insSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
19 changes: 19 additions & 0 deletions src/core/parReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0ba6afb

Please sign in to comment.