LISOUSI: Line Source Simulation
wnintegration.cc
Go to the documentation of this file.
1 
38 #define TF_WNINTEGRATION_CC_VERSION \
39  "TF_WNINTEGRATION_CC V1.0"
40 
41 #include "wnintegration.h"
42 
43 double ExpCoefficients::maxp() const
44 {
45  double retval=1.1/Mm.Vs;
46  return(retval);
47 } // double ExpCoefficients::maxp()
48 
49 /*----------------------------------------------------------------------*/
50 
51 TFourier::Tcoeff FSECZ::coeff(const double& p) const
52 {
53  TFourier::Tcoeff retval;
54  TFourier::Tcoeff pq=p*p;
55  TFourier::Tcoeff aq=(1./Malphaq)-pq;
56  TFourier::Tcoeff bq=(1./Mbetaq)-pq;
57  retval=std::sqrt(aq)+pq/std::sqrt(bq);
58  return(retval);
59 } // TFourier::Tcoeff FSECZ::coeff(const double& k) const
60 
61 /*----------------------------------------------------------------------*/
62 
63 TFourier::Tcoeff HSEC::rayleigh(const double& p) const
64 {
65  TFourier::Tcoeff retval;
66  Mpq=p*p;
67  Maq=(1./Malphaq)-Mpq;
68  Mbq=(1./Mbetaq)-Mpq;
69  Ma=std::sqrt(Maq);
70  Mb=std::sqrt(Mbq);
71  retval=(Mpq-Mbq)*(Mpq-Mbq)+4.*Mpq*Ma*Mb;
72  return(retval);
73 } // TFourier::Tcoeff HSEC::rayleigh(const double& k) const
74 
75 /*----------------------------------------------------------------------*/
76 
77 TFourier::Tcoeff HSECZ::coeff(const double& p) const
78 {
79  TFourier::Tcoeff retval;
80  retval=1./this->rayleigh(p);
81  retval *= Ma;
82  return(retval);
83 } // TFourier::Tcoeff HSECZ::coeff(const double& k) const
84 
85 /*----------------------------------------------------------------------*/
86 
87 TFourier::Tcoeff HSECR::coeff(const double& p) const
88 {
89  TFourier::Tcoeff retval;
90  retval=1./this->rayleigh(p);
91  retval *= p*(Mpq-Mbq+2.*Ma*Mb);
92  return(retval);
93 } // TFourier::Tcoeff HSECR::coeff(const double& k) const
94 
95 /*======================================================================*/
96 // destructors are placed in binary object
102 /*======================================================================*/
103 
113 Exco::Exco(const ExpCoefficients& ec, const IntegParam& par):
114  TFourier::Tspectrum(0,par.nsteps-1), Mdp(ec.maxp()*par.edge/par.nsteps)
115 {
116  int ltap=par.nsteps*(1.-par.taper);
117  for (int i=0; i<par.nsteps; ++i)
118  {
119  double p=Mdp*i;
120  this->operator()(i)=ec.coeff(p)*Mdp;
121  if (i>ltap)
122  {
123  double arg=M_PI*(i-ltap)/double(par.nsteps);
124  this->operator()(i) *= 0.5*(std::cos(arg)+1.);
125  }
126  }
127  this->operator()(0) *= 0.5;
128 } // Exco::Exco(const ExpCoefficients& ec, const IntegParam& par)
129 
130 /*======================================================================*/
131 
132 TFourier::Tcoeff wnintegration(const Exco& ec,
133  const double& f,
134  const double& offset,
135  const Ebasis& fb)
136 {
137  TFourier::Tcoeff retval=0.;
138  double dpxw=M_PI*2.*f*offset*ec.dp();
139  if (4.*dpxw > M_PI)
140  {
141  cout << " frequency: " << f << " Hz\n"
142  << " offset: " << offset << " m\n"
143  << " slowness stepsize: " << ec.dp() << " s/m\n"
144  << " argument stepsize: " << dpxw << std::endl;
145  }
146  TFXX_assert((4.*dpxw <= M_PI),
147  "argument increase in each trapezoid step is too large; "
148  "increase number of steps");
149  switch(fb)
150  {
151  case Fbessel0:
152  for (unsigned int i=0; i< ec.size(); ++i)
153  { retval += ec(i)*ec.dp()*double(i)*gsl_sf_bessel_J0(i*dpxw); }
154  break;
155  case Fbessel1:
156  for (unsigned int i=0; i< ec.size(); ++i)
157  { retval += ec(i)*double(i)*ec.dp()*gsl_sf_bessel_J1(i*dpxw); }
158  break;
159  case Fsin:
160  for (unsigned int i=0; i< ec.size(); ++i)
161  { retval += ec(i)*sin(i*dpxw); }
162  break;
163  case Fcos:
164  for (unsigned int i=0; i< ec.size(); ++i)
165  { retval += ec(i)*cos(i*dpxw); }
166  break;
167  }
168  return(retval);
169 } // TFourier::Tcoeff wnintegration()
170 
171 /* ----- END OF wnintegration.cc ----- */
Bessel function of order 1.
TFourier::Tcoeff Ma
derived values
cosine function
TFourier::Tcoeff Mpq
TFourier::Tcoeff Mbetaq
square of complex S-wave velocity
Definition: wnintegration.h:84
virtual TFourier::Tcoeff coeff(const double &p) const
return expansion coefficient for given phase slowness
virtual TFourier::Tcoeff coeff(const double &p) const =0
return expansion coefficient for given phase slowness
Ebasis
int nsteps
number of steps
Definition: lisousi.h:105
Bessel function of order 0.
TFourier::Tcoeff Mbq
virtual ~HSEC()
double dp() const
return slowness interval
virtual TFourier::Tcoeff coeff(const double &p) const
return expansion coefficient for given phase slowness
virtual ~FSECZ()
double Vs
S-wave propagation velocity.
Definition: wnintegration.h:49
double Mdp
slowness stepsize
Model Mm
parameters for propagation model
Definition: wnintegration.h:80
sine function
TFourier::Tcoeff Mb
TFourier::Tcoeff Malphaq
square of complex P-wave velocity
Definition: wnintegration.h:82
TFourier::Tcoeff wnintegration(const Exco &ec, const double &f, const double &offset, const Ebasis &fb)
TFourier::Tcoeff Maq
virtual ~HSECR()
Fourier coefficients obtained by wavenumber integration (prototypes)
double maxp() const
return desired minimum upper limit for integration
TFourier::Tcoeff rayleigh(const double &p) const
return value of Rayleigh determinant
fourier::fft::DRFFTWAFF TFourier
Definition: lisousi.h:72
double taper
taper fraction at upper limit of wavenumber range
Definition: lisousi.h:109
virtual ~HSECZ()
virtual TFourier::Tcoeff coeff(const double &p) const
return expansion coefficient for given phase slowness
virtual ~ExpCoefficients()