Hermes2D  3.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 "../weakform/weakform.h"
20 #include "../spline.h"
21 namespace Hermes
22 {
23  namespace Hermes2D
24  {
25  namespace WeakFormsMaxwell {
26  /* Default volumetric matrix form \int_{area} coeff_spline(u_ext[0]) \curl u \curl v d\bfx
27  spline_coeff... nonconstant parameter given by cubic spline
28  */
29 
30  template<typename Scalar>
31  class HERMES_API DefaultJacobianMagnetostatics : public MatrixFormVol < Scalar >
32  {
33  public:
34  DefaultJacobianMagnetostatics(int i, int j, std::string area = HERMES_ANY, Scalar const_coeff = 1.0,
35  CubicSpline* c_spline = nullptr, SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR,
36  int order_increase = 3);
37  DefaultJacobianMagnetostatics(int i, int j, std::vector<std::string> areas,
38  Scalar const_coeff, CubicSpline* c_spline = nullptr,
39  SymFlag sym = HERMES_NONSYM, GeomType gt = HERMES_PLANAR, int order_increase = 3);
40 
41  virtual Scalar value(int n, double *wt, Func<Scalar> *u_ext[], Func<double> *u,
42  Func<double> *v, GeomVol<double> *e, Func<Scalar> **ext) const;
43 
44  virtual Hermes::Ord ord(int n, double *wt, Func<Hermes::Ord> *u_ext[], Func<Hermes::Ord> *u, Func<Hermes::Ord> *v,
45  GeomVol<Hermes::Ord> *e, Func<Ord> **ext) const;
46 
47  // This is to make the form usable in rk_time_step_newton().
48  virtual MatrixFormVol<Scalar>* clone() const;
49 
50  private:
51  int idx_j;
52  Scalar const_coeff;
53  CubicSpline* spline_coeff;
54  GeomType gt;
55  int order_increase;
56  };
57 
58  template<typename Scalar>
59  class HERMES_API DefaultResidualMagnetostatics : public VectorFormVol < Scalar >
60  {
61  public:
62  DefaultResidualMagnetostatics(int i, std::string area = HERMES_ANY, Scalar const_coeff = 1.0,
63  CubicSpline* c_spline = nullptr,
64  GeomType gt = HERMES_PLANAR,
65  int order_increase = 3);
66  DefaultResidualMagnetostatics(int i, std::vector<std::string> areas, Scalar const_coeff = 1.0,
67  CubicSpline* c_spline = nullptr,
68  GeomType gt = HERMES_PLANAR, int order_increase = 3);
69 
70  virtual Scalar value(int n, double *wt, Func<Scalar> *u_ext[], Func<double> *v,
71  GeomVol<double> *e, Func<Scalar> **ext) const;
72 
73  virtual Hermes::Ord ord(int n, double *wt, Func<Hermes::Ord> *u_ext[], Func<Hermes::Ord> *v,
74  GeomVol<Hermes::Ord> *e, Func<Ord> **ext) const;
75 
76  // This is to make the form usable in rk_time_step_newton().
77  virtual VectorFormVol<Scalar>* clone() const;
78 
79  private:
80  int idx_i;
81  Scalar const_coeff;
82  CubicSpline* spline_coeff;
83  GeomType gt;
84  int order_increase;
85  };
86  };
87  }
88 }
89 #endif
Geometry - volumetric - for order calculation.
Definition: forms.h:90
Definition: adapt.h:24
SymFlag
Bilinear form symmetry flag, see WeakForm::add_matrix_form.
Definition: global.h:156
Calculated function values (from the class Function) on an element for assembling.
Definition: forms.h:214
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Abstract, base class for matrix Volumetric form - i.e. MatrixForm, where the integration is with resp...
Definition: weakform.h:45
GeomType
Geometrical type of weak forms.
Definition: global.h:148
Abstract, base class for vector Volumetric form - i.e. VectorForm, where the integration is with resp...
Definition: weakform.h:46