Plugins
eddy_current_e_nedelec.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2014: G-CSC, Goethe University Frankfurt
3  * Author: Dmitry Logashenko
4  *
5  * This file is part of UG4.
6  *
7  * UG4 is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License version 3 (as published by the
9  * Free Software Foundation) with the following additional attribution
10  * requirements (according to LGPL/GPL v3 §7):
11  *
12  * (1) The following notice must be displayed in the Appropriate Legal Notices
13  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14  *
15  * (2) The following notice must be displayed at a prominent place in the
16  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17  *
18  * (3) The following bibliography is recommended for citation and must be
19  * preserved in all covered files:
20  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21  * parallel geometric multigrid solver on hierarchically distributed grids.
22  * Computing and visualization in science 16, 4 (2013), 151-164"
23  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24  * flexible software system for simulating pde based models on high performance
25  * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU Lesser General Public License for more details.
31  */
32 
33 /*
34  * FE-discretization of the time-harmonic E-based formulation of the eddy
35  * current model.
36  */
37 
38 #ifndef __H__UG__PLUGINS__ELECTROMAGNETISM__EDDY_CURRENT_E_NEDELEC__
39 #define __H__UG__PLUGINS__ELECTROMAGNETISM__EDDY_CURRENT_E_NEDELEC__
40 
41 // basic ug4 headers
42 #include "common/common.h"
43 
44 // library-specific headers
45 #include "lib_grid/lg_base.h"
50 
51 /* Discretization's headers: */
52 #include "eddy_current_traits.h"
53 #include "../em_material.h"
54 #include "../nedelec_local_ass.h"
55 
56 namespace ug{
57 namespace Electromagnetism{
58 
61 
63 
95 template <typename TDomain, typename TAlgebra>
97  : public IElemDisc<TDomain>, public EddyCurrentTraits
98 {
99 private:
102 
105 
108 
111 
114 
116  static const int dim = base_type::dim;
117 
120 
121 public:
124  (
125  const char * functions,
126  ConstSmartPtr<EMaterial<domain_type> > spSubsetData,
127  number frequency
128  );
129 
130 public:
133  (
134  SmartPtr<TGridFunction> spgfJG,
135  const char * cmp,
136  const char * ss_names = NULL
137  );
140  (
141  SmartPtr<TGridFunction> spgfJG,
142  const char * cmp
143  )
144  {
145  set_generator_current (spgfJG, cmp, NULL);
146  }
147 
148 //---- Local discretization interface: ----
149 private:
150 
152  virtual void prepare_setting
153  (
154  const std::vector<LFEID> & vLfeID,
155  bool bNonRegular
156  );
157 
158 //---- Assembling functions: ----
159 
160  template <typename TElem>
161  void prepare_element_loop(ReferenceObjectID roid, int si);
162 
163  template <typename TElem>
164  void prepare_element(const LocalVector& u, GridObject* elem, ReferenceObjectID roid, const position_type vCornerCoords[]);
165 
166  template <typename TElem>
167  void finish_element_loop();
168 
169  template <typename TElem>
170  void ass_JA_elem(LocalMatrix& J, const LocalVector& u, GridObject* elem, const position_type vCornerCoords[]);
171 
172  template <typename TElem>
173  void ass_JM_elem(LocalMatrix& J, const LocalVector& u, GridObject* elem, const position_type vCornerCoords[]);
174 
175  template <typename TElem>
176  void ass_dA_elem(LocalVector& d, const LocalVector& u, GridObject* elem, const position_type vCornerCoords[]);
177 
178  template <typename TElem>
179  void ass_dM_elem(LocalVector& d, const LocalVector& u, GridObject* elem, const position_type vCornerCoords[]);
180 
181  template <typename TElem>
182  void ass_rhs_elem(LocalVector& d, GridObject* elem, const position_type vCornerCoords[]);
183 
184 //---- Registration of the template functions: ----
185 private:
186 
188 
192  template< typename TElem > void operator() (TElem &)
193  {m_pThis->register_loc_discr_func<TElem> ();}
194  };
195 
196  template <typename TElem>
197  void register_loc_discr_func ();
198 
199 //---- Auxiliary functions: ----
200 private:
201 
203  template<size_t numEdges>
204  void ass_elem_stiffness
205  (
206  number perm,
207  number cond,
208  number S [2][numEdges] [2][numEdges]
209  );
210 
211 //---- Physical parameters of the problem: ----
212 private:
215 
218 
221  {
223  size_t m_vFct[2];
226 
229  (
231  size_t vFct_Re, size_t vFct_Im,
232  SubsetGroup & ssGrp,
233  bool ew = false
234  )
235  : m_spGf (spGf), m_everywhere (ew), m_ssGrp (ssGrp)
236  {
237  m_vFct[_Re_] = vFct_Re; m_vFct[_Im_] = vFct_Im;
238  }
239  };
240 
242  std::vector<tGeneratorCurrent> m_vJG;
243 
246 
247 //---- Temporary data used in the local discretization ----
248 private:
249 
254 
257 
260 
261 }; // end class EddyCurrent_E_Nedelec
262 
264 
265 } // end namespace Electromagnetism
266 } // end namespace ug
267 
269 
270 #endif /* __H__UG__PLUGINS__ELECTROMAGNETISM__EDDY_CURRENT_E_NEDELEC__ */
271 
272 /* End of File */
Class for subdomain-dependent data for the E-based formulated problems.
Definition: em_material.h:63
FE-discretization of the time-harmonic E-based formulation of the eddy current model.
Definition: eddy_current_e_nedelec.h:98
static const size_t maxNumEdges
max. number of the edges of the full-dimensional elements in the domain
Definition: eddy_current_e_nedelec.h:119
tGeneratorCurrent * m_pSsJG
the source active in the current (assembled) subset
Definition: eddy_current_e_nedelec.h:245
void prepare_element(const LocalVector &u, GridObject *elem, ReferenceObjectID roid, const position_type vCornerCoords[])
prepares a given element for assembling: computes the discretization of the rot-rot operator
Definition: eddy_current_e_nedelec_impl.h:113
void ass_rhs_elem(LocalVector &d, GridObject *elem, const position_type vCornerCoords[])
computes the right-hand side due to the generator currents
Definition: eddy_current_e_nedelec_impl.h:258
void ass_dA_elem(LocalVector &d, const LocalVector &u, GridObject *elem, const position_type vCornerCoords[])
computes the local defect and transfers it to the global discretization
Definition: eddy_current_e_nedelec_impl.h:300
number m_conductivity
the electric conductivity in the subdomain
Definition: eddy_current_e_nedelec.h:259
EddyCurrent_E_Nedelec< TDomain, TAlgebra > this_type
own type
Definition: eddy_current_e_nedelec.h:104
EddyCurrent_E_Nedelec(const char *functions, ConstSmartPtr< EMaterial< domain_type > > spSubsetData, number frequency)
class constructor
Definition: eddy_current_e_nedelec_impl.h:451
void register_all_loc_discr_funcs()
registers the local assembler functions for all the elements and dimensions
Definition: eddy_current_e_nedelec_impl.h:337
void ass_JM_elem(LocalMatrix &J, const LocalVector &u, GridObject *elem, const position_type vCornerCoords[])
computes the mass matrix of a time-dependent problem
Definition: eddy_current_e_nedelec_impl.h:313
void ass_dM_elem(LocalVector &d, const LocalVector &u, GridObject *elem, const position_type vCornerCoords[])
computes the mass part of the defect of a time-dependent problem
Definition: eddy_current_e_nedelec_impl.h:326
number m_permeability
the magnetic permeability in the subdomain
Definition: eddy_current_e_nedelec.h:256
void set_generator_current(SmartPtr< TGridFunction > spgfJG, const char *cmp)
adds a generator current item to the discretization
Definition: eddy_current_e_nedelec.h:140
std::vector< tGeneratorCurrent > m_vJG
array of all the sources (generator currents)
Definition: eddy_current_e_nedelec.h:242
void prepare_element_loop(ReferenceObjectID roid, int si)
prepares the loop over the elements: checks whether the parameters are set, ...
Definition: eddy_current_e_nedelec_impl.h:81
void set_generator_current(SmartPtr< TGridFunction > spgfJG, const char *cmp, const char *ss_names=NULL)
adds a generator current item to the discretization
Definition: eddy_current_e_nedelec_impl.h:377
void register_loc_discr_func()
registers the local assembler functions for a given element
Definition: eddy_current_e_nedelec_impl.h:349
base_type::position_type position_type
position type
Definition: eddy_current_e_nedelec.h:113
number m_rot_rot_S[maxNumEdges][maxNumEdges]
local stiffness matrix of the rot-rot operator
Definition: eddy_current_e_nedelec.h:251
void finish_element_loop()
finalizes the loop over the elements: clear the source
Definition: eddy_current_e_nedelec_impl.h:104
number m_omega
frequency for the discretization
Definition: eddy_current_e_nedelec.h:214
virtual void prepare_setting(const std::vector< LFEID > &vLfeID, bool bNonRegular)
check type of the grid and the trial space
Definition: eddy_current_e_nedelec_impl.h:53
base_type::domain_type domain_type
domain type
Definition: eddy_current_e_nedelec.h:110
number m_rot_rot_M[maxNumEdges][maxNumEdges]
local mass matrix of the rot-rot operator
Definition: eddy_current_e_nedelec.h:253
void ass_JA_elem(LocalMatrix &J, const LocalVector &u, GridObject *elem, const position_type vCornerCoords[])
transfers the precomputed local stiffness matrix to the global discretization
Definition: eddy_current_e_nedelec_impl.h:211
ConstSmartPtr< EMaterial< domain_type > > m_spSubsetData
parameters of the materials in the domain
Definition: eddy_current_e_nedelec.h:217
GridFunction< TDomain, TAlgebra > TGridFunction
type of grid functions (used for the sources)
Definition: eddy_current_e_nedelec.h:107
static const int dim
world dimension
Definition: eddy_current_e_nedelec.h:116
void ass_elem_stiffness(number perm, number cond, number S[2][numEdges][2][numEdges])
composes the stiffness matrix of the stationary problem
Definition: eddy_current_e_nedelec_impl.h:173
IElemDisc< TDomain > base_type
base class type
Definition: eddy_current_e_nedelec.h:101
Auxiliary class defining some important constants.
Definition: eddy_current_traits.h:44
static const size_t _Im_
index of the imaginary part in the grid functions
Definition: eddy_current_traits.h:50
static const size_t _Re_
index of the real part in the grid functions
Definition: eddy_current_traits.h:48
TDomain::position_type position_type
static const int dim
double number
ReferenceObjectID
this_type * m_pThis
Definition: eddy_current_e_nedelec.h:191
void operator()(TElem &)
Definition: eddy_current_e_nedelec.h:192
RegisterLocalDiscr(this_type *pThis)
Definition: eddy_current_e_nedelec.h:190
class for a generator current (source) in a subdomain
Definition: eddy_current_e_nedelec.h:221
SmartPtr< TGridFunction > m_spGf
the grid function of the current
Definition: eddy_current_e_nedelec.h:222
SubsetGroup m_ssGrp
subsets where the source is defined (if ! m_everywhere)
Definition: eddy_current_e_nedelec.h:225
tGeneratorCurrent(SmartPtr< TGridFunction > &spGf, size_t vFct_Re, size_t vFct_Im, SubsetGroup &ssGrp, bool ew=false)
constructor
Definition: eddy_current_e_nedelec.h:229
size_t m_vFct[2]
components of the grid function
Definition: eddy_current_e_nedelec.h:223
bool m_everywhere
true iff the source is defined everywhere
Definition: eddy_current_e_nedelec.h:224