fix: new timestep not (always) stable for cylinder-coords, using the old one...

pull/1/head v0.0.10
Thorsten Liebig 2010-06-22 12:49:51 +02:00
parent cb5c1f877e
commit ebacc62812
4 changed files with 28 additions and 10 deletions

View File

@ -822,10 +822,20 @@ bool Operator::Calc_EC()
return true;
}
#if 0 //use the old timestep-calc (1) or the new one (0)
////Berechnung nach Andreas Rennings Dissertation 2008, Seite 66, Formel 4.52
double Operator::CalcTimestep()
{
#if 1 //use the old timestep-calc (1) or the new one (0)
return CalcTimestep_Var3();
#else
return CalcTimestep_Var1();
#endif
}
////Berechnung nach Andreas Rennings Dissertation 2008, Seite 66, Formel 4.52
double Operator::CalcTimestep_Var1()
{
cout << "Operator::CalcTimestep(): Using timestep algorithm by Andreas Rennings, Dissertation @ University Duisburg-Essen, 2008, pp. 66, eq. 4.52" << endl;
dT=1e200;
double newT;
unsigned int pos[3];
@ -864,8 +874,6 @@ double Operator::CalcTimestep()
return 0;
}
#else
double min(double* val, unsigned int count)
{
if (count==0)
@ -878,9 +886,10 @@ double min(double* val, unsigned int count)
}
//Berechnung nach Andreas Rennings Dissertation 2008, Seite 76 ff, Formel 4.77 ff
double Operator::CalcTimestep()
double Operator::CalcTimestep_Var3()
{
dT=1e200;
cout << "Operator::CalcTimestep(): Using timestep algorithm by Andreas Rennings, Dissertation @ University Duisburg-Essen, 2008, pp. 76, eq. 4.77 ff." << endl;
double newT;
unsigned int pos[3];
unsigned int ipos;
@ -893,11 +902,11 @@ double Operator::CalcTimestep()
int nP = (n+1)%3;
int nPP = (n+2)%3;
for (pos[2]=1;pos[2]<numLines[2]-1;++pos[2])
for (pos[2]=0;pos[2]<numLines[2];++pos[2])
{
for (pos[1]=1;pos[1]<numLines[1]-1;++pos[1])
for (pos[1]=0;pos[1]<numLines[1];++pos[1])
{
for (pos[0]=1;pos[0]<numLines[0]-1;++pos[0])
for (pos[0]=0;pos[0]<numLines[0];++pos[0])
{
MainOp->ResetShift();
ipos = MainOp->SetPos(pos[0],pos[1],pos[2]);
@ -943,8 +952,6 @@ double Operator::CalcTimestep()
return 0;
}
#endif
bool Operator::CalcFieldExcitation()
{
if (dT==0)

View File

@ -115,6 +115,9 @@ protected:
virtual double CalcTimestep();
double dT; //FDTD timestep!
double CalcTimestep_Var1();
double CalcTimestep_Var3();
//! Calc operator at certain pos
virtual void Calc_ECOperatorPos(int n, unsigned int* pos);

View File

@ -385,3 +385,8 @@ void Operator_Cylinder::AddExtension(Operator_Extension* op_ext)
else
cerr << "Operator_Cylinder::AddExtension: Warning: Operator extension \"" << op_ext->GetExtensionName() << "\" is not compatible with cylinder-coords!! skipping...!" << endl;
}
double Operator_Cylinder::CalcTimestep()
{
return CalcTimestep_Var1();
}

View File

@ -61,6 +61,9 @@ protected:
virtual void InitOperator();
virtual void Reset();
//Calc timestep only internal use
virtual double CalcTimestep();
bool CC_closedAlpha;
bool CC_R0_included;
};