Surface NMR forward modelling
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* This file is part of Lemma, a geophysical modelling and inversion API.
  2. * More information is available at http://lemmasoftware.org
  3. */
  4. /* This Source Code Form is subject to the terms of the Mozilla Public
  5. * License, v. 2.0. If a copy of the MPL was not distributed with this
  6. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. */
  8. /**
  9. * @file
  10. * @date 11/11/2016 02:44:37 PM
  11. * @version $Id$
  12. * @author Trevor Irons (ti)
  13. * @email tirons@egi.utah.edu
  14. * @copyright Copyright (c) 2016, University of Utah
  15. * @copyright Copyright (c) 2016, Lemma Software, LLC
  16. */
  17. #include <Merlin>
  18. using namespace Lemma;
  19. std::shared_ptr<PolygonalWireAntenna> CircularLoop ( int nd, Real radius, Real Offsetx, Real Offsety ) ;
  20. int main() {
  21. auto earth = LayeredEarthEM::NewSP();
  22. earth->SetNumberOfLayers(3);
  23. earth->SetLayerConductivity( (VectorXcr(3) << Complex(0.,0), Complex(1./50.,0), Complex(1./100.)).finished() );
  24. earth->SetLayerThickness( (VectorXr(1) << 10).finished() );
  25. // Set mag field info
  26. // From NOAA, Laramie WY, June 9 2016, aligned with mag. north
  27. earth->SetMagneticFieldIncDecMag( 67, 0, 52750, NANOTESLA );
  28. // Transmitter loops
  29. auto Tx1 = CircularLoop(21, 15, 100, 100);
  30. auto Tx2 = CircularLoop(21, 15, 100, 124.8);
  31. //auto Tx1 = CircularLoop(60, 15, 0, 0); // was 60
  32. auto Kern = KernelV0::NewSP();
  33. Kern->PushCoil( "Coil 1", Tx1 );
  34. Kern->PushCoil( "Coil 2", Tx2 );
  35. Kern->SetLayeredEarthEM( earth );
  36. Kern->SetIntegrationSize( (Vector3r() << 200,200,200).finished() );
  37. Kern->SetIntegrationOrigin( (Vector3r() << 0,0,0).finished() );
  38. Kern->SetTolerance( 1e-10 );
  39. Kern->SetPulseDuration(0.020);
  40. VectorXr I(36);
  41. I << 397.4208916184016, 352.364477036168, 313.0112765842783, 278.37896394065376, 247.81424224324982,
  42. 220.77925043190442, 196.76493264105017, 175.31662279234038, 156.0044839325404, 138.73983004230124,
  43. 123.42064612625474, 109.82713394836259, 97.76534468972267, 87.06061858367781, 77.56000002944572, 69.1280780096311,
  44. 61.64250263640252, 54.99473044877554, 49.091182970515476, 43.84634004556388, 39.184136917167976, 35.03619319797924,
  45. 31.347205894128976, 28.06346770557137, 25.139117042424758, 22.53420773366429, 20.214205433283347,
  46. 18.144318026099942, 16.299965972298878, 14.652633628829891, 13.184271405688083, 11.870540177313893,
  47. 10.697057141915716, 9.64778948429609, 8.709338689612677, 7.871268012862094;
  48. //Kern->SetPulseCurrent( VectorXr::LinSpaced( 1, 10, 200 ) ); // nbins, low, high
  49. Kern->SetPulseCurrent( I ); // nbins, low, high
  50. //Kern->SetDepthLayerInterfaces( VectorXr::LinSpaced( 30, 3, 45.5 ) ); // nlay, low, high
  51. //10**np.linspace(np.log10(10),np.log10(19),10)
  52. VectorXr interfaces = VectorXr::LinSpaced(21, std::log10(2), std::log10(50)); // 30 log spaced
  53. for (int i=0; i<interfaces.size(); ++i) {
  54. interfaces(i) = std::pow(10, interfaces(i));
  55. }
  56. Kern->SetDepthLayerInterfaces( interfaces ); // nlay, low, high
  57. // We could, I suppose, take the earth model in here? For non-linear that
  58. // may be more natural to work with?
  59. std::vector<std::string> tx = {std::string("Coil 1"), std::string("Coil 2") };
  60. std::vector<std::string> rx = {std::string("Coil 1")};
  61. Kern->CalculateK0( tx, rx, true );
  62. ofstream out = ofstream("k.yaml");
  63. out << *Kern;
  64. out.close();
  65. }
  66. std::shared_ptr<Lemma::PolygonalWireAntenna> CircularLoop ( int nd, Real Radius, Real Offsetx, Real Offsety ) {
  67. auto Tx1 = Lemma::PolygonalWireAntenna::NewSP();
  68. Tx1->SetNumberOfPoints(nd);
  69. VectorXr range = VectorXr::LinSpaced(nd, 0, 2*PI);
  70. int ii;
  71. for (ii=0; ii<nd; ++ii) {
  72. Tx1->SetPoint(ii, Vector3r(Offsetx+Radius*std::cos(range(ii)), Offsety+Radius*std::sin(range(ii)), -1e-3));
  73. }
  74. //Tx1->SetPoint(ii, Vector3r(Offsetx+Radius*1, Offsety, -1e-3));
  75. Tx1->SetCurrent(1.);
  76. Tx1->SetNumberOfTurns(1);
  77. Tx1->SetNumberOfFrequencies(1);
  78. Tx1->SetFrequency(0,2246);
  79. return Tx1;
  80. }