Nalu
Nalu: a generalized unstructured massively parallel low Mach flow code designed to support a variety of energy applications of interest (most notably Wind ECP) built on the Sierra Toolkit and Trilinos solver Tpetra/Epetra stack. The open source BSD, clause 3 license model has been chosen for the code base. See LICENSE for more information. http://NaluCFD.org
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
sierra::nalu::TpetraLinearSystem Class Reference

#include <TpetraLinearSystem.h>

Inheritance diagram for sierra::nalu::TpetraLinearSystem:
sierra::nalu::LinearSystem

Public Types

enum  DOFStatus {
  DS_NotSet = 0, DS_SkippedDOF = 1 << 1, DS_OwnedDOF = 1 << 2, DS_GloballyOwnedDOF = 1 << 3,
  DS_GhostedDOF = 1 << 4
}
 
typedef LinSys::GlobalOrdinal GlobalOrdinal
 
typedef LinSys::LocalOrdinal LocalOrdinal
 

Public Member Functions

 TpetraLinearSystem (Realm &realm, const unsigned numDof, EquationSystem *eqSys, LinearSolver *linearSolver)
 ====================================================================================================================================

======== T P E T R A ===============================================================================================================

More...
 
 ~TpetraLinearSystem ()
 
void buildNodeGraph (const stk::mesh::PartVector &parts)
 
void buildFaceToNodeGraph (const stk::mesh::PartVector &parts)
 
void buildEdgeToNodeGraph (const stk::mesh::PartVector &parts)
 
void buildElemToNodeGraph (const stk::mesh::PartVector &parts)
 
void buildReducedElemToNodeGraph (const stk::mesh::PartVector &parts)
 
void buildFaceElemToNodeGraph (const stk::mesh::PartVector &parts)
 
void buildNonConformalNodeGraph (const stk::mesh::PartVector &parts)
 
void buildOversetNodeGraph (const stk::mesh::PartVector &parts)
 
void finalizeLinearSystem ()
 
void zeroSystem ()
 
void sumInto (unsigned numEntities, const stk::mesh::Entity *entities, const SharedMemView< const double * > &rhs, const SharedMemView< const double ** > &lhs, const SharedMemView< int * > &localIds, const SharedMemView< int * > &sortPermutation, const char *trace_tag)
 
void sumInto (const std::vector< stk::mesh::Entity > &entities, std::vector< int > &scratchIds, std::vector< double > &scratchVals, const std::vector< double > &rhs, const std::vector< double > &lhs, const char *trace_tag=0)
 
void applyDirichletBCs (stk::mesh::FieldBase *solutionField, stk::mesh::FieldBase *bcValuesField, const stk::mesh::PartVector &parts, const unsigned beginPos, const unsigned endPos)
 
void prepareConstraints (const unsigned beginPos, const unsigned endPos)
 
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. More...
 
int solve (stk::mesh::FieldBase *linearSolutionField)
 
void loadComplete ()
 
void writeToFile (const char *filename, bool useOwned=true)
 
void printInfo (bool useOwned=true)
 
void writeSolutionToFile (const char *filename, bool useOwned=true)
 
size_t lookup_myLID (MyLIDMapType &myLIDs, stk::mesh::EntityId entityId, const char *msg=nullptr, stk::mesh::Entity entity=stk::mesh::Entity())
 
int getDofStatus (stk::mesh::Entity node)
 
- Public Member Functions inherited from sierra::nalu::LinearSystem
 LinearSystem (Realm &realm, const unsigned numDof, EquationSystem *eqSys, LinearSolver *linearSolver)
 
virtual ~LinearSystem ()
 
unsigned numDof () const
 
const int & linearSolveIterations ()
 
const double & linearResidual ()
 
const double & nonLinearResidual ()
 
const double & scaledNonLinearResidual ()
 
void setNonLinearResidual (const double nlr)
 
const std::string name ()
 
bool & recomputePreconditioner ()
 
bool & reusePreconditioner ()
 
double get_timer_precond ()
 
void zero_timer_precond ()
 

Private Member Functions

void beginLinearSystemConstruction ()
 
void checkError (const int err_code, const char *msg)
 
void copy_kokkos_unordered_map_to_sorted_vector (const ConnectionSetKK &connectionSetKK, ConnectionVec &connectionVec)
 
