Chi-Tech
chi_math::SpatialDiscretization Class Referenceabstract

#include <SpatialDiscretization.h>

Inheritance diagram for chi_math::SpatialDiscretization:
chi_math::spatial_discretization::FiniteElementBase chi_math::spatial_discretization::FiniteVolume chi_math::spatial_discretization::LagrangeBase chi_math::spatial_discretization::PieceWiseLinearBase chi_math::spatial_discretization::LagrangeContinuous chi_math::spatial_discretization::LagrangeDiscontinuous chi_math::spatial_discretization::PieceWiseLinearContinuous chi_math::spatial_discretization::PieceWiseLinearDiscontinuous

Public Types

typedef std::function< double(const chi_mesh::Vector3 &)> SpatialWeightFunction
 

Public Member Functions

std::pair< std::set< uint32_t >, std::set< uint32_t > > MakeCellInternalAndBndryNodeIDs (const chi_mesh::Cell &cell) const
 
const CellMappingGetCellMapping (const chi_mesh::Cell &cell) const
 
SpatialDiscretizationType Type () const
 
const chi_mesh::MeshContinuumGrid () const
 
CoordinateSystemType GetCoordinateSystemType () const
 
virtual void BuildSparsityPattern (std::vector< int64_t > &nodal_nnz_in_diag, std::vector< int64_t > &nodal_nnz_off_diag, const UnknownManager &unknown_manager) const =0
 
virtual int64_t MapDOF (const chi_mesh::Cell &cell, unsigned int node, const UnknownManager &unknown_manager, unsigned int unknown_id, unsigned int component) const =0
 
virtual int64_t MapDOFLocal (const chi_mesh::Cell &cell, unsigned int node, const UnknownManager &unknown_manager, unsigned int unknown_id, unsigned int component) const =0
 
virtual int64_t MapDOF (const chi_mesh::Cell &cell, unsigned int node) const =0
 
virtual int64_t MapDOFLocal (const chi_mesh::Cell &cell, unsigned int node) const =0
 
size_t GetNumLocalDOFs (const UnknownManager &unknown_manager) const
 
size_t GetNumGlobalDOFs (const UnknownManager &unknown_manager) const
 
virtual size_t GetNumGhostDOFs (const UnknownManager &unknown_manager) const =0
 
virtual std::vector< int64_t > GetGhostDOFIndices (const UnknownManager &unknown_manager) const =0
 
size_t GetNumLocalAndGhostDOFs (const UnknownManager &unknown_manager) const
 
size_t GetCellNumNodes (const chi_mesh::Cell &cell) const
 
const std::vector< chi_mesh::Vector3 > & GetCellNodeLocations (const chi_mesh::Cell &cell) const
 
std::vector< std::vector< std::vector< int > > > MakeInternalFaceNodeMappings (double tolerance=1.0e-12) const
 For each local cell, for each face, for each face-node, provides a mapping to the adjacent cell's nodes. More...
 
void CopyVectorWithUnknownScope (const std::vector< double > &from_vector, std::vector< double > &to_vector, const UnknownManager &from_vec_uk_structure, unsigned int from_vec_uk_id, const UnknownManager &to_vec_uk_structure, unsigned int to_vec_uk_id) const
 
virtual void LocalizePETScVector (Vec petsc_vector, std::vector< double > &local_vector, const UnknownManager &unknown_manager) const
 
virtual void LocalizePETScVectorWithGhosts (Vec petsc_vector, std::vector< double > &local_vector, const UnknownManager &unknown_manager) const
 
SpatialWeightFunction GetSpatialWeightingFunction () const
 
virtual ~SpatialDiscretization ()=default
 

Static Public Member Functions

static double CartesianSpatialWeightFunction (const chi_mesh::Vector3 &point)
 
static double CylindricalRZSpatialWeightFunction (const chi_mesh::Vector3 &point)
 
static double Spherical1DSpatialWeightFunction (const chi_mesh::Vector3 &point)
 

Data Fields

const UnknownManager UNITARY_UNKNOWN_MANAGER
 

Protected Types

typedef SpatialDiscretizationType SDMType
 

Protected Member Functions

 SpatialDiscretization (const chi_mesh::MeshContinuum &grid, CoordinateSystemType cs_type, SDMType sdm_type)
 

Protected Attributes

const chi_mesh::MeshContinuumref_grid_
 
std::vector< std::unique_ptr< CellMapping > > cell_mappings_
 
std::map< uint64_t, std::shared_ptr< CellMapping > > nb_cell_mappings_
 
uint64_t local_block_address_ = 0
 
