Browse Source

Coupling and image generation plots

master
Trevor Irons 7 years ago
parent
commit
4ae1cdbc0a
2 changed files with 23 additions and 19 deletions
  1. 20
    17
      examples/Coupling.cpp
  2. 3
    2
      src/Coupling.cpp

+ 20
- 17
examples/Coupling.cpp View File

@@ -26,7 +26,7 @@ std::shared_ptr<PolygonalWireAntenna> CircularLoop ( int nd, Real radius, Real O
26 26
 void MoveLoop( std::shared_ptr<PolygonalWireAntenna> Loop, int nd, Real Radius, Real Offsetx, Real Offsety, Real wL );
27 27
 
28 28
 int main(int argc, char** argv) {
29
-
29
+    /*
30 30
     if ( argc < 2 ) {
31 31
         std::cout << "Calculates the coupling between two sNMR loops at the Larmor frequency. Usage\n"
32 32
                   << "\t./Coupling   EarthModel.yaml" << std::endl;
@@ -34,39 +34,42 @@ int main(int argc, char** argv) {
34 34
     }
35 35
     //Real offset = atof(argv[1]);
36 36
     auto earth = LayeredEarthEM::DeSerialize( YAML::LoadFile(argv[1]) );
37
-    Real Larmor = earth->GetMagneticFieldMagnitude()*GAMMA/(2*PI);
38
-//  RedButtes model, also how you can generate your own files
39
-// 	auto earth = LayeredEarthEM::NewSP();
40
-// 		earth->SetNumberOfLayers(3);
41
-// 		earth->SetLayerConductivity( (VectorXcr(3) << Complex(0.,0), Complex(1./50.,0), Complex(1./100.)).finished() );
42
-// 		earth->SetLayerThickness( (VectorXr(1) << 10).finished() );
43
-//         // Set mag field info
44
-//         // From NOAA, Laramie WY, June 9 2016, aligned with mag. north
45
-//         earth->SetMagneticFieldIncDecMag( 67, 0, 52750, NANOTESLA );
37
+    */
38
+    // RedButtes model, also how you can generate your own files
39
+	auto earth = LayeredEarthEM::NewSP();
40
+		earth->SetNumberOfLayers(3);
41
+		//earth->SetLayerConductivity( (VectorXcr(3) << Complex(0.,0), Complex(1./50.,0), Complex(1./100.)).finished() );
42
+		earth->SetLayerConductivity( (VectorXcr(3) << Complex(0.,0), Complex(1./7.,0), Complex(1./100.)).finished() );
43
+		earth->SetLayerThickness( (VectorXr(1) << 10).finished() );
44
+        // Set mag field info
45
+        // From NOAA, Laramie WY, June 9 2016, aligned with mag. north
46
+        earth->SetMagneticFieldIncDecMag( 67, 0, 52750, NANOTESLA );
46 47
 //     auto sig = std::ofstream("SigmaModel.yaml");
47 48
 //         sig << *earth << std::endl;
48 49
 //         sig.close();
49 50
 
51
+    Real Larmor = earth->GetMagneticFieldMagnitude()*GAMMA/(2*PI);
52
+
50 53
     // Transmitter loops
51
-    auto Tx1 = CircularLoop(21, 15, 100, 75, Larmor);
52
-    auto Tx2 = CircularLoop(21, 15, 100, 75, Larmor); // initially coincident
54
+    auto Tx1 = CircularLoop(21, 15, 50, 50, Larmor);
55
+    auto Tx2 = CircularLoop(21, 15, 50, 50, Larmor); // initially coincident
53 56
 
54 57
     auto Kern = Coupling::NewSP();
55 58
         Kern->PushCoil( "Coil 1", Tx1 );
56 59
         Kern->PushCoil( "Coil 2", Tx2 );
57 60
         Kern->SetLayeredEarthEM( earth );
58 61
 
59
-        Kern->SetIntegrationSize( (Vector3r() << 200,300,20).finished() );
62
+        Kern->SetIntegrationSize( (Vector3r() << 50,100,20).finished() );
60 63
         Kern->SetIntegrationOrigin( (Vector3r() << 0,0,0.01).finished() );
61
-        Kern->SetTolerance( 1e-5 ); // 1e-12
64
+        Kern->SetTolerance( 1e-2 ); // 1e-12
62 65
 
63
-    std::vector<std::string> tx = {std::string("Coil 1")};
66
+    std::vector<std::string> tx = {std::string("Coil 1")};//,std::string("Coil 2")};
64 67
     std::vector<std::string> rx = {std::string("Coil 2")};
65
-    VectorXr Offsets = VectorXr::LinSpaced(6, 22.00, 23.0); // nbins, low, high
68
+    VectorXr Offsets = VectorXr::LinSpaced(6, 15.00, 23.0); // nbins, low, high
66 69
 
67 70
     auto outfile = std::ofstream("coupling.dat");
68 71
     for (int ii=0; ii< Offsets.size(); ++ii) {
69
-        MoveLoop(Tx2, 21, 15, 100, 75 + Offsets(ii), Larmor);
72
+        MoveLoop(Tx2, 21, 15, 50, 50 + Offsets(ii), Larmor);
70 73
         #ifdef LEMMAUSEVTK
71 74
         Complex coupling = Kern->Calculate( tx, rx, true );
72 75
         #else

+ 3
- 2
src/Coupling.cpp View File

@@ -252,8 +252,9 @@ namespace Lemma {
252 252
     //      Method:  f
253 253
     //--------------------------------------------------------------------------------------
254 254
     Complex Coupling::f( const Vector3r& r, const Real& volume, const Vector3cr& Ht, const Vector3cr& Hr ) {
255
-        //return volume*(Hr.norm() + Ht.norm());//.dot(Hr);
256
-        return volume * ( Ht.dot(Hr) );
255
+        //return volume * ( Ht.dot(Hr) );                              // coupling
256
+        //return volume * (1.-((Ht+Hr).norm()/(Hr.norm() + Ht.norm()))); // interference
257
+        return volume * std::acos( (Ht.dot(Hr) / (Ht.norm()*Hr.norm())) ); // angle
257 258
     }
258 259
 
259 260
     //--------------------------------------------------------------------------------------

Loading…
Cancel
Save