From add2f2decb7e8bdd2e373b275c92c833920144fb Mon Sep 17 00:00:00 2001 From: Thorsten Liebig Date: Thu, 18 Feb 2016 22:58:07 +0100 Subject: [PATCH] fix wrong time step for cylinder mesh with r=0 Signed-off-by: Thorsten Liebig --- FDTD/operator_cylinder.cpp | 12 +++++++++--- FDTD/operator_cylinder.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/FDTD/operator_cylinder.cpp b/FDTD/operator_cylinder.cpp index 4a53d9b..342415f 100644 --- a/FDTD/operator_cylinder.cpp +++ b/FDTD/operator_cylinder.cpp @@ -88,6 +88,15 @@ int Operator_Cylinder::CalcECOperator( DebugFlags debugFlags ) return rc; } +double Operator_Cylinder::CalcTimestep() +{ + if (discLines[0][0]==0.0) + // use conservative timestep for a mesh including the r==0 singularity + m_TimeStepVar = 1; + + return Operator::CalcTimestep(); +} + inline unsigned int Operator_Cylinder::GetNumberOfLines(int ny, bool full) const { if (full) @@ -493,9 +502,6 @@ bool Operator_Cylinder::SetupCSXGrid(CSRectGrid* grid) if (g_settings.GetVerboseLevel()>0) cout << "Operator_Cylinder::SetupCSXGrid: r=0 included..." << endl; CC_R0_included = CC_closedAlpha; //needed for correct ec-calculation, deactivate if closed cylinder is false... --> E_r = 0 anyways - - // use conservative timestep for a mesh including the r==0 singularity - m_TimeStepVar = 1; } #ifdef MPI_SUPPORT diff --git a/FDTD/operator_cylinder.h b/FDTD/operator_cylinder.h index 5d4b0e4..152f618 100644 --- a/FDTD/operator_cylinder.h +++ b/FDTD/operator_cylinder.h @@ -105,7 +105,7 @@ protected: virtual double GetMaterial(int ny, const double coords[3], int MatType, vector vPrims, bool markAsUsed=true) const; virtual int CalcECOperator( DebugFlags debugFlags = None ); - + virtual double CalcTimestep(); bool CC_closedAlpha; bool CC_R0_included; Operator_Ext_Cylinder* m_Cyl_Ext;