std::vector< uint64_t > locJ_block_address_
 
std::vector< uint64_t > locJ_block_size_
 
uint64_t local_base_block_size_ = 0
 
uint64_t globl_base_block_size_ = 0
 
const CoordinateSystemType coord_sys_type_
 

Private Attributes

const SpatialDiscretizationType type_
 

Detailed Description

Definition at line 18 of file SpatialDiscretization.h.

Member Typedef Documentation

◆ SDMType

◆ SpatialWeightFunction

Definition at line 143 of file SpatialDiscretization.h.

Constructor & Destructor Documentation

◆ ~SpatialDiscretization()

virtual chi_math::SpatialDiscretization::~SpatialDiscretization ( )
virtualdefault

◆ SpatialDiscretization()

chi_math::SpatialDiscretization::SpatialDiscretization ( const chi_mesh::MeshContinuum grid,
CoordinateSystemType  cs_type,
SDMType  sdm_type 
)
protected

Definition at line 11 of file SpatialDiscretization.cc.

Member Function Documentation

◆ BuildSparsityPattern()

virtual void chi_math::SpatialDiscretization::BuildSparsityPattern ( std::vector< int64_t > &  nodal_nnz_in_diag,
std::vector< int64_t > &  nodal_nnz_off_diag,
const UnknownManager unknown_manager 
) const
pure virtual

Builds the sparsity pattern for a local block matrix compatible with the given unknown manager. The modified vectors are: nodal_nnz_in_diag which specifies for each row the number of non-zeros in the local diagonal block, nodal_nnz_off_diag which specifies for each row the number of non-zeros in the off-diagonal block.

Implemented in chi_math::spatial_discretization::LagrangeContinuous, chi_math::spatial_discretization::LagrangeDiscontinuous, chi_math::spatial_discretization::PieceWiseLinearContinuous, chi_math::spatial_discretization::PieceWiseLinearDiscontinuous, and chi_math::spatial_discretization::FiniteVolume.

◆ CartesianSpatialWeightFunction()

double chi_math::SpatialDiscretization::CartesianSpatialWeightFunction ( const chi_mesh::Vector3 point)
static

Cartesian coordinate system spatial weighting function.

Definition at line 304 of file SpatialDiscretization.cc.

◆ CopyVectorWithUnknownScope()

void chi_math::SpatialDiscretization::CopyVectorWithUnknownScope ( const std::vector< double > &  from_vector,
std::vector< double > &  to_vector,
const UnknownManager from_vec_uk_structure,
unsigned int  from_vec_uk_id,
const UnknownManager to_vec_uk_structure,
unsigned int  to_vec_uk_id 
) const

Copies DOFs from the from_vector to the to_vector, however, both vectors have the unknown-structure specified, and the given from_vec_uk_id is copied to the to_vec_uk_id.

Copy part of vector A to vector B. Suppose vector A's entries are managed chi_math::UnknownManager A (uk_manA) and that the entries of the vector B are managed by chi_math::UnknownManager B (uk_manB). This function copies the entries associated with an unknown with id uk_id_A in uk_manA from vector A to vector B such that the entries in vector B are aligned with the entries of an unknown with id uk_id_B in uk_manB. All the components are copied.

Parameters
from_vectorVector to copy from.
to_vectorVector to copy to.
from_vec_uk_structureUnknown manager for vector A.
from_vec_uk_idUnknown-id in unknown manager A.
to_vec_uk_structureUnknown manager for vector B.
to_vec_uk_idUnknown-id in unknown manager B.

Definition at line 227 of file SpatialDiscretization.cc.

◆ CylindricalRZSpatialWeightFunction()

double chi_math::SpatialDiscretization::CylindricalRZSpatialWeightFunction ( const chi_mesh::Vector3 point)
static

Cylindrical coordinate system (RZ) spatial weighting function.

Definition at line 310 of file SpatialDiscretization.cc.

◆ GetCellMapping()

const CellMapping & chi_math::SpatialDiscretization::GetCellMapping ( const chi_mesh::Cell cell) const

Definition at line 23 of file SpatialDiscretization.cc.

◆ GetCellNodeLocations()

const std::vector< chi_mesh::Vector3 > & chi_math::SpatialDiscretization::GetCellNodeLocations ( const chi_mesh::Cell cell) const

For the given cell, returns a reference to the relevant node locations. The same can be achieved by retrieving the cell-to-element mapping first.

Definition at line 81 of file SpatialDiscretization.cc.

◆ GetCellNumNodes()

size_t chi_math::SpatialDiscretization::GetCellNumNodes ( const chi_mesh::Cell cell) const

