Linear Solvers and Systems Interface

Linear Systems

class LinearSystem

Subclassed by sierra::nalu::TpetraLinearSystem

Public Functions

virtual void buildDirichletNodeGraph(const stk::mesh::PartVector&)

Process nodes that belong to Dirichlet-type BC.

virtual void buildDirichletNodeGraph(const std::vector<stk::mesh::Entity>&)

Process nodes as belonging to a Dirichlet-type row.

See the documentation/implementation of sierra::nalu::FixPressureAtNodeAlgorithm for an example of this use case.

virtual void resetRows(std::vector<stk::mesh::Entity> nodeList, const unsigned beginPos, const unsigned endPos) = 0

Reset LHS and RHS for the given set of nodes to 0.

Parameters
  • nodeList: A list of STK node entities whose rows are zeroed out

  • beginPos: Starting index (usually 0)

  • endPos: Terminating index (1 for scalar quantities; nDim for vectors)

class TpetraLinearSystem : public sierra::nalu::LinearSystem

Public Functions

virtual void resetRows(const std::vector<stk::mesh::Entity> nodeList, const unsigned beginPos, const unsigned endPos)

Reset LHS and RHS for the given set of nodes to 0.

Parameters
  • nodeList: A list of STK node entities whose rows are zeroed out

  • beginPos: Starting index (usually 0)

  • endPos: Terminating index (1 for scalar quantities; nDim for vectors)

Warning

doxygenclass: Cannot find class “sierra::nalu::HypreLinearSystem” in doxygen xml output for project “nalu” from directory: ./doxygen/xml

Linear Solvers Interface

class LinearSolver

An abstract representation of a linear solver in Nalu.

Defines the basic API supported by the linear solvers for use within Nalu. See concrete implementations such as sierra::nalu::TpetraLinearSolver for more details.

Subclassed by sierra::nalu::TpetraLinearSolver

Public Functions

virtual PetraType getType() = 0

Type of solver instance as defined in sierra::nalu::PetraType.

virtual void destroyLinearSolver() = 0

Utility method to cleanup solvers during simulation.

bool &recomputePreconditioner()

Flag indicating whether the preconditioner is recomputed on each invocation.

bool &reusePreconditioner()

Flag indicating whether the preconditioner is reused on each invocation.

void zero_timer_precond()

Reset the preconditioner timer to 0.0 for future accumulation.

double get_timer_precond()

Get the preconditioner timer for the last invocation.

bool &activeMueLu()

Flag indicating whether the user has activated MueLU.

LinearSolverConfig *getConfig()

Get the solver configuration specified in the input file.

Public Members

std::string name_

User-friendly identifier for this particular solver instance.

class TpetraLinearSolver : public sierra::nalu::LinearSolver

Public Functions

TpetraLinearSolver(std::string solverName, TpetraLinearSolverConfig *config, const Teuchos::RCP<Teuchos::ParameterList> params, const Teuchos::RCP<Teuchos::ParameterList> paramsPrecond, LinearSolvers *linearSolvers)

Parameters
  • [in] solverName: The name of the solver

  • [in] config: Solver configuration

virtual void destroyLinearSolver()

Utility method to cleanup solvers during simulation.

void setMueLu()

Initialize the MueLU preconditioner before solve.

int residual_norm(int whichNorm, Teuchos::RCP<LinSys::Vector> sln, double &norm)

Compute the norm of the non-linear solution vector.

Parameters
  • [in] whichNorm: [0, 1, 2] norm to be computed

  • [in] sln: The solution vector

  • [out] norm: The norm of the solution vector

int solve(Teuchos::RCP<LinSys::Vector> sln, int &iterationCount, double &scaledResidual, bool isFinalOuterIter)

Solve the linear system Ax = b.

Parameters
  • [out] sln: The solution vector

  • [out] iterationCount: The number of linear solver iterations to convergence

  • [out] scaledResidual: The final residual norm

  • [in] isFinalOuterIter: Is this the final outer iteration

virtual PetraType getType()

Type of solver instance as defined in sierra::nalu::PetraType.

Warning

doxygenclass: Cannot find class “sierra::nalu::HypreDirectSolver” in doxygen xml output for project “nalu” from directory: ./doxygen/xml

class LinearSolvers

Collection of solvers and their associated configuration.

This class performs the following actions within a Nalu simulation:

  • Parse the linear_solvers section and create a mapping of user-defined configurations.

  • Create solvers for specific equation system and update the mapping

Public Functions

void load(const YAML::Node &node)

Parse the linear_solvers section from Nalu input file.

LinearSolver *create_solver(std::string solverBlockName, EquationType theEQ)

Create a solver for the EquationSystem.

Parameters
  • [in] solverBlockName: The name specified in the input file, e.g., solve_scalar

  • [in] theEQ: The type of equation

Public Members

SolverMap solvers_

Mapping of solver instances to the EquationType.

SolverTpetraConfigMap solverTpetraConfig_

A lookup table of solver configurations against the names provided in the input file when the type is tpetra

Simulation &sim_

Reference to the sierra::nalu::Simulation instance.

Solver Configuration

class LinearSolverConfig

Subclassed by sierra::nalu::TpetraLinearSolverConfig

class TpetraLinearSolverConfig : public sierra::nalu::LinearSolverConfig

Warning

doxygenclass: Cannot find class “sierra::nalu::HypreLinearSolverConfig” in doxygen xml output for project “nalu” from directory: ./doxygen/xml