UPML: allow pml in +/- alpha direction in a cylindrical FDTD mesh

This needs a lot of stability testing and verification!

Signed-off-by: Thorsten Liebig <Thorsten.Liebig@gmx.de>
This commit is contained in:
Thorsten Liebig 2012-02-21 12:40:36 +01:00
parent cf258a98d8
commit fedb8a91f2
3 changed files with 23 additions and 2 deletions

View File

@ -97,13 +97,13 @@ bool Operator_Ext_UPML::Create_UPML(Operator* op, const int ui_BC[6], const unsi
size[0]=0; size[0]=0;
cerr << "Operator_Ext_UPML::Create_UPML: Warning: An upml in r-min direction is not possible, resetting to PEC..." << endl; cerr << "Operator_Ext_UPML::Create_UPML: Warning: An upml in r-min direction is not possible, resetting to PEC..." << endl;
} }
if (BC[2]==3) if ( (BC[2]==3) && (op_cyl->GetClosedAlpha()) )
{ {
BC[2]=0; BC[2]=0;
size[2]=0; size[2]=0;
cerr << "Operator_Ext_UPML::Create_UPML: Warning: An upml in alpha-min direction is not possible, resetting to PEC..." << endl; cerr << "Operator_Ext_UPML::Create_UPML: Warning: An upml in alpha-min direction is not possible, resetting to PEC..." << endl;
} }
if (BC[3]==3) if ( (BC[3]==3) && (op_cyl->GetClosedAlpha()) )
{ {
BC[3]=0; BC[3]=0;
size[3]=0; size[3]=0;
@ -276,6 +276,12 @@ void Operator_Ext_UPML::CalcGradingKappa(int ny, unsigned int pos[3], double Zm,
width = (m_Op->GetDiscLine(n,m_Size[2*n]) - m_Op->GetDiscLine(n,0))*m_Op->GetGridDelta(); width = (m_Op->GetDiscLine(n,m_Size[2*n]) - m_Op->GetDiscLine(n,0))*m_Op->GetGridDelta();
depth = width - (m_Op->GetDiscLine(n,pos[n]) - m_Op->GetDiscLine(n,0))*m_Op->GetGridDelta(); depth = width - (m_Op->GetDiscLine(n,pos[n]) - m_Op->GetDiscLine(n,0))*m_Op->GetGridDelta();
if ((m_Op_Cyl) && (n==1))
{
width *= m_Op_Cyl->GetDiscLine(0,pos[0]);
depth *= m_Op_Cyl->GetDiscLine(0,pos[0]);
}
if (n==ny) if (n==ny)
depth-=m_Op->GetEdgeLength(n,pos)/2; depth-=m_Op->GetEdgeLength(n,pos)/2;
double vars[5] = {depth, width/m_Size[2*n], width, Zm, m_Size[2*n]}; double vars[5] = {depth, width/m_Size[2*n], width, Zm, m_Size[2*n]};
@ -301,6 +307,12 @@ void Operator_Ext_UPML::CalcGradingKappa(int ny, unsigned int pos[3], double Zm,
width = (m_Op->GetDiscLine(n,m_Op->GetOriginalNumLines(n)-1) - m_Op->GetDiscLine(n,m_Op->GetOriginalNumLines(n)-m_Size[2*n+1]-1))*m_Op->GetGridDelta(); width = (m_Op->GetDiscLine(n,m_Op->GetOriginalNumLines(n)-1) - m_Op->GetDiscLine(n,m_Op->GetOriginalNumLines(n)-m_Size[2*n+1]-1))*m_Op->GetGridDelta();
depth = width - (m_Op->GetDiscLine(n,m_Op->GetOriginalNumLines(n)-1) - m_Op->GetDiscLine(n,pos[n]))*m_Op->GetGridDelta(); depth = width - (m_Op->GetDiscLine(n,m_Op->GetOriginalNumLines(n)-1) - m_Op->GetDiscLine(n,pos[n]))*m_Op->GetGridDelta();
if ((m_Op_Cyl) && (n==1))
{
width *= m_Op_Cyl->GetDiscLine(0,pos[0]);
depth *= m_Op_Cyl->GetDiscLine(0,pos[0]);
}
if (n==ny) if (n==ny)
depth+=m_Op->GetEdgeLength(n,pos)/2; depth+=m_Op->GetEdgeLength(n,pos)/2;
double vars[5] = {depth, width/(m_Size[2*n]), width, Zm, m_Size[2*n]}; double vars[5] = {depth, width/(m_Size[2*n]), width, Zm, m_Size[2*n]};

View File

@ -17,10 +17,13 @@
#include "operator_extension.h" #include "operator_extension.h"
#include "FDTD/operator.h" #include "FDTD/operator.h"
#include "FDTD/operator_cylinder.h"
Operator_Extension::Operator_Extension(Operator* op) Operator_Extension::Operator_Extension(Operator* op)
{ {
m_Op = op; m_Op = op;
m_Op_Cyl = dynamic_cast<Operator_Cylinder*>(op);
} }
Operator_Extension::~Operator_Extension() Operator_Extension::~Operator_Extension()

View File

@ -29,6 +29,7 @@
using namespace std; using namespace std;
class Operator; class Operator;
class Operator_Cylinder;
class Engine_Extension; class Engine_Extension;
//! Abstract base-class for all operator extensions //! Abstract base-class for all operator extensions
@ -63,7 +64,12 @@ protected:
Operator_Extension(Operator* op); Operator_Extension(Operator* op);
//! Copy constructor, returns NULL if extension cannot be copied... //! Copy constructor, returns NULL if extension cannot be copied...
Operator_Extension(Operator* op, Operator_Extension* op_ext); Operator_Extension(Operator* op, Operator_Extension* op_ext);
//FDTD Operator
Operator* m_Op; Operator* m_Op;
//Cylindrical FDTD Operator (not NULL if a cylindrical FDTD is used)
Operator_Cylinder* m_Op_Cyl;
}; };
#endif // OPERATOR_EXTENSION_H #endif // OPERATOR_EXTENSION_H