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 <math.h>
</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->addBox(Ground, -wzInfty,log(R), -wzPi/2,wzPi/2, h-H,h);
oil_base->addBox(Isolation, log(d),log(D), -wzPi/2,wzPi/2, 1.1*d,h);
oil_base->setBorder( log(d*D/2),log(R), -wzPi/2,wzPi/2, h-H,h);
oil_base->addPlaneX(log(l));
oil_base->addPlaneX(log(2*D));
oil_base->addPlaneZ(d);
oil_base->addPlaneZ(1.05*d);
oil_base->addPlaneZ(1.5*d);
oil_base->addPlaneZ(3*d);
oil_base->refinementGlobal(0.2*log(R/d),0.11,0.13*H);
oil_base->faceRefinementGlobal(0.6*log(D/d),1.0);
cogenChart oil = new CogenChart(oil_base->generator(),expXY);
cogenOctree vert_base = new CogenOctree;
wzIndex boreHole = vert_base->addBox(BoreHole, 0,d, -wzPi/2,wzPi/2, -d,h);
wzIndex isolation = vert_base->addBox(Isolation,d,D, -wzPi/2,wzPi/2, 1.1*d,h);
vert_base->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->addPlaneZ(d);
vert_base->addPlaneZ(1.05*d);
vert_base->addPlaneZ(1.5*d);
vert_base->addPlaneZ(3*d);
vert_base->setFaceOfBoxSide(Hole,boreHole,wzZ);
vert_base->refinementGlobal(0.3*d,0.11,0.13*H);
cogenChart vert = new CogenChart(vert_base->generator(),cylXY);
cogenOctree hor_base = new CogenOctree;
hor_base->addBox(BoreHole, 0.0, d, -wzPi/2,wzPi/2, -wzInfty,log(l));
hor_base->setBorder( 0.0,3.0*d, -wzPi/2,wzPi/2, log(2*D),log(1.1*l));
cogenRefine hor_ref = new CogenRefine(hor_base->generator());
hor_ref->refinementGlobal(0.9*d,0.4,0.2*log(R/d));
cogenChart hor = new CogenChart(hor_ref->generator(),cylXZ);
cogenComposite gen = new CogenUnion;
gen->add(hor->generator());
gen->add(oil->generator());
gen->add(vert->generator());
</PRE>
<PRE>
wzgrid grid = (*gen)();
grid->write("oil.sg");
}
</PRE>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?