void compute_graph_row_lengths (const ConnectionVec &connectionVec, LinSys::RowLengths &globallyOwnedRowLengths, LinSys::RowLengths &locallyOwnedRowLengths)
 
void insert_graph_connections (const ConnectionVec &connectionVec, LinSys::Graph &ownedGraph, int ownedOrSharedMask)
 
void fill_entity_to_LID_mapping ()
 
void copy_tpetra_to_stk (const Teuchos::RCP< LinSys::Vector > tpetraVector, stk::mesh::FieldBase *stkField)
 
void copy_stk_to_tpetra (stk::mesh::FieldBase *stkField, const Teuchos::RCP< LinSys::MultiVector > tpetraVector)
 
int addConnections (const stk::mesh::Entity *entities, const size_t &)
 
void expand_unordered_map (unsigned newCapacityNeeded)
 
void checkForNaN (bool useOwned)
 
bool checkForZeroRow (bool useOwned, bool doThrow, bool doPrint=false)
 

Private Attributes

ConnectionSetKK connectionSetKK_
 
std::vector< GlobalOrdinaltotalGids_
 
Teuchos::RCP< LinSys::Nodenode_
 
Teuchos::RCP< LinSys::MaptotalColsMap_
 
Teuchos::RCP< LinSys::MapownedRowsMap_
 
Teuchos::RCP< LinSys::MapownedPlusGloballyOwnedRowsMap_
 
Teuchos::RCP< LinSys::MapgloballyOwnedRowsMap_
 
Teuchos::RCP< LinSys::GraphownedGraph_
 
Teuchos::RCP< LinSys::GraphgloballyOwnedGraph_
 
Teuchos::RCP< LinSys::MatrixownedMatrix_
 
Teuchos::RCP< LinSys::VectorownedRhs_
 
Teuchos::RCP< LinSys::MatrixgloballyOwnedMatrix_
 
Teuchos::RCP< LinSys::VectorgloballyOwnedRhs_
 
Teuchos::RCP< LinSys::Vectorsln_
 
Teuchos::RCP< LinSys::VectorglobalSln_
 
Teuchos::RCP< LinSys::Exportexporter_
 
Teuchos::RCP< LinSys::Importimporter_
 
MyLIDMapType myLIDs_
 
std::vector< LocalOrdinalentityToLID_
 
LocalOrdinal maxOwnedRowId_
 
LocalOrdinal maxGloballyOwnedRowId_
 
std::vector< int > sortPermutation_
 

Additional Inherited Members

- Static Public Member Functions inherited from sierra::nalu::LinearSystem
static LinearSystemcreate (Realm &realm, const unsigned numDof, EquationSystem *eqSys, LinearSolver *linearSolver)
 
- Public Attributes inherited from sierra::nalu::LinearSystem
bool provideOutput_
 
- Protected Member Functions inherited from sierra::nalu::LinearSystem
void sync_field (const stk::mesh::FieldBase *field)
 
bool debug ()
 
- Protected Attributes inherited from sierra::nalu::LinearSystem
Realmrealm_
 
EquationSystemeqSys_
 
bool inConstruction_
 
int writeCounter_
 
const unsigned numDof_
 
const std::string eqSysName_
 
LinearSolverlinearSolver_
 
int linearSolveIterations_
 
double nonLinearResidual_
 
double linearResidual_
 
double firstNonLinearResidual_
 
double scaledNonLinearResidual_
 
bool recomputePreconditioner_
 
bool reusePreconditioner_
 

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
DS_NotSet 
DS_SkippedDOF 
DS_OwnedDOF 
DS_GloballyOwnedDOF 
DS_GhostedDOF 

Constructor & Destructor Documentation

sierra::nalu::TpetraLinearSystem::TpetraLinearSystem ( Realm realm,
const unsigned  numDof,
EquationSystem eqSys,
LinearSolver linearSolver 
)

====================================================================================================================================

======== T P E T R A ===============================================================================================================

References node_.

sierra::nalu::TpetraLinearSystem::~TpetraLinearSystem ( )

Member Function Documentation