For the given cell, returns the number of relevant nodes. The same can be achieved by retrieving the cell-to-element mapping first.

Definition at line 75 of file SpatialDiscretization.cc.

◆ GetCoordinateSystemType()

CoordinateSystemType chi_math::SpatialDiscretization::GetCoordinateSystemType ( ) const

Definition at line 48 of file SpatialDiscretization.cc.

◆ GetGhostDOFIndices()

virtual std::vector< int64_t > chi_math::SpatialDiscretization::GetGhostDOFIndices ( const UnknownManager unknown_manager) const
pure virtual

◆ GetNumGhostDOFs()

virtual size_t chi_math::SpatialDiscretization::GetNumGhostDOFs ( const UnknownManager unknown_manager) const
pure virtual

◆ GetNumGlobalDOFs()

size_t chi_math::SpatialDiscretization::GetNumGlobalDOFs ( const UnknownManager unknown_manager) const

For the unknown structure in the unknown manager, returns the number of global degrees-of-freedom.

Definition at line 61 of file SpatialDiscretization.cc.

◆ GetNumLocalAndGhostDOFs()

size_t chi_math::SpatialDiscretization::GetNumLocalAndGhostDOFs ( const UnknownManager unknown_manager) const

For the unknown structure in the unknown manager, returns the number of local- and ghost degrees-of-freedom.

Definition at line 69 of file SpatialDiscretization.cc.

◆ GetNumLocalDOFs()

size_t chi_math::SpatialDiscretization::GetNumLocalDOFs ( const UnknownManager unknown_manager) const

For the unknown structure in the unknown manager, returns the number of local degrees-of-freedom.

Definition at line 53 of file SpatialDiscretization.cc.

◆ GetSpatialWeightingFunction()

SpatialDiscretization::SpatialWeightFunction chi_math::SpatialDiscretization::GetSpatialWeightingFunction ( ) const

Returns the spatial weighting function appropriate to the discretization's coordinate system.

Definition at line 324 of file SpatialDiscretization.cc.

◆ Grid()

const chi_mesh::MeshContinuum & chi_math::SpatialDiscretization::Grid ( ) const

Returns the reference grid on which this discretization is based.

Definition at line 43 of file SpatialDiscretization.cc.

◆ LocalizePETScVector()

void chi_math::SpatialDiscretization::LocalizePETScVector ( Vec  petsc_vector,
std::vector< double > &  local_vector,
const UnknownManager unknown_manager 
) const
virtual

Develops a localized view of a petsc vector. Each spatial discretization can have a specialization of this method.

Develops a localized view of a petsc vector.

Definition at line 280 of file SpatialDiscretization.cc.

◆ LocalizePETScVectorWithGhosts()

void chi_math::SpatialDiscretization::LocalizePETScVectorWithGhosts ( Vec  petsc_vector,
std::vector< double > &  local_vector,
const UnknownManager unknown_manager 
) const
virtual

Develops a localized view of a petsc vector. Each spatial discretization can have a specialization of this method.

Develops a localized view of a petsc vector.

Definition at line 293 of file SpatialDiscretization.cc.

◆ MakeCellInternalAndBndryNodeIDs()

std::pair< std::set< uint32_t >, std::set< uint32_t > > chi_math::SpatialDiscretization::MakeCellInternalAndBndryNodeIDs ( const chi_mesh::Cell cell) const

Utility method for getting node indices seperately for domain internal local nodes, and boundary nodes.

Definition at line 87 of file SpatialDiscretization.cc.

◆ MakeInternalFaceNodeMappings()

std::vector< std::vector< std::vector< int > > > chi_math::SpatialDiscretization::MakeInternalFaceNodeMappings ( double  tolerance = 1.0e-12) const

For each local cell, for each face, for each face-node, provides a mapping to the adjacent cell's nodes.

For each cell, for each face of that cell, for each node on that face, maps to which local node on the adjacent cell that node position corresponds.

Parameters
tolerancedouble. Tolerance to use to determine if two node locations are equal. [Default: 1.0e-12]

For example consider two adjacent quadrilaterals.

o--------o--------o                       o--------o
|3      2|3      2|                       |    2   |
|  101   |   102  | , face ids for both:  |3      1|
|0      1|0      1|                       |    0   |
o--------o--------o                       o--------o
internal face for cell 101 is face-1, ccw orientated
--o
 1|
  |
 0|
--o
internal face for cell 102 is face-3, ccw orientated
o-
|0
|
|1
o-

mapping[101][1][0] = 0
mapping[101][1][1] = 3

