123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #include <time.h>
- #include "Lemma"
- #include "banner.h"
-
- using namespace Lemma;
-
- #ifdef LEMMAUSEVTK
- #include "matplot.h"
- using namespace matplot;
- #endif
-
- int main(int argv, char** argc) {
-
-
- clock_t launch =clock();
-
-
- std::string name;
- std::string version;
- std::string usage;
- name = "TEM Forward Modeller - 1D";
- version = "1.0beta";
- usage = "temforward1d [inputfile]";
- banner(name,version,usage);
- if ( argv < 2 ) {
- std::cout << "No input file specified, should be of format\n";
- std::cout <<
- "origparabk.obsy ! Observations-style file.\n\
- origpara.con ! Starting model.\n\
- 100 ! Number of Hankel kernel evaluations.\n\
- 100 1. 1.0E+10 ! Number of Fourier kernel evaluations, & min & max freq.\n\
- N ! Is noise to be added?\n\
- 5. 1.0E-08 30 ! Noise to be added: percentage, threshold, seed.\n\
- " << std::endl;
-
- exit(0);
- }
-
- time_t curr=time(0);
- std::cout << std::endl;
- std::cout << " Start time: " << ctime(&curr) << std::endl;
-
-
- PolygonalWireAntenna* Trans = PolygonalWireAntenna::New();
-
-
-
-
-
-
-
-
-
-
-
-
- ReceiverPoints *Receivers = ReceiverPoints::New();
- LayeredEarthEM *Earth = LayeredEarthEM::New();
- VectorXr maintimes;
-
-
-
- ModelReaderTem1DUBC* Reader = ModelReaderTem1DUBC::New();
- Reader->SetEMEarth1D(Earth);
- Reader->SetTransmitter(Trans);
- Reader->SetReceiver(Receivers);
- Reader->ReadParameters( argc[1] );
- maintimes = Reader->GetTimes();
-
-
- InstrumentTem *instrument = InstrumentTem::New();
- instrument->EMEarthModel(Earth);
- instrument->SetTransmitLoop(Trans);
-
-
- instrument->SetReceiver(Receivers);
-
-
-
-
- VectorXr widths = VectorXr::Ones(maintimes.size());
-
-
-
-
- widths *= 1e-6;
- std::cout << widths.transpose() << std::endl;
-
- instrument->SetReferenceTime(.025);
-
- instrument->SetTimeGates(maintimes, widths);
-
-
- instrument->SetReceiverType(INDUCTIVE);
-
- VectorXr Amp(4); Amp << 0,1,1,0;
- VectorXr Times(4); Times << 0., .0005, .02497, .025;
-
-
-
-
-
-
-
-
-
-
-
- instrument->SetPulse(Amp, Times);
-
- std::cout << *Earth << "\n" << *Trans << "\n" << *Receivers << std::endl;
-
-
-
-
-
-
- instrument->MakeLaggedCalculation( FHTKEY201 );
-
-
- int nlag = instrument->GetMeasurements().rows();
-
- for (int ii=0; ii<nlag; ii++) {
- std::cout<<" "<<instrument->GetMeasurements()(ii,0)<<" "<<instrument->GetMeasurements()(ii,1)<<std::endl;
- }
-
-
- std::ofstream outfile1;
- outfile1.open("solution.out");
-
- outfile1 << "//timegate [s]\t dB/dt [T/s]" << std::endl;
- for (int ii=0; ii<nlag; ii++) {
-
- outfile1 << instrument->GetMeasurements()(ii,0)<< "\t" << MU0*instrument->GetMeasurements()(ii,1) << std::endl;
-
- }
- outfile1.close();
-
-
-
- std::cout << " Time for execution: " << (clock()-launch)/CLOCKS_PER_SEC << " [CPU] seconds."
- << std::endl;
-
-
- instrument->Delete();
- Trans->Delete();
- Earth->Delete();
- Receivers->Delete();
- Reader->Delete();
-
- return EXIT_SUCCESS;
- }
-
|