FDTD: new argument to reduce the used timestep by a given factor
Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>pull/1/head
parent
2f228f2161
commit
0022996df6
|
@ -84,6 +84,7 @@ void Operator::Init()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Exc = 0;
|
m_Exc = 0;
|
||||||
|
m_TimeStepFactor = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Operator::Delete()
|
void Operator::Delete()
|
||||||
|
@ -891,6 +892,8 @@ int Operator::CalcECOperator( DebugFlags debugFlags )
|
||||||
else
|
else
|
||||||
CalcTimestep();
|
CalcTimestep();
|
||||||
|
|
||||||
|
dT*=m_TimeStepFactor;
|
||||||
|
|
||||||
m_Exc->Reset(dT);
|
m_Exc->Reset(dT);
|
||||||
|
|
||||||
InitOperator();
|
InitOperator();
|
||||||
|
@ -1484,6 +1487,18 @@ bool Operator::Calc_EC()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Operator::SetTimestepFactor(double factor)
|
||||||
|
{
|
||||||
|
if ((factor<=0) || (factor>1))
|
||||||
|
{
|
||||||
|
cerr << "Operator::SetTimestepFactor: Warning, invalid timestep factor, skipping!" << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << "Operator::SetTimestepFactor: Setting timestep factor to " << factor << endl;
|
||||||
|
m_TimeStepFactor=factor;
|
||||||
|
}
|
||||||
|
|
||||||
double Operator::CalcTimestep()
|
double Operator::CalcTimestep()
|
||||||
{
|
{
|
||||||
if (m_TimeStepVar==3)
|
if (m_TimeStepVar==3)
|
||||||
|
|
|
@ -78,7 +78,9 @@ public:
|
||||||
|
|
||||||
//! Set a forced timestep to use by the operator
|
//! Set a forced timestep to use by the operator
|
||||||
virtual void SetTimestep(double ts) {dT = ts;}
|
virtual void SetTimestep(double ts) {dT = ts;}
|
||||||
|
virtual void SetTimestepFactor(double factor);
|
||||||
bool GetTimestepValid() const {return !m_InvaildTimestep;}
|
bool GetTimestepValid() const {return !m_InvaildTimestep;}
|
||||||
|
|
||||||
virtual double GetNumberCells() const;
|
virtual double GetNumberCells() const;
|
||||||
|
|
||||||
virtual unsigned int GetNumberOfNyquistTimesteps() const {return m_Exc->GetNyquistNum();}
|
virtual unsigned int GetNumberOfNyquistTimesteps() const {return m_Exc->GetNyquistNum();}
|
||||||
|
@ -180,6 +182,7 @@ protected:
|
||||||
|
|
||||||
//Calc timestep only internal use
|
//Calc timestep only internal use
|
||||||
int m_TimeStepVar;
|
int m_TimeStepVar;
|
||||||
|
double m_TimeStepFactor;
|
||||||
virtual double CalcTimestep();
|
virtual double CalcTimestep();
|
||||||
double opt_dT;
|
double opt_dT;
|
||||||
bool m_InvaildTimestep;
|
bool m_InvaildTimestep;
|
||||||
|
|
|
@ -12,6 +12,8 @@ function FDTD = InitFDTD(NrTS, endCrit, varargin)
|
||||||
% optional field arguments for usage with openEMS:
|
% optional field arguments for usage with openEMS:
|
||||||
% OverSampling: nyquist oversampling of time domain dumps
|
% OverSampling: nyquist oversampling of time domain dumps
|
||||||
% CoordSystem: choose coordinate system (0 Cartesian, 1 Cylindrical)
|
% CoordSystem: choose coordinate system (0 Cartesian, 1 Cylindrical)
|
||||||
|
% TimeStep: force to use a given timestep (dangerous!)
|
||||||
|
% TimeStepFactor: reduce the timestep by a given factor (>0 to <=1)
|
||||||
%
|
%
|
||||||
% examples:
|
% examples:
|
||||||
% %default init with 1e9 max. timesteps and -50dB end-criteria
|
% %default init with 1e9 max. timesteps and -50dB end-criteria
|
||||||
|
|
|
@ -652,6 +652,9 @@ int openEMS::SetupFDTD(const char* file)
|
||||||
FDTD_Opts->QueryDoubleAttribute("TimeStep",×tep);
|
FDTD_Opts->QueryDoubleAttribute("TimeStep",×tep);
|
||||||
if (timestep)
|
if (timestep)
|
||||||
FDTD_Op->SetTimestep(timestep);
|
FDTD_Op->SetTimestep(timestep);
|
||||||
|
double timestepfactor=0;
|
||||||
|
if (FDTD_Opts->QueryDoubleAttribute("TimeStepFactor",×tepfactor)==TIXML_SUCCESS)
|
||||||
|
FDTD_Op->SetTimestepFactor(timestepfactor);
|
||||||
|
|
||||||
if (m_CSX->GetQtyPropertyType(CSProperties::LORENTZMATERIAL)>0)
|
if (m_CSX->GetQtyPropertyType(CSProperties::LORENTZMATERIAL)>0)
|
||||||
FDTD_Op->AddExtension(new Operator_Ext_LorentzMaterial(FDTD_Op));
|
FDTD_Op->AddExtension(new Operator_Ext_LorentzMaterial(FDTD_Op));
|
||||||
|
|
Loading…
Reference in New Issue