Sinusoidal excitation

pull/1/head
Thorsten Liebig 2010-03-09 21:34:23 +01:00
parent c4c2222d26
commit 9e86a96436
2 changed files with 19 additions and 0 deletions

View File

@ -141,6 +141,22 @@ void Operator::CalcGaussianPulsExcitation(double f0, double fc)
} }
} }
void Operator::CalcSinusExcitation(double f0, int nTS)
{
if (dT==0) return;
if (nTS<=0) return;
ExciteLength = (unsigned int)(nTS);
delete[] ExciteSignal;
ExciteSignal = new FDTD_FLOAT[ExciteLength+1];
ExciteSignal[0]=0.0;
for (unsigned int n=1;n<ExciteLength+1;++n)
{
ExciteSignal[n] = sin(2.0*PI*f0*n*dT);
// cerr << ExciteSignal[n] << endl;
}
}
void Operator::DumpOperator2File(string filename) void Operator::DumpOperator2File(string filename)
{ {
ofstream file(filename.c_str(),ios_base::out); ofstream file(filename.c_str(),ios_base::out);

View File

@ -21,7 +21,10 @@ public:
virtual int CalcECOperator(); virtual int CalcECOperator();
//! Calculate an excitation with center of f0 and the half bandwidth fc
virtual void CalcGaussianPulsExcitation(double f0, double fc); virtual void CalcGaussianPulsExcitation(double f0, double fc);
//! Calculate a sinusoidal excitation with frequency f0 and a duration of nTS number of timesteps
virtual void CalcSinusExcitation(double f0, int nTS);
virtual void ApplyElectricBC(bool* dirs); //applied by default to all boundaries virtual void ApplyElectricBC(bool* dirs); //applied by default to all boundaries
virtual void ApplyMagneticBC(bool* dirs); virtual void ApplyMagneticBC(bool* dirs);