OGS
ProcessLib::NodalSourceTerm Class Referencefinal

Detailed Description

Definition at line 17 of file NodalSourceTerm.h.

#include <NodalSourceTerm.h>

Inheritance diagram for ProcessLib::NodalSourceTerm:
[legend]
Collaboration diagram for ProcessLib::NodalSourceTerm:
[legend]

Public Member Functions

 NodalSourceTerm (std::unique_ptr< NumLib::LocalToGlobalIndexMap > source_term_dof_table, std::size_t const source_term_mesh_id, MeshLib::Mesh const &st_mesh, const int variable_id, const int component_id, ParameterLib::Parameter< double > const &parameter)
 
void integrate (const double t, GlobalVector const &x, GlobalVector &b, GlobalMatrix *jac) const override
 
- Public Member Functions inherited from ProcessLib::SourceTerm
 SourceTerm (std::unique_ptr< NumLib::LocalToGlobalIndexMap > source_term_dof_table)
 
virtual ~SourceTerm ()=default
 

Private Attributes

std::size_t const _source_term_mesh_id
 
MeshLib::Mesh const & _st_mesh
 
int const _variable_id
 
int const _component_id
 
ParameterLib::Parameter< double > const & _parameter
 

Additional Inherited Members

- Protected Attributes inherited from ProcessLib::SourceTerm
std::unique_ptr< NumLib::LocalToGlobalIndexMap > const _source_term_dof_table
 

Constructor & Destructor Documentation

◆ NodalSourceTerm()

ProcessLib::NodalSourceTerm::NodalSourceTerm ( std::unique_ptr< NumLib::LocalToGlobalIndexMap > source_term_dof_table,
std::size_t const source_term_mesh_id,
MeshLib::Mesh const & st_mesh,
const int variable_id,
const int component_id,
ParameterLib::Parameter< double > const & parameter )
explicit

Definition at line 17 of file NodalSourceTerm.cpp.

24 : SourceTerm(std::move(source_term_dof_table)),
25 _source_term_mesh_id(source_term_mesh_id),
26 _st_mesh(st_mesh),
27 _variable_id(variable_id),
28 _component_id(component_id),
29 _parameter(parameter)
30{
31 DBUG("Create NodalSourceTerm.");
32}
void DBUG(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
std::size_t const _source_term_mesh_id
ParameterLib::Parameter< double > const & _parameter
MeshLib::Mesh const & _st_mesh
SourceTerm(std::unique_ptr< NumLib::LocalToGlobalIndexMap > source_term_dof_table)
Definition SourceTerm.h:23

References DBUG().

Member Function Documentation

◆ integrate()

void ProcessLib::NodalSourceTerm::integrate ( const double t,
GlobalVector const & x,
GlobalVector & b,
GlobalMatrix * jac ) const
overridevirtual

Implements ProcessLib::SourceTerm.

Definition at line 34 of file NodalSourceTerm.cpp.

36{
37 DBUG("Assemble NodalSourceTerm.");
38
39 for (MeshLib::Node const* const node : _st_mesh.getNodes())
40 {
41 auto const node_id = node->getID();
44 auto const global_index = _source_term_dof_table->getGlobalIndex(
46
47 if (global_index == NumLib::MeshComponentMap::nop)
48 {
49 continue;
50 }
51 // For the DDC approach (e.g. with PETSc option), the negative
52 // index of global_index means that the entry by that index is a ghost
53 // one, which should be dropped. Especially for PETSc routines
54 // MatZeroRows and MatZeroRowsColumns, which are called to apply the
55 // Dirichlet BC, the negative index is not accepted like other matrix or
56 // vector PETSc routines. Therefore, the following if-condition is
57 // applied.
58 if (global_index >= 0)
59 {
61 pos.setNodeID(node_id);
62 pos.setCoordinates(*node);
63
64 b.add(global_index, _parameter(t, pos).front());
65 }
66 }
67}
void add(IndexType rowId, double v)
add entry
Definition EigenVector.h:76
std::vector< Node * > const & getNodes() const
Get the nodes-vector for the mesh.
Definition Mesh.h:106
static constexpr NUMLIB_EXPORT GlobalIndexType const nop
void setNodeID(std::size_t node_id)
void setCoordinates(MathLib::Point3d const &coordinates)
std::unique_ptr< NumLib::LocalToGlobalIndexMap > const _source_term_dof_table
Definition SourceTerm.h:35

References _component_id, _parameter, ProcessLib::SourceTerm::_source_term_dof_table, _source_term_mesh_id, _st_mesh, _variable_id, MathLib::EigenVector::add(), DBUG(), MeshLib::Mesh::getNodes(), MeshLib::Node, NumLib::MeshComponentMap::nop, ParameterLib::SpatialPosition::setCoordinates(), and ParameterLib::SpatialPosition::setNodeID().

Member Data Documentation

◆ _component_id

int const ProcessLib::NodalSourceTerm::_component_id
private

Definition at line 33 of file NodalSourceTerm.h.

Referenced by integrate().

◆ _parameter

ParameterLib::Parameter<double> const& ProcessLib::NodalSourceTerm::_parameter
private

Definition at line 34 of file NodalSourceTerm.h.

Referenced by integrate().

◆ _source_term_mesh_id

std::size_t const ProcessLib::NodalSourceTerm::_source_term_mesh_id
private

Definition at line 30 of file NodalSourceTerm.h.

Referenced by integrate().

◆ _st_mesh

MeshLib::Mesh const& ProcessLib::NodalSourceTerm::_st_mesh
private

Definition at line 31 of file NodalSourceTerm.h.

Referenced by integrate().

◆ _variable_id

int const ProcessLib::NodalSourceTerm::_variable_id
private

Definition at line 32 of file NodalSourceTerm.h.

Referenced by integrate().


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