mainfacetest.html
来自「有限元学习研究用源代码(老外的),供科研人员参考」· HTML 代码 · 共 80 行
HTML
80 行
<TITLE>COG 2.0: boudnary conditions</TITLE>
<A HREF="mainreftest.html">next</A>
<H1>COG 2.0: Setting boundary conditions</H1>
<P>Regions have boundaries between them and outer boundaries. For
these boundaries, different numbers are useful to distinguish
different boundary conditions. That's why in COG every boundary face
has a face number. This face number is part of the
<A HREF="format.html">grid format</A> and may be used by the
application to define the boundary conditions.
<P>Now, starting with our rectangular geometry, we want to define
different 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> using
the class <B><A HREF="cogenoctree.html">CogenOctree</A></B>. We start
with slightly modifying the <A HREF="mainoctreetest.html"> previous
example 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(3), 0.2,1.0, 0.6,1.0);
</PRE>
<P>This return value may be used to set a face number for all sides
of the rectangle, or each of the four sides separately:
<PRE>
gen->setFaceOfBox(wzFace(2),i1);
gen->setFaceOfBox(wzFace(3),i2);
gen->setFaceOfBox(wzFace(4),i3);
gen->setFaceOfBoxSide(wzFace(5),i1,wzX);
gen->setFaceOfBoxSide(wzFace(6),i2,wzXdown);
</PRE>
<P>But we can set a boundary face number on some part of a side or
inside a box:
<PRE>
gen->setFaceOnPlaneX(wzFace(2),0.2, 0.6,0.7);
gen->setFaceInBox(wzFace(3), 0.0,0.2, 0.8,1.0);
</PRE>
<P>What remains is standard:
<PRE>
gen->refinementGlobal(0.1,0.05);
wzgrid grid = (*gen)();
grid->write("test.sg");
}
</PRE>
<P>If you want to write out only some of the faces (probably you
don't want to write out the default face 1) this is possible by
writing out
<A HREF="mainmaterialtest.html">face type numbers</A> instead of
face 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 number
3. This defines a non-convex region 3. Without any boundary
conditions, the inner edge may be cut off - the grid generator does
not know that this point is something special. But now the edge is
the place where the boundary condition changes, thus, a special point
which 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 face
numbers.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?