Plugins
|
The hybrid smoother by R. Hiptmair. More...
#include <hiptmair_hybrid_smoother.h>
Classes | |
struct | t_red_op_and |
"and" reduction operation class for the conductivity condition More... | |
struct | t_red_op_or |
"or" reduction operation class for the conductivity condition More... | |
struct | tEdgeInfo |
Structure of the storage for the information about the edge-vertex interconnections. More... | |
Public Types | |
typedef MatrixOperator< matrix_type, vector_type > | matrix_operator_type |
Matrix Operator type. More... | |
typedef TAlgebra::matrix_type | matrix_type |
Matrix type. More... | |
typedef MatrixOperator< pot_matrix_type, pot_vector_type > | pot_matrix_operator_type |
Matrix Operator type for the potential space. More... | |
typedef TPotAlgebra::matrix_type | pot_matrix_type |
Matrix type for the potential space. More... | |
typedef TPotAlgebra::vector_type | pot_vector_type |
Vector type for the potential space. More... | |
typedef GridFunction< TDomain, TAlgebra > | TGridFunc |
Grid function type for the solution. More... | |
typedef CPUAlgebra | TPotAlgebra |
The auxiliary algebra type for the space of the potential. (Note: It should be scalar.) More... | |
typedef GridFunction< TDomain, TPotAlgebra > | TPotGridFunc |
Grid function type for the potential. More... | |
typedef TAlgebra::vector_type | vector_type |
Vector type. More... | |
Public Types inherited from ug::ILinearIterator< class, class > | |
typedef Y | codomain_function_type |
typedef X | domain_function_type |
Public Types inherited from ug::DebugWritingObject< TAlgebra > | |
typedef TAlgebra | algebra_type |
typedef TAlgebra::matrix_type | matrix_type |
typedef TAlgebra::vector_type | vector_type |
Public Types inherited from VectorDebugWritingObject< TAlgebra::vector_type > | |
typedef TAlgebra::vector_type | vector_type |
Public Member Functions | |
bool | apply (vector_type &c, const vector_type &d) |
Computes the correction. More... | |
bool | apply_update_defect (vector_type &c, vector_type &d) |
Computes the correction and updates the defect d := d - L*c. More... | |
SmartPtr< ILinearIterator< vector_type, vector_type > > | clone () |
Clone the smoother by copying the data. More... | |
bool | init (SmartPtr< ILinearOperator< vector_type > > J, const vector_type &u) |
Initialization using a matrix and a GridFunction (not merely a vector!) More... | |
bool | init (SmartPtr< ILinearOperator< vector_type > > L) |
We cannot initialize without the geometry (this version of init cannot not work) More... | |
const char * | name () const |
Returns the name. More... | |
void | set_Dirichlet (SmartPtr< EMDirichlet< TDomain, TAlgebra > > spDirichlet) |
Sets the Dirichlet boundary. More... | |
void | set_skip_edge_smoother (bool skip_edge) |
Skip flag the edge smoother. More... | |
void | set_skip_vertex_smoother (bool skip_vertex) |
Skip flag the vertex smoother. More... | |
bool | supports_parallel () const |
Currently returns false because the computation of the potentials is not purely parallel up to now. More... | |
TimeHarmonicNedelecHybridSmoother (SmartPtr< ApproximationSpace< TDomain > > vertApproxSpace, SmartPtr< ILinearIterator< vector_type > > edgeSmoother, SmartPtr< ILinearIterator< pot_vector_type > > vertSmoother) | |
Constructor setting the approx. spaces and the default subsmoothers. More... | |
~TimeHarmonicNedelecHybridSmoother () | |
Destructor. More... | |
Public Member Functions inherited from ug::ILinearIterator< class, class > | |
virtual bool | apply (Y &c, const X &d)=0 |
virtual bool | apply_update_defect (Y &c, X &d)=0 |
virtual std::string | config_string () const |
SmartPtr< IDamping< X, Y > > | damping () |
ILinearIterator () | |
ILinearIterator (const ILinearIterator< X, Y > &parent) | |
virtual bool | init (SmartPtr< ILinearOperator< Y, X > > J, const Y &u)=0 |
virtual bool | init (SmartPtr< ILinearOperator< Y, X > > L)=0 |
void | set_damp (number factor) |
void | set_damp (SmartPtr< IDamping< X, Y > > spScaling) |
virtual | ~ILinearIterator () |
Public Member Functions inherited from ug::DebugWritingObject< TAlgebra > | |
SmartPtr< IDebugWriter< algebra_type > > | debug_writer () |
ConstSmartPtr< IDebugWriter< algebra_type > > | debug_writer () const |
bool | debug_writer_valid () const |
DebugWritingObject () | |
DebugWritingObject (const DebugWritingObject< algebra_type > &parent) | |
DebugWritingObject (SmartPtr< IDebugWriter< algebra_type > > spDebugWriter) | |
virtual void | set_debug (SmartPtr< IDebugWriter< algebra_type > > spDebugWriter) |
virtual | ~DebugWritingObject () |
Public Member Functions inherited from VectorDebugWritingObject< TAlgebra::vector_type > | |
virtual void | set_debug (SmartPtr< IVectorDebugWriter< vector_type > > spDebugWriter) |
SmartPtr< IVectorDebugWriter< vector_type > > | vector_debug_writer () |
ConstSmartPtr< IVectorDebugWriter< vector_type > > | vector_debug_writer () const |
bool | vector_debug_writer_valid () const |
VectorDebugWritingObject () | |
VectorDebugWritingObject (SmartPtr< IVectorDebugWriter< vector_type > > spDebugWriter) | |
void | write_debug (const vector_type &vec, const char *filename) |
virtual | ~VectorDebugWritingObject () |
Private Types | |
typedef TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra > | this_type |
Private Member Functions | |
void | collect_edge_defect (const vector_type &d, pot_vector_type &potDefRe, pot_vector_type &potDefIm) |
Computes the vertex-centered defect \( d_{pot} = G^T d \). More... | |
void | compute_GtMG () |
Computes the product \( G^T M^{(1)}_h G \). More... | |
void | compute_potential_matrix (const DoFDistribution *pEdgeDD, const DoFDistribution *pVertDD) |
Computes the matrix for the smoother in the potential space and marks the "conductive nodes". More... | |
void | distribute_vertex_correction (pot_vector_type &potCorRe, pot_vector_type &potCorIm, vector_type &c) |
Adds the vertex-centered correction to the edge-centered one: More... | |
void | get_edge_vert_correspondence (const DoFDistribution *pEdgeDD, const DoFDistribution *pVertDD) |
Gets the correspondence between the edges and the vertices. More... | |
bool | zero_mass_entry (double val) |
Measure for numerically zero entries in the mass matrix. More... | |
Private Attributes | |
bool | m_bInit |
Whether initialized. More... | |
bool | m_bSkipEdge |
Needed mainly for debugging: Whether to skip one of the stages. More... | |
bool | m_bSkipVertex |
GridLevel | m_GridLevel |
Grid level (or surface) where to smooth. More... | |
TPotGridFunc * | m_pPotCorIm |
Vertex-centered grid function for the Im-part of potential corrections (this is a GridFunction to allow geometry-dependent smoothers) More... | |
TPotGridFunc * | m_pPotCorRe |
Vertex-centered grid function for the Re-part of potential corrections (this is a GridFunction to allow geometry-dependent smoothers) More... | |
SmartPtr< EMDirichlet< TDomain, TAlgebra > > | m_spDirichlet |
Dirichlet boundary. More... | |
SmartPtr< DoFDistribution > | m_spEdgeDD |
DoF distribution for the Nedelec elements. More... | |
SmartPtr< ILinearIterator< vector_type > > | m_spEdgeSmoother |
Smoother for the edge dofs. More... | |
SmartPtr< pot_matrix_operator_type > | m_spPotMat |
Vertex-centered matrix for the potential. More... | |
SmartPtr< matrix_operator_type > | m_spSysMat |
Edge-centered matrix of the original equation. More... | |
SmartPtr< ApproximationSpace< TDomain > > | m_spVertApproxSpace |
Approximation space for the potential (vertex-centered) space. More... | |
SmartPtr< DoFDistribution > | m_spVertDD |
Level DoF distribution for the vertex centered grid func. More... | |
SmartPtr< ILinearIterator< pot_vector_type > > | m_spVertSmoother |
Smoother for the vertex dofs. More... | |
VariableArray1< tEdgeInfo > | m_vEdgeInfo |
Storage for the information about the edge-vertex interconnections. More... | |
The hybrid smoother by R. Hiptmair.
This class implements the hybrid smoother proposed by R. Hiptmair for the discretizations based on the Nedelec element. The smoother is based on the approximate Helmholtz decomponstion of the operator. This implementation is constructed for the discretizations of the time-harmonic equations. The class computes the matrix for the discrete potential and calls two further smoothers specified by the user: one in the space of the edge elements (Whitney-1 or Nedelec forms) and one in the vertex-centered potential space (i.e. the Whitney-0 or Lagrange-1 elements). Accordingly, this smoother requires 2 approximation spaces: one for the edge dofs and one for the vertex dofs.
References:
TDomain | Type of Domain |
TAlgebra | Type of Algebra |
typedef MatrixOperator<matrix_type, vector_type> ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::matrix_operator_type |
Matrix Operator type.
typedef TAlgebra::matrix_type ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::matrix_type |
Matrix type.
typedef MatrixOperator<pot_matrix_type, pot_vector_type> ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::pot_matrix_operator_type |
Matrix Operator type for the potential space.
typedef TPotAlgebra::matrix_type ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::pot_matrix_type |
Matrix type for the potential space.
typedef TPotAlgebra::vector_type ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::pot_vector_type |
Vector type for the potential space.
typedef GridFunction<TDomain, TAlgebra> ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::TGridFunc |
Grid function type for the solution.
|
private |
typedef CPUAlgebra ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::TPotAlgebra |
The auxiliary algebra type for the space of the potential. (Note: It should be scalar.)
typedef GridFunction<TDomain, TPotAlgebra> ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::TPotGridFunc |
Grid function type for the potential.
typedef TAlgebra::vector_type ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::vector_type |
Vector type.
|
inline |
Constructor setting the approx. spaces and the default subsmoothers.
vertApproxSpace | vertex-centered approx. space |
edgeSmoother | the edge-centered smoother |
vertSmoother | the vertex-centered smoother |
References SmartPtr< class, FreePolicy >::invalid(), ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::m_spEdgeSmoother, ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::m_spVertApproxSpace, ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::m_spVertSmoother, ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::name(), and UG_THROW.
|
inline |
bool ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::apply | ( | vector_type & | c, |
const vector_type & | d | ||
) |
Computes the correction.
This method applies the iterator operator, i.e. invertes the approximate matrix. The defect d remains unchanged.
The idea is to apply first the edge-centered smoother (specified as the argument of the constructor of the class). To the correction obtained in this way, the vertex-centered correction is added. The latter is obtained by the application of the vertex-centered smoother to the system
\begin{eqnarray*} \left ( \begin{array} {cc} 0 & A_{pot} \\ A_{pot} & 0 \end{array} \right ) \left ( \begin{array} {c} \mathbf{Re} c_{pot} \\ \mathbf{Im} c_{pot} \end{array} \right ) = \left ( \begin{array} {c} - \mathbf{Re} d_{pot} \\ \mathbf{Im} d_{pot} \end{array} \right ), \end{eqnarray*}
where \( A_{pot} = G^T M^{(1)}_h G \) and \( d_{pot} = G^T d \). To add the vertex-centered correction, obtained in this way, to the edge-centered one, one sets: \( c := c_{edge} + G c_{pot} \).
[in] | d | defect |
[out] | c | correction |
References ug::PST_ADDITIVE, ug::PST_CONSISTENT, ParallelVector< Vector< double > >::set_layouts(), ParallelVector< Vector< double > >::set_storage_type(), UG_LOG, and UG_THROW.
Referenced by ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::apply_update_defect().
|
inline |
Computes the correction and updates the defect d := d - L*c.
References ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::apply(), ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::m_spSysMat, ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::name(), and UG_THROW.
|
inlinevirtual |
Clone the smoother by copying the data.
Implements ug::ILinearIterator< class, class >.
References ug::ILinearIterator< class, class >::damping(), ug::DebugWritingObject< TAlgebra >::debug_writer(), ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::m_bSkipEdge, ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::m_bSkipVertex, ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::m_spDirichlet, ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::m_spEdgeSmoother, ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::m_spVertApproxSpace, and ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::m_spVertSmoother.
|
private |
Computes the vertex-centered defect \( d_{pot} = G^T d \).
Computes the defect in the potential space: \( d_{pot} = G^T d \), where \( d \) is the defect of the original system. This is done only for the 'conductive' vertices. At the other vertices, \( d_{pot} \) is set to 0.
d | original (edge-centered) defect |
potDefRe | real part of \( d_{pot} \) |
potDefIm | imaginary part of \( d_{pot} \) |
References ug::BlockRef(), ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::tEdgeInfo::conductive_vrt_0(), ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::tEdgeInfo::conductive_vrt_1(), ParallelVector< Vector< double > >::set(), and ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::tEdgeInfo::vrt_index.
|
private |
Computes the product \( G^T M^{(1)}_h G \).
Performs the multiplication \( G^T M^{(1)}_h G \). Furthermore, marks the 'conductive' vertices, i.e. the vertices that lie on the closure of the conductive subset (i.e. fills the m_vConductiveVertex array). 'Conductive' vertices are ends of the edges whose entries of the mass matrix \( M^{(1)}_h\) are non-zero. Any other vertex, which is not an end of such an edge, is considered as 'non-conductive'.
For the non-conductive nodes, the function sets the row of the potential stiffness matrix to the identity.
This function uses the m_vEdgeInfo-array to get the correspondence between the edges.
References ug::VariableArray1< class >::at(), ug::BlockRef(), ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::tEdgeInfo::is_Dirichlet(), ug::VariableArray1< class >::resize(), ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::tEdgeInfo::set_conductive_vrt_0(), ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::tEdgeInfo::set_conductive_vrt_1(), ug::SetDirichletRow(), UG_THROW, and ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::tEdgeInfo::vrt_index.
|
private |
Computes the matrix for the smoother in the potential space and marks the "conductive nodes".
Computes the matrix \(A_{pot}\) for the smoother in the potential space and marks the "conductive nodes" for the computation of the correction.
\begin{eqnarray*} A_{pot} = G^T M^{(1)}_h G, \end{eqnarray*}
where \(G\) is the note-to-edge gradient incidence matrix and \(M^{(1)}_h\) is the mass matrix of the Whitney-1-forms, taken from the (2, 1)-position of the block-form of the system matrix of the time-harmonic system:
\begin{eqnarray*} \left ( \begin{array} {cc} - S_h (\mu^{-1}) & \omega M^{(1)}_h (\sigma) \\ \omega M^{(1)}_h (\sigma) & S_h (\mu^{-1}) \end{array} \right ) \end{eqnarray*}
(this is the edge-centered matrix).
TDomain | type of domain in the class |
TAlgebra | type of algebra in the class |
pEdgeDD | edge-centered DoF distribution of the grid functions |
pVertDD | vertex-centered DoF distribution of the grid functions |
References ug::DoFDistribution::layouts(), ug::DoFDistribution::num_indices(), UG_CATCH_THROW, and UG_THROW.
|
private |
Adds the vertex-centered correction to the edge-centered one:
Updates the edge-centered correction: \( c := c_{edge} + G c_{pot} \).
potCorRe | real part of the potential correction \( c_{pot} \) |
potCorIm | imaginary part of the potential correction \( c_{pot} \) |
c | final (edge-centered) correction |
References ug::BlockRef(), and ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::tEdgeInfo::vrt_index.
|
private |
Gets the correspondence between the edges and the vertices.
Gets the correspondence between the edge DoFs and the vertex DoFs (i.e. fills the tEdgeInfo-structures in m_vEdgeInfo). Furthermore, this function marks edges at Dirichlet boundaries.
TDomain | type of domain in the class |
TAlgebra | type of algebra in the class |
pEdgeDD | edge-centered DoF distribution of the grid functions |
pVertDD | vertex-centered DoF distribution of the grid functions |
References ug::DoFDistribution::begin(), ug::DoFDistribution::end(), ug::DoFDistribution::inner_algebra_indices(), ug::DoFDistribution::num_indices(), ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::tEdgeInfo::set_init(), ug::SubsetGroup::size(), ug::DoFDistributionInfoProvider::subset_handler(), UG_THROW, ug::EdgeVertices::vertex(), and ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::tEdgeInfo::vrt_index.
bool ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::init | ( | SmartPtr< ILinearOperator< vector_type > > | J, |
const vector_type & | u | ||
) |
Initialization using a matrix and a GridFunction (not merely a vector!)
This function initializes the smoother with the matrix J and the geometry read from the GridFunction u. Note that u should be a GridFunction, not merely a vector.
[in] | J | the matrix of the time-harmonic Nedelec discretization |
[in] | u | the grid function containing the grid info (the values are not used) |
References ug::PST_CONSISTENT, and UG_THROW.
|
inline |
We cannot initialize without the geometry (this version of init cannot not work)
References ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::name(), and UG_THROW.
|
inlinevirtual |
Returns the name.
Implements ug::ILinearIterator< class, class >.
Referenced by ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::apply_update_defect(), ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::init(), and ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::TimeHarmonicNedelecHybridSmoother().
|
inline |
Sets the Dirichlet boundary.
spDirichlet | the Dirichlet BC object |
References ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::m_spDirichlet.
|
inline |
Skip flag the edge smoother.
References ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::m_bSkipEdge.
|
inline |
Skip flag the vertex smoother.
References ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::m_bSkipVertex.
|
inlinevirtual |
Currently returns false because the computation of the potentials is not purely parallel up to now.
Implements ug::ILinearIterator< class, class >.
|
inlineprivate |
Measure for numerically zero entries in the mass matrix.
|
private |
Whether initialized.
|
private |
Needed mainly for debugging: Whether to skip one of the stages.
Referenced by ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::clone(), and ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::set_skip_edge_smoother().
|
private |
|
private |
Grid level (or surface) where to smooth.
|
private |
Vertex-centered grid function for the Im-part of potential corrections (this is a GridFunction to allow geometry-dependent smoothers)
Referenced by ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::~TimeHarmonicNedelecHybridSmoother().
|
private |
Vertex-centered grid function for the Re-part of potential corrections (this is a GridFunction to allow geometry-dependent smoothers)
Referenced by ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::~TimeHarmonicNedelecHybridSmoother().
|
private |
|
private |
DoF distribution for the Nedelec elements.
|
private |
|
private |
Vertex-centered matrix for the potential.
|
private |
Edge-centered matrix of the original equation.
Referenced by ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::apply_update_defect().
|
private |
Approximation space for the potential (vertex-centered) space.
Referenced by ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::clone(), and ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::TimeHarmonicNedelecHybridSmoother().
|
private |
Level DoF distribution for the vertex centered grid func.
|
private |
Smoother for the vertex dofs.
Referenced by ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::clone(), and ug::Electromagnetism::TimeHarmonicNedelecHybridSmoother< TDomain, TAlgebra >::TimeHarmonicNedelecHybridSmoother().
|
private |
Storage for the information about the edge-vertex interconnections.