mainoctreetest.html

来自「有限元学习研究用源代码(老外的),供科研人员参考」· HTML 代码 · 共 106 行

HTML
106
字号
<TITLE>COG 2.0: cogenOctree</TITLE>

<A HREF="mainfacetest.html">next</A>

<H1>COG 2.0: CogenOctree</H1>

 <P>Let's consider now how to create grids for simple rectangular
geometries with <B><A HREF="cogenoctree.html">cogenOctree</A></B>:

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

<PRE>
#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"
int main()
{
  cogenOctree gen = new CogenOctree();
</PRE>

 <P>We can add a lot of rectangular boxes, with different region
numbers:

<PRE>
  gen-&gt;addBox(wzRegion(2), 0.0,0.4, 0.0,0.5);
  gen-&gt;addBox(wzRegion(3), 0.2,0.8, 0.3,1.0);
  gen-&gt;addBox(wzRegion(4), 0.2,1.0, 0.7,1.0);
</PRE>

 <P>If we do not define it with <B>setBorder</B>, the grid generator
defines the covering box (here the standard unit cube).  The coarse
grid includes all bounding planes of the regions (in x-direction the
planes 0.0, 0.2, 0.4, 1.0) and if we like some additional planes too:

<PRE>
  gen-&gt;addPlaneX(0.95);
  gen-&gt;addPlaneY(0.95);
</PRE>

 <P>An additional possibility is a regular refinement in each
direction:

<PRE>
   gen-&gt;refinementGlobal(0.2,0.1);
</PRE>

 <P>subdivides each rectangle as long as the size in x-
resp. y-direction is below 0.2 resp. 0.1.  The refinement is binary
starting from the nodes which have been already defined.  Thus, the
resulting distances may be lower than the given distance, but greater
than 1/2 of this distance.

 <P>Another refinement possibility is the regular subdivision:

<PRE>
//  gen-&gt;setRegularRefinementX(3);
</PRE>

 <P>subdivides each rectangle in x-direction into four parts (three
additional planes).  But this is not recommended - it leads to bad
point order and problems with the Delaunay algorithm if the refinement
is too large.  Later, we learn later much better ways to control
 <A HREF="mainreftest.html">refinement</A>.

 <P>What remains is the same as before:

<PRE>
  wzgrid grid = (*gen)();
  grid->write("test.sg");
}
</PRE>

 <P>If you want to write out only some of the regions (probably you
don't want to write out the default region 1) this is possible by
writing out
 <A HREF="mainmaterialtest.html">material numbers</A> instead of
region numbers and using the "invalid" material.

 <P>Similar to <A HREF="mainstarttest.html">mainstarttest.html</A>,
you can extract and test the code in this example using the perl
scripts <B>run</B> and <B>use</B>:

 <P><B>&gt; run main octree</B>

 <P>Now, let's continue with the definition of
 <A HREF="mainfacetest.html">boundary conditions</A>.

 <P>Of course, the possibilities of <B>CogenOctree</B> are available
also for <A HREF="mainoctree3dtest.html">3D grid generation</A>.

<H2>Known Bugs</H2>

 <P>It is possible to define nonconvex regions as a union of
rectangles (for example by replacing wzRegion(4) by wzRegion(3) in the
previous example).  In this case, the inner edge is cut off.

 <P>To avoid this, to use different region numbers (artificial
subdivision of regions).  This avoids non-convex regions. For this
possibility it is useful to write out
 <A HREF="mainmaterialtest.html">material numbers</A> instead of
region numbers.

 <P>The other possibility is to define different
 <A HREF="mainfacetest.html">boundary conditions</A> on different
parts of the boundary (artificial subdivision of boundary faces).
This avoids non-convex boundary faces.

⌨️ 快捷键说明

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