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,22 +58,23 @@ int main(int argc, char** argv) {
58 58
         Kern->PushCoil( "Coil 2", Tx2 );
59 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 63
         Kern->SetTolerance( 1e-5 ); // 1e-12
64 64
 
65 65
     std::vector<std::string> tx = {std::string("Coil 1")};//,std::string("Coil 2")};
66 66
     std::vector<std::string> rx = {std::string("Coil 2")};
67 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 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 76
         Complex coupling = Kern->Calculate( tx, rx, false );
76
-        #endif
77
+        //#endif
77 78
         std::cout << "coupling " << coupling << std::endl;
78 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,12 +89,14 @@ int main(int argc, char** argv) {
89 89
     // We could, I suppose, take the earth model in here? For non-linear that
90 90
     // may be more natural to work with?
91 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 94
     //std::vector<std::string> rx = {std::string("Coil 1"), std::string("Coil 2")};//, std::string("Coil 3") };
94 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 100
     dout << "# Transmitters: ";
99 101
     for (auto lp : tx) {
100 102
         dout << lp << "\t";
@@ -106,9 +108,8 @@ int main(int argc, char** argv) {
106 108
     dout << "\n# Tolerance: " << tol << std::endl;
107 109
     dout << "# Offset: " << offset << std::endl;
108 110
     dout << "# Radius: " << 15 << std::endl;
109
-    //std::ofstream dout = std::ofstream(std::string("k-coincident.dat"));
110 111
         dout << interfaces.transpose() << std::endl;
111
-        dout << I.transpose() << std::endl;
112
+        dout << Kern->GetPulseDuration()*I.transpose() << std::endl;
112 113
         dout << "#real\n";
113 114
         dout << Kern->GetKernel().real() << std::endl;
114 115
         dout << "#imag\n";
@@ -116,9 +117,10 @@ int main(int argc, char** argv) {
116 117
         dout.close();
117 118
 
118 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 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 126
 std::shared_ptr<Lemma::PolygonalWireAntenna> CircularLoop ( int nd, Real Radius, Real Offsetx, Real Offsety ) {

+ 4
- 0
include/KernelV0.h View File

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

+ 3
- 2
src/LoopInteractions.cpp View File

@@ -47,8 +47,9 @@ namespace Lemma {
47 47
 
48 48
     template <>
49 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 55
     template <>

Loading…
Cancel
Save