excitation: store only 2 periods of periodic excitations
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>pull/13/head
parent
b2f5ab3c6b
commit
9c80672855
|
@ -251,8 +251,8 @@ void Excitation::CalcSinusExcitation(double f0, int nTS)
|
|||
if (dT==0) return;
|
||||
if (nTS<=0) return;
|
||||
|
||||
Length = (unsigned int)(nTS);
|
||||
// cerr << "Operator::CalcSinusExcitation: Length of the excite signal: " << ExciteLength << " timesteps" << endl;
|
||||
Length = (unsigned int)(2.0/f0/dT);
|
||||
//cerr << "Operator::CalcSinusExcitation: Length of the excite signal: " << Length << " timesteps " << Length*dT << "s" << endl;
|
||||
delete[] Signal_volt;
|
||||
delete[] Signal_curr;
|
||||
Signal_volt = new FDTD_FLOAT[Length+1];
|
||||
|
|
|
@ -40,6 +40,10 @@ void Engine_Ext_Excitation::Apply2Voltages()
|
|||
unsigned int length = m_Op_Exc->m_Exc->GetLength();
|
||||
FDTD_FLOAT* exc_volt = m_Op_Exc->m_Exc->GetVoltageSignal();
|
||||
|
||||
int p = int(m_Op_Exc->m_Exc->GetSignalPeriod()/m_Op_Exc->m_Exc->GetTimestep());
|
||||
if (p>0)
|
||||
numTS = (numTS % p) + p;
|
||||
|
||||
//switch for different engine types to access faster inline engine functions
|
||||
switch (m_Eng->GetType())
|
||||
{
|
||||
|
@ -100,6 +104,10 @@ void Engine_Ext_Excitation::Apply2Current()
|
|||
unsigned int length = m_Op_Exc->m_Exc->GetLength();
|
||||
FDTD_FLOAT* exc_curr = m_Op_Exc->m_Exc->GetCurrentSignal();
|
||||
|
||||
int p = int(m_Op_Exc->m_Exc->GetSignalPeriod()/m_Op_Exc->m_Exc->GetTimestep());
|
||||
if (p>0)
|
||||
numTS = (numTS % p) + p;
|
||||
|
||||
//switch for different engine types to access faster inline engine functions
|
||||
switch (m_Eng->GetType())
|
||||
{
|
||||
|
|
|
@ -38,14 +38,18 @@ void Engine_Ext_TFSF::DoPostVoltageUpdates()
|
|||
unsigned int numTS = m_Eng->GetNumberOfTimesteps();
|
||||
unsigned int length = m_Op_TFSF->m_Exc->GetLength();
|
||||
|
||||
int p = int(m_Op_TFSF->m_Exc->GetSignalPeriod()/m_Op_TFSF->m_Exc->GetTimestep());
|
||||
|
||||
for (unsigned int n=0;n<=m_Op_TFSF->m_maxDelay;++n)
|
||||
{
|
||||
if ( numTS < n )
|
||||
m_DelayLookup[n]=0;
|
||||
else if ( numTS-n > length)
|
||||
else if ((numTS-n > length) && (p==0))
|
||||
m_DelayLookup[n]=0;
|
||||
else
|
||||
m_DelayLookup[n] = numTS - n;
|
||||
if (p>0)
|
||||
m_DelayLookup[n] = (m_DelayLookup[n] % p);
|
||||
}
|
||||
|
||||
//get the current signal since an H-field is added ...
|
||||
|
@ -124,14 +128,18 @@ void Engine_Ext_TFSF::DoPostCurrentUpdates()
|
|||
unsigned int numTS = m_Eng->GetNumberOfTimesteps();
|
||||
unsigned int length = m_Op_TFSF->m_Exc->GetLength();
|
||||
|
||||
int p = int(m_Op_TFSF->m_Exc->GetSignalPeriod()/m_Op_TFSF->m_Exc->GetTimestep());
|
||||
|
||||
for (unsigned int n=0;n<m_Op_TFSF->m_maxDelay;++n)
|
||||
{
|
||||
if ( numTS < n )
|
||||
m_DelayLookup[n]=0;
|
||||
else if ( numTS-n > length)
|
||||
else if ((numTS-n > length) && (p==0))
|
||||
m_DelayLookup[n]=0;
|
||||
else
|
||||
m_DelayLookup[n] = numTS - n;
|
||||
if (p>0)
|
||||
m_DelayLookup[n] = (m_DelayLookup[n] % p);
|
||||
}
|
||||
|
||||
//get the current signal since an E-field is added ...
|
||||
|
|
22
openems.cpp
22
openems.cpp
|
@ -805,11 +805,23 @@ int openEMS::SetupFDTD(const char* file)
|
|||
if (m_Exc->GetNyquistNum()>1000)
|
||||
cerr << "openEMS::SetupFDTD: Warning, the timestep seems to be very small --> long simulation. Check your mesh!?" << endl;
|
||||
|
||||
cout << "Excitation signal length is: " << m_Exc->GetLength() << " timesteps (" << m_Exc->GetLength()*FDTD_Op->GetTimestep() << "s)" << endl;
|
||||
cout << "Max. number of timesteps: " << NrTS << " ( --> " << (double)NrTS/(double)(m_Exc->GetLength()) << " * Excitation signal length)" << endl;
|
||||
if ( ((double)NrTS/(double)m_Exc->GetLength() < 3) && (m_Exc->GetExciteType()==0))
|
||||
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;
|
||||
if (m_Exc->GetSignalPeriod()==0)
|
||||
{
|
||||
cout << "Excitation signal length is: " << m_Exc->GetLength() << " timesteps (" << m_Exc->GetLength()*FDTD_Op->GetTimestep() << "s)" << endl;
|
||||
cout << "Max. number of timesteps: " << NrTS << " ( --> " << (double)NrTS/(double)(m_Exc->GetLength()) << " * Excitation signal length)" << endl;
|
||||
if ( ((double)NrTS/(double)m_Exc->GetLength() < 3) && (m_Exc->GetExciteType()==0))
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
int p = int(m_Exc->GetSignalPeriod()/FDTD_Op->GetTimestep());
|
||||
cout << "Excitation signal period is: " << p << " timesteps (" << m_Exc->GetSignalPeriod() << "s)" << endl;
|
||||
cout << "Max. number of timesteps: " << NrTS << " ( --> " << (double)NrTS/(double)(m_Exc->GetLength()) << " * Excitation signal period)" << endl;
|
||||
if (NrTS/p < 3)
|
||||
cerr << "openEMS::SetupFDTD: Warning, max. number of timesteps is smaller than three times the excitation signal period. " << endl << \
|
||||
"\tYou may want to choose a higher number of max. timesteps... " << endl;
|
||||
}
|
||||
|
||||
if (m_no_simulation)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue