mainoiltest.html

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

HTML
106
字号
<TITLE>COG 2.0: A bore-hole</TITLE>
<PRE>
#include "<A HREF="coglib.hxx">cog/coglib.hxx</A>"
#include &lt;math.h&gt;
</PRE>

<H1>3D Example application: a bore-hole</H1>

 <P>In this example application we want to create a 3D grid with a
thin bore-hole consisting of a vertical part with isolation and a
non-isolated horizontal part:

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

<PRE>
static wzRegion Ground(2);
static wzRegion BoreHole(3);
static wzRegion Isolation(4);
static wzFace	Hole(2);  // boundary condition for the upper end of the hole.
</PRE>


 <P>The problematic point is the relation between the distance
parameters: the diameter of the hole layer is bore-hole is 10,000
times the diameter of the bore-hole. This requires highly
anisotropical grids to reduce the number of points.

<PRE>
static wzFloat H = 1;
static wzFloat h = H / 2;
static wzFloat d = H/100;
static wzFloat D = 1.4 * d;
static wzFloat l = 1.5*H; //5 * H;
static wzFloat R = 100*H; //100 * H;
</PRE>

 <P>We use three systems of coordinates. Inside the vertical bore-hole
(vert) we use standard cylindrical coordinates (cylXY). For the ground
outside the bore-hole (oil) we use a variant: the complex exponential
function - this makes the coordinates conformal in xy-direction
(expXY). For the horizontal bore-hole we use cylindrical coordinates
in y-direction (cylXZ). Note that we use exponential scaling along the
bore-hole to avoid <A HREF="matchproblem.html">match problems</A> in
radial direction.

<PRE>
int main()
{
  wzcoordinates cylXY = new wz3DContinuation(new wzPolarCoordinates);
  wzcoordinates expXY = new wz3DContinuation(new wzComplexExp);
  wzcoordinates cylXZ = new wzYZSwitch(
	new wz3DContinuation(new wzPolarCoordinates,new wzScaleExp));

  cogenOctree oil_base = new CogenOctree;
  oil_base-&gt;addBox(Ground,   -wzInfty,log(R), -wzPi/2,wzPi/2, h-H,h);
  oil_base-&gt;addBox(Isolation,  log(d),log(D), -wzPi/2,wzPi/2, 1.1*d,h);
  oil_base-&gt;setBorder(           log(d*D/2),log(R), -wzPi/2,wzPi/2, h-H,h);
  oil_base-&gt;addPlaneX(log(l));
  oil_base-&gt;addPlaneX(log(2*D));
  oil_base-&gt;addPlaneZ(d);
  oil_base-&gt;addPlaneZ(1.05*d);
  oil_base-&gt;addPlaneZ(1.5*d);
  oil_base-&gt;addPlaneZ(3*d);
  oil_base-&gt;refinementGlobal(0.2*log(R/d),0.11,0.13*H);
  oil_base-&gt;faceRefinementGlobal(0.6*log(D/d),1.0);
  cogenChart oil = new CogenChart(oil_base-&gt;generator(),expXY);

  cogenOctree vert_base = new CogenOctree;
  wzIndex boreHole  = vert_base-&gt;addBox(BoreHole, 0,d, -wzPi/2,wzPi/2,  -d,h);
  wzIndex isolation = vert_base-&gt;addBox(Isolation,d,D, -wzPi/2,wzPi/2, 1.1*d,h);
  vert_base-&gt;setBorder(                             0,d*D/2, -wzPi/2,wzPi/2, h-H,h);
</PRE>

 <P>Now, we introduce the same coarse grid subdivisions in z-direction
as for the ground.  Else, we obtain <A HREF="matchproblem.html">match
problems</A> in z-direction.

<PRE>
  vert_base-&gt;addPlaneZ(d);
  vert_base-&gt;addPlaneZ(1.05*d);
  vert_base-&gt;addPlaneZ(1.5*d);
  vert_base-&gt;addPlaneZ(3*d);
  vert_base-&gt;setFaceOfBoxSide(Hole,boreHole,wzZ);
  vert_base-&gt;refinementGlobal(0.3*d,0.11,0.13*H);
  cogenChart vert = new CogenChart(vert_base-&gt;generator(),cylXY);

  cogenOctree hor_base = new CogenOctree;
  hor_base-&gt;addBox(BoreHole, 0.0,    d, -wzPi/2,wzPi/2, -wzInfty,log(l));
  hor_base-&gt;setBorder(             0.0,3.0*d, -wzPi/2,wzPi/2, log(2*D),log(1.1*l));
  cogenRefine hor_ref = new CogenRefine(hor_base-&gt;generator());
  hor_ref-&gt;refinementGlobal(0.9*d,0.4,0.2*log(R/d));
  cogenChart hor = new CogenChart(hor_ref-&gt;generator(),cylXZ);

  cogenComposite gen = new CogenUnion;
  gen-&gt;add(hor-&gt;generator());
  gen-&gt;add(oil-&gt;generator());
  gen-&gt;add(vert-&gt;generator());
</PRE>

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

⌨️ 快捷键说明

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