mapping[102][3][0] = 2
mapping[102][3][1] = 1

Definition at line 153 of file SpatialDiscretization.cc.

◆ MapDOF() [1/2]

virtual int64_t chi_math::SpatialDiscretization::MapDOF ( const chi_mesh::Cell cell,
unsigned int  node 
) const
pure virtual

Maps the local address of a degree of freedom. This can include ghost entries if the specific discretization has any. Default structure here is a single scalar unknown.

Implemented in chi_math::spatial_discretization::LagrangeContinuous, chi_math::spatial_discretization::LagrangeDiscontinuous, chi_math::spatial_discretization::PieceWiseLinearContinuous, chi_math::spatial_discretization::PieceWiseLinearDiscontinuous, and chi_math::spatial_discretization::FiniteVolume.

◆ MapDOF() [2/2]

virtual int64_t chi_math::SpatialDiscretization::MapDOF ( const chi_mesh::Cell cell,
unsigned int  node,
const UnknownManager unknown_manager,
unsigned int  unknown_id,
unsigned int  component 
) const
pure virtual

◆ MapDOFLocal() [1/2]

virtual int64_t chi_math::SpatialDiscretization::MapDOFLocal ( const chi_mesh::Cell cell,
unsigned int  node 
) const
pure virtual

Maps the local address of a degree of freedom. This can include ghost entries if the specific discretization has any. Default structure here is a single scalar unknown.

Implemented in chi_math::spatial_discretization::LagrangeContinuous, chi_math::spatial_discretization::LagrangeDiscontinuous, chi_math::spatial_discretization::PieceWiseLinearContinuous, chi_math::spatial_discretization::PieceWiseLinearDiscontinuous, and chi_math::spatial_discretization::FiniteVolume.

◆ MapDOFLocal() [2/2]

virtual int64_t chi_math::SpatialDiscretization::MapDOFLocal ( const chi_mesh::Cell cell,
unsigned int  node,
const UnknownManager unknown_manager,
unsigned int  unknown_id,
unsigned int  component 
) const
pure virtual

◆ Spherical1DSpatialWeightFunction()

double chi_math::SpatialDiscretization::Spherical1DSpatialWeightFunction ( const chi_mesh::Vector3 point)
static

Spherical coordinate system (1D Spherical) spatial weighting function.

Definition at line 316 of file SpatialDiscretization.cc.

◆ Type()

SpatialDiscretizationType chi_math::SpatialDiscretization::Type ( ) const

Definition at line 41 of file SpatialDiscretization.cc.

Field Documentation

◆ cell_mappings_

std::vector<std::unique_ptr<CellMapping> > chi_math::SpatialDiscretization::cell_mappings_
protected

Definition at line 159 of file SpatialDiscretization.h.

◆ coord_sys_type_

const CoordinateSystemType chi_math::SpatialDiscretization::coord_sys_type_
protected

Definition at line 169 of file SpatialDiscretization.h.

◆ globl_base_block_size_

uint64_t chi_math::SpatialDiscretization::globl_base_block_size_ = 0
protected

Definition at line 167 of file SpatialDiscretization.h.

◆ local_base_block_size_

uint64_t chi_math::SpatialDiscretization::local_base_block_size_ = 0
protected

Definition at line 166 of file SpatialDiscretization.h.

◆ local_block_address_

uint64_t chi_math::SpatialDiscretization::local_block_address_ = 0
protected

Definition at line 162 of file SpatialDiscretization.h.

◆ locJ_block_address_

std::vector<uint64_t> chi_math::SpatialDiscretization::locJ_block_address_
protected

Definition at line 163 of file SpatialDiscretization.h.

◆ locJ_block_size_

std::vector<uint64_t> chi_math::SpatialDiscretization::locJ_block_size_
protected

Definition at line 164 of file SpatialDiscretization.h.

◆ nb_cell_mappings_

std::map<uint64_t, std::shared_ptr<CellMapping> > chi_math::SpatialDiscretization::nb_cell_mappings_
protected

Definition at line 160 of file SpatialDiscretization.h.

◆ ref_grid_

const chi_mesh::MeshContinuum& chi_math::SpatialDiscretization::ref_grid_
protected

Definition at line 158 of file SpatialDiscretization.h.

◆ type_

const SpatialDiscretizationType chi_math::SpatialDiscretization::type_
private

Definition at line 172 of file SpatialDiscretization.h.

◆ UNITARY_UNKNOWN_MANAGER

const UnknownManager chi_math::SpatialDiscretization::UNITARY_UNKNOWN_MANAGER

Definition at line 21 of file SpatialDiscretization.h.


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