Main Lemma Repository
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.

InstrumentTEM.h 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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 M. Andy Kass
  8. @date 02/10/2011
  9. @version $Id: instrumenttem.h 201 2015-01-03 00:07:47Z tirons $
  10. **/
  11. #ifndef __INSTRUMENTTEM_H
  12. #define __INSTRUMENTTEM_H
  13. #include "Instrument.h"
  14. #include "EMEarth1D.h"
  15. #include "WireAntenna.h"
  16. #include "PolygonalWireAntenna.h"
  17. #include "FieldPoints.h"
  18. #include "DipoleSource.h"
  19. #include "LayeredEarthEM.h"
  20. //#include "DigitalFilterCosTrans.h"
  21. //#include "DigitalFilterSinTrans.h"
  22. //#include "TEMIntegrationKernel.h"
  23. #include "CubicSplineInterpolator.h"
  24. namespace Lemma {
  25. enum ReceiverType { INDUCTIVE, MAGNETOMETER, ELECTRIC };
  26. // ===================================================================
  27. // Class: InstrumentTem
  28. /// \brief TEM Instrument Class
  29. /// \details Provides utility to forward model TEM data in Lemma.
  30. // ===================================================================
  31. class InstrumentTem : public Instrument {
  32. friend std::ostream &operator<<(std::ostream &stream,
  33. const InstrumentTem &ob);
  34. public:
  35. // ==================== LIFECYCLE =======================
  36. static InstrumentTem* NewSP();
  37. // ==================== OPERATORS =======================
  38. // ==================== OPERATIONS =======================
  39. /// Perform the forward model calculation
  40. void MakeDirectCalculation( const HANKELTRANSFORMTYPE& hType );
  41. /** Perform the forward model calculation, use lagged convolutions to
  42. * speed up the calculations
  43. */
  44. void MakeLaggedCalculation( const HANKELTRANSFORMTYPE& hType );
  45. // ==================== ACCESS =======================
  46. /** Sets pulse parameters as a linearly segmented graph, so
  47. * for example a triangle wave needs three points in Amps and
  48. * times, a trapazoidal needs for. The pulse is assumed (defaults) to be
  49. * bipolar, only the positive polarity should be specified.
  50. * @param[in] Amp is the waveform current in Amps
  51. * @param[in] times are the abscissa values of the waveform
  52. * @param[in] bipolar specifies whether or not the pulse is bipolar
  53. */
  54. void SetPulse( const VectorXr& Amp, const VectorXr& times, bool bipolar=true );
  55. /// Sets layered earth model
  56. void EMEarthModel(LayeredEarthEM* Earth);
  57. /// Sets transmitter parameters
  58. void SetTransmitLoop(WireAntenna *antennae);
  59. /// Sets dipole source parameters
  60. void SetDipoleSource(DipoleSource* dipolesource);
  61. /// Sets receiver points and parameters
  62. void SetReceiver(ReceiverPoints* Receivers);
  63. /** Sets the type of receiver/measurement
  64. */
  65. void SetReceiverType( const ReceiverType& rtype );
  66. /// Return calculated data
  67. MatrixXr GetMeasurements();
  68. /**
  69. Set time gates, assumes gates widths are delta (instantaneous)
  70. @param[in] times gate centres units are in seconds
  71. */
  72. void SetTimes(const VectorXr &times);
  73. /** Sets time gates centres and widths, both in seconds. The window is assumed to be
  74. * a simple boxcar. Simpson's rule is used to integrate the response
  75. * @param[in] times gate centres units are in seconds
  76. * @param[in] widths gate widths units are in seconds
  77. */
  78. void SetTimeGates(const VectorXr &centres, const VectorXr& widths);
  79. /// Get number of times
  80. int GetNumberOfTimes();
  81. /** Sets reference time for time gate to pulse time offset.
  82. */
  83. void SetReferenceTime(const Real& RefTime);
  84. /// Attach EMEarth1D
  85. //void AttachEMEarth1D(EMEarth1D *EMEarth);
  86. // ==================== INQUIRY =======================
  87. protected:
  88. // ==================== LIFECYCLE =======================
  89. /// Default protected constructor.
  90. InstrumentTem (const std::string &name);
  91. /// Default protected constructor.
  92. ~InstrumentTem ();
  93. // ==================== OPERATIONS =======================
  94. /**
  95. * Converts impulse B response (step db/dt) into inductive db/dt
  96. * response for general waveform.
  97. */
  98. void FoldAndConvolve( CubicSplineInterpolator* Spline );
  99. /** Convolves the transmitter waveform(s), takes the impulse response
  100. and uses simpson's rule to evaluate the integral.
  101. @param[in] Spline is the Cubic Spline object representing the solution.
  102. @param[in] t is the evaluation time.
  103. */
  104. Real ConvolveWaveform( CubicSplineInterpolator* Spline, const Real& t );
  105. /** Subtracts previous waveform(s) from current impulse response, and re-splines.
  106. */
  107. void SubtractPrevious( CubicSplineInterpolator* Spline );
  108. // ==================== DATA MEMBERS =========================
  109. //EMEarth1D* EmEarth;
  110. WireAntenna* Antenna;
  111. ReceiverPoints* Receiver;
  112. LayeredEarthEM* EarthMod;
  113. DipoleSource* Dipole;
  114. bool bipolarWaveform;
  115. /** Number of previous pules to model */
  116. int NPreviousPulse;
  117. /** Reference time (relative to pulse abscissa) for time gates */
  118. Real RefTime;
  119. /** Pulse period, if bimodal 1/2 repitition period */
  120. Real PulseT;
  121. /** Transmitter repitition frequency */
  122. Real TxFreq;
  123. /** Receiver type */
  124. ReceiverType RType;
  125. MatrixXr ModelledData;
  126. /** Centre of time gate */
  127. VectorXr TimeGates;
  128. /** Width of time gates */
  129. VectorXr GateWidths;
  130. /** Pulse waveform */
  131. VectorXr Waveform;
  132. /** Current Amplitude of pulse */
  133. VectorXr TxAmp;
  134. /** Current -delta of pulse */
  135. VectorXr TxDelta;
  136. /** Current derivative of pulse */
  137. VectorXr TxDiff;
  138. /** times associated with TxAmp segments */
  139. VectorXr TxAbs;
  140. private:
  141. }; // ----- end of class InstrumentTem -----
  142. } // End of namespace Lemma
  143. #endif // __TEMINSTRUMENT_H