Browse Source

Updates for better integration with Akvo

master
Trevor Irons 6 years ago
parent
commit
0d25529377

+ 1
- 1
CMakeLists.txt View File

@@ -1,7 +1,7 @@
1 1
 # Configure Merlin 
2 2
 set(MERLIN_VERSION_MAJOR "0")
3 3
 set(MERLIN_VERSION_MINOR "0")
4
-set(MERLIN_VERSION_PATCH "2")
4
+set(MERLIN_VERSION_PATCH "3")
5 5
 set(MERLIN_VERSION "\"${MERLIN_VERSION_MAJOR}.${MERLIN_VERSION_MINOR}.${MERLIN_VERSION_PATCH}\"")
6 6
 set(MERLIN_VERSION_NOQUOTES "${MERLIN_VERSION_MAJOR}.${MERLIN_VERSION_MINOR}.${MERLIN_VERSION_PATCH}")
7 7
 

+ 2
- 0
examples/CMakeLists.txt View File

@@ -32,6 +32,8 @@ endif()
32 32
 
33 33
 INSTALL_TARGETS( "/share/Merlin/"
34 34
 	KernelV0
35
+	KernelV0-2
36
+	KernelAligner
35 37
 	Coupling
36 38
 	Interference
37 39
 )

+ 0
- 1
examples/KernelAligner.cpp View File

@@ -28,6 +28,5 @@ int main(int argc, char** argv) {
28 28
         exit(EXIT_SUCCESS);
29 29
     }
30 30
     auto K0 = KernelV0::NewSP();
31
-
32 31
     std::cout << *K0 << std::endl;
33 32
 }

+ 1
- 0
examples/KernelV0-2.cpp View File

