Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
panzer::L2Projection< LO, GO > Class Template Reference

Unified set of tools for building objects for lumped and consistent L2 projects between bases. More...

#include <Panzer_L2Projection.hpp>

Public Member Functions

 L2Projection ()
 Constructor. More...
 
void setup (const panzer::BasisDescriptor &targetBasis, const panzer::IntegrationDescriptor &integrationDescriptor, const Teuchos::RCP< const Teuchos::MpiComm< int >> &comm, const Teuchos::RCP< const panzer::ConnManager< LO, GO >> &connManager, const std::vector< std::string > &elementBlockNames, const Teuchos::RCP< panzer::WorksetContainer > worksetContainer=Teuchos::null)
 Setup base objects for L2 Projections - requires target scalar basis and creates worksets if not supplied by user. More...
 
Teuchos::RCP
< panzer::UniqueGlobalIndexer
< LO, GO > > 
getTargetGlobalIndexer () const
 Returns the target global indexer. Will be null if setup() has not been called. More...
 
Teuchos::RCP
< Tpetra::CrsMatrix< double,
LO, GO,
Kokkos::Compat::KokkosDeviceWrapperNode
< PHX::Device > > > 
buildMassMatrix (bool use_lumping=false, const std::unordered_map< std::string, double > *elementBlockMultipliers=nullptr)
 Allocates, fills and returns a mass matrix for L2 projection onto a target basis. More...
 
Teuchos::RCP
< Tpetra::MultiVector< double,
LO, GO,
Kokkos::Compat::KokkosDeviceWrapperNode
< PHX::Device > > > 
buildInverseLumpedMassMatrix ()
 Allocates, fills and returns a Tpetra::MultiVector containing the inverse lumped mass matrix values as computed via Hinton 1976. More...
 
Teuchos::RCP
< Tpetra::CrsMatrix< double,
LO, GO,
Kokkos::Compat::KokkosDeviceWrapperNode
< PHX::Device > > > 
buildRHSMatrix (const panzer::UniqueGlobalIndexer< LO, GO > &sourceDOFManager, const Teuchos::RCP< const Tpetra::Map< LO, GO, Kokkos::Compat::KokkosDeviceWrapperNode< PHX::Device >>> &ownedSourceMap, const std::string &sourceFieldName, const panzer::BasisDescriptor &sourceBasisDescriptor, const int vectorOrGradientDirectionIndex=-1)
 Allocates, fills and returns a rectangular matrix for L2 projection of a scalar field, one dimension of gradient (for hgrad basis), or one dimension of a vector field onto the target scalar basis. If you wish to project all values of a vector field or all the gradients of a scalar field, then you will need three separate RHS matrices to form the RHS for each independently. The vectors must be independent Tpetra vectors to solve multiple right hand sides with the linear solver. More...
 

Private Attributes

panzer::BasisDescriptor targetBasisDescriptor_
 
panzer::IntegrationDescriptor integrationDescriptor_
 
Teuchos::RCP< const
Teuchos::MpiComm< int > > 
comm_
 
Teuchos::RCP< const
panzer::ConnManager< LO, GO > > 
connManager_
 
std::vector< std::string > elementBlockNames_
 
Teuchos::RCP
< panzer::WorksetContainer
worksetContainer_
 
bool setupCalled_
 
Teuchos::RCP
< panzer::DOFManager< LO, GO > > 
targetGlobalIndexer_
 

Detailed Description

template<typename LO, typename GO>
class panzer::L2Projection< LO, GO >

Unified set of tools for building objects for lumped and consistent L2 projects between bases.

Definition at line 35 of file Panzer_L2Projection.hpp.

Constructor & Destructor Documentation

template<typename LO , typename GO >
panzer::L2Projection< LO, GO >::L2Projection ( )
inline

Constructor.

Definition at line 50 of file Panzer_L2Projection.hpp.

Member Function Documentation

template<typename LO , typename GO >
void panzer::L2Projection< LO, GO >::setup ( const panzer::BasisDescriptor targetBasis,
const panzer::IntegrationDescriptor integrationDescriptor,
const Teuchos::RCP< const Teuchos::MpiComm< int >> &  comm,
const Teuchos::RCP< const panzer::ConnManager< LO, GO >> &  connManager,
const std::vector< std::string > &  elementBlockNames,
const Teuchos::RCP< panzer::WorksetContainer worksetContainer = Teuchos::null 
)

Setup base objects for L2 Projections - requires target scalar basis and creates worksets if not supplied by user.

Parameters
[in]basis(required) Basis that field values will be projected to.
[in]integrationDescriptor(required) Integration order used for the projection.
[in]comm(required) Teuchos MPI communicator used all processes involved in the project.
[in]connManger(required) Connection manager to describe the mesh.
[in]elementBlockNames(required) Names of element blocks in mesh that are involved in the projection.
[in]worksetContainer(optional) If the user has already allocated worksets for the corresponding mesh/element blocks, we can used those instead of reallocating for projection.

Definition at line 26 of file Panzer_L2Projection_impl.hpp.

template<typename LO , typename GO >
Teuchos::RCP< panzer::UniqueGlobalIndexer< LO, GO > > panzer::L2Projection< LO, GO >::getTargetGlobalIndexer ( ) const

Returns the target global indexer. Will be null if setup() has not been called.

Definition at line 71 of file Panzer_L2Projection_impl.hpp.

