Chi-Tech
lbs::acceleration::DiffusionSolver Class Referenceabstract

#include <diffusion.h>

Inheritance diagram for lbs::acceleration::DiffusionSolver:
lbs::acceleration::DiffusionMIPSolver lbs::acceleration::DiffusionPWLCSolver

Data Structures

struct  Options
 

Public Member Functions

 DiffusionSolver (std::string text_name, const chi_math::SpatialDiscretization &sdm, const chi_math::UnknownManager &uk_man, std::map< uint64_t, BoundaryCondition > bcs, MatID2XSMap map_mat_id_2_xs, const std::vector< UnitCellMatrices > &unit_cell_matrices, bool verbose, bool requires_ghosts)
 
std::string TextName () const
 
const VecRHS () const
 
const std::map< uint64_t, BoundaryCondition > & BCS () const
 
const chi_math::UnknownManagerUnknownStructure () const
 
const chi_math::SpatialDiscretizationSpatialDiscretization () const
 
std::pair< size_t, size_t > GetNumPhiIterativeUnknowns ()
 
virtual ~DiffusionSolver ()
 
void Initialize ()
 
virtual void AssembleAand_b (const std::vector< double > &q_vector)=0
 
virtual void Assemble_b (const std::vector< double > &q_vector)=0
 
virtual void Assemble_b (Vec petsc_q_vector)=0
 
void AddToRHS (const std::vector< double > &values)
 
void Solve (std::vector< double > &solution, bool use_initial_guess=false)
 
void Solve (Vec petsc_solution, bool use_initial_guess=false)
 

Data Fields

struct lbs::acceleration::DiffusionSolver::Options options
 

Protected Types

typedef std::map< int, Multigroup_D_and_sigRMatID2XSMap
 

Protected Attributes

const std::string text_name_
 
const chi_mesh::MeshContinuumgrid_
 
const chi_math::SpatialDiscretizationsdm_
 
const chi_math::UnknownManager uk_man_
 
const std::map< uint64_t, BoundaryConditionbcs_
 
const MatID2XSMap mat_id_2_xs_map_
 
const std::vector< UnitCellMatrices > & unit_cell_matrices_
 
const int64_t num_local_dofs_
 
const int64_t num_global_dofs_
 
Mat A_ = nullptr
 
Vec rhs_ = nullptr
 
KSP ksp_ = nullptr
 
const bool requires_ghosts_
 

Detailed Description

Generic diffusion solver for acceleration.

Definition at line 32 of file diffusion.h.

Member Typedef Documentation

◆ MatID2XSMap

Definition at line 35 of file diffusion.h.

Constructor & Destructor Documentation

◆ DiffusionSolver()

lbs::acceleration::DiffusionSolver::DiffusionSolver ( std::string  text_name,
const chi_math::SpatialDiscretization sdm,
const chi_math::UnknownManager uk_man,
std::map< uint64_t, BoundaryCondition bcs,
MatID2XSMap  map_mat_id_2_xs,
const std::vector< UnitCellMatrices > &  unit_cell_matrices,
bool  verbose,
bool  requires_ghosts 
)

Default constructor.

Definition at line 14 of file diffusion.cc.

◆ ~DiffusionSolver()

lbs::acceleration::DiffusionSolver::~DiffusionSolver ( )
virtual

Default destructor.

Definition at line 42 of file diffusion.cc.

Member Function Documentation

◆ AddToRHS()

void lbs::acceleration::DiffusionSolver::AddToRHS ( const std::vector< double > &  values)

Adds to the right-hand side without applying spatial discretization.

Definition at line 80 of file diffusion.cc.

◆ Assemble_b() [1/2]

virtual void lbs::acceleration::DiffusionSolver::Assemble_b ( const std::vector< double > &  q_vector)
pure virtual

◆ Assemble_b() [2/2]

virtual void lbs::acceleration::DiffusionSolver::Assemble_b ( Vec  petsc_q_vector)
pure virtual

◆ AssembleAand_b()

virtual void lbs::acceleration::DiffusionSolver::AssembleAand_b ( const std::vector< double > &  q_vector)
pure virtual

◆ BCS()

const std::map< uint64_t, BoundaryCondition > & lbs::acceleration::DiffusionSolver::BCS ( ) const
inline

Definition at line 83 of file diffusion.h.

◆ GetNumPhiIterativeUnknowns()

std::pair< size_t, size_t > lbs::acceleration::DiffusionSolver::GetNumPhiIterativeUnknowns ( )

Definition at line 73 of file diffusion.cc.