@@ -30,6 +30,7 @@ int main(int argc, char** argv) {
30 30
 
31 31
     std::cout << "Using kernel paramaters: " << argv[1] << std::endl;
32 32
     auto Kern = KernelV0::DeSerialize( YAML::LoadFile(argv[1]) );
33
+    std::cout << "Kernel DeSerialized successful" << std::endl;
33 34
 
34 35
     std::vector<std::string> tx = {std::string(argv[2])};
35 36
     std::vector<std::string> rx = {std::string(argv[3])};

+ 29
- 22
examples/KernelV0.cpp View File

@@ -24,7 +24,10 @@ std::shared_ptr<PolygonalWireAntenna> CircularLoop ( int nd, Real radius, Real O
24 24
 
25 25
 int main(int argc, char** argv) {
26 26
 
27
-    Real offset = atof(argv[1]);
27
+    if (argc < 6) {             // 1          2           3                    4                5
28
+        std::cout << "./KernelV0 TxCoil.yaml RxCoil.yaml  EMEarthModel.yaml    AkvoDataSet.yaml Output.yaml \n";
29
+        exit(EXIT_SUCCESS);
30
+    }
28 31
 
29 32
 	auto earth = LayeredEarthEM::NewSP();
30 33
 		earth->SetNumberOfLayers(3);
@@ -34,10 +37,19 @@ int main(int argc, char** argv) {
34 37
         // From NOAA, Laramie WY, June 9 2016, aligned with mag. north
35 38
         earth->SetMagneticFieldIncDecMag( 67, 9, 52750, NANOTESLA );
36 39
 
37
-    // Transmitter loops
38
-    auto Tx1 = CircularLoop(21, 15, 100, 100);
39
-    auto Tx2 = CircularLoop(21, 15, 100, 100 + offset); // 100, 115, 124.8, 130
40
-    //auto Tx1 = CircularLoop(60, 15, 0, 0); // was 60
40
+        auto Tx1 = PolygonalWireAntenna::DeSerialize( YAML::LoadFile(argv[1]) );
41
+        auto Tx2 = PolygonalWireAntenna::DeSerialize( YAML::LoadFile(argv[2]) );
42
+
43
+        //////////////////////////////////////               _
44
+        Tx1->SetCurrent(1.);                //               |
45
+        Tx1->SetNumberOfTurns(1);           //    Set these from Akvo input!
46
+        Tx1->SetNumberOfFrequencies(1);     //               |
47
+        Tx1->SetFrequency(0,2246);          //               |
48
+        Tx2->SetCurrent(1.);                //               |
49
+        Tx2->SetNumberOfTurns(1);           //           \   |   /
50
+        Tx2->SetNumberOfFrequencies(1);     //            \  |  /
51
+        Tx2->SetFrequency(0,2246);          //             \ | /
52
+        //////////////////////////////////////               _
41 53
 
42 54
     auto Kern = KernelV0::NewSP();
43 55
         Kern->PushCoil( "Coil 1", Tx1 );
@@ -46,24 +58,15 @@ int main(int argc, char** argv) {
46 58
 
47 59
         Kern->SetIntegrationSize( (Vector3r() << 200,200,200).finished() );
48 60
         Kern->SetIntegrationOrigin( (Vector3r() << 0,0,0).finished() );
49
-        Kern->SetTolerance( 1e-12 ); // 1e-12
61
+        Kern->SetTolerance( 1e-9 ); // 1e-12
50 62
 
51
-        Kern->AlignWithAkvoDataset( YAML::LoadFile(argv[2]) );
63
+        auto AkvoDataNode = YAML::LoadFile(argv[4]);
64
+        Kern->AlignWithAkvoDataset( AkvoDataNode );
52 65
 
53
-        Kern->SetPulseDuration(0.020);
54
-        VectorXr I(36);
66
+        // These should to into AlignWithAkvoDataSet...
67
+        Kern->SetPulseDuration( AkvoDataNode["pulseLength"][0].as<Real>() );
68
+        Kern->SetPulseCurrent( AkvoDataNode["Pulses"]["Pulse 1"]["current"].as<VectorXr>() ); // nbins, low, high
55 69
 
56
-        // off from VC by 1.075926340216996
57
-        // Pulses from Wyoming Red Buttes exp 0
58
-        I << 397.4208916184016, 352.364477036168, 313.0112765842783, 278.37896394065376, 247.81424224324982,
59
-             220.77925043190442, 196.76493264105017, 175.31662279234038, 156.0044839325404, 138.73983004230124,
60
-             123.42064612625474, 109.82713394836259, 97.76534468972267, 87.06061858367781, 77.56000002944572, 69.1280780096311,
61
-             61.64250263640252, 54.99473044877554, 49.091182970515476, 43.84634004556388, 39.184136917167976, 35.03619319797924,
62
-             31.347205894128976, 28.06346770557137, 25.139117042424758, 22.53420773366429, 20.214205433283347,
63
-             18.144318026099942, 16.299965972298878, 14.652633628829891, 13.184271405688083, 11.870540177313893,
64
-             10.697057141915716, 9.64778948429609, 8.709338689612677, 7.871268012862094;
65
-        //Kern->SetPulseCurrent( VectorXr::LinSpaced( 1, 10, 200 )  ); // nbins, low, high
66
-        Kern->SetPulseCurrent( I ); // nbins, low, high
67 70
 
68 71
         //VectorXr interfaces = VectorXr::LinSpaced( 41, .5, 45.5 ); // nlay, low, high
69 72
         VectorXr interfaces = VectorXr::LinSpaced( 51, .5, 45.5 ); // nlay, low, high
@@ -76,10 +79,12 @@ int main(int argc, char** argv) {
76 79
 
77 80
     // We could, I suppose, take the earth model in here? For non-linear that
78 81
     // may be more natural to work with?
79
-    std::vector<std::string> tx = {std::string("Coil 1"), std::string("Coil 2") };
82
+    //std::vector<std::string> tx = {std::string("Coil 1"), std::string("Coil 2") };
83
+    std::vector<std::string> tx = {std::string("Coil 1")};  //, std::string("Coil 2") };
80 84
     std::vector<std::string> rx = {std::string("Coil 2")};
81 85
     Kern->CalculateK0( tx, rx, false );
82 86
 
87
+/*
83 88
     std::ofstream dout = std::ofstream(std::string("k-Tx2coil-Rx1coil-offset-")+ std::string(argv[1])+ std::string(".dat"));
84 89
     //std::ofstream dout = std::ofstream(std::string("k-coincident.dat"));
85 90
         dout << interfaces.transpose() << std::endl;
@@ -89,8 +94,10 @@ int main(int argc, char** argv) {
89 94
         dout << "#imag\n";
90 95
         dout << Kern->GetKernel().imag() << std::endl;
91 96
         dout.close();
97
+*/
92 98
 
93
-    std::ofstream out = std::ofstream(std::string("k-Tx2coil-Rx1coil-offset-")+std::string(argv[1])+std::string(".yaml"));
99
+    //std::ofstream out = std::ofstream(std::string("k-Tx2coil-Rx1coil-offset-")+std::string(argv[1])+std::string(".yaml"));
100
+    std::ofstream out = std::ofstream(std::string(argv[5]));
94 101
     //std::ofstream out = std::ofstream(std::string("k-coincident.yaml"));
95 102
     out << *Kern;
96 103
     out.close();

+ 2
- 2
include/KernelV0.h View File

@@ -20,7 +20,7 @@
20 20
 #define  KERNELV0_INC
21 21
 
22 22
 #pragma once
23
-#include "LemmaObject.h"
23
+#include "MerlinObject.h"
24 24
 #include "LayeredEarthEM.h"
25 25
 #include "PolygonalWireAntenna.h"
26 26
 #include "EMEarth1D.h"
@@ -58,7 +58,7 @@ namespace Lemma {
58 58
      * \details This class calculates the imaging kernel for a free induction decay
59 59
      *          pulse. The methodology follows from Weichman et al., 2000.
60 60
      */
61
-    class KernelV0 : public LemmaObject {
61
+    class KernelV0 : public MerlinObject {
62 62
 
63 63
         friend std::ostream &operator<<(std::ostream &stream, const KernelV0 &ob);
64 64
 

+ 2
- 2
include/LoopInteractions.h View File

@@ -41,8 +41,8 @@ namespace Lemma {
41 41
 
42 42
     /**
43 43
      * \ingroup Merlin
44
-     * \brief
45
-     * \details
44
+     * \brief   Class for calculating the interactions between wire loops.
45
+     * \details The calculations are done in the frequency domain.
46 46
      */
47 47
     template< INTERACTION Type  >
48 48
     class LoopInteractions : public LemmaObject {

+ 8
- 4
src/KernelV0.cpp View File

@@ -17,7 +17,7 @@
17 17
  * @copyright Copyright (c) 2008, Colorado School of Mines
18 18
  */
19 19
 
20
-
20
+#include "MerlinConfig.h"
21 21
 #include "KernelV0.h"
22 22
 #include "FieldPoints.h"
23 23
 
@@ -37,7 +37,7 @@ namespace Lemma {
37 37
     //      Method:  KernelV0
38 38
     // Description:  constructor (locked)
39 39
     //--------------------------------------------------------------------------------------
40
-    KernelV0::KernelV0 (const ctor_key& key) : LemmaObject( key ) {
40
+    KernelV0::KernelV0 (const ctor_key& key) : MerlinObject( key ) {
41 41
 
42 42
     }  // -----  end of method KernelV0::KernelV0  (constructor)  -----
43 43
 
@@ -46,7 +46,8 @@ namespace Lemma {
46 46
     //      Method:  KernelV0
47 47
     // Description:  DeSerializing constructor (locked)
48 48
     //--------------------------------------------------------------------------------------
49
-    KernelV0::KernelV0 (const YAML::Node& node, const ctor_key& key) : LemmaObject(node, key) {
49
+    KernelV0::KernelV0 (const YAML::Node& node, const ctor_key& key) : MerlinObject(node, key) {
50
+
50 51
         //node["PulseType"] = "FID";
51 52
         Larmor = node["Larmor"].as<Real>();
52 53
         Temperature = node["Temperature"].as<Real>();
@@ -116,7 +117,8 @@ namespace Lemma {
116 117
     //      Method:  Serialize
117 118
     //--------------------------------------------------------------------------------------
118 119
     YAML::Node  KernelV0::Serialize (  ) const {
119
-        YAML::Node node = LemmaObject::Serialize();
120
+
121
+        YAML::Node node = MerlinObject::Serialize();
120 122
         node.SetTag( GetName() );
121 123
 
122 124
         // Coils Transmitters & Receivers
@@ -173,11 +175,13 @@ namespace Lemma {
173 175
             std::cout << node["processed"] << std::endl;
174 176
         }
175 177
         if (node["pulseType"].as<std::string>() == "FID") {
178
+            std::cout << "FID pulse detected" << std::endl;
176 179
             PulseI  = node["Pulses"]["Pulse 1"]["current"].as<VectorXr>();
177 180
             this->SetPulseDuration( node["pulseLength"][0].as<double>() );
178 181
         } else {
179 182
             std::cerr << "Pulse Type " << node["PulseType"] << "is not supported\n";
180 183
         }
184
+        std::cout << "Finished with Akvo file read" << std::endl;
181 185
     }
182 186
 
183 187
     //--------------------------------------------------------------------------------------

Loading…
Cancel
Save