int sierra::nalu::TpetraLinearSystem::addConnections ( const stk::mesh::Entity *  entities,
const size_t &  num_entities 
)
private
void sierra::nalu::TpetraLinearSystem::applyDirichletBCs ( stk::mesh::FieldBase *  solutionField,
stk::mesh::FieldBase *  bcValuesField,
const stk::mesh::PartVector parts,
const unsigned  beginPos,
const unsigned  endPos 
)
virtual
void sierra::nalu::TpetraLinearSystem::beginLinearSystemConstruction ( )
privatevirtual
void sierra::nalu::TpetraLinearSystem::buildEdgeToNodeGraph ( const stk::mesh::PartVector parts)
virtual
void sierra::nalu::TpetraLinearSystem::buildElemToNodeGraph ( const stk::mesh::PartVector parts)
virtual
void sierra::nalu::TpetraLinearSystem::buildFaceElemToNodeGraph ( const stk::mesh::PartVector parts)
virtual
void sierra::nalu::TpetraLinearSystem::buildFaceToNodeGraph ( const stk::mesh::PartVector parts)
virtual
void sierra::nalu::TpetraLinearSystem::buildNodeGraph ( const stk::mesh::PartVector parts)
virtual
void sierra::nalu::TpetraLinearSystem::buildNonConformalNodeGraph ( const stk::mesh::PartVector parts)
virtual
void sierra::nalu::TpetraLinearSystem::buildOversetNodeGraph ( const stk::mesh::PartVector parts)
virtual
void sierra::nalu::TpetraLinearSystem::buildReducedElemToNodeGraph ( const stk::mesh::PartVector parts)
virtual
void sierra::nalu::TpetraLinearSystem::checkError ( const int  err_code,
const char *  msg 
)
inlineprivatevirtual
void sierra::nalu::TpetraLinearSystem::checkForNaN ( bool  useOwned)
private
bool sierra::nalu::TpetraLinearSystem::checkForZeroRow ( bool  useOwned,
bool  doThrow,
bool  doPrint = false 
)
private
void sierra::nalu::TpetraLinearSystem::compute_graph_row_lengths ( const ConnectionVec connectionVec,
LinSys::RowLengths globallyOwnedRowLengths,
LinSys::RowLengths locallyOwnedRowLengths 
)
private
void sierra::nalu::TpetraLinearSystem::copy_kokkos_unordered_map_to_sorted_vector ( const ConnectionSetKK connectionSetKK,
ConnectionVec connectionVec 
)
private
void sierra::nalu::TpetraLinearSystem::copy_stk_to_tpetra ( stk::mesh::FieldBase *  stkField,
const Teuchos::RCP< LinSys::MultiVector tpetraVector 
)
private
void sierra::nalu::TpetraLinearSystem::copy_tpetra_to_stk ( const Teuchos::RCP< LinSys::Vector tpetraVector,
stk::mesh::FieldBase *  stkField 
)
private
void sierra::nalu::TpetraLinearSystem::expand_unordered_map ( unsigned  newCapacityNeeded)
private
void sierra::nalu::TpetraLinearSystem::fill_entity_to_LID_mapping ( )
private
void sierra::nalu::TpetraLinearSystem::finalizeLinearSystem ( )
virtual
int sierra::nalu::TpetraLinearSystem::getDofStatus ( stk::mesh::Entity  node)
void sierra::nalu::TpetraLinearSystem::insert_graph_connections ( const ConnectionVec connectionVec,
LinSys::Graph ownedGraph,
int  ownedOrSharedMask 
)
private
void sierra::nalu::TpetraLinearSystem::loadComplete ( )
virtual
size_t sierra::nalu::TpetraLinearSystem::lookup_myLID ( MyLIDMapType myLIDs,
stk::mesh::EntityId  entityId,
const char *  msg = nullptr,
stk::mesh::Entity  entity = stk::mesh::Entity() 
)
inline
void sierra::nalu::TpetraLinearSystem::prepareConstraints ( const unsigned  beginPos,
const unsigned  endPos 
)
virtual
void sierra::nalu::TpetraLinearSystem::printInfo ( bool  useOwned = true)
void sierra::nalu::TpetraLinearSystem::resetRows ( const std::vector< stk::mesh::Entity >  nodeList,
const unsigned  beginPos,
const unsigned  endPos 
)
virtual

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

Parameters
nodeListA list of STK node entities whose rows are zeroed out
beginPosStarting index (usually 0)
endPosTerminating index (1 for scalar quantities; nDim for vectors)

Implements sierra::nalu::LinearSystem.

