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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. int main(int argc, char** argv) {
  20. if (argc<3) {
  21. //std::cout << "./KernelV0-2 earth.yaml tx.yaml rx.yaml \n";
  22. std::cout << "./KernelV0-2 Kernel.yaml TxString RxString \n";
  23. return(EXIT_SUCCESS);
  24. }
  25. std::cout << "Using kernel paramaters: " << argv[1] << std::endl;
  26. auto Kern = KernelV0::DeSerialize( YAML::LoadFile(argv[1]) );
  27. // std::cout << "Using earth model: " << argv[1] << std::endl;
  28. // auto earth = LayeredEarthEM::DeSerialize( YAML::LoadFile(argv[2]) );
  29. //
  30. // std::cout << "Using transmitter: " << argv[2] << std::endl;
  31. // auto Tx = PolygonalWireAntenna::DeSerialize( YAML::LoadFile(argv[3]) );
  32. //
  33. // std::cout << "Using receivers: " << argv[3] << std::endl;
  34. // auto Rx1 = PolygonalWireAntenna::DeSerialize( YAML::LoadFile(argv[4]) );
  35. #if 0
  36. auto Kern = KernelV0::NewSP();
  37. //Kern->PushCoil( "Coil 1", Tx );
  38. //Kern->PushCoil( "Coil 2", Rx1 );
  39. //Kern->SetLayeredEarthEM( earth );
  40. Kern->SetIntegrationSize( (Vector3r() << 200, 200., 100).finished() );
  41. Kern->SetIntegrationOrigin( (Vector3r() << -100, -100, .5).finished() );
  42. Real tol(1e-11); // 13
  43. Kern->SetTolerance( tol ); // 1e-12
  44. // Kern->AlignWithAkvoDataset( YAML::LoadFile(argv[2]) );
  45. Kern->SetPulseDuration(0.020);
  46. VectorXr I(36);
  47. // off from VC by 1.075926340216996
  48. // Pulses from Wyoming Red Buttes exp 0
  49. I << 397.4208916184016, 352.364477036168, 313.0112765842783, 278.37896394065376, 247.81424224324982,
  50. 220.77925043190442, 196.76493264105017, 175.31662279234038, 156.0044839325404, 138.73983004230124,
  51. 123.42064612625474, 109.82713394836259, 97.76534468972267, 87.06061858367781, 77.56000002944572, 69.1280780096311,
  52. 61.64250263640252, 54.99473044877554, 49.091182970515476, 43.84634004556388, 39.184136917167976, 35.03619319797924,
  53. 31.347205894128976, 28.06346770557137, 25.139117042424758, 22.53420773366429, 20.214205433283347,
  54. 18.144318026099942, 16.299965972298878, 14.652633628829891, 13.184271405688083, 11.870540177313893,
  55. 10.697057141915716, 9.64778948429609, 8.709338689612677, 7.871268012862094;
  56. //Kern->SetPulseCurrent( VectorXr::LinSpaced( 1, 10, 200 ) ); // nbins, low, high
  57. Kern->SetPulseCurrent( I ); // nbins, low, high
  58. //VectorXr interfaces = VectorXr::LinSpaced( 41, .5, 45.5 ); // nlay, low, high
  59. //VectorXr interfaces = VectorXr::LinSpaced( 61, .5, 45.5 ); // nlay, low, high
  60. VectorXr interfaces = VectorXr::LinSpaced( 58, .5, 45.5 ); // nlay, low, high
  61. Real thick = .1;
  62. for (int ilay=1; ilay<interfaces.size(); ++ilay) {
  63. interfaces(ilay) = interfaces(ilay-1) + thick;
  64. thick *= 1.085;
  65. }
  66. Kern->SetDepthLayerInterfaces( interfaces ); // nlay, low, high
  67. // We could, I suppose, take the earth model in here? For non-linear that
  68. // may be more natural to work with?
  69. #endif
  70. std::vector<std::string> tx = {std::string(argv[2])};
  71. std::vector<std::string> rx = {std::string(argv[3])};
  72. Kern->CalculateK0( tx, rx, false ); // 3rd argument is vtk output
  73. std::ofstream dout = std::ofstream(std::string("Rx-")+std::string(argv[3])+std::string(".dat"));
  74. dout << "# Transmitters: ";
  75. for (auto lp : tx) {
  76. dout << lp << "\t";
  77. }
  78. dout << "\n# Receivers: ";
  79. for (auto lp : rx) {
  80. dout << lp << "\t";
  81. }
  82. dout << "\n# Tolerance: " << Kern->GetTolerance() << std::endl;
  83. dout << Kern->GetInterfaces().transpose() << std::endl;
  84. dout << Kern->GetPulseDuration()*Kern->GetPulseCurrent().transpose() << std::endl;
  85. dout << "#real\n";
  86. dout << Kern->GetKernel().real() << std::endl;
  87. dout << "#imag\n";
  88. dout << Kern->GetKernel().imag() << std::endl;
  89. dout.close();
  90. std::ofstream out = std::ofstream(std::string("Rx-")+std::string(argv[2])+std::string(".yaml"));
  91. //std::ofstream out = std::ofstream(std::string("k-coincident.yaml"));
  92. out << *Kern;
  93. out.close();
  94. }