Lemma is an Electromagnetics API
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.

LayeredEarthEM.h 11KB

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