📄 mainwzcomplextest.html
字号:
<TITLE>WZ 1.1: Complex coordinates</TITLE><H1>Complex Coordinates</H1> <P>In general, for curvilinear grid generation the best coordinatesare conformal coordinates. The point is that they are orthogonal(that's what we need for grid generation) and, moreover, may becomposed to obtain other conformal coordinates. <P>In 2D, conformal coordinates are coordinates defined bycomplex-analytic functions. Here are some nice examples:<PRE>#include <math.h>#include "coglib.hxx"int main(){ cogenOctree ortho = new CogenOctree(); ortho->refinementGlobal(0.2,0.2,0.2); ortho->relativeMinimalDistance[0]=0.000001; ortho->relativeMinimalDistance[1]=0.000001; cogenRefine ref = new CogenRefine(ortho->generator()); ref->refinementGlobal(0.2,0.2,0.1); wz2dmap c2,ce;// ortho->setBorder(0,8,0,4); // nice for wz2Dacosh// ortho->setBorder(0,4,-wzPi,wzPi); // nice for wz2Dcosh and wz2Dexp</PRE><H2>Exponential function</H2> <P><IMG SRC="wz2dexp.gif"> <P>At a first look, they are like polar coordinates. But they havean exponential radial scale. So, to obtain appropriate values for theradius, you have to take a logarithm:<PRE> c2 = new wz2Dexp();// ortho->setBorder(log(1.0/16.0),log(4),-wzPi,wzPi);</PRE> <P>Despite this unpleasant property, these coordinates should bepreferred if you want to compose them with nonlinear coordinatetransformations from the right side:<PRE>/* c2 = new wz2Dexp(cnonlinear); // better than c2 = new wz2Dpolar(cnonlinear); c2->compose(cnonlinear);*/</PRE><H2>Cosinus hyperbolicus</H2> <P><IMG SRC="wz2dcosh.gif"> <P>This function is appropriate for the description of ellipses andhyperbolas. The upper bound (y-value for the ellipse) is defined as<i>sinh(x)</i> of the values <I>xmin, xmax</I> of the boxes, theintersection of the hyperbola with the x-axis is defined by<I>sin(y)</I> for the values <I>ymin, ymax</I> of the boxes.So, you have to put the relevant <I>asinh</I> and <I>asin</I>values into the box commands:<PRE> c2 = new wz2Dcosh();// ortho->setBorder(0,asinh(4.0),-wzPi,wzPi);</PRE><H2>Logarithm</H2> <P>The logarithm maps the whole plane into a stripe <I>-wzPi < y < wzPi</I>. <P><IMG SRC="wz2dlog.gif"> <P>This picture is part of the grid defined by:<PRE> c2 = new wz2Dlog();// ortho->setBorder(exp(0),exp(1.5),0,10);</PRE><H2>Combining cosh and Logarithms</H2><PRE> ce = new wz2Dacosh(); ce->stretch(0.8); ce->shift(0.2,0); c2 = new wz2Dexp(ce); c2->test();// ortho->setBorder(-2,2,-2,2);// ref->refinementNearPoint(0.0001,0.00005,0.001, 0.0005,0.0001,0.005, -1,0,0);// ref->refinementNearPoint(0.0001,0.00005,0.001, 0.0005,0.0001,0.005, 1,0,0);</PRE><H2>Shukovski's wing</H2> <P><IMG SRC="wz2dwing.gif"> <IMG SRC="wz2dwing2.gif"> <P>One of the famous applications of complex analysis has been theuse of complex coordinates to modelize in 2D an airplane wing. Hereare these coordinates:<PRE> wzFloat h=0.3,b=0.2; // these are the major parameters which influence the form of the wing. wzFloat h0 = h/(1+b),hr=sqrt(h*h+(1+b)*(1+b)),phi=atan2(h,1+b); wzFloat delta=0.02; // some environment to smooth the sharp edge ce = new wz2Dexp(); ce->stretch(hr); ce->rotate(-phi); // to make the origin (0,0) the edge point ce->shift(-b,h); wz2Dshukovski* cs = new wz2Dshukovski(ce); cs->setYofCircleCenter(h0); c2 = cs;/* ortho->setBorder(0,2,-wzPi,wzPi); ortho->addBox(wzRegion(2),0,0.02); // the anisotropic refinement around the wing ref->refinementNearPoint(0.01,0.05,0.001, 0.05,wzInfty,wzInfty, 0,0,0); // some isotropic refinement near the edge of the wing ref->refinementNearPoint(0.02,0.01,0.001, 0.1,0.1,wzInfty, 0,0,0);*/</PRE><H2>Combining Exponents and Logarithms</H2> <P>Combining logarithm, stretch and exponent gives the powerfunction. It is useful to obtain nice grids for skew angles: <P><IMG SRC="wz2dpower.gif"><PRE> ce = new wz2Dlog(); ce->stretch(1.5); c2 = new wz2Dexp(ce); ortho->setBorder(0,4,0,4);</PRE><H2>Why Conformal Coordinates?</H2> <P>We have already mentioned that the complex exponential function isconformal, while standard polar coordinates are not - they are onlyorthogonal. If we in the previous example instead of the conformalcomplex exponent use simple polar coordinates<PRE>// c2 = new wz2Dpolar(ce);</PRE> <P>the resulting composition is no longer orthogonal but skew. Andthis is fatal for the grid generation algorithm, we obtain grids ofthe following type: <P><IMG SRC="wz2dnonconform.gif"> <P>As you see, it works nice in some domains, but in the domain wherethe coordinates become really skew the Delaunay grid does notcorrespond with the coordinate lines. The situation may look even muchworse in case of anisotropic refinement. <IMG SRC="wz2dacosh.gif"><PRE>// c2 = new wz2Dacosh();</PRE> <P>Affine transformations may be added with the following operations:<PRE>// cogenChart gen = new CogenChart(ortho->generator(),c2); cogenChart gen = new CogenChart(ref->generator(),c2); wzgrid grid = (*gen)(); grid->write("test.sg");}</PRE>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -