14 { 0.0025, 0.00308337, 0.00513901, 0.00625, 0.0104167, 0.0125, 0.0208333,
15 0.025, 0.0416667, 0.05, 0.0833333, 0.1, 0.166667, 0.2, 0.333333, 0.4,
16 0.667, 0.64, 1.06667, 1.29333, 2.15554, 2.59997, 4.33332, 5.19994,
17 8.66701, 10.666667, 16.000, 21.333, 32.000, 42.667, 64.0, 85.332,
18 127.992, 170.678, 256.016, 341.297, 512.033, 682.594, 1023.541,
19 1366.120, 2049.180, 2732.240, 4098.361, 5464.481, 8196.722,
20 10869.565, 16393.443, 28800, 43200, 86400 };
22 C1DMTSynthData::C1DMTSynthData()
26 C1DMTSynthData::~C1DMTSynthData()
31 MTStation(old), Z(old.Z), calc_frequencies(old.calc_frequencies),
32 resistivity(old.resistivity), thickness(old.thickness), reserrors(
33 old.reserrors), thickerrors(old.thickerrors)
39 ofstream outfile(filename.c_str());
41 assert(resistivity.size() == thickness.size());
43 for (
unsigned int i = 0; i < thickness.size(); ++i)
45 outfile << cumthick <<
" " << resistivity.at(i);
46 if (!thickerrors.empty() || !reserrors.empty())
47 outfile <<
" " << thickerrors.at(i) <<
" " << reserrors.at(i);
49 cumthick += thickness.at(i);
50 outfile << cumthick <<
" " << resistivity.at(i);
51 if (!thickerrors.empty() || !reserrors.empty())
52 outfile <<
" " << thickerrors.at(i) <<
" " << reserrors.at(i);
59 assert(resistivity.size() == thickness.size());
60 ofstream outfile(filename.c_str());
62 outfile << thickness.size() << endl;
63 for (
unsigned int i = 0; i < thickness.size(); ++i)
65 outfile << thickness.at(i) <<
" " << resistivity.at(i) << endl;
71 assert(resistivity.size() == thickness.size());
72 const int length = resistivity.size();
73 gplib::rvec result(length * 2);
74 for (
int i = 0; i < length; ++i)
76 result(i) = log10(resistivity.at(i));
77 result(i + length) = thickness.at(i);
85 double currthick, curres;
88 ifstream infile(filename.c_str());
90 if (!infile.good() || layers < 0)
92 thickness.reserve(layers);
93 resistivity.reserve(layers);
96 infile >> currthick >> curres;
99 thickness.push_back(currthick);
100 resistivity.push_back(curres);
104 assert(resistivity.size() == thickness.size());
111 assert(resistivity.size() == thickness.size());
113 if (calc_frequencies.empty())
116 calc_frequencies.push_back(1.0 /
T[i]);
119 Assign(calc_frequencies.size());
120 for (
unsigned int i = 0; i < calc_frequencies.size(); ++i)
122 MTData.at(i).frequency = calc_frequencies.at(i);
123 MTData.at(i).Zxy = Z.at(i);
124 MTData.at(i).Zyx = -Z.at(i);
129 void C1DMTSynthData::Calc()
134 vector<dcomp> alpha(thickness.size(), 0);
137 double sigmacurr, sigmalow;
139 for (
unsigned int i = 0; i < calc_frequencies.size(); ++i)
141 omegamu = -I * 8e-7 * PI * PI * calc_frequencies.at(i);
142 fill(alpha.begin(), alpha.end(), 0);
143 sigmacurr = 1.0 / resistivity.back();
144 kcurr = sqrt(omegamu * sigmacurr);
145 for (
int layerindex = thickness.size() - 2; layerindex >= 0; --layerindex)
147 sigmalow = 1.0 / resistivity.at(layerindex + 1);
148 sigmacurr = 1.0 / resistivity.at(layerindex);
149 kcurr = sqrt(omegamu * sigmacurr);
150 klow = sqrt(omegamu * sigmalow);
151 if (kcurr.real() < 0.0)
156 xi = omegamu * (sigmacurr - sigmalow) / std::pow(kcurr + klow, 2);
157 alpha.at(layerindex + 1) = (xi + alpha.at(layerindex + 1)) / (1. + xi * alpha.at(
159 d = thickness.at(layerindex) * 1000.0;
160 alpha.at(layerindex) = alpha.at(layerindex + 1) * exp(-2. * kcurr * d);
162 adm = kcurr / (-I * 2. * PI * calc_frequencies.at(i)) * ((1.
163 - alpha.at(0)) / (1. + alpha.at(0)));
164 Z.push_back(conj(1. / (1000.0 * adm)));
gplib::rvec GetModelVector()
Return the model as a single vector first log10 of all resistivities, then all thicknesses in km...
const float T[frequenzen]
void WriteModel(std::string filename)
Write model into file for cagniard algorithm.
void ReadModel(std::string filename)
Read the model from a file.
The class MTStation is used to store the transfer functions and related information for a MT-site...
virtual void CalcSynthetic()
Calculate the synthetic data given the previously set parameters.
void Assign(const int nfreq)
Assign() assigns zero to all derived quantities, this makes the calculation.
void WritePlot(std::string filename)
Write out a file that can be used for plotting with xmgrace first column depth, second column resisti...
const float T[frequenzen]
Calculate synthetic MT data for a 1D model using Cagniard's algorithm.
trealdata GetFrequencies() const
return the available frequencies in a single vector
The basic exception class for all errors that arise in gplib.
void Update()
Update all derived quantities.