Lemma is an Electromagnetics API
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

utteminv1d.cpp 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. // ===========================================================================
  2. //
  3. // Filename: utteminv1d.cpp
  4. //
  5. // Description: Invert for the difference in water table
  6. //
  7. // Version: 0.0
  8. // Created: 03/23/2011 02:07:19 PM
  9. // Revision: none
  10. // Compiler: Tested with g++, icpc, and MSVC 2000
  11. //
  12. // Author: M. Andy Kass (MAK)
  13. //
  14. // Organisation: Colorado School of Mines (CSM)
  15. // Broken Spoke Development, LLC
  16. //
  17. // Email: mkass@numericalgeo.com
  18. //
  19. // This program is free software: you can redistribute it and/or modify
  20. // it under the terms of the GNU General Public License as published by
  21. // the Free Software Foundation, either version 3 of the License, or
  22. // (at your option) any later version.
  23. //
  24. // This program is distributed in the hope that it will be useful,
  25. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  26. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  27. // GNU General Public License for more details.
  28. //
  29. // You should have received a copy of the GNU General Public License
  30. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  31. //
  32. // ===========================================================================
  33. #include "Lemma"
  34. #include "banner.h"
  35. using namespace Lemma;
  36. int main () {
  37. VectorXr maintimes;
  38. int ntimes;
  39. //Banner
  40. std::string name;
  41. std::string version;
  42. std::string usage;
  43. name = "TEM Inversion - 1D";
  44. version = "1.0beta";
  45. usage = "teminv1d [inputfile]";
  46. banner(name,version,usage);
  47. PolygonalWireAntenna* Trans = PolygonalWireAntenna::New();
  48. ReceiverPoints* Receivers = ReceiverPoints::New();
  49. LayeredEarthEM* StartingMod = LayeredEarthEM::New();
  50. //LayeredEarthEM* RecoveredMod = LayeredEarthEM::New();
  51. InverseSolverTEM1D* Inverse = InverseSolverTEM1D::New();
  52. Trans->SetNumberOfPoints(5);
  53. Trans->SetPoint(0, Vector3r( 0, 0, -1e-3));
  54. Trans->SetPoint(1, Vector3r( 100, 0, -1e-3));
  55. Trans->SetPoint(2, Vector3r( 100, 100, -1e-3));
  56. Trans->SetPoint(3, Vector3r( 0, 100, -1e-3));
  57. Trans->SetPoint(4, Vector3r( 0, 0, -1e-3));
  58. Trans->SetCurrent(1);
  59. Trans->SetNumberOfTurns(1);
  60. Trans->SetMinDipoleRatio(1/2.);
  61. Vector3r loc;
  62. Real ox = 50.;
  63. Real oy = 50.;
  64. Real depth = -1.e-3;
  65. Receivers->SetNumberOfReceivers(1);
  66. loc << ox,oy,depth;
  67. Receivers->SetLocation(0,loc);
  68. StartingMod->SetNumberOfLayers(22);
  69. StartingMod->SetLayerConductivity( (VectorXcr(22) << 0.,1.e-3,
  70. 1.e-3,1.e-3,1.e-3,1.e-3,1.e-3,1.e-3,1.e-3,1.e-3,1.e-3,1.e-3,1.e-3,
  71. 1.e-3,1.e-3,1.e-3,1.e-3,1.e-3,1.e-3,1.e-3,1.e-3,1.e-3).finished() );
  72. StartingMod->SetLayerThickness((VectorXr(20)<<4,4,4,4,4,4,4,4,4,4,4,4,4,
  73. 4,4,4,4,4,4,4).finished());
  74. //EM-47 gate times
  75. ntimes = 30;
  76. maintimes.resize(ntimes);
  77. maintimes << 36.,45.25,57.,72.25,92.,117.,148.,186.5,234.,290.,
  78. 352.5,427.5,525.,647.5,802.5,1002.5,1257.5,1582.5,1997.5,2525.,
  79. 3197.5,4055.,5147.5,6542.5,8322.5,10592.,13490.,17187.,21902.,
  80. 27915.;
  81. maintimes = maintimes.array() /1000000;
  82. Inverse->AttachStartMod(StartingMod);
  83. Inverse->AttachWireAntenna(Trans);
  84. Inverse->AttachReceiver(Receivers);
  85. Inverse->SetTimes(maintimes);
  86. LayeredEarthEM* RecoveredMod = StartingMod->Clone();
  87. Inverse->AttachRecMod(RecoveredMod);
  88. //Read input data - temp for SEG!
  89. /// TODO write a TEM data reader class. and a functional TEM data class
  90. std::fstream infile("rotateddat.dat",std::ios::in);
  91. if (infile.fail()) {
  92. std::cout << "Shit!" << std::endl;
  93. }
  94. MatrixXr rotinpdata;
  95. rotinpdata.resize(30,1);
  96. for (int ii=0;ii<30;ii++) {
  97. infile >> rotinpdata(ii);
  98. }
  99. infile.close();
  100. Inverse->AttachMeasuredData(rotinpdata);
  101. //Inverse->SetFreeParams( (VectorXi(2)<<0,1).finished(),
  102. // (VectorXi(3)<<1,2,3).finished());
  103. std::cout << *Inverse << std::endl;
  104. Inverse->Calculate();
  105. //Inverse->ShowSoln();
  106. //Inverse->WriteSoln("temp.dat");
  107. Inverse->Delete();
  108. RecoveredMod->Delete();
  109. StartingMod->Delete();
  110. Receivers->Delete();
  111. Trans->Delete();
  112. return EXIT_SUCCESS;
  113. }