⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfbh2test.html

📁 有限元学习研究用源代码(老外的),供科研人员参考
💻 HTML
字号:
<TITLE>COG 2.0: FBH nr. 2</TITLE>

<H1>FBH example nr. 2</H1>

 <P>In this example we have to combine a rectangular planar structure
with a cylindrical hole:

 <P><IMG SRC="fbh2test.gif">

<PRE>
#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>
static wzRegion rLuft(1);
static wzRegion rGaAs(2);
static wzRegion rMetal(3);
static wzRegion rBase(6);
static wzRegion rCylinder(7);
static wzFace	fMetal(3);
static wzFace	fCylinder(7);
static wzFace	fBase(6);

wzFloat xHalf  =  800;	// half of the wide (x&lt;-&gt;-x is symmetry)
wzFloat yFull  = 1025;	// full length in y-direction
wzFloat zGaAs  =  150;	// thickness of the GaAs layer
wzFloat zMetal =    3;	// thickness of the metallic layer
wzFloat zTop   =  783;	// upper size for air
wzFloat xMetal =  110;	// wide of the metallic connection
wzFloat yMetal =  460;	// lenght of the metallic connection
wzFloat dCyl   =   90;	// diameter of the cylindrical hole
wzFloat dBase  =  130;	// wide of the metallic base of the cylinder
wzFloat yCenter=  525;	// center of the base and the cylinder

// begin (b) and end (e) values for some regions:
wzFloat yb = -yCenter, ye = yFull-yCenter;
wzFloat xbb = -dBase/2, xbe = dBase/2,  ybb = xbb, ybe = xbe;
wzFloat xmb = -xMetal/2,xme = xMetal/2, ymb = -yCenter, yme = ybb;
</PRE>
 <P>Now, we define the rectangular part of the grid.  Note that we
distiguish two metallic regions (rBase, rMetal) and define 
 <A HREF="mainfacetest.html">face numbers</A> for these regions.

<PRE>
int main()
{
  cogenOctree rec = new CogenOctree();
  rec-&gt;addBox(rGaAs, -xHalf,xHalf, yb,ye, -zGaAs,0.0);
  wzIndex ib = rec-&gt;addBox(rBase, xbb,xbe, ybb,ybe, 0.0,zMetal);
  wzIndex im = rec-&gt;addBox(rMetal, xmb,xme, ymb,yme, 0.0,zMetal);
  rec-&gt;setFaceOfBox(fMetal,im);
  rec-&gt;setFaceOfBox(fBase,ib);
  rec-&gt;addPlaneZ(zTop-zGaAs);
  rec-&gt;addPlaneZ(zMetal/2);
</PRE>
 <P>The reason for using different metallic regions is that we want
different <A HREF="mainreftest.html">refinement criteria</A>:

<PRE>
  cogenRefine recref = new CogenRefine(rec-&gt;generator());
  recref-&gt;refinementGlobal(200,200,200);
  recref-&gt;refinementInRegion(200,200,50,rGaAs);
  recref-&gt;refinementInRegion(50,100,zMetal,rMetal);
  recref-&gt;refinementInRegion(25,25,zMetal,rBase);
</PRE>
 <P>Now let's define the cylinder. The cylinder is full (from radius
0.0, angle -pi..pi). Note that the refinement in z-direction should be
compatible with the refinement outside.

<PRE>
  wzFloat rCyl = dCyl/2, rCylEnv = rCyl+10;
  cogenOctree cylbase = new CogenOctree();
  cylbase-&gt;setBorder(0.0,rCylEnv, -wzPi,wzPi, -zGaAs,zTop-zGaAs);
  ib = cylbase-&gt;addBox(rBase, 0.0,rCylEnv, -wzPi,wzPi, 0.0,zMetal);
  cylbase-&gt;setFaceOfBox(fBase,ib);
  wzIndex ic = cylbase-&gt;addBox(rCylinder, 0.0,rCyl, -wzPi,wzPi, -zGaAs,0.0);
  cylbase-&gt;setFaceOfBox(fCylinder,ic);
  cylbase-&gt;addPlaneZ(zMetal/2);
  cogenRefine cylref = new CogenRefine(cylbase-&gt;generator());
  cylref-&gt;refinementGlobal(22,0.5,200);
  cylref-&gt;refinementInRegion(22,0.5,50,rCylinder);
  cylref-&gt;refinementInRegion(22,0.5,zMetal,rBase);
  wzcoordinates ccyl = new wz3DContinuation(new wzPolarCoordinates);
  cogenChart cyl = new CogenChart(cylref-&gt;generator(),ccyl);
</PRE>
 <P>Then we define the <A HREF="mainuniontest.html">union</A> of these
two grids. The cylinder comes first, because in the part where above
grids are defined we want to use the cylinder grid:

<PRE>
  cogenComposite gen = new CogenUnion;
  gen-&gt;add(cyl-&gt;generator());
  gen-&gt;add(recref-&gt;generator());
  wzgrid grid = (*gen)();
  ibgOutput(grid);
  grid->write("test.sg");
}
</PRE>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -