10#include "operator/sparseMatrix.hh"
18#include "models/Maxwell2D_H_eField.hh"
27 class InputMaxwell2D_H;
42 enum solverType { SUPERLU = 0, SUPERLU2 = 1, BICGSTAB = 2, BICGSTAB2 = 3,
57 enum solverType type = SUPERLU,
bool diagPrecond =
true,
58 bool afterIter =
false,
59 const Real eps = EPS0,
const Real omega = OMEGA50,
60 const Real mu = MU0,
const uint geomRefAttrib = 100);
62 const uint geomRefAttrib = 100);
65 virtual std::ostream&
info(std::ostream& os)
const;
67 virtual const std::string
mshAbbr_() {
return geom_.meshAbbreviation(); }
82 std::unique_ptr<concepts::BoundaryConditions>
bc_;
89 std::unique_ptr<concepts::Vector<Cmplx> > residual_;
93 std::unique_ptr<concepts::Vector<Cmplx> > rhs_;
138 enum solverType type = SUPERLU,
bool diagPrecond =
true,
139 bool afterIter =
false,
140 const Real eps = EPS0,
const Real omega = OMEGA50,
141 const Real mu = MU0,
const uint geomRefAttrib = 100);
143 const uint geomRefAttrib = 100);
160 virtual std::ostream&
info(std::ostream& os)
const;
165 std::unique_ptr<hpAdaptiveSpaceH1> spc_;
167 std::unique_ptr<concepts::SparseMatrix<Cmplx> > A_, S_;
169 std::unique_ptr<concepts::SparseMatrix<Real> > M_;
172 void constructSpace_();
174 virtual void solve_();
191 enum solverType type = SUPERLU,
bool diagPrecond =
true,
192 bool afterIter =
false,
193 const Real eps = EPS0,
const Real omega = OMEGA50,
194 const Real mu = MU0,
const uint geomRefAttrib = 100,
195 std::string domains =
"(2)");
197 const uint geomRefAttrib = 100,
198 std::string domains =
"(2)");
209 virtual std::ostream&
info(std::ostream& os)
const;
216 std::unique_ptr<concepts::DomainDecomp<hp2D::hpAdaptiveSpaceH1> > spc_;
223 void constructSpace_(
const std::string& domainStr);
226 virtual void solve_();
230 void laplaceMatrix_();
232 void identityMatrix_();
264 virtual std::ostream&
letters(std::ostream& os)
const;
266 virtual std::ostream&
arguments(std::ostream& os)
const;
273 virtual int input(
int opt,
const char* optarg);
285 virtual std::ostream&
info(std::ostream& os)
const;
306 class ModelControl<
hp2D::Maxwell2D_H_Base> :
307 public ModelControlBase<Model<Cmplx> > {
311 virtual ~ModelControl() {}
320 virtual void matrices() = 0;
325 virtual Real solve() = 0;
327 void storeMatricesToMatlab(
const std::string
matrixFile)
const;
329 void setOmega(
const Real omega);
331 void setEpsilon(
const Real epsilon);
340 virtual std::ostream&
info(std::ostream&
os)
const;
346 class ModelControl<
hp2D::Maxwell2D_H> :
347 public ModelControl<hp2D::Maxwell2D_H_Base> {
351 virtual ~ModelControl() {}
359 virtual void matrices();
361 virtual Real solve();
363 void storeMatricesToMatlab(
const std::string
matrixFile)
const;
384 virtual std::ostream&
info(std::ostream&
os)
const;
390 class ModelControl<
hp2D::Maxwell2D_H_DD> :
391 public ModelControl<hp2D::Maxwell2D_H_Base> {
395 virtual ~ModelControl() {}
403 virtual void matrices();
405 virtual Real solve();
407 void storeMatricesToMatlab(
const std::string
matrixFile)
const;
415 virtual std::ostream&
info(std::ostream&
os)
const;
const boundaryType bType() const
Returns boundary type.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual F & model()
Returns the model.
ModelControl(F &model)
Constructor.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
const Real mu_
Permeability constant.
concepts::SparseMatrix< Real > * identityMatrix_(concepts::Space< Real > &spc, concepts::SparseMatrix< Cmplx > *S)
Calculate identity matrix and add's it to system matrix S.
void linearform_()
Calculate the load vector, assumes sigma = 0 inside the coil.
solverType
Type of the solver.
bool afterIter_
Nachiteration.
std::unique_ptr< concepts::BoundaryConditions > bc_
Boundary conditions.
uint iterations_
Number of iterations for iterative solver.
std::unique_ptr< Real > magnEnergy_
Magnetic energy.
std::unique_ptr< Real > residualNorm_
Euclidian norm of the residual of solving the linear system.
double solvetime_
Time to solve the system, to build the matrices, to rebuild the space.
enum solverType type_
Solver type.
Real omega_
Angular frequency.
concepts::PiecewiseFormulaFun< Cmplx, Real > iOmegaEps_plus_Sigma_Inv_
Piecewise constant formula.
bool diagPrecond_
Using diagonal preconditioning.
concepts::EddyGeometry2D & geom_
Mesh and material constants (sigma, j0)
Real eps_
Dielectricity constant.
virtual const std::string mshAbbr_()
Mesh abbreviation string.
Maxwell2D_H_Base(concepts::EddyGeometry2D &geom, enum boundaryType bType=PMC, enum solverType type=SUPERLU, bool diagPrecond=true, bool afterIter=false, const Real eps=EPS0, const Real omega=OMEGA50, const Real mu=MU0, const uint geomRefAttrib=100)
concepts::SparseMatrix< Cmplx > * laplaceMatrix_(concepts::Space< Real > &spc, concepts::SparseMatrix< Cmplx > *S)
Calculate stiffness matrix and add's it to system matrix S.
std::unique_ptr< Real > dissipation_
Dissipation power loss.
virtual hpFull & prebuild_()
Space Prebuilder.
Real dissipation()
Return dissipation power loss.
Real magnEnergy()
Return magnetic energy.
virtual concepts::DomainDecomp< hpAdaptiveSpaceH1 > & space() const
Returns the space.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual Real dissipation()
Return dissipation power loss.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
concepts::ElementFormula< concepts::Cmplx2d > * eField()
virtual Real magnEnergy()
Return magnetic energy.
concepts::ElementFormula< Cmplx > * hField()
virtual hpFull & prebuild_()
Space Prebuilder.
virtual hpAdaptiveSpaceH1 & space() const
Returns the space.
Maxwell2D_H(concepts::EddyGeometry2D &geom, enum concepts::MaxwellBoundary::boundaryType bType=PMC, enum solverType type=SUPERLU, bool diagPrecond=true, bool afterIter=false, const Real eps=EPS0, const Real omega=OMEGA50, const Real mu=MU0, const uint geomRefAttrib=100)
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.