Main Lemma Repository
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

LayeredEarthEM.h 11KB

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