Helix using Parameter... auto meshing needed...

pull/1/head v0.0.3
Thorsten Liebig 2010-03-16 23:02:14 +01:00
parent 62103cd6ac
commit a662c405f2
2 changed files with 31 additions and 21 deletions

View File

@ -612,11 +612,16 @@ void BuildHelix(const char* filename)
double wire_rad = 0.7;
double coil_rad = 10;
double coil_length = 50;
int coil_turns = 8;
double delta[] = {0.5,0.5,0.5};
CSPrimBox* box = NULL;
ParameterSet* PS = CSX.GetParameterSet();
PS->AddParameter(new Parameter("rad_coil",coil_rad));
PS->AddParameter(new Parameter("rad_wire",wire_rad));
PS->AddParameter(new Parameter("turns",coil_turns));
PS->AddParameter(new Parameter("coil_length",coil_length));
CSPropMaterial* copper = new CSPropMaterial(CSX.GetParameterSet());
copper->SetKappa(56e6);
@ -625,7 +630,7 @@ void BuildHelix(const char* filename)
CSPrimUserDefined* helix = new CSPrimUserDefined(CSX.GetParameterSet(),copper);
helix->SetCoordSystem(CSPrimUserDefined::CYLINDER_SYSTEM);
helix->SetFunction("(r>9.3)&(r<10.7)&(sqrt(pow(x-r*cos(2*pi*z/6.25),2)+pow(y-r*sin(2*pi*z/6.25),2))<1.4)&(z>0)&(z<50)");
helix->SetFunction("(r>(rad_coil-rad_wire))&(r<rad_coil+rad_wire)&(sqrt(pow(x-r*cos(2*pi*z*turns/coil_length),2)+pow(y-r*sin(2*pi*z*turns/coil_length),2))<(2*rad_wire))&(z>0)&(z<coil_length)");
CSX.AddPrimitive(helix);
CSPrimCylinder* cyl = new CSPrimCylinder(CSX.GetParameterSet(),copper);
cyl->SetRadius(wire_rad);

View File

@ -10,11 +10,16 @@
<YLines Qty="57">-35,-25,-20,-15,-12,-11,-10.5,-10,-9.5,-9,-8.5,-8,-7.5,-7,-6.5,-6,-5.5,-5,-4.5,-4,-3.5,-3,-2.5,-2,-1.5,-1,-0.5,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,12,13,15,17.5,20,25,35</YLines>
<ZLines Qty="117">-25,-15,-10,-5,-2,-1,-0.5,0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10,10.5,11,11.5,12,12.5,13,13.5,14,14.5,15,15.5,16,16.5,17,17.5,18,18.5,19,19.5,20,20.5,21,21.5,22,22.5,23,23.5,24,24.5,25,25.5,26,26.5,27,27.5,28,28.5,29,29.5,30,30.5,31,31.5,32,32.5,33,33.5,34,34.5,35,35.5,36,36.5,37,37.5,38,38.5,39,39.5,40,40.5,41,41.5,42,42.5,43,43.5,44,44.5,45,45.5,46,46.5,47,47.5,48,48.5,49,49.5,50,50.5,51,52,53,55,57.5,60,65,75</ZLines>
</RectilinearGrid>
<ParameterSet />
<ParameterSet>
<Parameter Type="Const" name="rad_coil" Sweep="1" value="10.000000" />
<Parameter Type="Const" name="rad_wire" Sweep="1" value="0.700000" />
<Parameter Type="Const" name="turns" Sweep="1" value="8.000000" />
<Parameter Type="Const" name="coil_length" Sweep="1" value="50.000000" />
</ParameterSet>
<Properties>
<Material ID="0" Name="copper" Isotropy="1">
<FillColor R="130" G="116" B="65" a="255" />
<EdgeColor R="130" G="116" B="65" a="255" />
<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" />
@ -23,8 +28,8 @@
<WeightZ Epsilon="1.000000e+00" Mue="1.000000e+00" Kappa="1.000000e+00" Sigma="1.000000e+00" />
</Material>
<Material ID="1" Name="resist" Isotropy="0">
<FillColor R="33" G="61" B="220" a="255" />
<EdgeColor R="33" G="61" B="220" a="255" />
<FillColor R="135" G="112" B="233" a="255" />
<EdgeColor R="135" G="112" B="233" a="255" />
<Property Epsilon="1.000000e+00" Mue="1.000000e+00" Kappa="0.000000e+00" 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="1.000000e+03" Sigma="0.000000e+00" />
@ -33,38 +38,38 @@
<WeightZ Epsilon="1.000000e+00" Mue="1.000000e+00" Kappa="1.000000e+00" Sigma="1.000000e+00" />
</Material>
<Electrode ID="2" 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" />
<FillColor R="62" G="161" B="65" a="255" />
<EdgeColor R="62" G="161" B="65" a="255" />
<Excitation Type="0" 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="3" 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>
<DumpBox ID="4" Name="Ht_xz_" GlobalSetting="1" DumpType="1" DumpMode="0">
<FillColor R="225" G="252" B="103" a="255" />
<EdgeColor R="225" G="252" B="103" 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="5" Name="u1" Number="0" Type="0">
<DumpBox ID="4" Name="Ht_xz_" GlobalSetting="1" DumpType="1" DumpMode="0">
<FillColor R="62" G="1" B="126" a="255" />
<EdgeColor R="62" G="1" B="126" a="255" />
</ProbeBox>
<ProbeBox ID="6" Name="i1" Number="0" Type="1">
<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="5" Name="u1" Number="0" Type="0">
<FillColor R="151" G="234" B="220" a="255" />
<EdgeColor R="151" G="234" B="220" a="255" />
</ProbeBox>
<ProbeBox ID="6" Name="i1" Number="0" Type="1">
<FillColor R="107" G="150" B="143" a="255" />
<EdgeColor R="107" G="150" B="143" 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&gt;9.3)&amp;(r&lt;10.7)&amp;(sqrt(pow(x-r*cos(2*pi*z/6.25),2)+pow(y-r*sin(2*pi*z/6.25),2))&lt;1.4)&amp;(z&gt;0)&amp;(z&lt;50)</Function>
<Function>(r&gt;(rad_coil-rad_wire))&amp;(r&lt;rad_coil+rad_wire)&amp;(sqrt(pow(x-r*cos(2*pi*z*turns/coil_length),2)+pow(y-r*sin(2*pi*z*turns/coil_length),2))&lt;(2*rad_wire))&amp;(z&gt;0)&amp;(z&lt;coil_length)</Function>
</UserDefined>
<Cylinder ID="1" PropertyID="0" Priority="0" Radius="7.000000e-01">
<P0 X="1.000000e+01" Y="0.000000e+00" Z="0.000000e+00" />
@ -87,8 +92,8 @@
<P2 X="4.500000e+01" Y="0.000000e+00" Z="7.500000e+01" />
</Box>
<Box ID="6" PropertyID="4" Priority="0">
<P1 X="-3.500000e+01" Y="-3.500000e+01" Z="2.500000e+01" />
<P2 X="4.500000e+01" Y="3.500000e+01" Z="2.500000e+01" />
<P1 X="-3.500000e+01" Y="0.000000e+00" Z="-2.500000e+01" />
<P2 X="4.500000e+01" Y="0.000000e+00" Z="7.500000e+01" />
</Box>
<Box ID="7" PropertyID="5" Priority="0">
<P1 X="2.000000e+01" Y="0.000000e+00" Z="5.000000e+01" />