Galerkin FEM for elliptic PDEs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LinearMag.h 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /* This file is part of Lemma, a geophysical modelling and inversion API.
  2. * More information is available at http://lemmasoftware.org
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. */
  8. /**
  9. * @file
  10. * @date 03/21/2016 01:39:32 PM
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email tirons@egi.utah.edu
  14. * @copyright Copyright (c) 2016, University of Utah
  15. * @copyright Copyright (c) 2016, Lemma Software, LLC
  16. */
  17. #ifndef LINEARMAG_INC
  18. #define LINEARMAG_INC
  19. #include <vtkCellIterator.h>
  20. #include "FEM4EllipticPDE.h"
  21. namespace Lemma {
  22. /** \addtogroup FEM4EllipticPDE
  23. @{
  24. */
  25. /**
  26. \brief Provides modelling of linear magnetic media
  27. \details This class solves the problem
  28. \f{equation}{
  29. \nabla^2 u(\mathbf{r}) = \nabla \cdot \kappa(\mathbf{r}) \mathbf{H}_0,
  30. \f}
  31. where \f$ \mathbf{H}_0\f$ is the static <B>homogeneous</B> inducing field, \f$ \kappa \f$
  32. is the <B>isotropic</B> magnetic suceptibility. The secondary field can be calculated
  33. \f$ \mathbf{H} = -\nabla \cdot u \f$
  34. */
  35. class LinearMag : public FEM4EllipticPDE {
  36. friend std::ostream &operator<<(std::ostream &stream,
  37. const LinearMag &ob);
  38. public:
  39. // ==================== LIFECYCLE =======================
  40. /**
  41. * @copybrief LemmaObject::New()
  42. * @copydetails LemmaObject::New()
  43. */
  44. static LinearMag* New();
  45. /**
  46. * @copybrief LemmaObject::Delete()
  47. * @copydetails LemmaObject::Delete()
  48. */
  49. void Delete();
  50. #ifdef HAVE_YAMLCPP
  51. /**
  52. * Uses YAML to serialize this object.
  53. * @return a YAML::Node
  54. */
  55. YAML::Node Serialize() const;
  56. /**
  57. * Constructs an object from a YAML::Node.
  58. */
  59. static LinearMag* DeSerialize(const YAML::Node& node);
  60. #endif
  61. // ==================== OPERATORS =======================
  62. // ==================== OPERATIONS =======================
  63. // ==================== ACCESS =======================
  64. /**
  65. * @param[in] B0 is the incident magnetic (-induction) field
  66. * @param[in] U is a MAGUNITS enum specifying the units of measurement
  67. */
  68. void SetInducingMagFieldVector( const Vector3r& B0, const MAGUNITS& U );
  69. /**
  70. * @param[in] intensity is the incident magnetic (-induction) field intensity
  71. * @param[in] inc is the incident magnetic (-induction) field inclination in degrees
  72. * @param[in] dec is the incident magnetic (-induction) field declination in degrees
  73. * @param[in] U is a MAGUNITS enum specifying the units of intensity
  74. */
  75. void SetInducingMagField( const Real& intensity, const Real& inclination,
  76. const Real& declination, const MAGUNITS& U );
  77. /**
  78. * Calculates the right hand side of the equation
  79. * \f$ \nabla \cdot \kappa \mathbf{H}_0 \f$
  80. */
  81. void CalculateRHS( const std::string& susName );
  82. // ==================== INQUIRY =======================
  83. protected:
  84. // ==================== LIFECYCLE =======================
  85. /** Default protected constructor, use New */
  86. LinearMag (const std::string& name);
  87. #ifdef HAVE_YAMLCPP
  88. /** Protected DeDerializing constructor, use factory DeSerialize method*/
  89. LinearMag (const YAML::Node& node);
  90. #endif
  91. /** Default protected destructor, use Delete */
  92. ~LinearMag ();
  93. /**
  94. * @copybrief LemmaObject::Release()
  95. * @copydetails LemmaObject::Release()
  96. */
  97. void Release();
  98. private:
  99. // ==================== DATA MEMBERS =========================
  100. Vector3r B0;
  101. /**
  102. * Used internally to scale mag units into Tesla
  103. */
  104. void ScaleB0 ( const MAGUNITS& U);
  105. }; // ----- end of class LinearMag -----
  106. /*! @} */ // End of group
  107. } // ----- end of Lemma name -----
  108. #endif // ----- #ifndef LINEARMAG_INC -----