Main Lemma Repository
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

LayeredEarthEM.h 11KB

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