Browse Source

Ternary array modifications

master
T-bone 7 years ago
parent
commit
784f30df10
4 changed files with 25 additions and 17 deletions
  1. 9
    8
      examples/Interference.cpp
  2. 9
    7
      examples/KV0-3loops.cpp
  3. 4
    0
      include/KernelV0.h
  4. 3
    2
      src/LoopInteractions.cpp

+ 9
- 8
examples/Interference.cpp View File

58
         Kern->PushCoil( "Coil 2", Tx2 );
58
         Kern->PushCoil( "Coil 2", Tx2 );
59
         Kern->SetLayeredEarthEM( earth );
59
         Kern->SetLayeredEarthEM( earth );
60
 
60
 
61
-        Kern->SetIntegrationSize( (Vector3r()   << 50,200,50).finished() );
62
-        Kern->SetIntegrationOrigin( (Vector3r() << 0, 0, 0.1).finished() );
61
+        Kern->SetIntegrationSize( (Vector3r()   << 50,200,10).finished() );
62
+        Kern->SetIntegrationOrigin( (Vector3r() << 0, 0, 50).finished() );
63
         Kern->SetTolerance( 1e-5 ); // 1e-12
63
         Kern->SetTolerance( 1e-5 ); // 1e-12
64
 
64
 
65
     std::vector<std::string> tx = {std::string("Coil 1")};//,std::string("Coil 2")};
65
     std::vector<std::string> tx = {std::string("Coil 1")};//,std::string("Coil 2")};
66
     std::vector<std::string> rx = {std::string("Coil 2")};
66
     std::vector<std::string> rx = {std::string("Coil 2")};
67
     VectorXr Offsets = VectorXr::LinSpaced(61, 0.00, 60.0); // nbins, low, high
67
     VectorXr Offsets = VectorXr::LinSpaced(61, 0.00, 60.0); // nbins, low, high
68
 
68
 
69
-    auto outfile = std::ofstream("interference-opposed.dat");
69
+    //auto outfile = std::ofstream("interference-opposed.dat");
70
+    auto outfile = std::ofstream("interference-50-60.dat");
70
     for (int ii=0; ii< Offsets.size(); ++ii) {
71
     for (int ii=0; ii< Offsets.size(); ++ii) {
71
-        MoveLoop(Tx2, 21, 15, 50, 50 + Offsets(ii), Larmor, -1.);
72
-        #ifdef LEMMAUSEVTK
73
-        Complex coupling = Kern->Calculate( tx, rx, true );
74
-        #else
72
+        MoveLoop(Tx2, 21, 15, 50, 50 + Offsets(ii), Larmor, 1.);
73
+        //#ifdef LEMMAUSEVTK
74
+        //Complex coupling = Kern->Calculate( tx, rx, true );
75
+        //#else
75
         Complex coupling = Kern->Calculate( tx, rx, false );
76
         Complex coupling = Kern->Calculate( tx, rx, false );
76
-        #endif
77
+        //#endif
77
         std::cout << "coupling " << coupling << std::endl;
78
         std::cout << "coupling " << coupling << std::endl;
78
         outfile << Offsets(ii) << "\t" <<  std::real(coupling) << "\t" << std::imag(coupling) << std::endl;
79
         outfile << Offsets(ii) << "\t" <<  std::real(coupling) << "\t" << std::imag(coupling) << std::endl;
79
     }
80
     }

+ 9
- 7
examples/KV0-3loops.cpp View File

89
     // We could, I suppose, take the earth model in here? For non-linear that
89
     // We could, I suppose, take the earth model in here? For non-linear that
90
     // may be more natural to work with?
90
     // may be more natural to work with?
91
     std::vector<std::string> tx = {std::string("Coil 1"), std::string("Coil 2"), std::string("Coil 3") };
91
     std::vector<std::string> tx = {std::string("Coil 1"), std::string("Coil 2"), std::string("Coil 3") };
92
-    std::vector<std::string> rx = {std::string("Coil 1"), std::string("Coil 2"), std::string("Coil 3") };
92
+    std::vector<std::string> rx = {std::string("Coil 1"), std::string("Coil 3")};
93
+    //std::vector<std::string> rx = {std::string("Coil 1"), std::string("Coil 2"), std::string("Coil 3") };
93
     //std::vector<std::string> rx = {std::string("Coil 1"), std::string("Coil 2")};//, std::string("Coil 3") };
94
     //std::vector<std::string> rx = {std::string("Coil 1"), std::string("Coil 2")};//, std::string("Coil 3") };
94
     //std::vector<std::string> rx = {std::string(argv[3])};
95
     //std::vector<std::string> rx = {std::string(argv[3])};
