operator: set a forced timestep

pull/1/head
Thorsten Liebig 2010-08-19 10:12:09 +02:00
parent e081a9cf94
commit 594b38e345
2 changed files with 14 additions and 1 deletions

View File

@ -35,6 +35,7 @@ Operator::Operator()
{
m_MeshType = ProcessFields::CARTESIAN_MESH;
Exc = 0;
dT = 0;
}
Operator::~Operator()
@ -77,6 +78,7 @@ void Operator::Init()
m_BC[n]=0;
Exc = 0;
dT = 0;
}
void Operator::Reset()
@ -531,6 +533,15 @@ int Operator::CalcECOperator()
if (Calc_EC()==0)
return -1;
if (dT>0)
{
double save_dT = dT;
CalcTimestep();
if (dT<save_dT)
cerr << "Operator::CalcECOperator: Warning, forced timestep: " << save_dT << "s is larger than calculated timestep: " << dT << "s! It is not recommended using this timestep!! " << endl;
dT = save_dT;
}
else
CalcTimestep();
InitOperator();

View File

@ -54,6 +54,8 @@ public:
virtual void ApplyElectricBC(bool* dirs); //applied by default to all boundaries
virtual void ApplyMagneticBC(bool* dirs);
//! Set a forced timestep to use by the operator
virtual void SetTimestep(double ts) {dT = ts;}
double GetTimestep() const {return dT;};
double GetNumberCells() const;