Geophysical Inversion and Modelling Library v1.5.4
Loading...
Searching...
No Matches
dc1dmodelling.h
1/******************************************************************************
2 * Copyright (C) 2009-2024 by the GIMLi development team *
3 * Thomas Günther thomas@resistivity.net *
4 * Carsten Rücker carsten@resistivity.net *
5 * *
6 * Licensed under the Apache License, Version 2.0 (the "License"); *
7 * you may not use this file except in compliance with the License. *
8 * You may obtain a copy of the License at *
9 * *
10 * http://www.apache.org/licenses/LICENSE-2.0 *
11 * *
12 * Unless required by applicable law or agreed to in writing, software *
13 * distributed under the License is distributed on an "AS IS" BASIS, *
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
15 * See the License for the specific language governing permissions and *
16 * limitations under the License. *
17 * *
18 ******************************************************************************/
19
20#ifndef _GIMLI_DC1DMODELLING__H
21#define _GIMLI_DC1DMODELLING__H
22
23#include "gimli.h"
24#include "mesh.h"
25#include "meshgenerators.h"
26#include "modellingbase.h"
27#include "vectortemplates.h"
28
29namespace GIMLI{
30
32
37class DLLEXPORT DC1dModelling : public ModellingBase {
38public:
41 DC1dModelling(size_t nlayers, const RVector & am, const RVector & an,
42 const RVector & bm, const RVector & bn, bool verbose=false);
43
45 DC1dModelling(size_t nlayers, const RVector & ab2, const RVector & mn2,
46 bool verbose=false);
47
49 DC1dModelling(size_t nlayers, DataContainer & data, bool verbose=false);
50
51 virtual ~DC1dModelling() { }
52
56 RVector response(const RVector & model);
57
58 RVector rhoa(const RVector & rho, const RVector & thk);
59
60 RVector kern1d(const RVector & lam, const RVector & rho, const RVector & h);
61
62 RVector pot1d(const RVector & R, const RVector & rho, const RVector & thk);
63
64 inline RVector getK() { return k_; }
65
66 inline RVector geometricFactor() { return k_; }
67
68 template < class Vec > Vec rhoaT(const Vec & rho, const RVector & thk){
69 Vec tmp;
70 tmp = pot1dT<Vec>(am_, rho, thk);
71 tmp -= pot1dT<Vec>(an_, rho, thk);
72 tmp -= pot1dT<Vec>(bm_, rho, thk);
73 tmp += pot1dT<Vec>(bn_, rho, thk);
74 return tmp * k_ + rho[ 0 ];
75 }
76 template < class Vec > Vec kern1dT(const RVector & lam, const Vec & rho,
77 const RVector & h){
78 size_t nr = rho.size();
79 size_t nl = lam.size();
80 Vec z(nl, rho[ nr - 1 ]);
81 Vec p(nl);
82 RVector th(nl);
83 for (int i = nr - 2; i >= 0; i--) {
84 p = (z - rho[ i ]) / (z + rho[ i ]);
85 th = tanh(lam * h[ i ]);
86 z = (z + toComplex(th) * rho[ i ]) / (z * th + rho[ i ]) * rho[ i ];
87 }
88
89 Vec ehl(p * RVector(exp(-2.0 * lam * h[0])));
90 return ehl / (1.0 - ehl) * rho[0] / 2.0 / PI ;
91 }
92 template < class Vec > Vec pot1dT(const RVector & R, const Vec & rho,
93 const RVector & thk){
94 Vec z0(R.size());
95 //double rabs;
96 RVector rabs(abs(R));
97 for (size_t i = 0; i < R.size(); i++) {
98 //rabs = std::fabs(R[ i ]);
99 z0[ i ] = sum(myw_ * kern1dT<Vec>(myx_ / rabs[i],
100 rho, thk) * 2.0) / rabs[i];
101 }
102 return z0;
103 }
104
105 RVector createDefaultStartModel();
106
107protected:
108
110 void init_();
111
112 void postprocess_();
113
114 size_t nlayers_;
115 double meanrhoa_;
116 RVector am_;
117 RVector an_;
118 RVector bm_;
119 RVector bn_;
120 RVector k_;
121 RVector tmp_;
122
123 RVector myx_;
124 RVector myw_;
125};
126
128class DLLEXPORT DC1dModellingC : public DC1dModelling {
129public:
132 DC1dModellingC(size_t nlayers,
133 const RVector & am, const RVector & an,
134 const RVector & bm, const RVector & bn, bool verbose=false);
135
137 DC1dModellingC(size_t nlayers, const RVector & ab2, const RVector & mn2,
138 bool verbose=false);
139
140 virtual ~DC1dModellingC() { }
141
143 RVector response(const RVector & model);
144};
145
149class DLLEXPORT DC1dRhoModelling : public DC1dModelling {
150public:
151 DC1dRhoModelling(const RVector & thk, const RVector & am,
152 const RVector & an, const RVector & bm,
153 const RVector & bn, bool verbose=false)
154 : DC1dModelling(thk.size(), am, an, bm, bn, verbose), thk_(thk) {
155 setMesh(createMesh1D(thk.size() + 1, 1));
156 }
157
158 DC1dRhoModelling(const RVector & thk, const RVector & ab2,
159 const RVector & mn2, bool verbose = false)
160 : DC1dModelling(thk.size(), ab2, mn2, verbose), thk_(thk) {
161 setMesh(createMesh1D(thk.size() + 1, 1));
162 }
163
164 DC1dRhoModelling(const RVector & thk, DataContainer & data,
165 bool verbose=false)
166 : DC1dModelling(thk.size(), data, verbose), thk_(thk) {
167 setMesh(createMesh1D(thk.size() + 1, 1));
168 }
169
170 virtual ~DC1dRhoModelling() { }
171
172 RVector response(const RVector & rho) { return rhoa(rho, thk_); }
173
175 return RVector(thk_.size() + 1, meanrhoa_);
176 }
177
178protected:
179 RVector thk_;
180};
181
182} // namespace GIMLI{
183
184#endif // _GIMLI_DC1DMODELLING__H
RVector response(const RVector &model)
Definition dc1dmodelling.cpp:426
DC1dModellingC(size_t nlayers, const RVector &am, const RVector &an, const RVector &bm, const RVector &bn, bool verbose=false)
Definition dc1dmodelling.cpp:412
DC1dModelling(size_t nlayers, const RVector &am, const RVector &an, const RVector &bm, const RVector &bn, bool verbose=false)
Definition dc1dmodelling.cpp:27
RVector createDefaultStartModel()
Definition dc1dmodelling.cpp:76
void init_()
Definition dc1dmodelling.cpp:132
RVector response(const RVector &model)
Definition dc1dmodelling.cpp:82
RVector createDefaultStartModel()
Definition dc1dmodelling.h:174
RVector response(const RVector &rho)
Definition dc1dmodelling.h:172
DataContainer to store, load and save data in the GIMLi unified data format.
Definition datacontainer.h:48
bool verbose() const
Definition modellingbase.h:48
void setMesh(const Mesh &mesh, bool ignoreRegionManager=false)
Definition modellingbase.cpp:179
DataContainer & data() const
Definition modellingbase.cpp:125
GIMLi main namespace for the Geophyiscal Inversion and Modelling Library.
Definition baseentity.h:24
RVector z(const R3Vector &rv)
Definition pos.cpp:120
Mesh createMesh1D(Index nCells, Index nClones)
Definition meshgenerators.cpp:49