|
@@ -1,246 +0,0 @@
|
1
|
|
-/* This file is part of Lemma, a geophysical modelling and inversion API */
|
2
|
|
-
|
3
|
|
-/* This Source Code Form is subject to the terms of the Mozilla Public
|
4
|
|
- * License, v. 2.0. If a copy of the MPL was not distributed with this
|
5
|
|
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
6
|
|
-
|
7
|
|
-/**
|
8
|
|
- @file
|
9
|
|
- @author Trevor Irons
|
10
|
|
- @date 05/18/2012
|
11
|
|
- @version $Id: kernelem1dreflbase.h 193 2014-11-10 23:51:41Z tirons $
|
12
|
|
- **/
|
13
|
|
-
|
14
|
|
-#ifndef KERNELEM1DREFLBASE_INC
|
15
|
|
-#define KERNELEM1DREFLBASE_INC
|
16
|
|
-
|
17
|
|
-//#include "KernelEM1DSpec.h"
|
18
|
|
-#include "kernelem1dbase.h"
|
19
|
|
-#include "DipoleSource.h"
|
20
|
|
-#include "LayeredEarthEM.h"
|
21
|
|
-
|
22
|
|
-namespace Lemma {
|
23
|
|
-
|
24
|
|
- enum DIPOLE_LOCATION { INAIR, INGROUND };
|
25
|
|
-
|
26
|
|
- // forward declaration for friend
|
27
|
|
- template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
|
28
|
|
- class KernelEM1DSpec;
|
29
|
|
-
|
30
|
|
-
|
31
|
|
- // ===================================================================
|
32
|
|
- // Class: KernelEM1DReflBase
|
33
|
|
- /**
|
34
|
|
- @class
|
35
|
|
- \brief Abstract class defining EM1DRefl class.
|
36
|
|
- \details Derived classes are template specialized for optimal performance.
|
37
|
|
- */
|
38
|
|
- // ===================================================================
|
39
|
|
- class KernelEM1DReflBase : public LemmaObject {
|
40
|
|
-
|
41
|
|
- template<EMMODE Mode, int Ikernel, DIPOLE_LOCATION Isource, DIPOLE_LOCATION Irecv>
|
42
|
|
- friend class KernelEM1DSpec;
|
43
|
|
- friend class KernelEM1DManager;
|
44
|
|
- //friend class DipoleSource;
|
45
|
|
-
|
46
|
|
- public:
|
47
|
|
-
|
48
|
|
- // ==================== LIFECYCLE =======================
|
49
|
|
-
|
50
|
|
- // ==================== OPERATORS =======================
|
51
|
|
-
|
52
|
|
- // ==================== OPERATIONS =======================
|
53
|
|
-
|
54
|
|
- void Initialise( std::shared_ptr<LayeredEarthEM> EarthIn) {
|
55
|
|
-
|
56
|
|
- nlay = EarthIn->GetNumberOfLayers();
|
57
|
|
- zh = VectorXcr::Zero(nlay);
|
58
|
|
- yh = VectorXcr::Zero(nlay);
|
59
|
|
- u = VectorXcr::Zero(nlay);
|
60
|
|
- cf = VectorXcr::Zero(nlay); // nlay -1 (lay 0 empty)
|
61
|
|
- rtu = VectorXcr::Zero(nlay); // nlay -1 Interfaces only
|
62
|
|
- rtd = VectorXcr::Zero(nlay); // nlay -1 Interfaces only
|
63
|
|
- kk = VectorXcr::Zero(nlay);
|
64
|
|
- Zyu = VectorXcr::Zero(nlay);
|
65
|
|
- Zyd = VectorXcr::Zero(nlay);
|
66
|
|
- Zyi = VectorXcr::Zero(nlay);
|
67
|
|
- th = VectorXcr::Zero(nlay);
|
68
|
|
-
|
69
|
|
- // Don't attach Earth, because this is performance critical.
|
70
|
|
- // Everying is internal, it's OK relax Frankie
|
71
|
|
- //if (Earth != NULL) {
|
72
|
|
- // Earth->DetachFrom(this);
|
73
|
|
- // Earth = NULL;
|
74
|
|
- //}
|
75
|
|
- //EarthIn->AttachTo(this);
|
76
|
|
- Earth = EarthIn;
|
77
|
|
-
|
78
|
|
- LayerThickness.resize(nlay);
|
79
|
|
- for (int ilay=0; ilay<nlay; ++ilay) {
|
80
|
|
- LayerThickness(ilay) = Earth->GetLayerThickness(ilay);
|
81
|
|
- }
|
82
|
|
-
|
83
|
|
- LayerDepth.resize(nlay);
|
84
|
|
- for (int ilay=0; ilay<nlay; ++ilay) {
|
85
|
|
- LayerDepth(ilay) = Earth->GetLayerDepth(ilay);
|
86
|
|
- }
|
87
|
|
-
|
88
|
|
- }
|
89
|
|
-
|
90
|
|
- void SetUpSource( std::shared_ptr<DipoleSource> Dipole, const int &ifreq ) {
|
91
|
|
-
|
92
|
|
- zh(0) = Complex(0, Dipole->GetAngularFrequency(ifreq)*MU0);
|
93
|
|
- yh(0) = Complex(0, Dipole->GetAngularFrequency(ifreq)*EPSILON0);
|
94
|
|
- kk(0) = -zh(0) * yh(0);
|
95
|
|
-
|
96
|
|
- Earth->EvaluateColeColeModel(Dipole->GetAngularFrequency(ifreq));
|
97
|
|
-
|
98
|
|
- for (int ilay=1; ilay<Earth->GetNumberOfLayers(); ++ilay) {
|
99
|
|
- zh(ilay) = zh(0) * Earth->GetLayerSusceptibility(ilay);
|
100
|
|
- yh(ilay) = Earth->GetLayerConductivity(ilay) +
|
101
|
|
- yh(0)*Earth->GetLayerPermitivity(ilay);
|
102
|
|
- kk(ilay) = -zh(ilay)*yh(ilay);
|
103
|
|
- }
|
104
|
|
-
|
105
|
|
- tx_z = Dipole->GetLocation(2);
|
106
|
|
- lays = 0;
|
107
|
|
- Real Depth(0);
|
108
|
|
- for (int ilay=1; ilay<nlay; ++ilay) {
|
109
|
|
- if (tx_z > Depth) {
|
110
|
|
- lays = ilay;
|
111
|
|
- }
|
112
|
|
- Depth += LayerThickness(ilay);
|
113
|
|
- }
|
114
|
|
- }
|
115
|
|
-
|
116
|
|
- void SetUpReceiver(const Real &rz) {
|
117
|
|
- rx_z = rz;
|
118
|
|
- Real Depth(0.);
|
119
|
|
- layr = 0;
|
120
|
|
- for (int ilay=1; ilay<Earth->GetNumberOfLayers(); ++ilay) {
|
121
|
|
- if (rx_z > Depth) {
|
122
|
|
- layr = ilay;
|
123
|
|
- }
|
124
|
|
- Depth += LayerThickness(ilay);
|
125
|
|
- }
|
126
|
|
- }
|
127
|
|
-
|
128
|
|
- // ==================== ACCESS =======================
|
129
|
|
- Complex GetYm() {
|
130
|
|
- return yh(layr);
|
131
|
|
- }
|
132
|
|
-
|
133
|
|
- Complex GetZm() {
|
134
|
|
- return zh(layr);
|
135
|
|
- }
|
136
|
|
-
|
137
|
|
- Complex GetZs() {
|
138
|
|
- return zh(lays);
|
139
|
|
- }
|
140
|
|
-
|
141
|
|
- Complex GetKs() {
|
142
|
|
- return kk(lays);
|
143
|
|
- }
|
144
|
|
-
|
145
|
|
- // ==================== INQUIRY =======================
|
146
|
|
-
|
147
|
|
- protected:
|
148
|
|
-
|
149
|
|
- // ==================== LIFECYCLE =======================
|
150
|
|
-
|
151
|
|
- /// Default protected constructor.
|
152
|
|
- KernelEM1DReflBase ( ) : LemmaObject( )
|
153
|
|
- {
|
154
|
|
- }
|
155
|
|
-
|
156
|
|
- /// Default protected constructor.
|
157
|
|
- ~KernelEM1DReflBase () {
|
158
|
|
- }
|
159
|
|
-
|
160
|
|
- // ==================== OPERATIONS =======================
|
161
|
|
-
|
162
|
|
- /** Computes reflection coefficients. Depending on the
|
163
|
|
- * specialisation, this will either be TM or TE mode.
|
164
|
|
- */
|
165
|
|
- virtual void ComputeReflectionCoeffs(const Real& lambda)=0;
|
166
|
|
-
|
167
|
|
- /** Precomputes expensive calculations that are reused by insances
|
168
|
|
- * of KernelEM1DSpec in the calculation of Related potentials.
|
169
|
|
- */
|
170
|
|
- virtual void PreComputePotentialTerms()=0;
|
171
|
|
-
|
172
|
|
- // ==================== DATA MEMBERS =========================
|
173
|
|
-
|
174
|
|
- /// Bessel order, only 0 or 1 supported
|
175
|
|
- int id; // Needs to be dim nRel, or separate
|
176
|
|
-
|
177
|
|
- /// Layer the source is in
|
178
|
|
- int lays;
|
179
|
|
-
|
180
|
|
- /// Layer the receiver is in
|
181
|
|
- int layr;
|
182
|
|
-
|
183
|
|
- /// Number of Layers
|
184
|
|
- int nlay;
|
185
|
|
-
|
186
|
|
- /// Number of Related kernels to be computed
|
187
|
|
- int nRelated;
|
188
|
|
-
|
189
|
|
- /// Used in related kernel precompute calls
|
190
|
|
- int relIud;
|
191
|
|
-
|
192
|
|
- /// Receiver z position
|
193
|
|
- Real rx_z;
|
194
|
|
-
|
195
|
|
- /// Transmitter z position
|
196
|
|
- Real tx_z;
|
197
|
|
-
|
198
|
|
- /// bessel arg squared
|
199
|
|
- Real rams;
|
200
|
|
-
|
201
|
|
- /** Related part of con term */
|
202
|
|
- Complex relCon;
|
203
|
|
-
|
204
|
|
- Complex relenukadz;
|
205
|
|
-
|
206
|
|
- Complex relexp_pbs1;
|
207
|
|
-
|
208
|
|
- Complex relexp_pbs2;
|
209
|
|
-
|
210
|
|
- Complex rel_a;
|
211
|
|
-
|
212
|
|
- /// TM or TE mode
|
213
|
|
- EMMODE mode;
|
214
|
|
-
|
215
|
|
- /// Pointer to layered earth
|
216
|
|
- std::shared_ptr<LayeredEarthEM> Earth;
|
217
|
|
-
|
218
|
|
- Complex uk;
|
219
|
|
- Complex um;
|
220
|
|
- VectorXcr cf; // nlay
|
221
|
|
- VectorXcr u; // nlay
|
222
|
|
- VectorXcr yh; // nlay
|
223
|
|
- VectorXcr zh; // nlay
|
224
|
|
- VectorXcr kk; // nlay
|
225
|
|
- VectorXcr Zyu; //(nlay); //Zyu.setZero();
|
226
|
|
- VectorXcr Zyd; //(nlay); //Zyd.setZero();
|
227
|
|
- VectorXcr Zyi; //(nlay); //Zyi.setZero();
|
228
|
|
- VectorXcr th; //(nlay);
|
229
|
|
- VectorXr LayerThickness;
|
230
|
|
- VectorXr LayerDepth;
|
231
|
|
-
|
232
|
|
- /// Reflection/Transmission coeffients for upgoing waves in a
|
233
|
|
- /// layered earth model
|
234
|
|
- VectorXcr rtu;
|
235
|
|
-
|
236
|
|
- /// Reflection/Transmission coeffients for downgoing waves in
|
237
|
|
- /// a layered earth model
|
238
|
|
- VectorXcr rtd;
|
239
|
|
-
|
240
|
|
- private:
|
241
|
|
-
|
242
|
|
- }; // ----- end of class KernelEM1DReflBase -----
|
243
|
|
-
|
244
|
|
-} // ----- end of Lemma name -----
|
245
|
|
-
|
246
|
|
-#endif // ----- #ifndef KERNELEM1DREFLBASE_INC -----
|