timestep length warning only for gaussian pulse excitation type

pull/1/head
Thorsten Liebig 2012-01-17 11:31:53 +01:00
parent 84daf1a024
commit 2cbdf2d2b2
4 changed files with 15 additions and 7 deletions

View File

@ -36,6 +36,8 @@ Excitation::Excitation( double timestep )
Curr_dir = 0; Curr_dir = 0;
Curr_Count = 0; Curr_Count = 0;
m_Excit_Type = -1;
for (int n=0; n<3; ++n) for (int n=0; n<3; ++n)
{ {
Volt_index[n] = 0; Volt_index[n] = 0;
@ -87,6 +89,8 @@ void Excitation::Reset( double timestep )
Volt_Count = 0; Volt_Count = 0;
Curr_Count = 0; Curr_Count = 0;
m_Excit_Type = -1;
for (int n=0; n<3; ++n) for (int n=0; n<3; ++n)
{ {
delete[] Volt_index[n]; delete[] Volt_index[n];
@ -110,12 +114,11 @@ bool Excitation::setupExcitation( TiXmlElement* Excite, unsigned int maxTS )
return false; return false;
} }
int Excit_Type=0;
double f0=0; double f0=0;
double fc=0; double fc=0;
Excite->QueryIntAttribute("Type",&Excit_Type); Excite->QueryIntAttribute("Type",&m_Excit_Type);
switch (Excit_Type) switch (m_Excit_Type)
{ {
case 0: case 0:
Excite->QueryDoubleAttribute("f0",&f0); Excite->QueryDoubleAttribute("f0",&f0);
@ -137,7 +140,8 @@ bool Excitation::setupExcitation( TiXmlElement* Excite, unsigned int maxTS )
CalcCustomExcitation(f0,maxTS,Excite->Attribute("Function")); CalcCustomExcitation(f0,maxTS,Excite->Attribute("Function"));
break; break;
default: default:
cerr << "Excitation::setupExcitation: Unknown excitation type: \"" << Excit_Type<< "\" !!" << endl; cerr << "Excitation::setupExcitation: Unknown excitation type: \"" << m_Excit_Type<< "\" !!" << endl;
m_Excit_Type = -1;
return false; return false;
} }

View File

@ -54,6 +54,9 @@ public:
//! Get the used timestep //! Get the used timestep
double GetTimestep() const {return dT;} double GetTimestep() const {return dT;}
//! Get the type of excitation
int GetExciteType() const {return m_Excit_Type;}
//Excitation time-signal //Excitation time-signal
unsigned int Length; unsigned int Length;
FDTD_FLOAT* Signal_volt; FDTD_FLOAT* Signal_volt;
@ -78,6 +81,7 @@ public:
protected: protected:
double dT; double dT;
unsigned int m_nyquistTS; unsigned int m_nyquistTS;
int m_Excit_Type;
//! Calculate a custom signal //! Calculate a custom signal
virtual void CalcCustomExcitation(double f0, int nTS, string signal); virtual void CalcCustomExcitation(double f0, int nTS, string signal);

View File

@ -501,7 +501,7 @@ void openEMS_FDTD_MPI::RunFDTD()
PA->FlushNext(); PA->FlushNext();
} }
} }
if ((m_MyID==0) && (m_EnergyDecrement>endCrit)) if ((m_MyID==0) && (m_EnergyDecrement>endCrit) && (FDTD_Op->Exc->GetExciteType()==0))
cerr << "RunFDTD: max. number of timesteps was reached before the end-criteria of -" << fabs(10.0*log10(endCrit)) << "dB was reached... " << endl << \ cerr << "RunFDTD: max. number of timesteps was reached before the end-criteria of -" << fabs(10.0*log10(endCrit)) << "dB was reached... " << endl << \
"\tYou may want to choose a higher number of max. timesteps... " << endl; "\tYou may want to choose a higher number of max. timesteps... " << endl;

View File

@ -680,7 +680,7 @@ int openEMS::SetupFDTD(const char* file)
cout << "Excitation signal length is: " << FDTD_Op->Exc->Length << " timesteps (" << FDTD_Op->Exc->Length*FDTD_Op->GetTimestep() << "s)" << endl; cout << "Excitation signal length is: " << FDTD_Op->Exc->Length << " timesteps (" << FDTD_Op->Exc->Length*FDTD_Op->GetTimestep() << "s)" << endl;
cout << "Max. number of timesteps: " << NrTS << " ( --> " << (double)NrTS/(double)(FDTD_Op->Exc->Length) << " * Excitation signal length)" << endl; cout << "Max. number of timesteps: " << NrTS << " ( --> " << (double)NrTS/(double)(FDTD_Op->Exc->Length) << " * Excitation signal length)" << endl;
if ((double)NrTS/(double)FDTD_Op->Exc->Length < 3) if ( ((double)NrTS/(double)FDTD_Op->Exc->Length < 3) && (FDTD_Op->Exc->GetExciteType()==0))
cerr << "openEMS::SetupFDTD: Warning, max. number of timesteps is smaller than three times the excitation. " << endl << \ cerr << "openEMS::SetupFDTD: Warning, max. number of timesteps is smaller than three times the excitation. " << endl << \
"\tYou may want to choose a higher number of max. timesteps... " << endl; "\tYou may want to choose a higher number of max. timesteps... " << endl;
@ -813,7 +813,7 @@ void openEMS::RunFDTD()
PA->FlushNext(); PA->FlushNext();
} }
} }
if (change>endCrit) if ((change>endCrit) && (FDTD_Op->Exc->GetExciteType()==0))
cerr << "RunFDTD: Warning: Max. number of timesteps was reached before the end-criteria of -" << fabs(10.0*log10(endCrit)) << "dB was reached... " << endl << \ cerr << "RunFDTD: Warning: Max. number of timesteps was reached before the end-criteria of -" << fabs(10.0*log10(endCrit)) << "dB was reached... " << endl << \
"\tYou may want to choose a higher number of max. timesteps... " << endl; "\tYou may want to choose a higher number of max. timesteps... " << endl;