95
-    Kern->CalculateK0( tx, rx, true );
96
+    Kern->CalculateK0( tx, rx, false );
96
 
97
 
97
-    std::ofstream dout = std::ofstream(std::string("k0-3Tx-RxCh-") + std::string(argv[3]) + std::string("-tol") + std::string(argv[1])+ std::string(".dat"));
98
+    //std::ofstream dout = std::ofstream(std::string("k0-3Tx-RxCh-") + std::string(argv[3]) + std::string("-tol") + std::string(argv[1])+ std::string(".dat"));
99
+    std::ofstream dout = std::ofstream(std::string("k0-3Tx-RxCh-13") + std::string("-off-") + std::string(argv[1])+ std::string(".dat"));
98
     dout << "# Transmitters: ";
100
     dout << "# Transmitters: ";
99
     for (auto lp : tx) {
101
     for (auto lp : tx) {
100
         dout << lp << "\t";
102
         dout << lp << "\t";
106
     dout << "\n# Tolerance: " << tol << std::endl;
108
     dout << "\n# Tolerance: " << tol << std::endl;
107
     dout << "# Offset: " << offset << std::endl;
109
     dout << "# Offset: " << offset << std::endl;
108
     dout << "# Radius: " << 15 << std::endl;
110
     dout << "# Radius: " << 15 << std::endl;
109
-    //std::ofstream dout = std::ofstream(std::string("k-coincident.dat"));
110
         dout << interfaces.transpose() << std::endl;
111
         dout << interfaces.transpose() << std::endl;
111
-        dout << I.transpose() << std::endl;
112
+        dout << Kern->GetPulseDuration()*I.transpose() << std::endl;
112
         dout << "#real\n";
113
         dout << "#real\n";
113
         dout << Kern->GetKernel().real() << std::endl;
114
         dout << Kern->GetKernel().real() << std::endl;
114
         dout << "#imag\n";
115
         dout << "#imag\n";
116
         dout.close();
117
         dout.close();
117
 
118
 
118
     //std::ofstream out = std::ofstream(std::string("k0-3Tx-RxCh1-")+std::string(argv[1])+std::string(".yaml"));
119
     //std::ofstream out = std::ofstream(std::string("k0-3Tx-RxCh1-")+std::string(argv[1])+std::string(".yaml"));
120
+    std::ofstream out = std::ofstream(std::string("k0-3Tx-RxCh-13") + std::string("-off-") + std::string(argv[1])+ std::string(".yaml"));
119
     //std::ofstream out = std::ofstream(std::string("k-coincident.yaml"));
121
     //std::ofstream out = std::ofstream(std::string("k-coincident.yaml"));
120
-    //out << *Kern;
121
-    //out.close();
122
+    out << *Kern;
123
+    out.close();
122
 }
124
 }
123
 
125
 
124
 std::shared_ptr<Lemma::PolygonalWireAntenna> CircularLoop ( int nd, Real Radius, Real Offsetx, Real Offsety ) {
126
 std::shared_ptr<Lemma::PolygonalWireAntenna> CircularLoop ( int nd, Real Radius, Real Offsetx, Real Offsety ) {

+ 4
- 0
include/KernelV0.h View File

205
             Taup = taup;
205
             Taup = taup;
206
         }
206
         }
207
 
207
 
208
+        inline Real GetPulseDuration( ) {
209
+            return Taup;
210
+        }
211
+
208
         inline void SetDepthLayerInterfaces( const VectorXr& iface ){
212
         inline void SetDepthLayerInterfaces( const VectorXr& iface ){
209
             Interfaces = iface;
213
             Interfaces = iface;
210
         }
214
         }

+ 3
- 2
src/LoopInteractions.cpp View File

47
 
47
 
48
     template <>
48
     template <>
49
     Complex LoopInteractions<INTERFERENCE>::f( const Vector3r& r, const Real& volume, const Vector3cr& Ht, const Vector3cr& Hr ) {
49
     Complex LoopInteractions<INTERFERENCE>::f( const Vector3r& r, const Real& volume, const Vector3cr& Ht, const Vector3cr& Hr ) {
50
-        //return volume * (1.-((Ht+Hr).norm()/(Hr.norm() + Ht.norm()))); // normalized interference
51
-        return volume * (Ht+Hr).norm();  // interference not normalized
50
+        //return volume * (1.-((Ht+Hr).norm()/(Hr.norm() + Ht.norm())));     // normalized interference
51
+        return volume * ( (Ht+Hr).norm() - std::max(Hr.norm(), Ht.norm()) ); // interference emphisized
52
+        //return volume * (Ht+Hr).norm();  // interference not normalized
52
     }
53
     }
53
 
54
 
54
     template <>
55
     template <>

Loading…
Cancel
Save