Lemma is an Electromagnetics API
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

LayeredEarthEM.h 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. /* This file is part of Lemma, a geophysical modelling and inversion API */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /**
  6. @file
  7. @author Trevor Irons
  8. @date 06/24/2009
  9. @version 0.0
  10. **/
  11. #ifndef __LAYEREDEARTHEM_H
  12. #define __LAYEREDEARTHEM_H
  13. #include "LayeredEarth.h"
  14. #include <iomanip>
  15. namespace Lemma {
  16. // =======================================================================
  17. // Class: LayeredEarthEM
  18. /// \ingroup FDEM1D
  19. /// \brief 1D layered earth. Attributes include all aspects of
  20. /// Cole-Cole model.
  21. /// \details Primarily used for EM calculations.
  22. // =======================================================================
  23. class LayeredEarthEM : public LayeredEarth {
  24. public:
  25. // ==================== FRIENDS ===========================
  26. /** Recursively streams information about this class */
  27. friend std::ostream &operator<<(std::ostream &stream,
  28. const LayeredEarthEM &ob);
  29. // ==================== LIFECYCLE ===========================
  30. /**
  31. * Factory method for generating concrete class.
  32. * @return a std::shared_ptr of type LayeredEarthEM
  33. */
  34. static std::shared_ptr<LayeredEarthEM> NewSP();
  35. /** YAML Serializing method
  36. */
  37. YAML::Node Serialize() const;
  38. /**
  39. * Constructs an object from a YAML::Node.
  40. */
  41. static std::shared_ptr< LayeredEarthEM > DeSerialize(const YAML::Node& node);
  42. /** @return a deep copy
  43. */
  44. std::shared_ptr<LayeredEarthEM> Clone();
  45. // ==================== OPERATORS ===========================
  46. // ==================== OPERATIONS ===========================
  47. /** Evaluates the cole-cole model for suceptability and
  48. * permeability.
  49. * @param[in] omega is the frequency in Hz
  50. */
  51. void EvaluateColeColeModel(const Real& omega);
  52. // ==================== ACCESS ===========================
  53. /** Sets the number of layers and resizes all model parameters to
  54. * be the correct size, finally initialises all values to free
  55. * space.
  56. * @param[in] nlay is the number of layers
  57. */
  58. virtual void SetNumberOfLayers(const int& nlay);
  59. /** Sets Complex Conductivity of the layers
  60. * @param[in] sigma is a vector of the conducivity of the layers
  61. */
  62. void SetLayerConductivity(const VectorXcr &sigma);
  63. /** Sets Complex Conductivity of a single layer
  64. * @param[in] sigma is the conducivity of the layer
  65. * @param[in] ilay is the layer index
  66. */
  67. void SetLayerConductivity(const int& ilay, const Complex &sigma);
  68. /* Sets Complex resitivity of the layers
  69. * @param[in] ohm is a vector of the resistivity of the layers
  70. Singularity at 0 resistivity in air. Need to reformaulat things a bit
  71. */
  72. //void SetLayerResistivity(const VectorXcr &ohm);
  73. /** Sets the thickness of the layers
  74. * @param[in] thick is a vector of the thicknesses of the layers.
  75. * Must be two less than the total number of Layers as the top and
  76. * bottom layers are assumed infinite.
  77. */
  78. void SetLayerThickness(const VectorXr &thick);
  79. /** Sets the High frequency susceptibility
  80. */
  81. void SetLayerHighFreqSusceptibility(const VectorXr& sushi);
  82. /** Sets the Low frequency susceptibility
  83. */
  84. void SetLayerLowFreqSusceptibility(const VectorXr& sushi);
  85. /** Sets the Layer breath susceptibility
  86. */
  87. void SetLayerBreathSusceptibility(const VectorXr& susbr);
  88. /** Sets the Layer tau susceptibility
  89. */
  90. void SetLayerTauSusceptibility(const VectorXr& susta);
  91. /** Sets the High frequency permitivity
  92. */
  93. void SetLayerHighFreqPermitivity(const VectorXr& sushi);
  94. /** Sets the Low frequency permitivity
  95. */
  96. void SetLayerLowFreqPermitivity(const VectorXr& sushi);
  97. /** Sets the Layer breath permitivity
  98. */
  99. void SetLayerBreathPermitivity(const VectorXr& oerbr);
  100. /** Sets the Layer breath permitivity
  101. */
  102. void SetLayerTauPermitivity(const VectorXr& oerbr);
  103. // ==================== INQUIRY ===========================
  104. /** Returns the thickness of a layer
  105. @return a VectorXcr of the layer conductivities.
  106. */
  107. VectorXcr GetLayerConductivity( );
  108. /** Returns the conductivity of a layer
  109. * @param[in] ilay is the layer indice of interest
  110. * @return the complex valued conductivity of the layer of
  111. * interest.
  112. */
  113. Complex GetLayerConductivity(const int &ilay);
  114. /** Returns the susceptibility of a layer
  115. * @param[in] ilay is the layer indice of interest.
  116. * @return a Complex value of the electrical susceptibility of the
  117. * probes layer.
  118. */
  119. Complex GetLayerSusceptibility(const int &ilay);
  120. /** Returns the Susceptibility of Cole-Cole model
  121. * @return a VectorXcr of the suceptibilities of the model.
  122. */
  123. VectorXcr GetLayerSusceptibility( );
  124. /** Returns the low freq susceptibility of a layer
  125. */
  126. Real GetLayerLowFreqSusceptibility(const int &ilay);
  127. /** Returns the low freq susceptibility of a layer
  128. */
  129. VectorXr GetLayerLowFreqSusceptibility( );
  130. /** Returns the low freq susceptibility of a layer
  131. */
  132. Real GetLayerHighFreqSusceptibility(const int &ilay);
  133. /** Returns the low freq susceptibility of a layer
  134. */
  135. VectorXr GetLayerHighFreqSusceptibility( );
  136. /** Returns the low freq susceptibility of a layer
  137. */
  138. Real GetLayerTauSusceptibility(const int &ilay);
  139. /** Returns the low freq susceptibility of a layer
  140. */
  141. VectorXr GetLayerTauSusceptibility( );
  142. /** Returns the low freq susceptibility of a layer
  143. */
  144. Real GetLayerBreathSusceptibility(const int &ilay);
  145. /** Returns the low freq susceptibility of a layer
  146. */
  147. VectorXr GetLayerBreathSusceptibility( );
  148. /** Returns the Relative Permitivity of the cole cole model
  149. */
  150. VectorXcr GetLayerPermitivity( );
  151. /** Returns the conductivity of a layer
  152. * @param[in] ilay is the layer indice of interest.
  153. * @return a Complex value of the electrical permitivity of the
  154. * probed layer.
  155. */
  156. Complex GetLayerPermitivity(const int &ilay);
  157. /** Low Freq permivitity
  158. */
  159. VectorXr GetLayerLowFreqPermitivity( );
  160. /** Returns the low freq susceptibility of a layer
  161. */
  162. Real GetLayerLowFreqPermitivity(const int &ilay);
  163. /** Returns the low freq susceptibility of a layer
  164. */
  165. Real GetLayerHighFreqPermitivity(const int &ilay);
  166. /** Returns the low freq susceptibility of a layer
  167. */
  168. VectorXr GetLayerHighFreqPermitivity( );
  169. /** Returns the low freq susceptibility of a layer
  170. */
  171. Real GetLayerTauPermitivity(const int &ilay);
  172. /** Returns the low freq susceptibility of a layer
  173. */
  174. VectorXr GetLayerTauPermitivity( );
  175. /** Returns the low freq susceptibility of a layer
  176. */
  177. Real GetLayerBreathPermitivity(const int &ilay);
  178. /** Returns the low freq susceptibility of a layer
  179. */
  180. VectorXr GetLayerBreathPermitivity( );
  181. /** Returns the name of the underlying class, similiar to Python's type */
  182. virtual inline std::string GetName() const {
  183. return CName;
  184. }
  185. protected:
  186. // ==================== LIFECYCLE ===========================
  187. /** Default protected constructor. */
  188. LayeredEarthEM ( );
  189. /** Default protected constructor. */
  190. LayeredEarthEM (const YAML::Node& node);
  191. /** Default protected constructor. */
  192. ~LayeredEarthEM ();
  193. /**
  194. * @copybrief LemmaObject::Release()
  195. * @copydetails LemmaObject::Release()
  196. */
  197. void Release();
  198. // ==================== DATA MEMBERS ===========================
  199. /** Vector of layer Conductivity */
  200. VectorXcr LayerConductivity;
  201. /** Vector of layer Susceptibility (chi)
  202. * This is calculated using the Cole-Cole model
  203. * \f[ sus(i) = sush(i)
  204. * + \frac{(susl(i)-sush(i))} {(1+(jw * sustau(i))^{susalp(i)})} \f]
  205. */
  206. VectorXcr LayerSusceptibility;
  207. /** Vector of low frequency susceptibility, for use in Cole-Cole
  208. model */
  209. VectorXr LayerLowFreqSusceptibility;
  210. /** Vector of high frequency susceptibility, for use in Cole-Cole
  211. model */
  212. VectorXr LayerHighFreqSusceptibility;
  213. /** Vector of relaxation time constants, for use in Cole-Cole model
  214. */
  215. VectorXr LayerTauSusceptibility;
  216. /** Vector relaxation breath, for use in Cole-Cole model
  217. */
  218. VectorXr LayerBreathSusceptibility;
  219. /** Vector of Layer Permitivity (epsilon)
  220. * Calculated using the Cole-Cole model
  221. * \f[ epr(i) = eprh(i)
  222. * + \frac{ (eprl(i)-eprh(i))} { (1+(jw*eprtau(i))^{epralp(i)})} \f]
  223. */
  224. VectorXcr LayerPermitivity;
  225. /** Low frequency permitivity for each layer */
  226. VectorXr LayerLowFreqPermitivity;
  227. /** High frequency permitivity for each layer */
  228. VectorXr LayerHighFreqPermitivity;
  229. /** Decay time constant for each layer */
  230. VectorXr LayerTauPermitivity;
  231. /** Relaxation breath for each layer */
  232. VectorXr LayerBreathPermitivity;
  233. private:
  234. /** ASCII string representation of the class name */
  235. static constexpr auto CName = "LayeredEarthEM";
  236. }; // ----- end of class LayeredEarthEM -----
  237. } // namespace Lemma
  238. #endif // __LAYEREDEARTHEM_H
  239. /* vim: set tabstop=4 expandtab: */
  240. /* vim: set filetype=cpp: */