References globallyOwnedMatrix_, globallyOwnedRhs_, lookup_myLID(), maxGloballyOwnedRowId_, maxOwnedRowId_, myLIDs_, sierra::nalu::Realm::naluGlobalId_, sierra::nalu::LinearSystem::numDof_, ownedMatrix_, ownedRhs_, sierra::nalu::LinearSystem::realm_, and anonymous_namespace{UnitTestContinuityAdvElem.C}::hex8_golds::advection_default::rhs.

int sierra::nalu::TpetraLinearSystem::solve ( stk::mesh::FieldBase *  linearSolutionField)
virtual
void sierra::nalu::TpetraLinearSystem::sumInto ( unsigned  numEntities,
const stk::mesh::Entity *  entities,
const SharedMemView< const double * > &  rhs,
const SharedMemView< const double ** > &  lhs,
const SharedMemView< int * > &  localIds,
const SharedMemView< int * > &  sortPermutation,
const char *  trace_tag 
)
virtual
void sierra::nalu::TpetraLinearSystem::sumInto ( const std::vector< stk::mesh::Entity > &  entities,
std::vector< int > &  scratchIds,
std::vector< double > &  scratchVals,
const std::vector< double > &  rhs,
const std::vector< double > &  lhs,
const char *  trace_tag = 0 
)
virtual
void sierra::nalu::TpetraLinearSystem::writeSolutionToFile ( const char *  filename,
bool  useOwned = true 
)
virtual
void sierra::nalu::TpetraLinearSystem::writeToFile ( const char *  filename,
bool  useOwned = true 
)
virtual
void sierra::nalu::TpetraLinearSystem::zeroSystem ( )
virtual

Member Data Documentation

ConnectionSetKK sierra::nalu::TpetraLinearSystem::connectionSetKK_
private
std::vector<LocalOrdinal> sierra::nalu::TpetraLinearSystem::entityToLID_
private
Teuchos::RCP<LinSys::Export> sierra::nalu::TpetraLinearSystem::exporter_
private
Teuchos::RCP<LinSys::Graph> sierra::nalu::TpetraLinearSystem::globallyOwnedGraph_
private

Referenced by finalizeLinearSystem().

Teuchos::RCP<LinSys::Matrix> sierra::nalu::TpetraLinearSystem::globallyOwnedMatrix_
private
Teuchos::RCP<LinSys::Vector> sierra::nalu::TpetraLinearSystem::globallyOwnedRhs_
private
Teuchos::RCP<LinSys::Map> sierra::nalu::TpetraLinearSystem::globallyOwnedRowsMap_
private
Teuchos::RCP<LinSys::Vector> sierra::nalu::TpetraLinearSystem::globalSln_
private
Teuchos::RCP<LinSys::Import> sierra::nalu::TpetraLinearSystem::importer_
private
LocalOrdinal sierra::nalu::TpetraLinearSystem::maxGloballyOwnedRowId_
private
LocalOrdinal sierra::nalu::TpetraLinearSystem::maxOwnedRowId_
private
MyLIDMapType sierra::nalu::TpetraLinearSystem::myLIDs_
private
Teuchos::RCP<LinSys::Node> sierra::nalu::TpetraLinearSystem::node_
private
Teuchos::RCP<LinSys::Graph> sierra::nalu::TpetraLinearSystem::ownedGraph_
private
Teuchos::RCP<LinSys::Matrix> sierra::nalu::TpetraLinearSystem::ownedMatrix_
private
Teuchos::RCP<LinSys::Map> sierra::nalu::TpetraLinearSystem::ownedPlusGloballyOwnedRowsMap_
private
Teuchos::RCP<LinSys::Vector> sierra::nalu::TpetraLinearSystem::ownedRhs_
private
Teuchos::RCP<LinSys::Map> sierra::nalu::TpetraLinearSystem::ownedRowsMap_
private
Teuchos::RCP<LinSys::Vector> sierra::nalu::TpetraLinearSystem::sln_
private
std::vector<int> sierra::nalu::TpetraLinearSystem::sortPermutation_
private

Referenced by sumInto().

Teuchos::RCP<LinSys::Map> sierra::nalu::TpetraLinearSystem::totalColsMap_
private

Referenced by finalizeLinearSystem().

std::vector<GlobalOrdinal> sierra::nalu::TpetraLinearSystem::totalGids_
private

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