mainmaterialtest.html

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

HTML
59
字号
<TITLE>COG 2.0: Materials</TITLE>

<H1>COG 2.0: Writing out materials</H1>

 <P>Different regions are distinguished by different numbers.
Sometimes these numbers are not what you need in your application.
There are two reasons:

 <UL>
 <LI> You need only some of the regions. For example, usually you do
not need the grid in the region "outside".
 <LI> Sometimes an artificial subdivision of a domain into parts is
useful for the grid generation. But in the application you want to
"reunify" them.
 </UL>

 <P>For this purposes, we have a possibility to write out material
numbers instead of the region numbers.  It allows to define a material
number for every region. The same is possible for faces.

 <P>Now, there exists already a default segment description
<B>wzDefaultSegmentDescription</B>, which is declared in
 <A HREF="wzdefault.hxx">wzdefault.hxx</A> and defined in
 <A HREF="wzdefault.cxx">wzdefault.cxx</A>.  It may be modified or
used as a pattern.

<PRE>
#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"
int main()
{
  cogenOctree gen = new CogenOctree();
  wzIndex i1 = gen-&gt;addBox(wzRegion(2), 0.0,0.4, 0.0,0.5);
  wzIndex i2 = gen-&gt;addBox(wzRegion(3), 0.2,0.8, 0.3,1.0);
  wzIndex i3 = gen-&gt;addBox(wzRegion(4), 0.2,1.0, 0.6,1.0);
  gen-&gt;setFaceOfBox(wzFace(2),i2);
  gen-&gt;setFaceOfBox(wzFace(3),i3);
  gen-&gt;refinementGlobal(0.1,0.05);
  wzgrid grid = (*gen)();
</PRE>

<PRE>
  wzDefaultSegmentDescription.use();	// that's default.
  wzRegion(1).material().invalidate();	// region 1 should not be written out
  wzRegion(4).material() = wzRegion(3);	// write out region 4 as region 3;
  wzFace(1).type().invalidate();	// face 1 should not be written out;	
  wzFace(3).type() = wzFace(2);		// write out face 3 as face 2;
  grid->write("test.sg",wzDefaultSegmentDescription);
}
</PRE>

<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.

⌨️ 快捷键说明

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