10#include "operator/sparseMatrix.hh"
17#include "models/Maxwell2D_H_eField.hh"
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_; }
49 virtual std::ostream&
info(std::ostream& os)
const {
51 <<
", H0_i = " << H0_ <<
")";
87 const Real omega = OMEGA50,
88 const Real mu = MU0,
enum solverType type = SUPERLU);
99 const Real omega = OMEGA50,
100 const Real mu = MU0,
enum solverType type = SUPERLU);
102 const uint geomRefAttrib = 100);
119 virtual std::ostream&
info(std::ostream& os)
const;
121 virtual const std::string
mshAbbr_() {
return geom_.meshAbbreviation(); }
126 virtual hpFull& prebuild_() {
return spc_->prebuild(); }
128 virtual void solve_();
132 void laplaceMatrix_();
134 void identityMatrix_();
136 bool connectedIdx_(uint& i);
138 void systemMatrix_();
143 std::unique_ptr<hpAdaptiveSpaceH1> spc_;
147 std::unique_ptr<concepts::BoundaryConditions> bc_;
149 std::unique_ptr<concepts::CellConditions> cc_;
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_;
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_;
177 std::unique_ptr<Real> dissipation_;
179 std::unique_ptr<Real> magnEnergy_;
181 std::unique_ptr<const concepts::ElementFunction<Cmplx> > fun_;
202 virtual std::ostream&
letters(std::ostream& os)
const;
204 virtual std::ostream&
arguments(std::ostream& os)
const;
211 virtual int input(
int opt,
const char* optarg);
229 virtual std::ostream&
info(std::ostream& os)
const;
257 class HField_CircularCoil :
public Formula<Real> {
265 R1_(
R1), R2_(
R2), h0_(
h0) {
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_;
275 virtual Real operator() (
const Real2d& p,
const Real t = 0.0)
const {
276 return (*
this)(p.l2());
278 virtual Real operator() (
const Real3d& p,
const Real t = 0.0)
const {
279 return (*
this)(p.l2());
281 virtual HField_CircularCoil* clone()
const {
282 return new HField_CircularCoil(R1_, R2_, h0_);
285 virtual std::ostream& info(std::ostream&
os)
const {
288 os << R1_ <<
" < r <= " << R2_ <<
" : " << R2_/(R2_-R1_)*h0_ <<
"-("
289 << h0_/(R2_-R1_) <<
")*r, ";
290 return os <<
"r > " << R2_ <<
" : 0.0)";
305 class CurlHField_CircularCoil :
public Formula<Real2d> {
313 : R1_(
R1), R2_(
R2), h0_(
h0) {
317 virtual Real2d operator() (
const Real p,
const Real t = 0.0)
const {
318 return (*
this)(Real2d(p,0));
320 virtual Real2d operator() (
const Real2d& p,
const Real t = 0.0)
const {
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);
326 virtual Real2d operator() (
const Real3d& p,
const Real t = 0.0)
const {
327 return (*
this)(Real2d(p));
329 virtual CurlHField_CircularCoil* clone()
const {
330 return new CurlHField_CircularCoil(R1_, R2_, h0_);
333 virtual std::ostream& info(std::ostream&
os)
const {
336 os <<
"r <= " << R1_ <<
" : " << 0.0 <<
", "
337 << R1_ <<
" < r <= " << R2_ <<
" : (y,-x)^T/|r| * "
338 << h0_ / (R2_-R1_) <<
", r > " << R2_ <<
" : 0.0";
355 class DivGradHField_CircularCoil :
public Formula<Real> {
362 DivGradHField_CircularCoil(
const Real R1,
const Real R2,
364 : R1_(
R1), R2_(
R2), h0_(
h0) {
368 virtual Real operator() (
const Real p,
const Real t = 0.0)
const {
369 return (*
this)(Real2d(p,0));
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;
377 virtual Real operator() (
const Real3d& p,
const Real t = 0.0)
const {
378 return (*
this)(Real2d(p));
380 virtual DivGradHField_CircularCoil* clone()
const {
381 return new DivGradHField_CircularCoil(R1_, R2_, h0_);
384 virtual std::ostream& info(std::ostream&
os)
const {
387 os <<
"r <= " << R1_ <<
" : " << 0.0 <<
", "
388 << R1_ <<
" < r <= " << R2_ <<
" : " << -h0_/(R2_ - R1_) <<
"/r"
389 <<
", r > " << R2_ <<
" : 0.0";
Real l2() const
Returns the Euclidian norm of the vector.
Eddy2D_H_Interior(const Eddy2D_H_Interior &i)
Copy constructor.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
const Real Omega_i() const
Returns size of the embedded area.
const Real H0() const
Returns magnetic field of homogenization at.
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.
solverType
Type of the solver.
#define conceptsAssert(cond, exc)
std::string typeOf(const T &t)
Set< F > makeSet(uint n, const F &first,...)
std::complex< Real > Cmplx
Type for a complex number. It also depends on the setting of Real.