◆ Initialize()

void lbs::acceleration::DiffusionSolver::Initialize ( )

Initializes the diffusion solver. This involves creating the sparse matrix with the appropriate sparsity pattern. Creating the RHS vector. Creating the KSP solver. Setting the very specialized parameters for Hypre's BooomerAMG. Note: PCSetFromOptions and KSPSetFromOptions are called at the end. Therefore, any number of additional PETSc options can be passed via the commandline.

Definition at line 18 of file diffusion_01_initialize.cc.

◆ RHS()

const Vec & lbs::acceleration::DiffusionSolver::RHS ( ) const

Returns the right-hand side petsc vector.

Definition at line 55 of file diffusion.cc.

◆ Solve() [1/2]

void lbs::acceleration::DiffusionSolver::Solve ( std::vector< double > &  solution,
bool  use_initial_guess = false 
)

Solves the system and stores the local solution in the vector provide.

Parameters
solutionVector in to which the solution will be parsed.
use_initial_guessbool [Default:False] Flag, when set, will use the values of the output solution as initial guess.

Definition at line 17 of file diffusion_03_solve.cc.

◆ Solve() [2/2]

void lbs::acceleration::DiffusionSolver::Solve ( Vec  petsc_solution,
bool  use_initial_guess = false 
)

Solves the system and stores the local solution in the vector provide.

Parameters
petsc_solutionVector in to which the solution will be parsed.
use_initial_guessbool [Default:False] Flag, when set, will use the values of the output solution as initial guess.

Definition at line 104 of file diffusion_03_solve.cc.

◆ SpatialDiscretization()

const chi_math::SpatialDiscretization & lbs::acceleration::DiffusionSolver::SpatialDiscretization ( ) const

Returns the associated spatial discretization.

Definition at line 67 of file diffusion.cc.

◆ TextName()

std::string lbs::acceleration::DiffusionSolver::TextName ( ) const

Returns the assigned text name.

Definition at line 51 of file diffusion.cc.

◆ UnknownStructure()

const chi_math::UnknownManager & lbs::acceleration::DiffusionSolver::UnknownStructure ( ) const

Returns the assigned unknown structure.

Definition at line 59 of file diffusion.cc.

Field Documentation

◆ A_

Mat lbs::acceleration::DiffusionSolver::A_ = nullptr
protected

Definition at line 51 of file diffusion.h.

◆ bcs_

const std::map<uint64_t, BoundaryCondition> lbs::acceleration::DiffusionSolver::bcs_
protected

Definition at line 42 of file diffusion.h.

◆ grid_

const chi_mesh::MeshContinuum& lbs::acceleration::DiffusionSolver::grid_
protected

Definition at line 38 of file diffusion.h.

◆ ksp_

KSP lbs::acceleration::DiffusionSolver::ksp_ = nullptr
protected

Definition at line 53 of file diffusion.h.

◆ mat_id_2_xs_map_

const MatID2XSMap lbs::acceleration::DiffusionSolver::mat_id_2_xs_map_
protected

Definition at line 44 of file diffusion.h.

◆ num_global_dofs_

const int64_t lbs::acceleration::DiffusionSolver::num_global_dofs_
protected

Definition at line 49 of file diffusion.h.

◆ num_local_dofs_

const int64_t lbs::acceleration::DiffusionSolver::num_local_dofs_
protected

Definition at line 48 of file diffusion.h.

◆ options

struct lbs::acceleration::DiffusionSolver::Options lbs::acceleration::DiffusionSolver::options

◆ requires_ghosts_

const bool lbs::acceleration::DiffusionSolver::requires_ghosts_
protected

Definition at line 55 of file diffusion.h.

◆ rhs_

Vec lbs::acceleration::DiffusionSolver::rhs_ = nullptr
protected

Definition at line 52 of file diffusion.h.

◆ sdm_

const chi_math::SpatialDiscretization& lbs::acceleration::DiffusionSolver::sdm_
protected

Definition at line 39 of file diffusion.h.

◆ text_name_

const std::string lbs::acceleration::DiffusionSolver::text_name_
protected

Definition at line 37 of file diffusion.h.

◆ uk_man_

const chi_math::UnknownManager lbs::acceleration::DiffusionSolver::uk_man_
protected

Definition at line 40 of file diffusion.h.

◆ unit_cell_matrices_

const std::vector<UnitCellMatrices>& lbs::acceleration::DiffusionSolver::unit_cell_matrices_
protected

Definition at line 46 of file diffusion.h.


The documentation for this class was generated from the following files: