mainpolartest.html
来自「有限元学习研究用源代码(老外的),供科研人员参考」· HTML 代码 · 共 58 行
HTML
58 行
<TITLE>COG 2.0: polar coordinates</TITLE>
<A HREF="main2Dtest.html">next</A>
<H1>COG 2.0: polar coordinates</H1>
<P>Now, let's consider how to create curved grids with coordinate
transformations. As an example, we use polar coordinates. This
allows to define curved geometries based on the previous method for
rectangular geometries:
<P><IMG SRC="polartest.gif">
<P>First, we create a rectangular grid and geometry with some
<A HREF="mainoctreetest.html">regions</A>,
<A HREF="mainfacetest.html">faces</A> and
<A HREF="mainreftest.html">refinement</A> as before:
<PRE>
#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"
int main()
{
cogenOctree base = new CogenOctree();
wzIndex i1 = base->addBox(wzRegion(2), 0.0,0.4,-0.3,1.5);
wzIndex i2 = base->addBox(wzRegion(3), 0.2,0.3);
wzIndex i3 = base->addBox(wzRegion(4), 0.2,0.3, 0.3,1.0);
base->setFaceOfBox(wzFace(2),i1);
base->setFaceOfBox(wzFace(3),i2);
base->setFaceOfBox(wzFace(4),i3);
base->refinementGlobal(0.05,0.3);
</PRE>
<P>But we should have in mind that we want to use polar
coordinates. Thus, the minimal value which is allowed here for the
first coordinate (the radius) is zero. Else, the program will fail.
But the extremal values (zero radius, angles -Pi, Pi) are allowed:
<PRE>
base->addPlaneY(wzPi);
base->addPlaneY(-wzPi);
</PRE>
<P>Now we apply the polar coordinates to this rectangular geometry:
<PRE>
wzcoordinates polar = new wzPolarCoordinates;
cogenChart gen = new CogenChart(base->generator(),polar);
</PRE>
<P>Then we compute the grid as usual:
<PRE>
wzgrid grid = (*gen)();
grid->write("test.sg");
}
</PRE>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?