Hermes2D  2.0
weakforms_maxwell.h
1 // This file is part of Hermes2D.
2 //
3 // Hermes2D is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 2 of the License, or
6 // (at your option) any later version.
7 //
8 // Hermes2D is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Hermes2D. If not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef __H2D_MAXWELL_WEAK_FORMS_H
17 #define __H2D_MAXWELL_WEAK_FORMS_H
18 
19 #include "../integrals/h1.h"
20 #include "../weakform/weakform.h"
21 #include "../spline.h"
22 namespace Hermes
23 {
24  namespace Hermes2D
25  {
26  namespace WeakFormsMaxwell {
27  /* Default volumetric matrix form \int_{area} coeff_spline(u_ext[0]) \curl u \curl v d\bfx
28  spline_coeff... nonconstant parameter given by cubic spline
29  */
30 
31  template<typename Scalar>
32  class HERMES_API DefaultJacobianMagnetostatics : public MatrixFormVol<Scalar>
33  {
34  public:
35  DefaultJacobianMagnetostatics(int i, int j, std::string area = HERMES_ANY, Scalar const_coeff = 1.0,
36  CubicSpline* c_spline = HERMES_DEFAULT_SPLINE, SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR,
37  int order_increase = 3);
38  DefaultJacobianMagnetostatics(int i, int j, Hermes::vector<std::string> areas,
39  Scalar const_coeff, CubicSpline* c_spline = HERMES_DEFAULT_SPLINE,
40  SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR, int order_increase = 3);
41 
42  virtual Scalar value(int n, double *wt, Func<Scalar> *u_ext[], Func<double> *u,
43  Func<double> *v, Geom<double> *e, Func<Scalar> **ext) const;
44 
45  virtual Hermes::Ord ord(int n, double *wt, Func<Hermes::Ord> *u_ext[], Func<Hermes::Ord> *u, Func<Hermes::Ord> *v,
46  Geom<Hermes::Ord> *e, Func<Ord> **ext) const;
47 
48  // This is to make the form usable in rk_time_step_newton().
49  virtual MatrixFormVol<Scalar>* clone() const;
50 
51  private:
52  int idx_j;
53  Scalar const_coeff;
54  CubicSpline* spline_coeff;
55  GeomType gt;
56  int order_increase;
57  };
58 
59  template<typename Scalar>
60  class HERMES_API DefaultResidualMagnetostatics : public VectorFormVol<Scalar>
61  {
62  public:
63  DefaultResidualMagnetostatics(int i, std::string area = HERMES_ANY, Scalar const_coeff = 1.0,
64  CubicSpline* c_spline = HERMES_DEFAULT_SPLINE,
65  GeomType gt = HERMES_PLANAR,
66  int order_increase = 3);
67  DefaultResidualMagnetostatics(int i, Hermes::vector<std::string> areas, Scalar const_coeff = 1.0,
68  CubicSpline* c_spline = HERMES_DEFAULT_SPLINE,
69  GeomType gt = HERMES_PLANAR, int order_increase = 3);
70 
71  virtual Scalar value(int n, double *wt, Func<Scalar> *u_ext[], Func<double> *v,
72  Geom<double> *e, Func<Scalar> **ext) const;
73 
74  virtual Hermes::Ord ord(int n, double *wt, Func<Hermes::Ord> *u_ext[], Func<Hermes::Ord> *v,
75  Geom<Hermes::Ord> *e, Func<Ord> **ext) const;
76 
77  // This is to make the form usable in rk_time_step_newton().
78  virtual VectorFormVol<Scalar>* clone() const;
79 
80  private:
81  int idx_i;
82  Scalar const_coeff;
83  CubicSpline* spline_coeff;
84  GeomType gt;
85  int order_increase;
86  };
87  };
88  }
89 }
90 #endif