Go to the documentation of this file.00001
00006 #ifndef Maxwell2D_E_hh
00007 #define Maxwell2D_E_hh
00008
00009 #include "adaptiveModels.hh"
00010 #include "operator/sparseMatrix.hh"
00011 #include "hp2Dedge/hpAdaptiveSpaceHCurl.hh"
00012 #include "formula/boundary.hh"
00013 #include "models/maxwell.hh"
00014 #include "models/maxwellConstants.hh"
00015 #include "models/Eddy2D_geometries.hh"
00016
00017 namespace hp2D {
00018
00019 using concepts::Real;
00020 using concepts::Cmplx;
00021
00022 class InputMaxwell2D_E;
00023
00024
00025
00031 class Maxwell2D_E : public AdaptiveModel<Cmplx>,
00032 public concepts::MaxwellModel,
00033 public concepts::MaxwellBoundary {
00034 friend class concepts::ModelControl<Maxwell2D_E>;
00035 public:
00037 enum solverType { SUPERLU = 0, BICGSTAB};
00038 Maxwell2D_E(concepts::EddyGeometry2D& geom, enum boundaryType bType = PEC,
00039 enum solverType type = SUPERLU, bool diagPrecond = true,
00040 bool afterIter = false,
00041 const Real eps = EPS0, const Real omega = OMEGA50,
00042 const Real mu = MU0, const uint geomRefAttrib = 100);
00043 Maxwell2D_E(concepts::EddyGeometry2D& geom, InputMaxwell2D_E& input,
00044 const uint geomRefAttrib = 100);
00045 virtual ~Maxwell2D_E() {}
00047 virtual hp2D::hpAdaptiveSpaceHCurl& space() const { return *spc_; }
00049 virtual Real dissipation();
00051 virtual Real magnEnergy();
00052 protected:
00053 virtual std::ostream& info(std::ostream& os) const;
00055 virtual hpFull& prebuild_() { return spc_->prebuild(); }
00057 virtual const std::string mshAbbr_() { return geom_.meshAbbreviation(); }
00058 private:
00060 void constructor_();
00061
00063 concepts::EddyGeometry2D& geom_;
00065 std::auto_ptr<hp2D::hpAdaptiveSpaceHCurl> spc_;
00067 std::auto_ptr<concepts::BoundaryConditions> bc_;
00068
00070 enum solverType type_;
00072 bool diagPrecond_;
00074 bool afterIter_, statusAfterIter_;
00076 std::auto_ptr<concepts::Vector<Cmplx> > residual_;
00078 std::auto_ptr<Real> residualNorm_;
00080 std::auto_ptr<concepts::SparseMatrix<Cmplx> > S_;
00082 std::auto_ptr<concepts::SparseMatrix<Real> > A_, M_eddy_, M_wave_;
00083
00084 std::auto_ptr<concepts::Vector<Cmplx> > rhs_;
00086 const Real eps_;
00088 const Real omega_;
00090 const Real mu_;
00092 virtual void solve_();
00094 void matrices_();
00096 void rotrotMatrix_();
00098 void identityMatrix_();
00100 void linearform_();
00102 std::auto_ptr<Real> dissipation_;
00104 std::auto_ptr<Real> magnEnergy_;
00106 double solvetime_, matrixtime_, spacetime_;
00107 };
00108
00109
00110
00115 class InputMaxwell2D_E : public concepts::InputParameter {
00116 public:
00118 InputMaxwell2D_E(concepts::InOutParameters& input);
00122 virtual std::ostream& letters(std::ostream& os) const;
00124 virtual std::ostream& arguments(std::ostream& os) const;
00126 virtual std::ostream& description(std::ostream& os) const;
00131 virtual int input(int opt, const char* optarg);
00133 enum Maxwell2D_E::solverType type() const { return type_; }
00135 enum concepts::MaxwellBoundary::boundaryType boundary() const {
00136 return bType_;
00137 }
00139 bool solving() const { return solving_; }
00140 protected:
00141 virtual std::ostream& info(std::ostream& os) const;
00142 private:
00144 enum concepts::MaxwellBoundary::boundaryType bType_;
00146 enum Maxwell2D_E::solverType type_;
00148 bool solving_;
00149 };
00150
00151 }
00152
00153 namespace concepts {
00154
00155
00156
00157 template<>
00158 class ModelControl<hp2D::Maxwell2D_E> :
00159 public ModelControlBase<Model<Cmplx> > {
00160 public:
00162 ModelControl(hp2D::Maxwell2D_E& model);
00163 virtual ~ModelControl() {}
00164
00165 virtual hp2D::Maxwell2D_E& model() {
00166 return static_cast<hp2D::Maxwell2D_E&>(model_);
00167 }
00168 virtual const hp2D::Maxwell2D_E& model() const {
00169 return static_cast<const hp2D::Maxwell2D_E&>(model_);
00170 }
00172 virtual void matrices();
00174 void solverType(enum hp2D::Maxwell2D_E::solverType type,
00175 bool diagPrecond);
00177 virtual Real solve();
00179 void storeMatricesToMatlab(const std::string matrixFile) const;
00181 hp2D::hpFull& prebuild() { return model().prebuild_(); }
00182 protected:
00183 virtual std::ostream& info(std::ostream& os) const;
00184 };
00185
00186 }
00187
00188 #endif // Maxwell2D_E_hh