Class documentation of Concepts

Loading...
Searching...
No Matches
Eddy2D_H.hh
Go to the documentation of this file.
1
7#ifndef Eddy2D_hh
8#define Eddy2D_hh
9
10#include "operator/sparseMatrix.hh"
12#include "formula/boundary.hh"
14#include "models/maxwell.hh"
17#include "models/Maxwell2D_H_eField.hh"
18
19namespace hp2D {
20
21 using concepts::Real;
22 using concepts::Real2d;
23 using concepts::Cmplx;
24
25 // forward declaration
26 class InputEddy2D_H;
27
28 // ***************************************************** Eddy2D_H_Interior **
29
36 public:
37 Eddy2D_H_Interior(const Real Omega_i, const Real H0) :
38 Omega_i_(Omega_i), H0_(H0) {
40 }
43 Omega_i_(i.Omega_i_), H0_(i.H0_) {}
45 const Real Omega_i() const { return Omega_i_; }
47 const Real H0() const { return H0_; }
48 protected:
49 virtual std::ostream& info(std::ostream& os) const {
50 return os << concepts::typeOf(*this)<<"(Omega_i = " << Omega_i_
51 << ", H0_i = " << H0_ << ")";
52 }
53 private:
55 const Real Omega_i_;
57 const Real H0_;
58 };
59
60 // ************************************************************** Eddy2D_H **
61
67 class Eddy2D_H : public AdaptiveModel<Cmplx>, public concepts::MaxwellModel {
68 public:
70 enum solverType { SUPERLU = 0, BICGSTAB = 1};
84 const concepts::Formula<Real2d>& curlH0,
85 const concepts::Formula<Real>* divgradH0 = 0,
86 Eddy2D_H_Interior* interior = 0, const uint geomRefAttrib = 100,
87 const Real omega = OMEGA50,
88 const Real mu = MU0, enum solverType type = SUPERLU);
97 Eddy2D_H(concepts::EddyGeometry2D& geom, const Real H0,
98 Eddy2D_H_Interior* interior = 0, const uint geomRefAttrib = 100,
99 const Real omega = OMEGA50,
100 const Real mu = MU0, enum solverType type = SUPERLU);
102 const uint geomRefAttrib = 100);
103 virtual ~Eddy2D_H() {}
105 virtual hpAdaptiveSpaceH1& space() const;
107 virtual Real dissipation();
109 virtual Real magnEnergy();
118 protected:
119 virtual std::ostream& info(std::ostream& os) const;
121 virtual const std::string mshAbbr_() { return geom_.meshAbbreviation(); }
122 private:
124 void constructor_();
126 virtual hpFull& prebuild_() { return spc_->prebuild(); }
128 virtual void solve_();
130 void matrices_();
132 void laplaceMatrix_();
134 void identityMatrix_();
136 bool connectedIdx_(uint& i);
138 void systemMatrix_();
140 void linearform_();
141
143 std::unique_ptr<hpAdaptiveSpaceH1> spc_;
147 std::unique_ptr<concepts::BoundaryConditions> bc_;
149 std::unique_ptr<concepts::CellConditions> cc_;
151 enum solverType type_;
153 std::unique_ptr<concepts::Vector<Cmplx> > residual_;
155 std::unique_ptr<Real> residualNorm_;
157 std::unique_ptr<concepts::SparseMatrix<Real> > A_;
159 std::unique_ptr<concepts::SparseMatrix<Real> > M_;
161 std::unique_ptr<concepts::SparseMatrix<Cmplx> > S_;
162 // load vector
163 std::unique_ptr<concepts::Vector<Cmplx> > rhs_;
167 std::unique_ptr<const concepts::PiecewiseFormulaBase<Real> > H0_;
168 std::unique_ptr<const concepts::PiecewiseFormulaBase<Real2d> > curlH0_;
169 std::unique_ptr<const concepts::PiecewiseFormulaBase<Real> > divgradH0_;
171 std::unique_ptr<Eddy2D_H_Interior> interior_;
173 const Real omega_;
175 const Real mu_;
177 std::unique_ptr<Real> dissipation_;
179 std::unique_ptr<Real> magnEnergy_;
181 std::unique_ptr<const concepts::ElementFunction<Cmplx> > fun_;
183 double solvetime_;
184 };
185
186 // ****************************************************** InputEddy2D_H **
187
196 public:
202 virtual std::ostream& letters(std::ostream& os) const;
204 virtual std::ostream& arguments(std::ostream& os) const;
206 virtual std::ostream& description(std::ostream& os) const;
211 virtual int input(int opt, const char* optarg);
213 const concepts::Sequence<Real>& omega() const { return omega_; }
215 const concepts::PiecewiseFormulaBase<Real>* H0() const { return H0_; }
218 return curlH0_; }
221 return divgradH0_; }
223 bool interior() const { return false; }
225 enum Eddy2D_H::solverType type() const { return type_; }
227 bool solving() const { return solving_; }
228 protected:
229 virtual std::ostream& info(std::ostream& os) const;
230 private:
240 bool defaultOmega_;
242 enum Eddy2D_H::solverType type_;
244 bool solving_;
245 };
246
247} // namespace hp2D
248
249namespace concepts {
250
251 // *************************************************** HField_CircularCoil **
252
253 /* Formula for the magnetic field created by a circular coil
254
255 @author Kersten Schmidt, 2005
256 */
257 class HField_CircularCoil : public Formula<Real> {
258 public:
264 HField_CircularCoil(const Real R1, const Real R2, const Real h0 = 1.0) :
265 R1_(R1), R2_(R2), h0_(h0) {
266 conceptsAssert(R2 >= R1, Assertion());
267 conceptsAssert(R1 >= 0, Assertion());
268 }
269 virtual Real operator() (const Real p, const Real t = 0.0) const {
270 const Real r = std::abs(p);
271 if (r >= R2_) return 0.0;
272 if (r <= R1_) return h0_;
273 return (R2_ - r)/(R2_ - R1_) * h0_;
274 }
275 virtual Real operator() (const Real2d& p, const Real t = 0.0) const {
276 return (*this)(p.l2());
277 }
278 virtual Real operator() (const Real3d& p, const Real t = 0.0) const {
279 return (*this)(p.l2());
280 }
281 virtual HField_CircularCoil* clone() const {
282 return new HField_CircularCoil(R1_, R2_, h0_);
283 }
284 protected:
285 virtual std::ostream& info(std::ostream& os) const {
286 os << concepts::typeOf(*this)<<"(r <= " << R1_ << " : " << h0_ << ", ";
287 if (R2_ > R1_)
288 os << R1_ << " < r <= " << R2_ << " : " << R2_/(R2_-R1_)*h0_ << "-("
289 << h0_/(R2_-R1_) << ")*r, ";
290 return os << "r > " << R2_ << " : 0.0)";
291 }
292 private:
294 const Real R1_, R2_;
296 const Real h0_;
297 };
298
299 // *********************************************** CurlHField_CircularCoil **
300
301 /* Formula for the curl of the magnetic field created by a circular coil
302
303 @author Kersten Schmidt, 2006
304 */
305 class CurlHField_CircularCoil : public Formula<Real2d> {
306 public:
312 CurlHField_CircularCoil(const Real R1, const Real R2, const Real h0 = 1.0)
313 : R1_(R1), R2_(R2), h0_(h0) {
314 conceptsAssert(R2 >= R1, Assertion());
315 conceptsAssert(R1 >= 0, Assertion());
316 }
317 virtual Real2d operator() (const Real p, const Real t = 0.0) const {
318 return (*this)(Real2d(p,0));
319 }
320 virtual Real2d operator() (const Real2d& p, const Real t = 0.0) const {
321 const Real r = p.l2();
322 if (r >= R2_) return 0.0;
323 if (r <= R1_) return 0.0;
324 return Real2d(p[1], -p[0]) * (-h0_ /(R2_ - R1_) / r);
325 }
326 virtual Real2d operator() (const Real3d& p, const Real t = 0.0) const {
327 return (*this)(Real2d(p));
328 }
329 virtual CurlHField_CircularCoil* clone() const {
330 return new CurlHField_CircularCoil(R1_, R2_, h0_);
331 }
332 protected:
333 virtual std::ostream& info(std::ostream& os) const {
334 os << concepts::typeOf(*this)<<"(";
335 if (R2_ > R1_)
336 os << "r <= " << R1_ << " : " << 0.0 << ", "
337 << R1_ << " < r <= " << R2_ << " : (y,-x)^T/|r| * "
338 << h0_ / (R2_-R1_) << ", r > " << R2_ << " : 0.0";
339 else os << "0.0";
340 return os << ")";
341 }
342 private:
344 const Real R1_, R2_;
346 const Real h0_;
347 };
348
349 // ******************************************** DivGradHField_CircularCoil **
350
351 /* Formula for the curl of the magnetic field created by a circular coil
352
353 @author Kersten Schmidt, 2006
354 */
355 class DivGradHField_CircularCoil : public Formula<Real> {
356 public:
362 DivGradHField_CircularCoil(const Real R1, const Real R2,
363 const Real h0 = 1.0)
364 : R1_(R1), R2_(R2), h0_(h0) {
365 conceptsAssert(R2 >= R1, Assertion());
366 conceptsAssert(R1 >= 0, Assertion());
367 }
368 virtual Real operator() (const Real p, const Real t = 0.0) const {
369 return (*this)(Real2d(p,0));
370 }
371 virtual Real operator() (const Real2d& p, const Real t = 0.0) const {
372 const Real r = p.l2();
373 if (r >= R2_) return 0.0;
374 if (r <= R1_) return 0.0;
375 return -h0_/(R2_ - R1_)/r;
376 }
377 virtual Real operator() (const Real3d& p, const Real t = 0.0) const {
378 return (*this)(Real2d(p));
379 }
380 virtual DivGradHField_CircularCoil* clone() const {
381 return new DivGradHField_CircularCoil(R1_, R2_, h0_);
382 }
383 protected:
384 virtual std::ostream& info(std::ostream& os) const {
385 os << concepts::typeOf(*this)<<"(";
386 if (R2_ > R1_)
387 os << "r <= " << R1_ << " : " << 0.0 << ", "
388 << R1_ << " < r <= " << R2_ << " : " << -h0_/(R2_ - R1_) << "/r"
389 << ", r > " << R2_ << " : 0.0";
390 else os << "0.0";
391 return os << ")";
392 }
393 private:
395 const Real R1_, R2_;
397 const Real h0_;
398 };
399
400
401} // namespace concepts
402
403#endif // Eddy2D_hh
Real l2() const
Returns the Euclidian norm of the vector.
Eddy2D_H_Interior(const Eddy2D_H_Interior &i)
Copy constructor.
Definition Eddy2D_H.hh:42
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition Eddy2D_H.hh:49
const Real Omega_i() const
Returns size of the embedded area.
Definition Eddy2D_H.hh:45
const Real H0() const
Returns magnetic field of homogenization at.
Definition Eddy2D_H.hh:47
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual hpAdaptiveSpaceH1 & space() const
Returns the space.
virtual Real dissipation()
Return dissipation energy.
Eddy2D_H(concepts::EddyGeometry2D &geom, const Real H0, Eddy2D_H_Interior *interior=0, const uint geomRefAttrib=100, const Real omega=OMEGA50, const Real mu=MU0, enum solverType type=SUPERLU)
concepts::ElementFormula< Cmplx > * hField()
virtual Real magnEnergy()
Return magnetic energy.
Eddy2D_H(concepts::EddyGeometry2D &geom, const concepts::Formula< Real > &H0, const concepts::Formula< Real2d > &curlH0, const concepts::Formula< Real > *divgradH0=0, Eddy2D_H_Interior *interior=0, const uint geomRefAttrib=100, const Real omega=OMEGA50, const Real mu=MU0, enum solverType type=SUPERLU)
concepts::ElementFormula< concepts::Cmplx2d > * eField()
virtual const std::string mshAbbr_()
Mesh abbreviation string.
Definition Eddy2D_H.hh:121
solverType
Type of the solver.
Definition Eddy2D_H.hh:70
const concepts::PiecewiseFormulaBase< Real > * divgradH0() const
Returns the curl formula for homogenization.
Definition Eddy2D_H.hh:220
InputEddy2D_H(concepts::InOutParameters &input)
Constructor.
bool solving() const
Returns true, if model should be solved.
Definition Eddy2D_H.hh:227
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
const concepts::PiecewiseFormulaBase< Real2d > * curlH0() const
Returns the curl formula for homogenization.
Definition Eddy2D_H.hh:217
enum Eddy2D_H::solverType type() const
Returns solver.
Definition Eddy2D_H.hh:225
virtual std::ostream & arguments(std::ostream &os) const
Returns argument list as string.
const concepts::PiecewiseFormulaBase< Real > * H0() const
Returns formula for homogenization.
Definition Eddy2D_H.hh:215
virtual int input(int opt, const char *optarg)
const concepts::Sequence< Real > & omega() const
Returns set of angular frequencies.
Definition Eddy2D_H.hh:213
bool interior() const
Returns true, if there is a embedded area.
Definition Eddy2D_H.hh:223
virtual std::ostream & letters(std::ostream &os) const
virtual std::ostream & description(std::ostream &os) const
Returns description for help.
#define conceptsAssert(cond, exc)
std::string typeOf(const T &t)
Definition output.hh:43
double Real
Definition typedefs.hh:39
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320
std::complex< Real > Cmplx
Type for a complex number. It also depends on the setting of Real.
Definition typedefs.hh:42