37 #ifndef __H__UG__PLUGINS__ELECTROMAGNETISM__NEDELEC_SOURCE__
38 #define __H__UG__PLUGINS__ELECTROMAGNETISM__NEDELEC_SOURCE__
61 namespace Electromagnetism{
121 template <
typename TDomain,
typename TAlgebra>
172 const char * ssNames,
173 const char * posSsNames,
174 const char * cutSsNames,
182 const char * fctNames,
204 template <
typename TElem>
249 template <
typename TElem>
283 static const size_t _C_ = 0;
298 const std::vector<LFEID> & vLfeID,
305 template <
typename TElem>
308 template <
typename TElem>
311 template <
typename TElem>
314 template <
typename TElem>
317 template <
typename TElem>
320 template <
typename TElem>
323 UG_THROW (
"NedelecProject: Attempt to use nonstationary discretization for the potential.");
325 template <
typename TElem>
328 UG_THROW (
"NedelecProject: Attempt to assemble non-linear system for the potential.");
330 template <
typename TElem>
333 UG_THROW (
"NedelecProject: Attempt to use nonstationary discretization for the potential.");
348 template <
typename TElem>
385 template <
typename TElem>
405 m_pThis->template mark_source_vertices_elem_type<TElem> (
m_pDom);
454 AttachmentAllReduce<Vertex> (*mg, a_in_source,
PCL_RO_LOR);
482 const std::vector<number> * vScaleMass = NULL,
483 const std::vector<number> * vScaleStiff = NULL
556 m_spOoS->set_zero_average (* sp_gf->dd (), * sp_gf);
566 template <
typename TElem>
569 const TDomain & domain,
586 const TDomain & domain,
Class for local assembling of the auxiliary Laplace operator.
Definition: nedelec_source.h:280
bool m_in_pos_subset
whether we assemble in the subset specifying the positive direction
Definition: nedelec_source.h:363
NedelecLoopCurrent & m_master
the master object of the projection
Definition: nedelec_source.h:355
static const size_t _C_
a name for the component in the grid functions
Definition: nedelec_source.h:283
SubsetGroup m_posSsGrp
group of the positive direction subsets
Definition: nedelec_source.h:358
void ass_dM_elem(LocalVector &d, const LocalVector &u, GridObject *elem, const position_type vCornerCoords[])
Definition: nedelec_source.h:331
void prepare_element(const LocalVector &u, GridObject *elem, ReferenceObjectID roid, const position_type vCornerCoords[])
Definition: nedelec_source.h:315
void ass_JM_elem(LocalMatrix &J, const LocalVector &u, GridObject *elem, const position_type vCornerCoords[])
Definition: nedelec_source.h:321
void ass_JA_elem(LocalMatrix &J, const LocalVector &u, GridObject *elem, const position_type vCornerCoords[])
transfer the local stiffness matrix to the global discretization
Definition: nedelec_source_impl.h:496
void register_loc_discr_func()
Definition: nedelec_source_impl.h:464
void register_all_loc_discr_funcs()
Definition: nedelec_source_impl.h:452
SubsetGroup m_cutSsGrp
group of the surfaces at the cut
Definition: nedelec_source.h:360
static const size_t maxCorners
maximum number of corners of an element
Definition: nedelec_source.h:286
void finish_element_loop()
Definition: nedelec_source.h:318
virtual void prepare_setting(const std::vector< LFEID > &vLfeID, bool bNonRegular)
switches between non-regular and regular grids
Definition: nedelec_source_impl.h:432
void prepare_element_loop(ReferenceObjectID roid, int si)
Definition: nedelec_source_impl.h:484
void ass_rhs_elem(LocalVector &d, GridObject *elem, const position_type vCornerCoords[])
Definition: nedelec_source_impl.h:519
void ass_dA_elem(LocalVector &d, const LocalVector &u, GridObject *elem, const position_type vCornerCoords[])
Definition: nedelec_source.h:326
AuxLaplaceLocAss(NedelecLoopCurrent &master)
constructor
Definition: nedelec_source_impl.h:411
Helper class for assembling the local stiffness matrix of Laplacian in various routines.
Definition: nedelec_source.h:251
static void stiffness(GridObject *elem, const position_type vCornerCoords[], number loc_A[numCorners][numCorners])
Computes the local discretization of the Laplace operator.
Definition: nedelec_source_impl.h:355
reference_element_traits< TElem >::reference_element_type ref_elem_type
Definition: nedelec_source.h:253
static const int numCorners
Definition: nedelec_source.h:254
static bool bnd_corners(GridObject *elem, const SubsetGroup &bndGrp, bool bnd_flag[numCorners])
Checks whether corners are on boundary (returns true if yes)
Definition: nedelec_source_impl.h:389
Constraint that sets the problem to 0-identity out of the source.
Definition: nedelec_source.h:374
DoFDistribution::traits< Vertex >::const_iterator t_vert_iterator
Iterator over vertices.
Definition: nedelec_source.h:380
void adjust_solution(pot_vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
sets the value in the solution for all conductor indices
Definition: nedelec_source.h:491
void adjust_linear(pot_matrix_type &A, pot_vector_type &b, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
sets unity rows in A and dirichlet values in right-hand side b
Definition: nedelec_source.h:503
void adjust_defect(pot_vector_type &d, const pot_vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0, ConstSmartPtr< VectorTimeSeries< pot_vector_type > > vSol=SPNULL, const std::vector< number > *vScaleMass=NULL, const std::vector< number > *vScaleStiff=NULL)
sets a zero value in the defect for all conductor indices
Definition: nedelec_source.h:475
aa_vert_flag_type m_in_source
attachment accessor for the current vertex flags
Definition: nedelec_source.h:537
int type() const
returns the type of the constraints
Definition: nedelec_source.h:529
void adjust_rhs(pot_vector_type &b, const pot_vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
sets the dirichlet value in the right-hand side
Definition: nedelec_source.h:517
void adjust_vector(const DoFDistribution &vertDD, pot_vector_type &u)
sets to 0 all the entries of a vector that do not belong to the closure of the source subdomain
Definition: nedelec_source_impl.h:650
void adjust_matrix(const DoFDistribution &vertDD, pot_matrix_type &A)
sets to identity all the matrix rows that do not belong to the closure of the source subdomain
Definition: nedelec_source_impl.h:621
OutOfSource(NedelecLoopCurrent &master)
constructor
Definition: nedelec_source_impl.h:552
NedelecLoopCurrent & m_master
the master object of the projection
Definition: nedelec_source.h:534
void init(domain_type *dom, a_vert_flag_type &a_in_source)
initializer
Definition: nedelec_source.h:445
void adjust_jacobian(pot_matrix_type &J, const pot_vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0, ConstSmartPtr< VectorTimeSeries< pot_vector_type > > vSol=SPNULL, const number s_a0=1.0)
sets a unity row for all conductor indices
Definition: nedelec_source.h:460
static const size_t maxCorners
maximum number of corners of an element
Definition: nedelec_source.h:377
void mark_source_vertices_elem_type(const TDomain *dom)
marks the vertices belonging to elements in the source (for one element type)
Definition: nedelec_source_impl.h:564
void mark_source_vertices(const TDomain *dom)
marks the vertices belonging to elements in the source (for all element types)
Definition: nedelec_source_impl.h:600
void set_zero_average(const DoFDistribution &vertDD, pot_vector_type &u)
sets the arithmetic average of the solution vector to zero
Definition: nedelec_source_impl.h:678
Postprocessor to eliminate the kernel parts in the solution.
Definition: nedelec_source.h:547
virtual void post_process(SmartPtr< pot_gf_type > sp_gf)
Sets the arithmetical average to zero.
Definition: nedelec_source.h:554
SmartPtr< OutOfSource > m_spOoS
access to the inner vertex marks
Definition: nedelec_source.h:562
ZeroAverage(SmartPtr< OutOfSource > spOoS)
Constructor.
Definition: nedelec_source.h:551
Class for computation of loop currents.
Definition: nedelec_source.h:123
Grid::VertexAttachmentAccessor< a_vert_flag_type > aa_vert_flag_type
Definition: nedelec_source.h:165
ABool a_vert_flag_type
Definition: nedelec_source.h:164
SmartPtr< AssembledLinearOperator< TPotAlgebra > > m_auxLaplaceOp
Matrix of the discretization.
Definition: nedelec_source.h:650
void compute(SmartPtr< GridFunction< TDomain, TAlgebra > > sp_u)
Computation of the source (only if 'init'ialized): distributes the potential.
Definition: nedelec_source_impl.h:121
std::string subsets()
Returns the subsets where the source is defined.
Definition: nedelec_source.h:193
SmartPtr< OutOfSource > m_outOfSource
Extension of the matrices and vectors to the whole domain.
Definition: nedelec_source.h:638
SubsetGroup m_posSsGrp
Group of the subsets of the positive direction.
Definition: nedelec_source.h:628
SubsetGroup m_cutSsGrp
Group of the surfaces of the cut of the loop.
Definition: nedelec_source.h:630
void distribute_source_potential(const DoFDistribution &vertDD, pot_vector_type &src_pot, DoFDistribution &edgeDD, size_t func, number value, vector_type &src_field)
Computes the gradient of the potential.
Definition: nedelec_source_impl.h:281
std::string m_allSsNames
Names of all the subsets of the source.
Definition: nedelec_source.h:619
std::string m_cutSsNames
Names of the surfaces of the cut of the loop.
Definition: nedelec_source.h:623
TDomain::grid_type grid_type
Type of Grid:
Definition: nedelec_source.h:132
TAlgebra::vector_type vector_type
Type of Vector (for the Nedelec-element-based grid functions)
Definition: nedelec_source.h:140
SmartPtr< ITransferPostProcess< TDomain, TPotAlgebra > > zero_average()
Returns the postprocess routine to eliminate the kernel part of the potential.
Definition: nedelec_source.h:196
AChar a_edge_flag_type
Type of the attachment and its accessor for flags.
Definition: nedelec_source.h:162
void compute_potential(pot_gf_type &pot_u)
Computes the potential of the source.
Definition: nedelec_source_impl.h:246
std::vector< TSrcData > m_vSrcData
Array of the electric current data.
Definition: nedelec_source.h:616
TPotAlgebra::matrix_type pot_matrix_type
Matrix type for the potential space.
Definition: nedelec_source.h:149
domain_type::subset_handler_type subset_handler_type
Type of subset handler.
Definition: nedelec_source.h:135
TDomain domain_type
Type of Domain.
Definition: nedelec_source.h:129
TDomain::position_type position_type
position type
Definition: nedelec_source.h:157
CPUAlgebra TPotAlgebra
The auxiliary algebra type for the space of the potential. (Note: It should be scalar....
Definition: nedelec_source.h:145
std::string m_posSsNames
Names of the subsets of the positive direction.
Definition: nedelec_source.h:621
SmartPtr< ZeroAverage > m_zeroAverage
Elimination of the kernal parts in the solution.
Definition: nedelec_source.h:640
TAlgebra algebra_type
Type of algebra (for the Nedelec-element-based grid functions)
Definition: nedelec_source.h:138
SmartPtr< AuxLaplaceLocAss > m_auxLocLaplace
Local discretization of the auxiliary equations.
Definition: nedelec_source.h:636
TAlgebra::matrix_type matrix_type
Type of Vector (for the Nedelec-element-based grid functions)
Definition: nedelec_source.h:142
GridFunction< TDomain, TPotAlgebra > pot_gf_type
Grid function type for the potential space.
Definition: nedelec_source.h:151
void set(const char *fctNames, number I)
Setting the electric current value.
Definition: nedelec_source_impl.h:108
SmartPtr< DomainDiscretization< TDomain, TPotAlgebra > > m_auxLaplaceAss
Global discretization of the auxiliary equations.
Definition: nedelec_source.h:648
NedelecLoopCurrent< TDomain, TAlgebra > this_type
This type.
Definition: nedelec_source.h:125
NedelecLoopCurrent(const char *ssNames, const char *posSsNames, const char *cutSsNames, SmartPtr< ApproximationSpace< TDomain > > vertApproxSpace, SmartPtr< ILinearOperatorInverse< pot_vector_type > > potSolver)
Constructor.
Definition: nedelec_source_impl.h:52
void get_flux_of_pot(const TDomain &domain, const pot_vector_type &pot, const DoFDistribution &vertDD, number &flux)
Computes the flux of of the gradient of the potential over the cut (for one type of elements)
Definition: nedelec_source_impl.h:733
void mark_source_edges(const DoFDistribution &edgeDD, aa_edge_flag_type &in_source)
Marks edges that belong to the loop source domain (for one type of elements)
Definition: nedelec_source_impl.h:199
static const int WDim
world dimention
Definition: nedelec_source.h:154
Grid::EdgeAttachmentAccessor< a_edge_flag_type > aa_edge_flag_type
Definition: nedelec_source.h:163
SmartPtr< ApproximationSpace< TDomain > > m_spVertApproxSpace
Vertex-centered approximation space.
Definition: nedelec_source.h:633
SubsetGroup m_allSsGrp
Group of all the subsets of the source.
Definition: nedelec_source.h:626
TPotAlgebra::vector_type pot_vector_type
Vector type for the potential space.
Definition: nedelec_source.h:147
SmartPtr< ILinearOperatorInverse< pot_vector_type > > m_potSolver
Solver for the auxliliary equations.
Definition: nedelec_source.h:652
bool access(Grid &grid, TAttachment &a)
ConstSmartPtr< DoFDistribution > dd(const GridLevel &gl) const
TDomain::position_type position_type
ParallelMatrix< SparseMatrix< double > > matrix_type
ParallelVector< Vector< double > > vector_type
MathVector< dim > position_type
TSubsetHandler subset_handler_type
const NullSmartPtr SPNULL
SurfaceView::traits< TElem >::const_iterator const_iterator
Definition: nedelec_source.h:341
RegisterLocalDiscr(AuxLaplaceLocAss *pThis)
Definition: nedelec_source.h:342
void operator()(TElem &)
Definition: nedelec_source.h:344
AuxLaplaceLocAss * m_pThis
Definition: nedelec_source.h:343
Helper class for computation of the flux of potential over the cut.
Definition: nedelec_source.h:576
const domain_type & m_domain
Definition: nedelec_source.h:578
GetFluxOfPotential(this_type *pThis, const TDomain &domain, const pot_vector_type &pot, const DoFDistribution &vertDD, number &flux)
Definition: nedelec_source.h:584
number & m_flux
Definition: nedelec_source.h:581
const DoFDistribution & m_vertDD
Definition: nedelec_source.h:580
const pot_vector_type & m_pot
Definition: nedelec_source.h:579
void operator()(TElem &)
Definition: nedelec_source.h:596
this_type * m_pThis
Definition: nedelec_source.h:577
Helper class for marking the edges in the source.
Definition: nedelec_source.h:212
MarkSourceEdges(this_type *pThis, const DoFDistribution &edgeDD, aa_edge_flag_type &in_source)
Definition: nedelec_source.h:218
void operator()(TElem &)
Definition: nedelec_source.h:225
this_type * m_pThis
Definition: nedelec_source.h:213
const DoFDistribution & m_edgeDD
Definition: nedelec_source.h:214
aa_edge_flag_type & m_in_source
Definition: nedelec_source.h:215
Helper class for marking the vertices in the closure of the source subdomain.
Definition: nedelec_source.h:392
MarkSourceVertices(OutOfSource *pThis, const TDomain *pDom)
Definition: nedelec_source.h:397
void operator()(TElem &)
Definition: nedelec_source.h:403
const TDomain * m_pDom
Definition: nedelec_source.h:394
OutOfSource * m_pThis
Definition: nedelec_source.h:393
Structure for keeping electric current data.
Definition: nedelec_source.h:606
TSrcData(const char *the_fctNames, number the_I)
Constructor.
Definition: nedelec_source.h:611
number I
value of the electric current
Definition: nedelec_source.h:608
std::string fctNames
function names for the value
Definition: nedelec_source.h:607