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

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