Maxwell2D_E.hh

Go to the documentation of this file.
1 
7 #ifndef Maxwell2D_E_hh
8 #define Maxwell2D_E_hh
9 
10 #include "adaptiveModels.hh"
11 #include "operator/sparseMatrix.hh"
13 #include "formula/boundary.hh"
14 #include "models/maxwell.hh"
17 
18 namespace hp2D {
19 
20  using concepts::Real;
21  using concepts::Cmplx;
22 
23  class InputMaxwell2D_E;
24 
25  // *********************************************************** Maxwell2D_E **
26 
32  class Maxwell2D_E : public AdaptiveModel<Cmplx>,
35  friend class concepts::ModelControl<Maxwell2D_E>;
36  public:
38  enum solverType { SUPERLU = 0, BICGSTAB};
40  enum solverType type = SUPERLU, bool diagPrecond = true,
41  bool afterIter = false,
42  const Real eps = EPS0, const Real omega = OMEGA50,
43  const Real mu = MU0, const uint geomRefAttrib = 100);
45  const uint geomRefAttrib = 100);
46  virtual ~Maxwell2D_E() {}
48  virtual hp2D::hpAdaptiveSpaceHCurl& space() const { return *spc_; }
50  virtual Real dissipation();
52  virtual Real magnEnergy();
53  protected:
54  virtual std::ostream& info(std::ostream& os) const;
56  virtual hpFull& prebuild_() { return spc_->prebuild(); }
58  virtual const std::string mshAbbr_() { return geom_.meshAbbreviation(); }
59  private:
61  void constructor_();
62 
66  std::unique_ptr<hp2D::hpAdaptiveSpaceHCurl> spc_;
68  std::unique_ptr<concepts::BoundaryConditions> bc_;
69 
71  enum solverType type_;
77  std::unique_ptr<concepts::Vector<Cmplx> > residual_;
79  std::unique_ptr<Real> residualNorm_;
81  std::unique_ptr<concepts::SparseMatrix<Cmplx> > S_;
83  std::unique_ptr<concepts::SparseMatrix<Real> > A_, M_eddy_, M_wave_;
84  // load vector
85  std::unique_ptr<concepts::Vector<Cmplx> > rhs_;
87  const Real eps_;
89  const Real omega_;
91  const Real mu_;
93  virtual void solve_();
95  void matrices_();
97  void rotrotMatrix_();
101  void linearform_();
103  std::unique_ptr<Real> dissipation_;
105  std::unique_ptr<Real> magnEnergy_;
108  };
109 
110  // ****************************************************** InputMaxwell2D_E **
111 
117  public:
123  virtual std::ostream& letters(std::ostream& os) const;
125  virtual std::ostream& arguments(std::ostream& os) const;
127  virtual std::ostream& description(std::ostream& os) const;
132  virtual int input(int opt, const char* optarg);
134  enum Maxwell2D_E::solverType type() const { return type_; }
137  return bType_;
138  }
140  bool solving() const { return solving_; }
141  protected:
142  virtual std::ostream& info(std::ostream& os) const;
143  private:
149  bool solving_;
150  };
151 
152 } // namespace hp2D
153 
154 namespace concepts {
155 
156  // *************************************** ModelControl<hp2D::Maxwell2D_E> **
157 
158  template<>
159  class ModelControl<hp2D::Maxwell2D_E> :
160  public ModelControlBase<Model<Cmplx> > {
161  public:
164  virtual ~ModelControl() {}
165 
167  return static_cast<hp2D::Maxwell2D_E&>(model_);
168  }
169  virtual const hp2D::Maxwell2D_E& model() const {
170  return static_cast<const hp2D::Maxwell2D_E&>(model_);
171  }
173  virtual void matrices();
176  bool diagPrecond);
178  virtual Real solve();
180  void storeMatricesToMatlab(const std::string matrixFile) const;
182  hp2D::hpFull& prebuild() { return model().prebuild_(); }
183  protected:
184  virtual std::ostream& info(std::ostream& os) const;
185  };
186 
187 } // namespace concepts
188 
189 #endif // Maxwell2D_E_hh
virtual hp2D::hpAdaptiveSpaceHCurl & space() const
Returns the space.
Definition: Maxwell2D_E.hh:48
const Real EPS0
virtual std::ostream & letters(std::ostream &os) const
Return letters for the arguments.
Maxwell2D_E(concepts::EddyGeometry2D &geom, enum boundaryType bType=PEC, 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)
solverType
Type of the solver.
Definition: Maxwell2D_E.hh:38
const Real MU0
void rotrotMatrix_()
Calculate stiffness matrix.
Base class for controlling a model.
Definition: models.hh:27
std::unique_ptr< concepts::SparseMatrix< Real > > M_wave_
Definition: Maxwell2D_E.hh:83
bool diagPrecond_
Using diagonal preconditioning.
Definition: Maxwell2D_E.hh:73
InputMaxwell2D_E(concepts::InOutParameters &input)
Constructor.
std::unique_ptr< concepts::BoundaryConditions > bc_
Boundary conditions.
Definition: Maxwell2D_E.hh:68
void linearform_()
Calculate the load vector, assumes sigma = 0 inside the coil.
std::unique_ptr< concepts::SparseMatrix< Real > > M_eddy_
Definition: Maxwell2D_E.hh:83
void solverType(enum hp2D::Maxwell2D_E::solverType type, bool diagPrecond)
Change the solver type.
std::unique_ptr< Real > dissipation_
Dissipation power loss.
Definition: Maxwell2D_E.hh:103
std::unique_ptr< concepts::SparseMatrix< Real > > A_
Mass matrix.
Definition: Maxwell2D_E.hh:83
virtual std::ostream & description(std::ostream &os) const
Returns description for help.
Maxwell2D_E(concepts::EddyGeometry2D &geom, InputMaxwell2D_E &input, const uint geomRefAttrib=100)
bool solving_
True, if model should be solved.
Definition: Maxwell2D_E.hh:149
Holds parameters in hashes.
Definition: inputOutput.hh:75
Helper class for building 2D hp-FEM spaces (space pre builder).
Abstract class for carrying information, which helps for reading input parameters from command line.
Definition: inputParam.hh:24
virtual ~Maxwell2D_E()
Definition: Maxwell2D_E.hh:46
virtual std::ostream & arguments(std::ostream &os) const
Returns argument list as string.
virtual Real magnEnergy()
Return magnetic energy.
enum concepts::MaxwellBoundary::boundaryType bType_
Boundary condition.
Definition: Maxwell2D_E.hh:145
virtual hpFull & prebuild_()
Space Prebuilder.
Definition: Maxwell2D_E.hh:56
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
std::unique_ptr< concepts::Vector< Cmplx > > rhs_
Definition: Maxwell2D_E.hh:85
2D hp-FEM for H1-conforming elements.
std::unique_ptr< hp2D::hpAdaptiveSpaceHCurl > spc_
Space.
Definition: Maxwell2D_E.hh:66
enum concepts::MaxwellBoundary::boundaryType boundary() const
Returns type of boundary condition.
Definition: Maxwell2D_E.hh:136
const Real omega_
Angular frequency.
Definition: Maxwell2D_E.hh:89
double solvetime_
Time to solve the system, to build the matrices, to rebuild the space.
Definition: Maxwell2D_E.hh:107
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual void matrices()
Builds the matrices and the load vector.
virtual Real dissipation()
Return dissipation power loss.
enum solverType type_
Solver type.
Definition: Maxwell2D_E.hh:71
void matrices_()
Building the matrices.
std::unique_ptr< Real > residualNorm_
Euclidian norm of the residual of solving the linear system.
Definition: Maxwell2D_E.hh:79
Abstract class for Maxwell's problems.
Definition: maxwell.hh:55
bool solving() const
Returns true, if model should be solved.
Definition: Maxwell2D_E.hh:140
const Real OMEGA50
hp2D::hpFull & prebuild()
Returns Space Prebuilder.
Definition: Maxwell2D_E.hh:182
virtual std::ostream & info(std::ostream &os) const
std::complex< Real > Cmplx
Type for a complex number. It also depends on the setting of Real.
Definition: typedefs.hh:39
virtual int input(int opt, const char *optarg)
Process an argument and sets input parameter, if found.
void meshAbbreviation(const char *meshAbbr)
std::unique_ptr< Real > magnEnergy_
Magnetic energy.
Definition: Maxwell2D_E.hh:105
std::unique_ptr< concepts::SparseMatrix< Cmplx > > S_
Stiffness and System matrix.
Definition: Maxwell2D_E.hh:81
boundaryType
Boundary type.
Definition: maxwell.hh:27
const Real mu_
Permeability constant.
Definition: Maxwell2D_E.hh:91
const boundaryType bType() const
Returns boundary type.
Definition: maxwell.hh:33
void constructor_()
Private constructor.
Class for calculating Eddy current problem with Maxwell modell in e-formulation.
Definition: Maxwell2D_E.hh:34
enum Maxwell2D_E::solverType type_
Solver type.
Definition: Maxwell2D_E.hh:147
virtual const hp2D::Maxwell2D_E & model() const
Definition: Maxwell2D_E.hh:169
virtual const std::string mshAbbr_()
Mesh abbreviation string.
Definition: Maxwell2D_E.hh:58
concepts::EddyGeometry2D & geom_
Mesh and material constants (sigma, j0)
Definition: Maxwell2D_E.hh:64
Helps for reading input parameters for single solving of Maxwell2D_E.
Definition: Maxwell2D_E.hh:116
void storeMatricesToMatlab(const std::string matrixFile) const
Stores the calculated vectors.
enum Maxwell2D_E::solverType type() const
Returns solver.
Definition: Maxwell2D_E.hh:134
ModelControl(hp2D::Maxwell2D_E &model)
Constructor.
void identityMatrix_()
Calculate identity matrix.
Abstract class for holding geometry and material for eddy current problems.
virtual Real solve()
Solves the system and returns the residual.
const Real eps_
Dielectricity constant.
Definition: Maxwell2D_E.hh:87
std::unique_ptr< concepts::Vector< Cmplx > > residual_
Residual of solving the linear system.
Definition: Maxwell2D_E.hh:77
virtual void solve_()
Method for solving, throws exception when it wasn't successfull.
bool afterIter_
Nachiteration.
Definition: Maxwell2D_E.hh:75
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
virtual hp2D::Maxwell2D_E & model()
Returns the model.
Definition: Maxwell2D_E.hh:166
Basic namespace for Concepts-2.
Definition: pml_formula.h:16
Class for holding boundary type of Maxwell's problems.
Definition: maxwell.hh:19
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich