Eddy2D_E.hh

Go to the documentation of this file.
1 
7 #ifndef Eddy2D_E_hh
8 #define Eddy2D_E_hh
9 
10 #include "formula/boundary.hh"
11 #include "operator/sparseMatrix.hh"
15 #include "models/maxwell.hh"
18 #include "adaptiveModels.hh"
19 
20 namespace hp2D {
21 
22  using concepts::Real;
23  using concepts::Cmplx;
24 
25  class InputEddy2D_E;
26 
27  // ************************************************************** Eddy2D_E **
28 
34  class Eddy2D_E : public AdaptiveModel<Cmplx>,
37  friend class concepts::ModelControl<Eddy2D_E>;
38  public:
48  const Real omega = OMEGA50, const Real mu = MU0,
49  const uint geomRefAttrib = 100);
51  enum boundaryType bType = PEC, const uint geomRefAttrib = 100);
52  virtual ~Eddy2D_E() {}
54  virtual hpAdaptiveSpaceHCurl_H1& space() const { return *spc_; }
56  virtual Real dissipation();
58  virtual Real magnEnergy();
59  protected:
60  virtual std::ostream& info(std::ostream& os) const;
62  virtual hpFull& prebuild_() { return spc_->spcE().prebuild(); }
64  virtual const std::string mshAbbr_() { return geom_.meshAbbreviation(); }
65  private:
67  void constructor_();
68 
72  std::unique_ptr<hpAdaptiveSpaceHCurl_H1> spc_;
73  std::unique_ptr<hpAdaptiveSpaceHCurl> spcE_;
74  std::unique_ptr<hpAdaptiveSpaceH1> spcN_;
76  std::unique_ptr<concepts::BoundaryConditions> bcE_, bcN_;
77  std::unique_ptr<concepts::CellConditions> cc_;
78 
80  std::unique_ptr<concepts::Vector<Cmplx> > residual_;
82  std::unique_ptr<Real> residualNorm_;
83 
84 
86  std::unique_ptr<concepts::SparseMatrix<Cmplx> > S_;
88  std::unique_ptr<concepts::SparseMatrix<Real> > A_, M_eddy_;
89  // load vector
90  std::unique_ptr<concepts::Vector<Cmplx> > rhs_;
91 
93  const Real omega_;
95  const Real mu_;
96 
100  virtual void solve_();
102  void matrices_();
108  void regMatrix_();
110  void linearform_();
111 
113  std::unique_ptr<Real> dissipation_;
115  std::unique_ptr<Real> magnEnergy_;
118  };
119 
120  // ********************************************************* InputEddy2D_E **
121 
127  public:
133  virtual std::ostream& letters(std::ostream& os) const;
135  virtual std::ostream& arguments(std::ostream& os) const;
137  virtual std::ostream& description(std::ostream& os) const;
142  virtual int input(int opt, const char* optarg);
144  bool solving() const { return solving_; }
145  protected:
146  virtual std::ostream& info(std::ostream& os) const;
147  private:
149  bool solving_;
150  };
151 
152 } // namespace hp2D
153 
154 namespace concepts {
155 
156  // ****************************************** ModelControl<hp2D::Eddy2D_E> **
157 
158  template<>
159  class ModelControl<hp2D::Eddy2D_E> :
160  public ModelControlBase<Model<Cmplx> > {
161  public:
164  virtual ~ModelControl() {}
165 
166  virtual hp2D::Eddy2D_E& model() {
167  return static_cast<hp2D::Eddy2D_E&>(model_);
168  }
169  virtual const hp2D::Eddy2D_E& model() const {
170  return static_cast<const hp2D::Eddy2D_E&>(model_);
171  }
173  virtual void matrices();
175  virtual Real solve();
177  void storeMatricesToMatlab(const std::string matrixFile) const;
178  void storeMatricesToOctave(const std::string matrixFile) const;
180  void checkRanks() 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 // Eddy2D_E_hh
190 
std::unique_ptr< Real > magnEnergy_
Magnetic energy.
Definition: Eddy2D_E.hh:115
void linearform_()
Calculate the load vector, assumes sigma = 0 inside the coil.
const Real MU0
Base class for controlling a model.
Definition: models.hh:27
Class for calculating Eddy current problem with Maxwell modell in h formulation.
Definition: Eddy2D_E.hh:36
void checkRanks() const
Checks the ranks of A and S.
std::unique_ptr< hpAdaptiveSpaceHCurl > spcE_
Definition: Eddy2D_E.hh:73
virtual void matrices()
Builds the matrices and the load vector.
virtual int input(int opt, const char *optarg)
Process an argument and sets input parameter, if found.
virtual hpAdaptiveSpaceHCurl_H1 & space() const
Returns the space.
Definition: Eddy2D_E.hh:54
const Real omega_
Angular frequency.
Definition: Eddy2D_E.hh:93
void storeMatricesToOctave(const std::string matrixFile) const
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
void matrices_()
Building the matrices.
void constructor_()
Private constructor.
void rotrotMatrix_()
Calculate stiffness matrix.
ModelControl(hp2D::Eddy2D_E &model)
Constructor.
virtual void solve_()
Method for solving, throws exception when it wasn't successfull.
std::unique_ptr< concepts::Vector< Cmplx > > rhs_
Definition: Eddy2D_E.hh:90
virtual const hp2D::Eddy2D_E & model() const
Definition: Eddy2D_E.hh:169
std::unique_ptr< concepts::BoundaryConditions > bcN_
Definition: Eddy2D_E.hh:76
std::unique_ptr< concepts::Vector< Cmplx > > residual_
Residual of solving the linear system.
Definition: Eddy2D_E.hh:80
std::unique_ptr< hpAdaptiveSpaceHCurl_H1 > spc_
Spaces.
Definition: Eddy2D_E.hh:72
2D hp-FEM for H1-conforming elements.
std::unique_ptr< concepts::CellConditions > cc_
Definition: Eddy2D_E.hh:77
std::unique_ptr< hpAdaptiveSpaceH1 > spcN_
Definition: Eddy2D_E.hh:74
std::unique_ptr< concepts::SparseMatrix< Real > > A_
Mass matrix.
Definition: Eddy2D_E.hh:88
virtual std::ostream & arguments(std::ostream &os) const
Returns argument list as string.
Eddy2D_E(concepts::EddyGeometry2D &geom, enum concepts::MaxwellBoundary::boundaryType bType=PEC, const Real omega=OMEGA50, const Real mu=MU0, const uint geomRefAttrib=100)
Constructor.
void identityMatrix_()
Calculate identity matrix.
virtual std::ostream & info(std::ostream &os) const
InputEddy2D_E(concepts::InOutParameters &input)
Constructor.
bool solving() const
Returns true, if model should be solved.
Definition: Eddy2D_E.hh:144
std::unique_ptr< concepts::BoundaryConditions > bcE_
Boundary conditions.
Definition: Eddy2D_E.hh:76
Abstract class for Maxwell's problems.
Definition: maxwell.hh:55
virtual hp2D::Eddy2D_E & model()
Returns the model.
Definition: Eddy2D_E.hh:166
const Real OMEGA50
virtual std::ostream & description(std::ostream &os) const
Returns description for help.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
virtual Real solve()
Solves the system and returns the residual.
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
std::complex< Real > Cmplx
Type for a complex number. It also depends on the setting of Real.
Definition: typedefs.hh:39
virtual ~Eddy2D_E()
Definition: Eddy2D_E.hh:52
void meshAbbreviation(const char *meshAbbr)
void constructSpace_()
Constructs the space.
const Real mu_
Permeability constant.
Definition: Eddy2D_E.hh:95
virtual Real magnEnergy()
Return magnetic energy.
void regMatrix_()
Calculate regularisation matrix.
boundaryType
Boundary type.
Definition: maxwell.hh:27
const boundaryType bType() const
Returns boundary type.
Definition: maxwell.hh:33
std::unique_ptr< concepts::SparseMatrix< Real > > M_eddy_
Definition: Eddy2D_E.hh:88
std::unique_ptr< Real > dissipation_
Dissipation power loss.
Definition: Eddy2D_E.hh:113
virtual std::ostream & letters(std::ostream &os) const
Return letters for the arguments.
void storeMatricesToMatlab(const std::string matrixFile) const
Stores the calculated vectors and matrices.
std::unique_ptr< Real > residualNorm_
Euclidian norm of the residual of solving the linear system.
Definition: Eddy2D_E.hh:82
virtual Real dissipation()
Return dissipation power loss.
bool solving_
True, if model should be solved.
Definition: Eddy2D_E.hh:149
Container class for a 2D hp edge element space with an 2D hp nodal element space.
Eddy2D_E(concepts::EddyGeometry2D &geom, InputEddy2D_E &input, enum boundaryType bType=PEC, const uint geomRefAttrib=100)
virtual hpFull & prebuild_()
Space Prebuilder.
Definition: Eddy2D_E.hh:62
Helps for reading input parameters for single solving of Eddy2D_E.
Definition: Eddy2D_E.hh:126
Abstract class for holding geometry and material for eddy current problems.
concepts::EddyGeometry2D & geom_
Mesh and material constants (sigma, j0)
Definition: Eddy2D_E.hh:70
hp2D::hpFull & prebuild()
Returns Space Prebuilder.
Definition: Eddy2D_E.hh:182
double solvetime_
Time to solve the system, to build the matrices, to rebuild the space.
Definition: Eddy2D_E.hh:117
double spacetime_
Definition: Eddy2D_E.hh:117
double matrixtime_
Definition: Eddy2D_E.hh:117
double Real
Type normally used for a floating point number.
Definition: typedefs.hh:36
virtual const std::string mshAbbr_()
Mesh abbreviation string.
Definition: Eddy2D_E.hh:64
std::unique_ptr< concepts::SparseMatrix< Cmplx > > S_
Stiffness and System matrix.
Definition: Eddy2D_E.hh:86
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