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_TimeStepFactor = 1;
|
||||
}
|
||||
|
||||
void Operator::Delete()
|
||||
|
@ -891,6 +892,8 @@ int Operator::CalcECOperator( DebugFlags debugFlags )
|
|||
else
|
||||
CalcTimestep();
|
||||
|
||||
dT*=m_TimeStepFactor;
|
||||
|
||||
m_Exc->Reset(dT);
|
||||
|
||||
InitOperator();
|
||||
|
@ -1484,6 +1487,18 @@ bool Operator::Calc_EC()
|
|||
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()
|
||||
{
|
||||
if (m_TimeStepVar==3)
|
||||
|
|
|
@ -78,7 +78,9 @@ public:
|
|||
|
||||
//! Set a forced timestep to use by the operator
|
||||
virtual void SetTimestep(double ts) {dT = ts;}
|
||||
virtual void SetTimestepFactor(double factor);
|
||||
bool GetTimestepValid() const {return !m_InvaildTimestep;}
|
||||
|
||||
virtual double GetNumberCells() const;
|
||||
|
||||
virtual unsigned int GetNumberOfNyquistTimesteps() const {return m_Exc->GetNyquistNum();}
|
||||
|
@ -180,6 +182,7 @@ protected:
|
|||
|
||||
//Calc timestep only internal use
|
||||
int m_TimeStepVar;
|
||||
double m_TimeStepFactor;
|
||||
virtual double CalcTimestep();
|
||||
double opt_dT;
|
||||
bool m_InvaildTimestep;
|
||||
|
|
|
@ -12,6 +12,8 @@ function FDTD = InitFDTD(NrTS, endCrit, varargin)
|
|||
% optional field arguments for usage with openEMS:
|
||||
% OverSampling: nyquist oversampling of time domain dumps
|
||||
% 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:
|
||||
% %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);
|
||||
if (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)
|
||||
FDTD_Op->AddExtension(new Operator_Ext_LorentzMaterial(FDTD_Op));
|
||||
|
|
Loading…
Reference in New Issue