3 #include "CResPkModel.h"
5 #include "CUniformRNG.h"
6 #include "MakeInputConf.h"
7 #include "CSeismicDataComp.h"
10 #include <boost/bind.hpp>
14 using namespace gplib;
16 string version =
"$Id: makeinput.cpp 1816 2009-09-07 11:28:35Z mmoorkamp $";
18 int main(
int argc,
char *argv[])
21 <<
" This is makeinput: Create MT and receiver function models and data"
23 cout <<
" to be used as input for inversion methods." << endl;
25 <<
" If one argument is given, this argument is taken as the filename base for all output files."
28 <<
" Otherwise the output file base is read from the configuration file 'makeinput.conf' "
30 cout <<
" The configuration file contains all other relevant settings. "
32 cout <<
" This is Version: " <<
version << endl << endl;
35 Configuration.GetData(
"makeinput.conf");
41 outputbase = Configuration.outputbase;
45 RecCalc RecSynth(Configuration.shift, Configuration.omega,
46 Configuration.sigma, Configuration.cc);
48 const double basevel = 3.2;
49 const double basedens = 2.6;
50 const double baseres = 1.0 + Random.
GetNumber();
51 const double basethick = 1.0 + Random.
GetNumber() * 10;
52 vector<double> velocities(Configuration.nlayers);
53 vector<double> densities(Configuration.nlayers);
54 vector<double> resistivities(Configuration.nlayers);
55 vector<double> mtthickness(Configuration.nlayers);
56 vector<double> recthickness(Configuration.nlayers);
57 densities.front() = basedens;
58 resistivities.front() = baseres;
59 velocities.front() = basevel;
60 mtthickness.front() = basethick;
61 if (Configuration.correlated)
63 recthickness.front() = basethick;
67 recthickness.front() = basethick * Random.
GetNumber(1.1, 2.0);
69 for (
int i = 1; i < Configuration.nlayers; ++i)
71 mtthickness.at(i) = mtthickness.at(i - 1) * Random.
GetNumber(1.1, 2.0);
72 if (Configuration.correlated)
74 recthickness.at(i) = mtthickness.at(i);
78 recthickness.at(i) = mtthickness.at(i) * Random.
GetNumber(1.1, 2.0);
81 densities.at(i) = densities.at(i - 1) * Random.
GetNumber(1.1, 1.5);
82 resistivities.at(i) = Random.
GetNumber(0.0, 3.0);
83 velocities.at(i) = velocities.at(i - 1) * Random.
GetNumber(1.05, 1.2);
85 transform(resistivities.begin(), resistivities.end(),
86 resistivities.begin(), boost::bind(fopow<double, double> (), 10, _1));
89 MTSynth.writemodel(outputbase +
"_mt.mod");
90 MTSynth.writeplot(outputbase +
"_mt.plot");
94 RecModel.
Init(Configuration.nlayers);
95 RecModel.slowness = Configuration.slowness;
96 copy(recthickness.begin(), recthickness.end(), RecModel.Thickness.begin());
97 copy(velocities.begin(), velocities.end(), RecModel.SVelocity.begin());
98 copy(densities.begin(), densities.end(), RecModel.Density.begin());
99 transform(RecModel.SVelocity.begin(), RecModel.SVelocity.end(),
100 RecModel.PVelocity.begin(), boost::bind(multiplies<double> (), _1,
101 Configuration.poisson));
102 RecModel.dt = Configuration.dt;
103 RecModel.npts = Configuration.npts;
104 RecSynth.
CalcRecSynth(Configuration.outputbase +
"_rec", RecModel,
105 RecSynthData,
false);
This class is used to calculate receiver functions from seismic data.
void WritePlot(const std::string &filename)
Write out an ascii file for plotting with xmgrace etc.
virtual void GetData(const std::string filename)
read in data from file, determines format by ending
void CalcRecSynth(const std::string &filename, ResPkModel &Model, SeismicDataComp &Receiver, const bool cleanfiles=false)
Calculate synthetic receiver funtions from a model.
void SetThicknesses(const trealdata &thick)
Read only access to the vector of layer thicknesses for the 1D model from top to bottom in km...
void Init(const int nlayers)
Init provides a convenient way to allocate memory in all structures for a given number of layers...
void WriteAsMtt(const std::string filename)
Write data in goettingen .mtt format.
Calculate synthetic MT data for a 1D model using Cagniard's algorithm.
void SetResistivities(const trealdata &res)
Read-write access to the vector of resistivities for the 1D model from top to bottom in Ohmm...
CLevanisoConf Configuration
This class stores and writes model for the respktn 1D seismic code that we use for receiver function ...
int WriteAsSac(const std::string &filename) const
Write the data in sac binary format.