Plugins
|
Projection procedure class. More...
#include <nedelec_project.h>
Classes | |
class | AuxLaplaceLocAss |
Class for local assembling of the auxiliary Laplace operator. More... | |
class | AuxLaplaceRHS |
Constraint that assembles the rhs und the bc for the auxiliary problems. More... | |
struct | ClearDivInConductors |
Helper class for assembling the weak divergence operator. More... | |
struct | IntegrateDivDVF |
Helper class for computation of the charges of the DVFs. More... | |
class | LocLaplaceA |
Helper class for assembling the local stiffness matrix of Laplacian in various routines. More... | |
struct | MarkCondVert |
Helper class for setting the base conductor indices to vertices. More... | |
struct | WeakDiv |
Helper class for the computation the weak divergence. More... | |
Public Types | |
typedef TAlgebra | algebra_type |
Type of algebra (for the Nedelec-element-based grid functions) More... | |
typedef TDomain | domain_type |
Type of Domain. More... | |
typedef TDomain::grid_type | grid_type |
Type of Grid: More... | |
typedef TAlgebra::matrix_type | matrix_type |
Type of Vector (for the Nedelec-element-based grid functions) More... | |
typedef TDomain::position_type | position_type |
position type More... | |
typedef GridFunction< TDomain, TPotAlgebra > | pot_gf_type |
Grid function 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 domain_type::subset_handler_type | subset_handler_type |
Type of subset handler. More... | |
typedef CPUAlgebra | TPotAlgebra |
The auxiliary algebra type for the space of the potential. (Note: It should be scalar.) More... | |
typedef TAlgebra::vector_type | vector_type |
Type of Vector (for the Nedelec-element-based grid functions) More... | |
Public Types inherited from ug::IPProcessVector< TAlgebra::vector_type > | |
typedef TVector | vector_type |
Public Member Functions | |
void | apply (GridFunction< TDomain, TAlgebra > &u, const char *fct_names) |
Performs the projection of given functions. More... | |
void | apply (GridFunction< TDomain, TAlgebra > &u, const FunctionGroup &fctGrp) |
Performs the projection of given functions. More... | |
void | apply (vector_type &vec) |
Performs the projection of all functions in a grid function. More... | |
void | compute_div (SmartPtr< GridFunction< TDomain, TAlgebra > > sp_u, const char *u_fct_name, SmartPtr< GridFunction< TDomain, TPotAlgebra > > sp_div) |
Computes the weak divergence in insulators. More... | |
NedelecProject (SmartPtr< EMaterial< TDomain > > emMatherial, SmartPtr< ApproximationSpace< TDomain > > vertApproxSpace, SmartPtr< ILinearOperatorInverse< pot_vector_type > > potSolver) | |
Constructor. More... | |
void | set_dampDVFs (bool val) |
Sets whether to damp Dirichlet vector fields. More... | |
void | set_Dirichlet (SmartPtr< EMDirichlet< TDomain, TAlgebra > > spDirichlet) |
Sets the Dirichlet boundary. More... | |
~NedelecProject () | |
Destructor. More... | |
Public Member Functions inherited from ug::IPProcessVector< TAlgebra::vector_type > | |
virtual void | apply (vector_type &v)=0 |
virtual | ~IPProcessVector () |
Static Public Attributes | |
static const int | WDim = TDomain::dim |
world dimention More... | |
Private Types | |
typedef AInt | a_vert_cond_type |
Type of the attachment and its accessor the base conductor indices. More... | |
typedef Grid::VertexAttachmentAccessor< a_vert_cond_type > | aa_vert_cond_type |
typedef NedelecProject< TDomain, TAlgebra > | this_type |
This type. More... | |
Private Member Functions | |
void | alloc_DVFs (const TDomain &domain, pot_gf_type &aux_rhs) |
Allocates memory for the DVFs associated with the ungrounded conductors. More... | |
void | assemble_div (const TDomain &domain, const DoFDistribution &edgeDD, const vector_type &u, size_t fct, const DoFDistribution &vertDD, pot_vector_type &div, DenseVector< VariableArray1< number > > &charge) |
Assembles the weak divergence operator on the whole grid. More... | |
template<typename TElem > | |
void | clear_div_in_conductors (const DoFDistribution &vertDD, pot_vector_type &div, DenseVector< VariableArray1< number > > &charge) |
Sets the div operator to 0 in conductors (for all elements of the same type) More... | |
void | compute_DVF_potential_coeffs (const TDomain &domain, DoFDistribution &vertDD) |
Computes the potential coefficients. More... | |
void | compute_DVFs (pot_gf_type &aux_rhs) |
Computes the Dirichlet vector fields (DVFs) More... | |
void | damp_DVFs (pot_vector_type &cor, const DenseVector< VariableArray1< number > > &charge) |
Damps the Dirichlet vector fields (DVFs) More... | |
void | distribute_cor (const TDomain &domain, const DoFDistribution &edgeDD, vector_type &u, size_t fct, const DoFDistribution &vertDD, const pot_vector_type &cor) |
Updates the grid function by the potential correction. More... | |
template<typename TElem > | |
void | integrate_div_DVF_elem_type (const TDomain &domain, const DoFDistribution &vertDD, const aa_vert_cond_type &vert_base_cond, DenseMatrix< VariableArray2< number > > &C) |
Integrates div E over boundaries of conductors for elements of the same type. More... | |
template<typename TElem > | |
void | mark_cond_vert_elem_type (DoFDistribution &vertDD, aa_vert_cond_type &vert_base_cond) |
Sets the base conductor indices for every vertex (for all elements of the same type) More... | |
void | project_func (const SmartPtr< TDomain > &domain, const SmartPtr< DoFDistribution > &edgeDD, vector_type &u, size_t fct, const SmartPtr< DoFDistribution > &vertDD, pot_gf_type &aux_rhs, pot_gf_type &aux_cor) |
Projects one function (i.e. performs the main action): More... | |
template<typename TElem > | |
void | weak_div_elem_type (const TDomain &domain, const DoFDistribution &edgeDD, const vector_type &u, size_t fct, const DoFDistribution &vertDD, pot_vector_type &div) |
Computes the weak divergence (for all elements of the same type) More... | |
Private Attributes | |
SmartPtr< DomainDiscretization< TDomain, TPotAlgebra > > | m_auxLaplaceAss |
Global discretization of the auxiliary equations. More... | |
SmartPtr< AssembledLinearOperator< TPotAlgebra > > | m_auxLaplaceOp |
Matrix of the discretization. More... | |
SmartPtr< AuxLaplaceRHS > | m_auxLaplaceRHS |
Rhs and BC for the auxiliary problem. More... | |
SmartPtr< AuxLaplaceLocAss > | m_auxLocLaplace |
Local discretization of the auxiliary equations. More... | |
bool | m_bDampDVFs |
Whether to damp the Dirichlet vector fields (DVFs) More... | |
std::vector< pot_gf_type * > | m_DVF_phi |
Dirichlet vector fields (DVFs) More... | |
DenseMatrix< VariableArray2< number > > | m_potCoeff |
Potential coefficients: More... | |
SmartPtr< ILinearOperatorInverse< pot_vector_type > > | m_potSolver |
Solver for the auxliliary equations. More... | |
SmartPtr< EMDirichlet< TDomain, TAlgebra > > | m_spDirichlet |
Dirichlet boundary. More... | |
SmartPtr< EMaterial< TDomain > > | m_spEmMaterial |
Properties of the matherials in the domain. More... | |
SmartPtr< ApproximationSpace< TDomain > > | m_spVertApproxSpace |
Approximation space for the potential (vertex-centered) space. More... | |
Projection procedure class.
This class implements the procedure for projection of vector fields in the Nedelec-element representation to the divergence-free space and elimination of the non-zero potentials of conductors.
|
private |
Type of the attachment and its accessor the base conductor indices.
|
private |
typedef TAlgebra ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::algebra_type |
Type of algebra (for the Nedelec-element-based grid functions)
typedef TDomain ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::domain_type |
Type of Domain.
typedef TDomain::grid_type ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::grid_type |
Type of Grid:
typedef TAlgebra::matrix_type ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::matrix_type |
Type of Vector (for the Nedelec-element-based grid functions)
typedef TDomain::position_type ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::position_type |
position type
typedef GridFunction<TDomain, TPotAlgebra> ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::pot_gf_type |
Grid function type for the potential space.
typedef TPotAlgebra::matrix_type ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::pot_matrix_type |
Matrix type for the potential space.
typedef TPotAlgebra::vector_type ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::pot_vector_type |
Vector type for the potential space.
typedef domain_type::subset_handler_type ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::subset_handler_type |
Type of subset handler.
|
private |
This type.
typedef CPUAlgebra ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::TPotAlgebra |
The auxiliary algebra type for the space of the potential. (Note: It should be scalar.)
typedef TAlgebra::vector_type ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::vector_type |
Type of Vector (for the Nedelec-element-based grid functions)
ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::NedelecProject | ( | SmartPtr< EMaterial< TDomain > > | emMatherial, |
SmartPtr< ApproximationSpace< TDomain > > | vertApproxSpace, | ||
SmartPtr< ILinearOperatorInverse< pot_vector_type > > | potSolver | ||
) |
Constructor.
Class constructor:
emMatherial | properties of the materials |
vertApproxSpace | vertex-centered approx. space |
potSolver | linear solver for the potential |
References SmartPtr< class, FreePolicy >::invalid(), ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::m_auxLaplaceAss, ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::m_auxLaplaceRHS, ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::m_auxLocLaplace, ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::m_potSolver, ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::m_spEmMaterial, ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::m_spVertApproxSpace, and UG_THROW.
|
inline |
Destructor.
References ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::m_DVF_phi.
|
private |
Allocates memory for the DVFs associated with the ungrounded conductors.
Allocates memory for the DVFs associated with the conductors that do not touch the Dirichlet boundary
[in] | domain | the domain |
[in] | aux_rhs | grid function for the auxiliary rhs |
References pcl::ProcessCommunicator::allreduce(), ug::GridFunction< class, class >::approx_space(), ug::DoFDistribution::begin(), ug::GridFunction< class, class >::dof_distribution(), ug::DoFDistribution::end(), SmartPtr< class, FreePolicy >::get(), grid(), PCL_RO_LOR, ug::PointerConstArray< class >::size(), and ug::SubsetGroup::size().
void ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::apply | ( | GridFunction< TDomain, TAlgebra > & | u, |
const char * | fct_names | ||
) |
Performs the projection of given functions.
Performs the projection of given functions
[in] | u | the grid function to project |
[in] | fct_names | the function names |
References ug::DoFDistributionInfoProvider::fct_grp_by_name(), and UG_CATCH_THROW.
void ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::apply | ( | GridFunction< TDomain, TAlgebra > & | u, |
const FunctionGroup & | fctGrp | ||
) |
Performs the projection of given functions.
Performs the projection of given functions
[in] | u | the grid function to project |
fctGrp | the function indices |
References ug::GridFunction< class, class >::dof_distribution(), ug::GridFunction< class, class >::domain(), SmartPtr< class, FreePolicy >::get(), SmartPtr< domain_type >::get(), ug::GridFunction< class, class >::grid_level(), ug::GridFunction< class, class >::init(), ug::DoFDistributionInfoProvider::local_finite_element_id(), ug::LFEID::NEDELEC, ug::FunctionGroup::size(), ug::LFEID::type(), and UG_THROW.
void ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::apply | ( | vector_type & | vec | ) |
Performs the projection of all functions in a grid function.
Performs the projection of all functions in a grid function
[in] | vec | the grid function to project |
References ug::FunctionGroup::add_all(), ug::DoFDistributionInfoProvider::dof_distribution_info(), and UG_THROW.
|
private |
Assembles the weak divergence operator on the whole grid.
Assembles the weak divergence operator on the whole grid and computes the charges of the base conductors.
[in] | domain | the domain |
[in] | edgeDD | the edge DD |
[in] | u | the vector to compute div for |
[in] | fct | function in u to compute div for |
[in] | vertDD | the vertex DD |
[out] | div | for the weak divergence of u |
[out] | charge | charges of the conductors |
References pcl::ProcessCommunicator::allreduce(), PCL_RO_SUM, ug::PST_ADDITIVE, ParallelVector< Vector< double > >::set(), and ParallelVector< Vector< double > >::set_storage_type().
|
private |
Sets the div operator to 0 in conductors (for all elements of the same type)
Sets the div operator to 0 in conductors for all elements of the same type and computes the charges of the base conductors. The charges of the base conductors are the sums of the divergences in all the interface vertices between the base conductors and the insulators. As the divergence inside of the conductors is set to zero, we sum over all the nodes in the closure of the conductors. Remark: Only full-dimensional elements should be considered.
[in] | vertDD | the vertex DD |
[out] | div | to update the weak divergence of u |
[out] | charge | charges of the conductors |
References ug::DoFDistribution::algebra_indices(), ug::DoFDistributionInfoProvider::num_subsets(), and UG_THROW.
void ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::compute_div | ( | SmartPtr< GridFunction< TDomain, TAlgebra > > | sp_u, |
const char * | u_fct_name, | ||
SmartPtr< GridFunction< TDomain, TPotAlgebra > > | sp_div | ||
) |
Computes the weak divergence in insulators.
Computes weak divergence in insulators and saves it in a vertex-centered grid function
[in] | sp_u | the vector field grid function |
[in] | u_fct_name | the function name of the Nedelec DoFs |
[out] | sp_div | the grid function for the divergence |
References ParallelVector< Vector< double > >::change_storage_type(), ug::GridFunction< class, class >::dof_distribution(), ug::GridFunction< class, class >::domain(), ug::DoFDistributionInfoProvider::fct_id_by_name(), SmartPtr< domain_type >::get(), SmartPtr< class, FreePolicy >::get(), ug::Vector< class >::get(), ug::GridFunction< class, class >::grid_level(), ug::DoFDistributionInfoProvider::local_finite_element_id(), ug::LFEID::NEDELEC, ug::PST_CONSISTENT, ug::LFEID::type(), UG_CATCH_THROW, and UG_THROW.
|
private |
Computes the potential coefficients.
Computes the potential coefficients
[in] | domain | the domain |
[in] | vertDD | the vertex DD |
References pcl::ProcessCommunicator::allreduce(), ug::DoFDistribution::begin(), ug::DoFDistribution::end(), ug::Invert(), ug::DoFDistribution::multi_grid(), PCL_RO_MAX, PCL_RO_SUM, and ug::SetAttachmentValues().
|
private |
Computes the Dirichlet vector fields (DVFs)
Computes the Dirichlet vector fields
aux_rhs | grid function for the auxiliary rhs |
References ug::GridFunction< class, class >::dof_distribution(), ug::PST_ADDITIVE, and ug::PST_CONSISTENT.
|
private |
Damps the Dirichlet vector fields (DVFs)
Damps the Dirichlet vector fields (DVFs)
cor | the potential correction to update | |
[in] | charge | charges of the conductors |
References ug::VecScaleAdd().
|
private |
Updates the grid function by the potential correction.
Computes the edge-centered correction from the vertex-centered (potential) one by applying the gradient operator.
Note that the edge-centered correction is considered only in the closure of insulators. There, it is the gradient of the vertex-centered (potential) correction. But in the conductors (as well as on the Dirichlet boundaries), the vertex-centered correction is constant by construction so that its gradient is 0 any way. (Adjacent conductors are concidered as one conductor in the projection, so that the different factors for the charges in different conductors does not violate the constant value of the vertex-centered correction in any separated piece of conductors.) For this, the function computes the gradient over the whole domain.
[in] | domain | the domain |
[in] | edgeDD | the edge DD |
[out] | u | the vector to correct (to update) |
[in] | fct | function in u to update |
[in] | vertDD | the vertex DD |
[in] | cor | the potential correction for u |
References ug::DoFDistribution::begin(), ug::DoFRef(), ug::DoFDistribution::end(), ug::DoFDistribution::inner_algebra_indices(), ug::DoFDistribution::inner_dof_indices(), ug::PST_CONSISTENT, UG_THROW, and ug::EdgeVertices::vertex().
|
private |
Integrates div E over boundaries of conductors for elements of the same type.
Integration of div E over boundaries of conductors (for one type of elements) to get the capacity matrix. We compute only the lower triangular part of the capacity matrix: This matrix is symmetric.
[in] | domain | the domain |
[in] | vertDD | the vertex DD |
[in] | vert_base_cond | indices of the base conductors for every vertex |
[out] | C | the matrix to update |
References ug::DoFDistribution::algebra_indices(), ug::DoFDistributionInfoProvider::num_subsets(), and UG_THROW.
|
private |
Sets the base conductor indices for every vertex (for all elements of the same type)
Initializes 'vert_base_cond' with the indices of the base conductors according to the closure of the conductive subsets. Note that the insulators are marked with -2 (and NOT with -1!), whereas the grounded conductors with -1 and the other conductors with their base conductor index. The attachment must be preinitialized with the default value -2 (for the insulators).
[in] | vertDD | the vertex DD |
[out] | vert_base_cond | indices of the base conductors for every vertex |
References ug::DoFDistributionInfoProvider::num_subsets().
|
inlineprivate |
Projects one function (i.e. performs the main action):
Projects one function, thus performs the main action of the projection. This function assumes that the object is completely initialized, i.e. the solver and the discretization are initialized.
[in] | domain | the domain |
[in] | edgeDD | the edge DD |
[in] | u | the vector where to project |
[in] | fct | function in u to compute div for |
[in] | vertDD | the vertex DD |
[in] | aux_rhs | a grid function for the rhs of the aux. problem |
[in] | aux_cor | a grid function for the sol. of the aux. problem |
References SmartPtr< class, FreePolicy >::get(), SmartPtr< TDomain >::get(), and ug::PST_CONSISTENT.
|
inline |
Sets whether to damp Dirichlet vector fields.
References ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::m_bDampDVFs.
|
inline |
Sets the Dirichlet boundary.
spDirichlet | the Dirichlet BC object |
References ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::m_spDirichlet.
|
private |
Computes the weak divergence (for all elements of the same type)
Assembles the weak divergence operator for all elements of the same type. Remark: Only full-dimensional elements should be considered.
[in] | domain | the domain |
[in] | edgeDD | the edge DD |
[in] | u | the vector to compute div for |
[in] | fct | function in u to compute div for |
[in] | vertDD | the vertex DD |
div | to update the weak divergence of u |
References ug::DoFDistribution::algebra_indices(), ug::DoFDistribution::dof_indices(), ug::DoFRef(), ug::Electromagnetism::NedelecT1_LDisc< TDomain, TElem >::local_div_matrix(), ug::MatVecMult(), ug::DoFDistributionInfoProvider::num_subsets(), and UG_THROW.
|
private |
Global discretization of the auxiliary equations.
Referenced by ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::NedelecProject().
|
private |
Matrix of the discretization.
|
private |
Rhs and BC for the auxiliary problem.
Referenced by ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::NedelecProject().
|
private |
Local discretization of the auxiliary equations.
Referenced by ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::NedelecProject().
|
private |
Whether to damp the Dirichlet vector fields (DVFs)
Referenced by ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::set_dampDVFs().
|
private |
Dirichlet vector fields (DVFs)
Referenced by ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::~NedelecProject().
|
private |
Potential coefficients:
|
private |
Solver for the auxliliary equations.
Referenced by ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::NedelecProject().
|
private |
Dirichlet boundary.
Referenced by ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::set_Dirichlet().
|
private |
Properties of the matherials in the domain.
Referenced by ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::NedelecProject().
|
private |
Approximation space for the potential (vertex-centered) space.
Referenced by ug::Electromagnetism::NedelecProject< TDomain, TAlgebra >::NedelecProject().
|
static |
world dimention