mainteam7test.html
来自「有限元学习研究用源代码(老外的),供科研人员参考」· HTML 代码 · 共 106 行
HTML
106 行
<TITLE>COG 2.0: TEAM example 7</TITLE>
<H1>TEAM example nr.7</H1>
<P>This is a grid to describe the geometry of the TEAM (Testing
Electromagnetic Analysis Methods) Workshops nr. 7. It contains an
aluminium plate with a rectangular hole and a coil over the plate:
<P><IMG SRC="team7test.gif">
<PRE>
#include <math.h>
#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"
</PRE>
<P>First, we introduce self-commenting names for regions, faces and
the distances we need:
<PRE>
wzRegion rAir = 1;
wzRegion rAlu = 2;
wzRegion rCoil = 3;
wzRegion rHole = 4;
wzFloat lAlu = 294, hAlu = 19; // sizes of the aluminium plate
wzFloat bHole = 18, eHole = 126; // sizes of the hole in the plate
wzFloat lCoil = 200, dCoil = 25; // sizes of the coil
wzFloat bCoil = hAlu + 30; // minimal z-value of the coil
wzFloat eCoil = bCoil + 100; // maximal z-value of the coil
wzFloat radius = 50; // radius of the rounded part of the coil
wzFloat envAlu = 15; // environment of the aluminium plate discretized
wzFloat uAlu = lAlu+envAlu; // upper limit for aluminium grid
int main()
{
</PRE>
<P>This defines the aluminium plate:
<PRE>
cogenOctree alu = new CogenOctree();
alu->addBox(rAlu, 0.0,lAlu, 0.0,lAlu, 0.0,hAlu);
alu->addBox(rHole, bHole,eHole, bHole,eHole, 0.0,hAlu);
alu->setBorder(-envAlu,uAlu,-envAlu,uAlu,-envAlu,hAlu+envAlu);
alu->refinementGlobal(20,20,10);
</PRE>
<P>For the coil we use two systems of coordinates: rectangular
coordinates inside (<B>coilinside</B>) and a "rounded box" (a
combination of rectangular coordinates and polar coordinates near the
corners) for the coil itself and the domain outside (<B>coilbase,
coil</B>).
<PRE>
wzFloat yCoil=lCoil/2,xCoil=lAlu-yCoil,mCoil=yCoil-radius;
wzRoundedBoxCoordinates& cc = * new
wzRoundedBoxCoordinates(xCoil,yCoil,mCoil,mCoil);
wzcoordinates c3 = new wz3DContinuation(&cc);
cogenOctree coilbase = new CogenOctree();
coilbase->addBox(rCoil, radius-dCoil,radius,
cc.ymin[1],cc.ymax[1], bCoil,eCoil);
coilbase->setBorder(0,2*radius, cc.ymin[1],cc.ymax[1],-50,eCoil+100);
coilbase->refinementGlobal(20,40,50);
cogenOctree coilinside = new CogenOctree();
coilinside->setBorder(xCoil-mCoil,xCoil+mCoil,
yCoil-mCoil,yCoil+mCoil, bCoil,eCoil);
coilinside->refinementGlobal(40,40,50);
</PRE>
<P>To add some planes which are part of the other grid increases grid
quality in the intermediate region:
<PRE>
coilbase->addPlaneZ(bCoil-10);
coilbase->addPlaneZ(hAlu);
coilbase->addPlaneZ(hAlu+envAlu);
coilbase->addPlaneZ(0.0);
coilbase->addPlaneZ(-envAlu);
coilinside->addPlaneZ(bCoil-10);
coilinside->addPlaneZ(hAlu);
coilinside->addPlaneZ(hAlu+envAlu);
coilinside->addPlaneZ(0.0);
coilinside->addPlaneZ(-envAlu);
cogenChart coil = new CogenChart(coilbase->generator(),c3);
cogenComposite gen = new CogenUnion;
gen->add(alu->generator());
gen->add(coil->generator());
gen->add(coilinside->generator());
wzgrid grid = (*gen)();
</PRE>
<P>What remains is to define the material numbers - they are useful
in our output function - and to look at the grid:
<PRE>
rAir.material() = rAir;
rAlu.material() = rAlu;
rCoil.material() = rCoil;
rHole.material() = rAir;
ibgOutput(grid);
grid->write("test.sg");
}
</PRE>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?