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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // ===========================================================================
  2. //
  3. // Filename: utemdipearth1d.cpp
  4. //
  5. // Description:
  6. //
  7. // Version: 0.0
  8. // Created: 01/06/2010 04:27:56 PM
  9. // Revision: none
  10. // Compiler: g++ (c++)
  11. //
  12. // Author: Trevor Irons (ti)
  13. //
  14. // Organisation: Colorado School of Mines (CSM)
  15. // United States Geological Survey (USGS)
  16. //
  17. // Email: tirons@mines.edu, tirons@usgs.gov
  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 <FDEM1D>
  34. using namespace Lemma;
  35. int main() {
  36. // Test with a single dipole
  37. auto dipole = DipoleSource::NewSP();
  38. dipole->SetType(GROUNDEDELECTRICDIPOLE);
  39. dipole->SetPolarisation(XPOLARISATION);
  40. dipole->SetNumberOfFrequencies(1);
  41. dipole->SetMoment(1);
  42. dipole->SetFrequency(0, 4400.1000);
  43. //dipole->SetPhase(0);
  44. //dipole->SetLocation( (VectorXr(3) << 49, 49, -1e-4).finished() );
  45. dipole->SetLocation( 49, 49, -1e-4 );
  46. // Define model
  47. VectorXcr sigma(2);
  48. sigma << 0., 1e-3;//, .1;//, .01, .001;
  49. VectorXr thick(1);
  50. thick << 10;//, 10, 10;
  51. auto earth = LayeredEarthEM::NewSP();
  52. earth->SetNumberOfLayers(2);
  53. earth->SetLayerConductivity(sigma);
  54. //earth->SetLayerThickness(thick);
  55. // Receivers
  56. auto receivers = FieldPoints::NewSP();
  57. Vector3r loc;
  58. //Real ox = -5.1456;
  59. //Real oy = 2.2350;
  60. Real ox = 50.;
  61. Real oy = 20.;
  62. Real depth = 18.10;
  63. Real dz = 2.6;
  64. int nz = 1;
  65. receivers->SetNumberOfPoints(nz);
  66. int ir = 0;
  67. for (int iz=0; iz<nz; ++iz) {
  68. loc << ox, oy, depth;
  69. receivers->SetLocation(ir, loc);
  70. depth += dz;
  71. ++ ir;
  72. }
  73. //receivers->SetLocation(1, ox, oy, depth);
  74. auto EmEarth = EMEarth1D::NewSP();
  75. //EmEarth->SetHankelTransformMethod(DIGITALFILTERING);
  76. EmEarth->SetFieldsToCalculate(BOTH); // Fortran needs this
  77. EmEarth->AttachDipoleSource(dipole);
  78. EmEarth->AttachLayeredEarthEM(earth);
  79. EmEarth->AttachFieldPoints(receivers);
  80. //dipole->SetType(ELECTRICDIPOLE);
  81. // receivers->SetNumberOfReceivers(1);
  82. // //for
  83. // receivers->SetLocation(0, ox, oy, depth);
  84. std::cout << "C++\n";
  85. EmEarth->MakeCalc3();
  86. std::cout << receivers->GetEfield(0,0) << std::endl;
  87. //std::cout << receivers->GetEfield(0) << std::endl;
  88. //std::cout << receivers->GetHfield(1) << std::endl;
  89. //std::cout << receivers->GetEfield(1) << std::endl;
  90. //receivers->ClearFields();
  91. // swap tx rx posigion
  92. /*
  93. receivers->SetLocation(0, dipole->GetLocation());
  94. dipole->SetLocation(loc);
  95. EmEarth->MakeCalc3();
  96. std::cout << receivers->GetEfield(0,0) << std::endl;
  97. receivers->ClearFields();
  98. */
  99. #ifdef NOKIHALEE_EM1D
  100. std::cout << "\nFORTRAN\n";
  101. EmEarth->MakeCalc();
  102. // std::cout << receivers->GetHfield(0,0) << std::endl;
  103. std::cout << receivers->GetEfield(0,0) << std::endl;
  104. #endif
  105. }