Template Class Component
Defined in File Component.hpp
Nested Relationships
Nested Types
Inheritance Relationships
Base Type
public GridKit::Model::Evaluator< scalar_type, index_type >(Template Class Evaluator)
Derived Types
public GridKit::EMT::Bus< scalar_type, index_type >(Template Class Bus)public GridKit::EMT::LoadZ< scalar_type, index_type >(Template Class LoadZ)public GridKit::EMT::SystemModel< scalar_type, index_type >(Template Class SystemModel)public GridKit::EMT::VectorFit< scalar_type, index_type >(Template Class VectorFit)
Class Documentation
-
template<typename scalar_type, typename index_type>
class Component : public GridKit::Model::Evaluator<scalar_type, index_type> EMT component, which views its blocks of the system vectors.
The local variables are the internal variables, then the external variables of each port. Each has a value, a derivative and a residual.
Subclassed by GridKit::EMT::Bus< scalar_type, index_type >, GridKit::EMT::LoadZ< scalar_type, index_type >, GridKit::EMT::SystemModel< scalar_type, index_type >, GridKit::EMT::VectorFit< scalar_type, index_type >
Public Functions
-
template<typename PortT>
int connect(PortT port, Component &component, IdxT offset = 0) Connect
portto the local variables ofcomponentfromoffset.
-
template<typename PortT>
int connect(PortT port, Component &component, std::vector<IdxT> indices) Connect
portto the local variables ofcomponentatindices.
-
template<Utilities::SizedEnum VariableT>
inline IdxT size(VariableT variable) const Size of internal variable
variable.
-
template<Utilities::SizedEnum VariableT>
inline std::span<ScalarT> y(VariableT variable) Values of internal variable
variable, once the system is allocated.
-
template<Utilities::SizedEnum VariableT>
inline std::span<ScalarT> getResidual(VariableT variable) Residuals of internal variable
variable, once the system is allocated.
-
template<Utilities::SizedEnum VariableT>
inline std::span<ScalarT> absoluteTolerance(VariableT variable) Absolute tolerances of internal variable
variable, once the system is allocated.
-
inline const std::string &id() const
Case id, or
id.symbolfor a submodel.
-
inline virtual int allocate() override
The system binds each component to its blocks.
-
inline virtual int tagDifferentiable() override
Fill the tag() vector with proper indicators.
Note
For some models, this may be a no-op, and the vector returned by tag() will still be empty.
- Pre:
allocate() must have been called.
-
inline virtual int setAbsoluteTolerance(RealT rel_tol) override
The relative tolerance, unless a model scales its own.
-
inline virtual int evaluateResidual() override
Evaluate the model’s residual function.
For models which can be appropriately modeled in semi-explicit form, this will evaluate
\[F(t, y, \dot{y}) = f(t,y) - M \dot{y},\]where\[M\]is the mass matrix. For models which can be modeled in Hessenberg form,\[M\]should be a simple indicator function for if the variable is differential (if\[\dot{y}\]appears in its equation). This indicator should be given by tag().
-
virtual int evaluateJacobian() override
dF/dy + alpha dF/dy’ from the partials of the last tagging
-
inline virtual IdxT size() override
How many variables exist in the model.
-
inline virtual IdxT nnz() override
How many non-zero elements are in this model’s Jacobian.
This knowledge may be needed to allocate the buffers for the model’s Jacobian, so it it should not depend on allocate() having been called.
See also
-
inline virtual bool hasJacobian() override
Is the Jacobian defined. Used in IDA to determine whether DQ is used or not.
- Returns:
true
- Returns:
false
-
inline virtual VectorT &absoluteTolerance() override
Get the absolute tolerance for each variable in the model.
- Returns:
a reference to the absolute tolerance vector.
- Pre:
setAbsoluteTolerancemust have been called first.
-
inline virtual const VectorT &absoluteTolerance() const override
Get the absolute tolerance for each variable in the model.
- Returns:
a const reference to the absolute tolerance vector.
- Pre:
setAbsoluteTolerancemust have been called first.
-
inline virtual std::vector<bool> &tag() override
An indicator for which variables in the model are differential (true) or algebraic (false).
This information may be required for certain integrator features (such as the AnalysisManager::NativeDynamicSolver::Rosenbrock integrator), but is not required to be set. A reference to an empty vector may be returned.
- Pre:
tagDifferentiable() must have been called.
-
struct Port
External variables read from and added to the local variables of
componentatindices.
-
struct CooBuffer
Derivative entries in global indices.
-
template<typename PortT>