Helix example
parent
bb7aa0b2a3
commit
daaf898e83
|
@ -597,3 +597,157 @@ void BuildCoaxial_Cartesian(const char* filename)
|
||||||
doc.SaveFile();
|
doc.SaveFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BuildHelix(const char* filename)
|
||||||
|
{
|
||||||
|
int maxIter = 10000;
|
||||||
|
double f0=0.15e9;
|
||||||
|
double fc=0.15e9;
|
||||||
|
int Excit_Type=0;
|
||||||
|
int bounds[] = {1,1,1,1,0,0};
|
||||||
|
|
||||||
|
cerr << "Create Helix Geometry..." << endl;
|
||||||
|
ContinuousStructure CSX;
|
||||||
|
|
||||||
|
double width = 800;
|
||||||
|
double length = 800;
|
||||||
|
double delta[] = {5,5,5};
|
||||||
|
|
||||||
|
//MSL
|
||||||
|
CSPropMaterial* copper = new CSPropMaterial(CSX.GetParameterSet());
|
||||||
|
copper->SetKappa(56e6);
|
||||||
|
copper->SetName("copper");
|
||||||
|
CSX.AddProperty(copper);
|
||||||
|
|
||||||
|
CSPrimUserDefined* helix = new CSPrimUserDefined(CSX.GetParameterSet(),copper);
|
||||||
|
helix->SetCoordSystem(CSPrimUserDefined::CYLINDER_SYSTEM);
|
||||||
|
helix->SetFunction("(r<110)&(r>90)&(sqrt(pow(x-r*cos(2*pi*z/100),2)+pow(y-r*sin(2*pi*z/100),2))<20)&(z>200)&(z<600)");
|
||||||
|
CSX.AddPrimitive(helix);
|
||||||
|
CSPrimCylinder* cyl = new CSPrimCylinder(CSX.GetParameterSet(),copper);
|
||||||
|
cyl->SetRadius(10);
|
||||||
|
cyl->SetCoord(0,100.0);cyl->SetCoord(1,310.0);
|
||||||
|
cyl->SetCoord(2,0.0);cyl->SetCoord(3,0.0);
|
||||||
|
cyl->SetCoord(4,200.0);cyl->SetCoord(5,200.0);
|
||||||
|
CSX.AddPrimitive(cyl);
|
||||||
|
cyl = new CSPrimCylinder(CSX.GetParameterSet(),copper);
|
||||||
|
cyl->SetRadius(10);
|
||||||
|
cyl->SetCoord(0,100.0);cyl->SetCoord(1,310.0);
|
||||||
|
cyl->SetCoord(2,0.0);cyl->SetCoord(3,0.0);
|
||||||
|
cyl->SetCoord(4,600.0);cyl->SetCoord(5,600.0);
|
||||||
|
CSX.AddPrimitive(cyl);
|
||||||
|
|
||||||
|
CSPropElectrode* elec = new CSPropElectrode(CSX.GetParameterSet());
|
||||||
|
elec->SetExcitation(1.0,2);
|
||||||
|
elec->SetExcitType(1);
|
||||||
|
// elec->SetDelay(2.0e-9);
|
||||||
|
CSX.AddProperty(elec);
|
||||||
|
cyl = new CSPrimCylinder(CSX.GetParameterSet(),elec);
|
||||||
|
cyl->SetRadius(10);
|
||||||
|
cyl->SetCoord(0,300.0);cyl->SetCoord(1,300.0);
|
||||||
|
cyl->SetCoord(2,0.0);cyl->SetCoord(3,0.0);
|
||||||
|
cyl->SetCoord(4,200.0);cyl->SetCoord(5,600.0);
|
||||||
|
CSX.AddPrimitive(cyl);
|
||||||
|
|
||||||
|
CSPropDumpBox* Edump = NULL;
|
||||||
|
//E-field dump xz
|
||||||
|
Edump = new CSPropDumpBox(CSX.GetParameterSet());
|
||||||
|
Edump->SetDumpType(0);
|
||||||
|
Edump->SetName("Et_xz_");
|
||||||
|
CSX.AddProperty(Edump);
|
||||||
|
CSPrimBox* box = new CSPrimBox(CSX.GetParameterSet(),Edump);
|
||||||
|
box->SetCoord(0,width/-2.0);box->SetCoord(1,width/2.0);
|
||||||
|
box->SetCoord(2,0.0);box->SetCoord(3,0.0);
|
||||||
|
box->SetCoord(4,-50.0);box->SetCoord(5,length);
|
||||||
|
CSX.AddPrimitive(box);
|
||||||
|
//
|
||||||
|
// //E-field dump xy
|
||||||
|
// Edump = new CSPropDumpBox(CSX.GetParameterSet());
|
||||||
|
// Edump->SetDumpType(0);
|
||||||
|
// Edump->SetName("Et_xy_");
|
||||||
|
// CSX.AddProperty(Edump);
|
||||||
|
// box = new CSPrimBox(CSX.GetParameterSet(),Edump);
|
||||||
|
// box->SetCoord(0,width/-2.0);box->SetCoord(1,width/2.0);
|
||||||
|
// box->SetCoord(2,0.0);box->SetCoord(3,height);
|
||||||
|
// box->SetCoord(4,0.0);box->SetCoord(5,0.0);
|
||||||
|
// CSX.AddPrimitive(box);
|
||||||
|
|
||||||
|
// //E-field dump 3D
|
||||||
|
// Edump = new CSPropDumpBox(CSX.GetParameterSet());
|
||||||
|
// Edump->SetDumpType(0);
|
||||||
|
// Edump->SetDumpMode(2); //cell interpolated dump
|
||||||
|
// Edump->SetName("Et_");
|
||||||
|
// CSX.AddProperty(Edump);
|
||||||
|
// box = new CSPrimBox(CSX.GetParameterSet(),Edump);
|
||||||
|
// box->SetCoord(0,MSL_width*-1.5);box->SetCoord(1,MSL_width*1.5);
|
||||||
|
// box->SetCoord(2,0.0);box->SetCoord(3,MSL_height*1.5);
|
||||||
|
// box->SetCoord(4,length/-2.0);box->SetCoord(5,length/2.0);
|
||||||
|
// CSX.AddPrimitive(box);
|
||||||
|
//
|
||||||
|
//voltage calc
|
||||||
|
CSPropProbeBox* volt = new CSPropProbeBox(CSX.GetParameterSet());
|
||||||
|
volt->SetProbeType(0);
|
||||||
|
volt->SetName("u1");
|
||||||
|
CSX.AddProperty(volt);
|
||||||
|
box = new CSPrimBox(CSX.GetParameterSet(),volt);
|
||||||
|
box->SetCoord(0,300.0);box->SetCoord(1,300.0);
|
||||||
|
box->SetCoord(2,0.0);box->SetCoord(3,0.0);
|
||||||
|
box->SetCoord(4,200.0);box->SetCoord(5,600.0);
|
||||||
|
CSX.AddPrimitive(box);
|
||||||
|
|
||||||
|
//current calc
|
||||||
|
CSPropProbeBox* curr = new CSPropProbeBox(CSX.GetParameterSet());
|
||||||
|
curr->SetProbeType(1);
|
||||||
|
curr->SetName("i1");
|
||||||
|
CSX.AddProperty(curr);
|
||||||
|
box = new CSPrimBox(CSX.GetParameterSet(),curr);
|
||||||
|
box->SetCoord(0,200.0);box->SetCoord(1,200.0);
|
||||||
|
box->SetCoord(2,-50.0);box->SetCoord(3,50.0);
|
||||||
|
box->SetCoord(4,150.0);box->SetCoord(5,250.0);
|
||||||
|
CSX.AddPrimitive(box);
|
||||||
|
|
||||||
|
CSRectGrid* grid = CSX.GetGrid();
|
||||||
|
|
||||||
|
for (double n=width/-2.0;n<=width/2;n+=delta[0])
|
||||||
|
grid->AddDiscLine(0,n);
|
||||||
|
for (double n=width/-2.0;n<=width/2;n+=delta[0])
|
||||||
|
grid->AddDiscLine(1,n);
|
||||||
|
for (double n=-50;n<=length;n+=delta[2])
|
||||||
|
grid->AddDiscLine(2,n);
|
||||||
|
|
||||||
|
grid->SetDeltaUnit(1e-3);
|
||||||
|
|
||||||
|
//*************** Create XML file **********************
|
||||||
|
TiXmlDocument doc(filename);
|
||||||
|
doc.InsertEndChild(TiXmlDeclaration("1.0","ISO-8859-1","yes"));
|
||||||
|
|
||||||
|
TiXmlElement openEMS("openEMS");
|
||||||
|
|
||||||
|
TiXmlElement FDTD_Opts("FDTD");
|
||||||
|
FDTD_Opts.SetAttribute("NumberOfTimesteps",maxIter);
|
||||||
|
|
||||||
|
TiXmlElement Excite("Excitation");
|
||||||
|
Excite.SetAttribute("Type",Excit_Type);
|
||||||
|
Excite.SetAttribute("f0",f0);
|
||||||
|
Excite.SetAttribute("fc",fc);
|
||||||
|
FDTD_Opts.InsertEndChild(Excite);
|
||||||
|
|
||||||
|
TiXmlElement BC("BoundaryCond");
|
||||||
|
BC.SetAttribute("xmin",bounds[0]);
|
||||||
|
BC.SetAttribute("xmax",bounds[1]);
|
||||||
|
BC.SetAttribute("ymin",bounds[2]);
|
||||||
|
BC.SetAttribute("ymax",bounds[3]);
|
||||||
|
BC.SetAttribute("zmin",bounds[4]);
|
||||||
|
BC.SetAttribute("zmax",bounds[5]);
|
||||||
|
FDTD_Opts.InsertEndChild(BC);
|
||||||
|
|
||||||
|
openEMS.InsertEndChild(FDTD_Opts);
|
||||||
|
|
||||||
|
if (CSX.Write2XML(&openEMS,true)==false)
|
||||||
|
{
|
||||||
|
cerr << "writing failed" << endl;
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
doc.InsertEndChild(openEMS);
|
||||||
|
|
||||||
|
doc.SaveFile();
|
||||||
|
}
|
||||||
|
|
|
@ -29,5 +29,6 @@ void BuildMSL(const char* filename);
|
||||||
|
|
||||||
void BuildCoaxial_Cartesian(const char* filename);
|
void BuildCoaxial_Cartesian(const char* filename);
|
||||||
|
|
||||||
|
void BuildHelix(const char* filename);
|
||||||
|
|
||||||
#endif // FDTD_EXAMPLES_H
|
#endif // FDTD_EXAMPLES_H
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>
|
||||||
|
<openEMS>
|
||||||
|
<FDTD NumberOfTimesteps="10000">
|
||||||
|
<Excitation Type="0" f0="150000000" fc="150000000" />
|
||||||
|
<BoundaryCond xmin="1" xmax="1" ymin="1" ymax="1" zmin="0" zmax="0" />
|
||||||
|
</FDTD>
|
||||||
|
<ContinuousStructure>
|
||||||
|
<RectilinearGrid DeltaUnit="0.001000">
|
||||||
|
<XLines Qty="161">-400,-395,-390,-385,-380,-375,-370,-365,-360,-355,-350,-345,-340,-335,-330,-325,-320,-315,-310,-305,-300,-295,-290,-285,-280,-275,-270,-265,-260,-255,-250,-245,-240,-235,-230,-225,-220,-215,-210,-205,-200,-195,-190,-185,-180,-175,-170,-165,-160,-155,-150,-145,-140,-135,-130,-125,-120,-115,-110,-105,-100,-95,-90,-85,-80,-75,-70,-65,-60,-55,-50,-45,-40,-35,-30,-25,-20,-15,-10,-5,0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,255,260,265,270,275,280,285,290,295,300,305,310,315,320,325,330,335,340,345,350,355,360,365,370,375,380,385,390,395,400</XLines>
|
||||||
|
<YLines Qty="161">-400,-395,-390,-385,-380,-375,-370,-365,-360,-355,-350,-345,-340,-335,-330,-325,-320,-315,-310,-305,-300,-295,-290,-285,-280,-275,-270,-265,-260,-255,-250,-245,-240,-235,-230,-225,-220,-215,-210,-205,-200,-195,-190,-185,-180,-175,-170,-165,-160,-155,-150,-145,-140,-135,-130,-125,-120,-115,-110,-105,-100,-95,-90,-85,-80,-75,-70,-65,-60,-55,-50,-45,-40,-35,-30,-25,-20,-15,-10,-5,0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,255,260,265,270,275,280,285,290,295,300,305,310,315,320,325,330,335,340,345,350,355,360,365,370,375,380,385,390,395,400</YLines>
|
||||||
|
<ZLines Qty="171">-50,-45,-40,-35,-30,-25,-20,-15,-10,-5,0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240,245,250,255,260,265,270,275,280,285,290,295,300,305,310,315,320,325,330,335,340,345,350,355,360,365,370,375,380,385,390,395,400,405,410,415,420,425,430,435,440,445,450,455,460,465,470,475,480,485,490,495,500,505,510,515,520,525,530,535,540,545,550,555,560,565,570,575,580,585,590,595,600,605,610,615,620,625,630,635,640,645,650,655,660,665,670,675,680,685,690,695,700,705,710,715,720,725,730,735,740,745,750,755,760,765,770,775,780,785,790,795,800</ZLines>
|
||||||
|
</RectilinearGrid>
|
||||||
|
<ParameterSet />
|
||||||
|
<Properties>
|
||||||
|
<Material ID="0" Name="copper" Isotropy="1">
|
||||||
|
<FillColor R="33" G="61" B="220" a="255" />
|
||||||
|
<EdgeColor R="33" G="61" B="220" a="255" />
|
||||||
|
<Property Epsilon="1.000000e+00" Mue="1.000000e+00" Kappa="5.600000e+07" Sigma="0.000000e+00" />
|
||||||
|
<PropertyY Epsilon="1.000000e+00" Mue="1.000000e+00" Kappa="0.000000e+00" Sigma="0.000000e+00" />
|
||||||
|
<PropertyZ Epsilon="1.000000e+00" Mue="1.000000e+00" Kappa="0.000000e+00" Sigma="0.000000e+00" />
|
||||||
|
<WeightX Epsilon="1.000000e+00" Mue="1.000000e+00" Kappa="1.000000e+00" Sigma="1.000000e+00" />
|
||||||
|
<WeightY Epsilon="1.000000e+00" Mue="1.000000e+00" Kappa="1.000000e+00" Sigma="1.000000e+00" />
|
||||||
|
<WeightZ Epsilon="1.000000e+00" Mue="1.000000e+00" Kappa="1.000000e+00" Sigma="1.000000e+00" />
|
||||||
|
</Material>
|
||||||
|
<Electrode ID="1" Name="" Number="0" Delay="0.000000e+00">
|
||||||
|
<FillColor R="135" G="112" B="233" a="255" />
|
||||||
|
<EdgeColor R="135" G="112" B="233" a="255" />
|
||||||
|
<Excitation Type="1" Excit_X="0.000000e+00" Excit_Y="0.000000e+00" Excit_Z="1.000000e+00" />
|
||||||
|
<Weight X="1.000000e+00" Y="1.000000e+00" Z="1.000000e+00" />
|
||||||
|
</Electrode>
|
||||||
|
<DumpBox ID="2" Name="Et_xz_" GlobalSetting="1" DumpType="0" DumpMode="0">
|
||||||
|
<FillColor R="62" G="161" B="65" a="255" />
|
||||||
|
<EdgeColor R="62" G="161" B="65" a="255" />
|
||||||
|
<ScalarDump DumpPhi="1" DumpDivE="0" DumpDivD="0" DumpDivP="0" DumpFieldW="0" DumpChargeW="0" />
|
||||||
|
<VectorDump DumpEField="0" DumpDField="0" DumpPField="0" />
|
||||||
|
<SubGridDump SubGridDump="0" SimpleDump="0" SubGridLevel="-1" />
|
||||||
|
</DumpBox>
|
||||||
|
<ProbeBox ID="3" Name="u1" Number="0" Type="0">
|
||||||
|
<FillColor R="225" G="252" B="103" a="255" />
|
||||||
|
<EdgeColor R="225" G="252" B="103" a="255" />
|
||||||
|
</ProbeBox>
|
||||||
|
<ProbeBox ID="4" Name="i1" Number="0" Type="1">
|
||||||
|
<FillColor R="62" G="1" B="126" a="255" />
|
||||||
|
<EdgeColor R="62" G="1" B="126" a="255" />
|
||||||
|
</ProbeBox>
|
||||||
|
</Properties>
|
||||||
|
<Primitives>
|
||||||
|
<UserDefined ID="0" PropertyID="0" Priority="0" CoordSystem="1">
|
||||||
|
<CoordShift X="0.000000e+00" Y="0.000000e+00" Z="0.000000e+00" />
|
||||||
|
<Function>(r<110)&(r>90)&(sqrt(pow(x-r*cos(2*pi*z/100),2)+pow(y-r*sin(2*pi*z/100),2))<20)&(z>200)&(z<600)</Function>
|
||||||
|
</UserDefined>
|
||||||
|
<Cylinder ID="1" PropertyID="0" Priority="0" Radius="1.000000e+01">
|
||||||
|
<P0 X="1.000000e+02" Y="0.000000e+00" Z="2.000000e+02" />
|
||||||
|
<P1 X="3.100000e+02" Y="0.000000e+00" Z="2.000000e+02" />
|
||||||
|
</Cylinder>
|
||||||
|
<Cylinder ID="2" PropertyID="0" Priority="0" Radius="1.000000e+01">
|
||||||
|
<P0 X="1.000000e+02" Y="0.000000e+00" Z="6.000000e+02" />
|
||||||
|
<P1 X="3.100000e+02" Y="0.000000e+00" Z="6.000000e+02" />
|
||||||
|
</Cylinder>
|
||||||
|
<Cylinder ID="3" PropertyID="1" Priority="0" Radius="1.000000e+01">
|
||||||
|
<P0 X="3.000000e+02" Y="0.000000e+00" Z="2.000000e+02" />
|
||||||
|
<P1 X="3.000000e+02" Y="0.000000e+00" Z="6.000000e+02" />
|
||||||
|
</Cylinder>
|
||||||
|
<Box ID="4" PropertyID="2" Priority="0">
|
||||||
|
<P1 X="-4.000000e+02" Y="0.000000e+00" Z="-5.000000e+01" />
|
||||||
|
<P2 X="4.000000e+02" Y="0.000000e+00" Z="8.000000e+02" />
|
||||||
|
</Box>
|
||||||
|
<Box ID="5" PropertyID="3" Priority="0">
|
||||||
|
<P1 X="3.000000e+02" Y="0.000000e+00" Z="2.000000e+02" />
|
||||||
|
<P2 X="3.000000e+02" Y="0.000000e+00" Z="6.000000e+02" />
|
||||||
|
</Box>
|
||||||
|
<Box ID="6" PropertyID="4" Priority="0">
|
||||||
|
<P1 X="2.000000e+02" Y="-5.000000e+01" Z="1.500000e+02" />
|
||||||
|
<P2 X="2.000000e+02" Y="5.000000e+01" Z="2.500000e+02" />
|
||||||
|
</Box>
|
||||||
|
</Primitives>
|
||||||
|
</ContinuousStructure>
|
||||||
|
</openEMS>
|
8
main.cpp
8
main.cpp
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "examples/FDTD_examples.h"
|
#include "examples/FDTD_examples.h"
|
||||||
|
|
||||||
#define STANDALONE
|
//#define STANDALONE
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -73,11 +73,15 @@ int main(int argc, char *argv[])
|
||||||
const char* fileCoax="../examples/Coax_Cart.xml";
|
const char* fileCoax="../examples/Coax_Cart.xml";
|
||||||
BuildCoaxial_Cartesian(fileCoax);
|
BuildCoaxial_Cartesian(fileCoax);
|
||||||
|
|
||||||
const char* file=fileMSL;
|
const char* fileHelix="../examples/Helix.xml";
|
||||||
|
BuildHelix(fileHelix);
|
||||||
|
|
||||||
|
const char* file=fileHelix;
|
||||||
|
|
||||||
// cerr << CSX.ReadFromXML("examples/PlaneWave.xml") << endl;
|
// cerr << CSX.ReadFromXML("examples/PlaneWave.xml") << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
FDTD.DebugMaterial();
|
||||||
int EC = FDTD.SetupFDTD(file);
|
int EC = FDTD.SetupFDTD(file);
|
||||||
if (EC) return EC;
|
if (EC) return EC;
|
||||||
FDTD.RunFDTD();
|
FDTD.RunFDTD();
|
||||||
|
|
Loading…
Reference in New Issue