T-bone 7 lat temu
rodzic
commit
6813e85b53

+ 3
- 0
examples/CMakeLists.txt Wyświetl plik

@@ -1,6 +1,9 @@
1 1
 add_executable( KernelV0 KernelV0.cpp  )
2 2
 target_link_libraries(  KernelV0  "lemmacore" "fdem1d" "merlin")
3 3
 
4
+add_executable( KernelV0-2 KernelV0-2.cpp  )
5
+target_link_libraries(  KernelV0-2  "lemmacore" "fdem1d" "merlin")
6
+
4 7
 add_executable( KV0-3loops KV0-3loops.cpp  )
5 8
 target_link_libraries(  KV0-3loops  "lemmacore" "fdem1d" "merlin")
6 9
 

+ 7
- 6
examples/KV0-3loops.cpp Wyświetl plik

@@ -40,10 +40,6 @@ int main(int argc, char** argv) {
40 40
         // Set mag field info
41 41
         // From NOAA, Laramie WY, June 9 2016, aligned with mag. north
42 42
         earth->SetMagneticFieldIncDecMag( 67, 0, 52750, NANOTESLA );
43
-        //earth->SetMagneticFieldIncDecMag( 90, 0, 52750, NANOTESLA );
44
-        std::cout << "B0 " << earth->GetMagneticField( ).transpose() << std::endl;
45
-        std::cout << "hat BO " << earth->GetMagneticFieldUnitVector().transpose() << std::endl ;
46
-        std::cout << "hat |BO| " << earth->GetMagneticFieldUnitVector().norm() << std::endl ;
47 43
 
48 44
     // Transmitter loops
49 45
     auto Tx1 = CircularLoop(21, 15, 100+offset/2., 100-offset/2.);
@@ -89,10 +85,11 @@ int main(int argc, char** argv) {
89 85
     // We could, I suppose, take the earth model in here? For non-linear that
90 86
     // may be more natural to work with?
91 87
     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 3")};
88
+    //std::vector<std::string> rx = {std::string("Coil 1"), std::string("Coil 2")};//, std::string("Coil 3") };
89
+    std::vector<std::string> rx = {std::string(argv[3])};
93 90
     //std::vector<std::string> rx = {std::string("Coil 1"), std::string("Coil 2"), std::string("Coil 3") };
94 91
     //std::vector<std::string> rx = {std::string("Coil 1"), std::string("Coil 2")};//, std::string("Coil 3") };
95
-    //std::vector<std::string> rx = {std::string(argv[3])};
92
+    std::vector<std::string> rx = {std::string(argv[3])};
96 93
     Kern->CalculateK0( tx, rx, false );
97 94
 
98 95
     //std::ofstream dout = std::ofstream(std::string("k0-3Tx-RxCh-") + std::string(argv[3]) + std::string("-tol") + std::string(argv[1])+ std::string(".dat"));
@@ -116,9 +113,13 @@ int main(int argc, char** argv) {
116 113
         dout << Kern->GetKernel().imag() << std::endl;
117 114
         dout.close();
118 115
 
116
+<<<<<<< HEAD
119 117
     //std::ofstream out = std::ofstream(std::string("k0-3Tx-RxCh1-")+std::string(argv[1])+std::string(".yaml"));
120 118
     std::ofstream out = std::ofstream(std::string("k0-3Tx-RxCh-13") + std::string("-off-") + std::string(argv[1])+ std::string(".yaml"));
121 119
     //std::ofstream out = std::ofstream(std::string("k-coincident.yaml"));
120
+=======
121
+    std::ofstream out = std::ofstream(std::string("k0-3Tx-RxCh-") + std::string(argv[3]) + std::string("-tol") + std::string(argv[1])+ std::string(".yaml"));
122
+>>>>>>> 241215b41d033a7d74d572d479d486850b30ffce
122 123
     out << *Kern;
123 124
     out.close();
124 125
 }

+ 95
- 0
examples/KernelV0-2.cpp Wyświetl plik

@@ -0,0 +1,95 @@
1
+/* This file is part of Lemma, a geophysical modelling and inversion API.
2
+ * More information is available at http://lemmasoftware.org
3
+ */
4
+
5
+/* This Source Code Form is subject to the terms of the Mozilla Public
6
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
7
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
+ */
9
+
10
+/**
11
+ * @file
12
+ * @date      11/11/2016 02:44:37 PM
13
+ * @version   $Id$
14
+ * @author    Trevor Irons (ti)
15
+ * @email     tirons@egi.utah.edu
16
+ * @copyright Copyright (c) 2016, University of Utah
17
+ * @copyright Copyright (c) 2016, Lemma Software, LLC
18
+ */
19
+
20
+#include <Merlin>
21
+using namespace Lemma;
22
+
23
+
24
+int main(int argc, char** argv) {
25
+
26
+    if (argc<4) {
27
+        std::cout << "./KernelV0-2 earth.yaml tx.yaml  rx.yaml \n";
28
+        return(EXIT_SUCCESS);
29
+    }
30
+    std::cout << "Using earth model: " << argv[1] << std::endl;
31
+    auto earth = LayeredEarthEM::DeSerialize( YAML::LoadFile(argv[1]) );
32
+
33
+    std::cout << "Using transmitter: " << argv[2] << std::endl;
34
+    auto Tx = PolygonalWireAntenna::DeSerialize( YAML::LoadFile(argv[2]) );
35
+
36
+    std::cout << "Using receivers: " << argv[3] << std::endl;
37
+    auto Rx1 = PolygonalWireAntenna::DeSerialize( YAML::LoadFile(argv[3]) );
38
+
39
+    auto Kern = KernelV0::NewSP();
40
+        Kern->PushCoil( "Coil 1", Tx );
41
+        Kern->PushCoil( "Coil 2", Rx1 );
42
+        Kern->SetLayeredEarthEM( earth );
43
+
44
+        Kern->SetIntegrationSize( (Vector3r() << 200,200,200).finished() );
45
+        Kern->SetIntegrationOrigin( (Vector3r() << 0,0,0).finished() );
46
+        Kern->SetTolerance( 1e-10 ); // 1e-12
47
+
48
+//         Kern->AlignWithAkvoDataset( YAML::LoadFile(argv[2]) );
49
+
50
+        Kern->SetPulseDuration(0.020);
51
+        VectorXr I(36);
52
+        // off from VC by 1.075926340216996
53
+        // Pulses from Wyoming Red Buttes exp 0
54
+        I << 397.4208916184016, 352.364477036168, 313.0112765842783, 278.37896394065376, 247.81424224324982,
55
+             220.77925043190442, 196.76493264105017, 175.31662279234038, 156.0044839325404, 138.73983004230124,
56
+             123.42064612625474, 109.82713394836259, 97.76534468972267, 87.06061858367781, 77.56000002944572, 69.1280780096311,
57
+             61.64250263640252, 54.99473044877554, 49.091182970515476, 43.84634004556388, 39.184136917167976, 35.03619319797924,
58
+             31.347205894128976, 28.06346770557137, 25.139117042424758, 22.53420773366429, 20.214205433283347,
59
+             18.144318026099942, 16.299965972298878, 14.652633628829891, 13.184271405688083, 11.870540177313893,
60
+             10.697057141915716, 9.64778948429609, 8.709338689612677, 7.871268012862094;
61
+        //Kern->SetPulseCurrent( VectorXr::LinSpaced( 1, 10, 200 )  ); // nbins, low, high
62
+        Kern->SetPulseCurrent( I ); // nbins, low, high
63
+
64
+        //VectorXr interfaces = VectorXr::LinSpaced( 41, .5, 45.5 ); // nlay, low, high
65
+        VectorXr interfaces = VectorXr::LinSpaced( 51, .5, 45.5 ); // nlay, low, high
66
+        Real thick = .5;
67
+        for (int ilay=1; ilay<interfaces.size(); ++ilay) {
68
+            interfaces(ilay) = interfaces(ilay-1) + thick;
69
+            thick *= 1.05;
70
+        }
71
+        Kern->SetDepthLayerInterfaces( interfaces ); // nlay, low, high
72
+
73
+    // We could, I suppose, take the earth model in here? For non-linear that
74
+    // may be more natural to work with?
75
+    std::vector<std::string> tx = {std::string("Coil 1")};
76
+    std::vector<std::string> rx = {std::string("Coil 2")};
77
+    Kern->CalculateK0( tx, rx, false );
78
+
79
+    std::ofstream dout = std::ofstream(std::string("test-")+ std::string(argv[1])+ std::string(".dat"));
80
+    //std::ofstream dout = std::ofstream(std::string("k-coincident.dat"));
81
+        dout << interfaces.transpose() << std::endl;
82
+        dout << I.transpose() << std::endl;
83
+        dout << "#real\n";
84
+        dout << Kern->GetKernel().real() << std::endl;
85
+        dout << "#imag\n";
86
+        dout << Kern->GetKernel().imag() << std::endl;
87
+        dout.close();
88
+
89
+    std::ofstream out = std::ofstream(std::string("test-")+std::string(argv[1])+std::string(".yaml"));
90
+    //std::ofstream out = std::ofstream(std::string("k-coincident.yaml"));
91
+    out << *Kern;
92
+    out.close();
93
+}
94
+
95
+

+ 2
- 0
examples/KernelV0.cpp Wyświetl plik

@@ -48,6 +48,8 @@ int main(int argc, char** argv) {
48 48
         Kern->SetIntegrationOrigin( (Vector3r() << 0,0,0).finished() );
49 49
         Kern->SetTolerance( 1e-12 ); // 1e-12
50 50
 
51
+        Kern->AlignWithAkvoDataset( YAML::LoadFile(argv[2]) );
52
+
51 53
         Kern->SetPulseDuration(0.020);
52 54
         VectorXr I(36);
53 55
 

+ 5
- 0
include/KernelV0.h Wyświetl plik

@@ -166,6 +166,11 @@ namespace Lemma {
166 166
         }		// -----  end of method KernelV0::SetIntegrationOrigin  -----
167 167
 
168 168
         /**
169
+         *  Aligns the kernel settings with an Akvo Processed dataset.
170
+         */
171
+        void AlignWithAkvoDataset( const YAML::Node& node ) ;
172
+
173
+        /**
169 174
          *   Assign transmiter coils
170 175
          */
171 176
         inline void PushCoil( const std::string& label, std::shared_ptr<PolygonalWireAntenna> ant ) {

+ 17
- 0
src/KernelV0.cpp Wyświetl plik

@@ -112,6 +112,23 @@ namespace Lemma {
112 112
 
113 113
     //--------------------------------------------------------------------------------------
114 114
     //       Class:  KernelV0
115
+    //      Method:  AlignWithAkvoDataset
116
+    //--------------------------------------------------------------------------------------
117
+    void KernelV0::AlignWithAkvoDataset( const YAML::Node& node ) {
118
+        if (node["processed"].as<std::string>().substr(0,4) == "Akvo") {
119
+            std::cout << "Akvo file read\n";
120
+            std::cout << node["processed"] << std::endl;
121
+        }
122
+        if (node["pulseType"].as<std::string>() == "FID") {
123
+            PulseI  = node["Pulse 1"]["current"].as<VectorXr>();
124
+            this->SetPulseDuration( node["pulseLength"].as<double>() );
125
+        } else {
126
+            std::cerr << "Pulse Type " << node["PulseType"] << "is not supported\n";
127
+        }
128
+    }
129
+
130
+    //--------------------------------------------------------------------------------------
131
+    //       Class:  KernelV0
115 132
     //      Method:  DeSerialize
116 133
     //--------------------------------------------------------------------------------------
117 134
     void KernelV0::CalculateK0 (const std::vector< std::string>& Tx, const std::vector<std::string >& Rx,

Ładowanie…
Anuluj
Zapisz