2010-09-02 20:14:40 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 Thorsten Liebig (Thorsten.Liebig@gmx.de)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-05-06 20:55:59 +00:00
|
|
|
#include "operator_ext_cylinder.h"
|
2010-12-06 14:30:47 +00:00
|
|
|
#include "FDTD/operator_cylinder.h"
|
2010-05-06 20:55:59 +00:00
|
|
|
#include "engine_ext_cylinder.h"
|
|
|
|
|
|
|
|
Operator_Ext_Cylinder::Operator_Ext_Cylinder(Operator_Cylinder* op) : Operator_Extension(op)
|
|
|
|
{
|
|
|
|
m_Op_Cyl = op;
|
|
|
|
|
|
|
|
CC_R0_included=m_Op_Cyl->GetR0Included();
|
|
|
|
CC_closedAlpha=m_Op_Cyl->GetClosedAlpha();
|
|
|
|
|
|
|
|
vv_R0 = NULL;
|
|
|
|
vi_R0 = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Operator_Ext_Cylinder::~Operator_Ext_Cylinder()
|
|
|
|
{
|
2010-12-06 12:04:37 +00:00
|
|
|
delete[] vv_R0;
|
|
|
|
vv_R0=NULL;
|
|
|
|
delete[] vi_R0;
|
|
|
|
vi_R0=NULL;
|
2010-05-06 20:55:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Operator_Ext_Cylinder::BuildExtension()
|
|
|
|
{
|
2010-12-06 12:04:37 +00:00
|
|
|
delete[] vv_R0;
|
|
|
|
vv_R0=NULL;
|
|
|
|
delete[] vi_R0;
|
|
|
|
vi_R0=NULL;
|
2010-05-06 20:55:59 +00:00
|
|
|
|
|
|
|
//if r=0 is not included -> obviously no special treatment for r=0
|
|
|
|
//if alpha direction is not closed, PEC-BC at r=0 necessary and already set...
|
2011-03-28 08:38:48 +00:00
|
|
|
if (CC_R0_included==false)
|
2010-05-06 20:55:59 +00:00
|
|
|
return true;
|
|
|
|
|
2013-02-06 15:33:12 +00:00
|
|
|
vv_R0 = new FDTD_FLOAT[m_Op->GetNumberOfLines(2,true)];
|
|
|
|
vi_R0 = new FDTD_FLOAT[m_Op->GetNumberOfLines(2,true)];
|
2010-05-06 20:55:59 +00:00
|
|
|
|
|
|
|
unsigned int pos[3];
|
2012-02-10 10:57:28 +00:00
|
|
|
double coord[3];
|
2010-05-06 20:55:59 +00:00
|
|
|
double inEC[4];
|
|
|
|
double dT = m_Op->GetTimestep();
|
|
|
|
pos[0]=0;
|
2013-02-06 15:33:12 +00:00
|
|
|
for (pos[2]=0; pos[2]<m_Op->GetNumberOfLines(2,true); ++pos[2])
|
2010-05-06 20:55:59 +00:00
|
|
|
{
|
|
|
|
double C=0;
|
|
|
|
double G=0;
|
2013-02-06 15:33:12 +00:00
|
|
|
for (pos[1]=0; pos[1]<m_Op->GetNumberOfLines(1,true)-2; ++pos[1])
|
2010-05-06 20:55:59 +00:00
|
|
|
{
|
|
|
|
m_Op_Cyl->Calc_ECPos(2,pos,inEC);
|
2010-12-08 15:55:27 +00:00
|
|
|
C+=inEC[0];
|
|
|
|
G+=inEC[1];
|
2010-05-06 20:55:59 +00:00
|
|
|
}
|
2010-10-20 05:26:16 +00:00
|
|
|
m_Op->SetVV(2,0,0,pos[2], 1);
|
2010-05-06 20:55:59 +00:00
|
|
|
vv_R0[pos[2]] = (1-dT*G/2/C)/(1+dT*G/2/C);
|
|
|
|
vi_R0[pos[2]] = (dT/C)/(1+dT*G/2/C);
|
2012-02-10 10:57:28 +00:00
|
|
|
|
2013-02-06 15:33:12 +00:00
|
|
|
for (unsigned int i=0; i<m_Op->GetNumberOfLines(1,true); ++i)
|
2012-06-06 08:29:57 +00:00
|
|
|
{
|
|
|
|
m_Op->EC_C[2][m_Op->MainOp->SetPos(0,i,pos[2])] = C;
|
|
|
|
m_Op->EC_G[2][m_Op->MainOp->SetPos(0,i,pos[2])] = G;
|
|
|
|
}
|
|
|
|
|
2012-02-10 10:57:28 +00:00
|
|
|
//search for metal on z-axis
|
|
|
|
m_Op_Cyl->GetYeeCoords(2,pos,coord,false);
|
|
|
|
CSProperties* prop = m_Op->CSX->GetPropertyByCoordPriority(coord, (CSProperties::PropertyType)(CSProperties::MATERIAL | CSProperties::METAL), true);
|
|
|
|
if (prop)
|
|
|
|
{
|
|
|
|
if (prop->GetType()==CSProperties::METAL) //set to PEC
|
|
|
|
{
|
|
|
|
m_Op->SetVV(2,0,0,pos[2], 0);
|
|
|
|
vv_R0[pos[2]] = 0;
|
|
|
|
vi_R0[pos[2]] = 0;
|
2012-06-06 08:29:57 +00:00
|
|
|
m_Op->EC_C[2][m_Op->MainOp->SetPos(0,0,pos[2])] = 0;
|
|
|
|
m_Op->EC_G[2][m_Op->MainOp->SetPos(0,0,pos[2])] = 0;
|
2012-02-10 10:57:28 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-06 20:55:59 +00:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
Engine_Extension* Operator_Ext_Cylinder::CreateEngineExtention()
|
|
|
|
{
|
|
|
|
Engine_Ext_Cylinder* eng_ext = new Engine_Ext_Cylinder(this);
|
|
|
|
return eng_ext;
|
|
|
|
}
|
2010-07-11 21:45:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
void Operator_Ext_Cylinder::ShowStat(ostream &ostr) const
|
|
|
|
{
|
|
|
|
Operator_Extension::ShowStat(ostr);
|
|
|
|
string On_Off[2] = {"Off", "On"};
|
|
|
|
ostr << " Zeroth Radius\t\t: " << On_Off[CC_R0_included] << endl;
|
|
|
|
ostr << " Closed Rotation\t: " << On_Off[CC_closedAlpha] << endl;
|
|
|
|
}
|