Define a max FDTD simulated time, maybe useful for e.g. sinusoidal excitations

matlab example: simulate 1us in the time domain:
FDTD = InitFDTD(5e5,1e-5,'MaxTime',1e-6)
pull/1/head
Thorsten Liebig 2010-05-21 16:55:04 +02:00
parent f290fd6db4
commit 1b52834e89
1 changed files with 8 additions and 0 deletions

View File

@ -188,6 +188,10 @@ int openEMS::SetupFDTD(const char* file)
if (m_OverSampling<2)
m_OverSampling=2;
double maxTime=0;
FDTD_Opts->QueryDoubleAttribute("MaxTime",&maxTime);
TiXmlElement* BC = FDTD_Opts->FirstChildElement("BoundaryCond");
if (BC==NULL)
{
@ -250,6 +254,10 @@ int openEMS::SetupFDTD(const char* file)
}
FDTD_Op->CalcECOperator();
unsigned int maxTime_TS = (unsigned int)(maxTime/FDTD_Op->GetTimestep());
if ((maxTime_TS>0) && (maxTime_TS<NrTS))
NrTS = maxTime_TS;
if (!FDTD_Op->Exc->setupExcitation( FDTD_Opts->FirstChildElement("Excitation"), NrTS ))
exit(2);