template<typename LO , typename GO >
Teuchos::RCP< Tpetra::CrsMatrix< double, LO, GO, panzer::TpetraNodeType > > panzer::L2Projection< LO, GO >::buildMassMatrix ( bool  use_lumping = false,
const std::unordered_map< std::string, double > *  elementBlockMultipliers = nullptr 
)

Allocates, fills and returns a mass matrix for L2 projection onto a target basis.

Parameters
use_lumping(optional) If set to true, the returned mass matrix is a lumped diagonal mass matrix following Hinton, et al. 1976.
elementBlockMultipliers(optional) If non-null, a multiplier will be used for each element block. The elements should be ordered corresponding to commManger block ordering.
Returns
Filled mass matrix in a Tpetra::CrsMatrix

Definition at line 76 of file Panzer_L2Projection_impl.hpp.

template<typename LO , typename GO >
Teuchos::RCP< Tpetra::MultiVector< double, LO, GO, panzer::TpetraNodeType > > panzer::L2Projection< LO, GO >::buildInverseLumpedMassMatrix ( )

Allocates, fills and returns a Tpetra::MultiVector containing the inverse lumped mass matrix values as computed via Hinton 1976.

References:

[1] E. Hinton, T. Rock and O. C. Zienkiewicz, "A Note on Mass Lumping and Related Processes in the Finite Element Method," Earthquake Engineering and Structural Dynamics, 4 (1976), 245-249.

[2] T. J. R. Hughes, "The Finite Element Method: Linear Static and Dynamic Finite Element Analysis," (1987), Section 7.3.2.

NOTE: This is currently sligtly inefficient in that it temporarily allocates the consistent mass matrix. This saves significant code duplication at the temporary runtime cost of allocating the mass matrix. The temporary matrix is deallocated on exit from this function so it should not be an issue.

Returns
Filled inverse lumped mass matrix in a Tpetra::MultiVector (diagonal entries mass matrix)

Definition at line 288 of file Panzer_L2Projection_impl.hpp.

template<typename LO , typename GO >
Teuchos::RCP< Tpetra::CrsMatrix< double, LO, GO, panzer::TpetraNodeType > > panzer::L2Projection< LO, GO >::buildRHSMatrix ( const panzer::UniqueGlobalIndexer< LO, GO > &  sourceDOFManager,
const Teuchos::RCP< const Tpetra::Map< LO, GO, Kokkos::Compat::KokkosDeviceWrapperNode< PHX::Device >>> &  ownedSourceMap,
const std::string &  sourceFieldName,
const panzer::BasisDescriptor sourceBasisDescriptor,
const int  vectorOrGradientDirectionIndex = -1 
)

Allocates, fills and returns a rectangular matrix for L2 projection of a scalar field, one dimension of gradient (for hgrad basis), or one dimension of a vector field onto the target scalar basis. If you wish to project all values of a vector field or all the gradients of a scalar field, then you will need three separate RHS matrices to form the RHS for each independently. The vectors must be independent Tpetra vectors to solve multiple right hand sides with the linear solver.

Parameters
[in](required)sourceDOFManager The source dof manger object
[in](required)ownedSourceMap The Tpetra Map for the owned source vector
[in](required)sourceFieldName The string name of the source field to project
[in](required)sourceBasisDescriptor The type of the basis for the source field
[in](optional)vectorOrGradientDirectionIndex For vector fields, this is the vector index to project (x,y, or z component). For scalar fields, the default value of -1 results in a projection of the scalar field value. If set to 0 or greater, it is assumed that the gradient of the HGrad field is projected and that this value is the dimension index for the particular gradient (x, y, or z component).
Returns
Alocated and filled Tpetra::CrsMatrix

Definition at line 309 of file Panzer_L2Projection_impl.hpp.

Member Data Documentation

template<typename LO , typename GO >
panzer::BasisDescriptor panzer::L2Projection< LO, GO >::targetBasisDescriptor_
private

Definition at line 37 of file Panzer_L2Projection.hpp.

template<typename LO , typename GO >
panzer::IntegrationDescriptor panzer::L2Projection< LO, GO >::integrationDescriptor_
private

Definition at line 38 of file Panzer_L2Projection.hpp.

template<typename LO , typename GO >
Teuchos::RCP<const Teuchos::MpiComm<int> > panzer::L2Projection< LO, GO >::comm_
private

Definition at line 39 of file Panzer_L2Projection.hpp.

template<typename LO , typename GO >
Teuchos::RCP<const panzer::ConnManager<LO,GO> > panzer::L2Projection< LO, GO >::connManager_
private

Definition at line 40 of file Panzer_L2Projection.hpp.

template<typename LO , typename GO >
std::vector<std::string> panzer::L2Projection< LO, GO >::elementBlockNames_
private

Definition at line 41 of file Panzer_L2Projection.hpp.

template<typename LO , typename GO >
Teuchos::RCP<panzer::WorksetContainer> panzer::L2Projection< LO, GO >::worksetContainer_
mutableprivate

Definition at line 42 of file Panzer_L2Projection.hpp.

template<typename LO , typename GO >
bool panzer::L2Projection< LO, GO >::setupCalled_
private

Definition at line 43 of file Panzer_L2Projection.hpp.

template<typename LO , typename GO >
Teuchos::RCP<panzer::DOFManager<LO,GO> > panzer::L2Projection< LO, GO >::targetGlobalIndexer_
private

Definition at line 45 of file Panzer_L2Projection.hpp.


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