📄 mainfacetest.html
字号:
<TITLE>COG 2.1: Boundary conditions</TITLE><A HREF="mainreftest.html">next</A><H1>COG 2.1: Setting boundary conditions</H1> <P>Regions have boundaries between them and outer boundaries. Forthese boundaries, different numbers are useful to distinguishdifferent boundary conditions. That's why in COG every boundary facehas a face number. This face number is part of the <A HREF="simplexgrid.html">simplex grid format</A> and may be used bythe application to define the boundary conditions. <P>Now, starting with our rectangular geometry, we want to definedifferent face numbers on different parts on the boundary, like here: <P><IMG SRC="facetest.gif"> <P>Let's consider now how to define these <B>face numbers</B> usingthe class <B><A HREF="cogenoctree.html">CogenOctree</A></B>. We startwith slightly modifying the <A HREF="mainoctreetest.html"> previousexample code</A> - we remember the return value of <B>addBox</B>:<PRE>#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"int main(){ cogenOctree gen = new CogenOctree(); wzIndex i1 = gen->addBox(wzRegion(2), 0.0,0.4, 0.0,0.5); wzIndex i2 = gen->addBox(wzRegion(3), 0.2,0.8, 0.3,1.0); wzIndex i3 = gen->addBox(wzRegion(4), 0.4,1.0, 0.7,1.0);</PRE> <P>This return value may be used to set a face number with<B>setFaceOfBox</B> for the whole rectangle:<PRE> gen->setFaceOfBox(wzFace(2),i1); gen->setFaceOfBox(wzFace(4),i3); gen->setFaceOfBox(wzFace(3),i2);</PRE> <P>The boundary conditions may be defined for each of the four sidesseparately with <B>setFaceOfBoxSide</B>. The sides are named<I>wzSideLeft, wzSideRight, wzSideUp, wzSideDown, wzSideNear,wzSideFar</I>.<PRE> gen->setFaceOfBoxSide(wzFace(7),i1,wzSideRight); gen->setFaceOfBoxSide(wzFace(6),i2,wzSideLeft);</PRE> <P>The boundary face number may be re defined also inside a box with<B>setFaceInBox</B> or, as a variant, on some part of a plane with<B>setFaceOnPlaneX, setFaceOnPlaneY, setFaceOnPlaneZ</B>.<PRE> gen->setFaceOnPlaneX(wzFace(5),0.2, 0.6,0.7); gen->setFaceOnPlaneY(wzFace(5),0.0, 0.6,0.7); gen->setFaceInBox(wzFace(8), 0.0,0.2, 0.8,1.0);</PRE> <P>Note that the priority depends on the order - the latest call haspriority. For example, the part of i3 inside i2 gets the face numberof the region i2 instead of i3. <P>If you want to write out only some of the faces (probably youdon't want to write out the default face 1) this is possible bywriting out <A HREF="mainmaterialtest.html">face type numbers</A> instead offace numbers and using the "invalid" face type.<H3>Usage of face numbers to protect edges</H3> <P>Note that two of the three regions have the same region number3. This defines a non-convex region 3. Without any boundaryconditions, the inner edge may be cut off - the grid generator doesnot know that this point is something special. But now the edge isthe place where the boundary condition changes, thus, a special pointwhich has to be computed exactly. <P>In this situation, it is probably also useful to write out <A HREF="mainmaterialtest.html">face type numbers</A> instead of facenumbers. <HR><PRE> gen->refinementGlobal(0.1,0.05); wzgrid grid = (*gen)(); grid->write("test.sg");}</PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -