Go to the documentation of this file.00001
00007 #ifndef Eddy2D_E_hh
00008 #define Eddy2D_E_hh
00009
00010 #include "formula/boundary.hh"
00011 #include "operator/sparseMatrix.hh"
00012 #include "hp2D/hpAdaptiveSpaceH1.hh"
00013 #include "hp2Dedge/hpAdaptiveSpaceHCurl.hh"
00014 #include "hp2Dedge/hpAdaptiveSpaceHCurl_H1.hh"
00015 #include "models/maxwell.hh"
00016 #include "models/maxwellConstants.hh"
00017 #include "models/Eddy2D_geometries.hh"
00018 #include "adaptiveModels.hh"
00019
00020 namespace hp2D {
00021
00022 using concepts::Real;
00023 using concepts::Cmplx;
00024
00025 class InputEddy2D_E;
00026
00027
00028
00034 class Eddy2D_E : public AdaptiveModel<Cmplx>,
00035 public concepts::MaxwellModel,
00036 public concepts::MaxwellBoundary {
00037 friend class concepts::ModelControl<Eddy2D_E>;
00038 public:
00046 Eddy2D_E(concepts::EddyGeometry2D& geom,
00047 enum concepts::MaxwellBoundary::boundaryType bType = PEC,
00048 const Real omega = OMEGA50, const Real mu = MU0,
00049 const uint geomRefAttrib = 100);
00050 Eddy2D_E(concepts::EddyGeometry2D& geom, InputEddy2D_E& input,
00051 enum boundaryType bType = PEC, const uint geomRefAttrib = 100);
00052 virtual ~Eddy2D_E() {}
00054 virtual hpAdaptiveSpaceHCurl_H1& space() const { return *spc_; }
00056 virtual Real dissipation();
00058 virtual Real magnEnergy();
00059 protected:
00060 virtual std::ostream& info(std::ostream& os) const;
00062 virtual hpFull& prebuild_() { return spc_->spcE().prebuild(); }
00064 virtual const std::string mshAbbr_() { return geom_.meshAbbreviation(); }
00065 private:
00067 void constructor_();
00068
00070 concepts::EddyGeometry2D& geom_;
00072 std::auto_ptr<hpAdaptiveSpaceHCurl_H1> spc_;
00073 std::auto_ptr<hpAdaptiveSpaceHCurl> spcE_;
00074 std::auto_ptr<hpAdaptiveSpaceH1> spcN_;
00076 std::auto_ptr<concepts::BoundaryConditions> bcE_, bcN_;
00077 std::auto_ptr<concepts::CellConditions> cc_;
00078
00080 std::auto_ptr<concepts::Vector<Cmplx> > residual_;
00082 std::auto_ptr<Real> residualNorm_;
00083
00084
00086 std::auto_ptr<concepts::SparseMatrix<Cmplx> > S_;
00088 std::auto_ptr<concepts::SparseMatrix<Real> > A_, M_eddy_;
00089
00090 std::auto_ptr<concepts::Vector<Cmplx> > rhs_;
00091
00093 const Real omega_;
00095 const Real mu_;
00096
00098 void constructSpace_();
00100 virtual void solve_();
00102 void matrices_();
00104 void rotrotMatrix_();
00106 void identityMatrix_();
00108 void regMatrix_();
00110 void linearform_();
00111
00113 std::auto_ptr<Real> dissipation_;
00115 std::auto_ptr<Real> magnEnergy_;
00117 double solvetime_, matrixtime_, spacetime_;
00118 };
00119
00120
00121
00126 class InputEddy2D_E : public concepts::InputParameter {
00127 public:
00129 InputEddy2D_E(concepts::InOutParameters& input);
00133 virtual std::ostream& letters(std::ostream& os) const;
00135 virtual std::ostream& arguments(std::ostream& os) const;
00137 virtual std::ostream& description(std::ostream& os) const;
00142 virtual int input(int opt, const char* optarg);
00144 bool solving() const { return solving_; }
00145 protected:
00146 virtual std::ostream& info(std::ostream& os) const;
00147 private:
00149 bool solving_;
00150 };
00151
00152 }
00153
00154 namespace concepts {
00155
00156
00157
00158 template<>
00159 class ModelControl<hp2D::Eddy2D_E> :
00160 public ModelControlBase<Model<Cmplx> > {
00161 public:
00163 ModelControl(hp2D::Eddy2D_E& model);
00164 virtual ~ModelControl() {}
00165
00166 virtual hp2D::Eddy2D_E& model() {
00167 return static_cast<hp2D::Eddy2D_E&>(model_);
00168 }
00169 virtual const hp2D::Eddy2D_E& model() const {
00170 return static_cast<const hp2D::Eddy2D_E&>(model_);
00171 }
00173 virtual void matrices();
00175 virtual Real solve();
00177 void storeMatricesToMatlab(const std::string matrixFile) const;
00178 void storeMatricesToOctave(const std::string matrixFile) const;
00180 void checkRanks() const;
00182 hp2D::hpFull& prebuild() { return model().prebuild_(); }
00183 protected:
00184 virtual std::ostream& info(std::ostream& os) const;
00185 };
00186
00187 }
00188
00189 #endif // Eddy2D_E_hh
00190