123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- /* This file is part of Lemma, a geophysical modelling and inversion API.
- * More information is available at http://lemmasoftware.org
- */
-
- /* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
- D0 = 10; // Top of magnet
- D1 = 11; // Bottom of magnet
- radius = 2.25; // Radius of the damn thing
-
- lc = 2*radius; // 0.25; // Target element size
-
- // Total Solution Space
- Box = 6*radius; // The down side of potential
- X0 = -Box;
- X1 = Box;
- Y0 = -Box;
- Y1 = Box;
- Z0 = -Box;
- Z1 = Box;
-
- cellSize=lc; //300;
- dd = 0 ; // 1e-5; //cellSize; // .01;
- pio2=Pi/2;
-
-
- /////////////////////////////////////
- // Large Bounding box
- pp = newp;
- Point(pp) = {X0, Y0, Z0, lc};
- Point(pp+1) = {X1, Y0, Z0, lc};
- Point(pp+2) = {X1, Y1, Z0, lc};
- Point(pp+3) = {X0, Y1, Z0, lc};
-
-
- lv = newl;
- Line(lv) = {pp,pp+1};
- Line(lv+1) = {pp+1,pp+2};
- Line(lv+2) = {pp+2,pp+3};
- Line(lv+3) = {pp+3,pp};
- Line Loop(lv+4) = {lv, lv+1, lv+2, lv+3};
-
- // Hard coded doom
- Plane Surface(125) = {lv+4};
-
- //v = newv;
- v[] = Extrude {0, 0, Z1-Z0} { Surface{125}; };
-
- // // Calculate offset effect
- // theta = Asin(dd/radius);
- // rr = radius * Cos(theta);
- //
- // ///////////////////////////////////
- // // Positive half sphere
- // // create inner 1/8 shell
- // p0 = newp;
- // Point(p0) = { 0, 0, 0, cellSize}; // origin
- // Point(p0+1) = { -rr, 0, dd, cellSize};
- // Point(p0+2) = { 0, rr, dd, cellSize};
- // Point(p0+3) = { 0, 0, radius, cellSize};
- // Point(p0+4) = { 0, 0, dd, cellSize}; // origin
- //
- // c0 = newc;
- // Circle(c0 ) = {p0+1, p0+4, p0+2}; // Tricky, This one needs to be offset!
- // Circle(c0+1) = {p0+3, p0, p0+1};
- // Circle(c0+2) = {p0+3, p0, p0+2};
- //
- // Line Loop(10) = {c0, -(c0+2), c0+1} ;
- // Ruled Surface (60) = {10};
- //
- // ////////////////////////////////////////////////////////////
- // // Negative half sphere
- // p = newp;
- // Point( p) = { 0, 0, 0, cellSize};
- // Point(p+1) = { -rr, 0, -dd, cellSize};
- // Point(p+2) = { 0, rr, -dd, cellSize};
- // Point(p+3) = { 0, 0, -radius, cellSize};
- // Point(p+4) = { 0, 0, -dd, cellSize};
- //
- // cc = newc;
- // Circle(cc ) = {p+1, p+4, p+2};
- // Circle(cc+1) = {p+3, p, p+1};
- // Circle(cc+2) = {p+3, p, p+2};
- //
- // Circle(cc+3) = {p+3, p, p+2};
- // Circle(cc+4) = {p+3, p, p+2};
- // Circle(cc+5) = {p+3, p, p+2};
- //
- // ccl = newl;
- // Line(ccl) = { p0+3, p+3 };
- //
- // Line Loop(11) = {cc, -(cc+2), cc+1} ;
- // Ruled Surface (61) = {11};
- //
- // // create remaining 7/8 inner shells
- // t1[] = Rotate {{0,0,1},{0,0,0},pio2 } {Duplicata{Surface{60};}};
- // t2[] = Rotate {{0,0,1},{0,0,0},pio2*2} {Duplicata{Surface{60};}};
- // t3[] = Rotate {{0,0,1},{0,0,0},pio2*3} {Duplicata{Surface{60};}};
- // //
- // t4[] = Rotate {{0,0,1},{0,0,0},pio2 } {Duplicata{Surface{61};}};
- // t5[] = Rotate {{0,0,1},{0,0,0},pio2*2} {Duplicata{Surface{61};}};
- // t6[] = Rotate {{0,0,1},{0,0,0},pio2*3} {Duplicata{Surface{61};}};
- //
- // /* This is GOOD */
- // Surface{60} In Volume{v[1]};
- // Surface{t1[0]} In Volume{v[1]};
- // Surface{t2[0]} In Volume{v[1]};
- // Surface{t3[0]} In Volume{v[1]};
- //
- // Surface{61} In Volume{v[1]};
- // Surface{t4[0]} In Volume{v[1]};
- // Surface{t5[0]} In Volume{v[1]};
- // Surface{t6[0]} In Volume{v[1]};
- //
- // ///////////////////////////////////////////////
- // // Attractor Field
- //
- // //Field[1] = Attractor;
- // //Field[1].NodesList = {p}; //0, p0+1, p0+2, p0+3, p0+4, p, p+1, p+2, p+3, p+4};
- //
- // //Field[2] = MathEval;
- // //Field[2].F = Sprintf("(2.25 - F1)^2 + %g", cellSize*10 ); // WORKS
- // //Field[2].F = Sprintf("(%g - F1)^2 + %g", radius, 2*cellSize );
- // //Background Field = 2;
- //
- // // Don't extend the elements sizes from the boundary inside the domain
- // //Mesh.CharacteristicLengthExtendFromBoundary = 0;
- //
- // Physical Volume(1) = {v[1]};
-
- // To create the mesh run
- // gmsh sphere.gmsh -2 -v 0 -format msh -o sphere.msh
- //gmsh -3 -format msh1 -o outfile.msh sphere.geo
|