Skip to content
Snippets Groups Projects
Commit c4a77083 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

improve comments (thanks to Takuya OSHIMA)

parent 28ab5d51
No related branches found
No related tags found
No related merge requests found
......@@ -6,22 +6,23 @@
*
*********************************************************************/
// As usual, we start by defining some variables, some points and some
// lines:
// As usual, we start by defining some variables:
cm = 1e-02;
e1 = 4.5 * cm; e2 = 6 * cm / 2; e3 = 5 * cm / 2;
h1 = 5 * cm; h2 = 10 * cm; h3 = 5 * cm; h4 = 2 * cm; h5 = 4.5 * cm;
R1 = 1 * cm; R2 = 1.5 * cm; r = 1 * cm;
Lc1 = 0.01;
Lc2 = 0.003;
e1 = 4.5*cm; e2 = 6*cm / 2; e3 = 5*cm / 2;
h1 = 5*cm; h2 = 10*cm; h3 = 5*cm; h4 = 2*cm; h5 = 4.5*cm;
// We can use all the usual mathematical functions (note the
// capitalized first letters), plus some useful functions like
// Hypot(a, b) := Sqrt(a^2 + b^2):
R1 = 1*cm; R2 = 1.5*cm; r = 1*cm;
ccos = (-h5*R1 + e2 * Hypot(h5, Hypot(e2, R1))) / (h5^2 + e2^2);
ssin = Sqrt(1 - ccos^2);
ccos = ( -h5*R1 + e2 * Hypot(h5,Hypot(e2,R1)) ) / (h5^2 + e2^2);
ssin = Sqrt(1-ccos^2);
Lc1 = 0.01;
Lc2 = 0.003;
// Then we define some points and some lines using these variables:
Point(1) = { -e1-e2, 0.0 , 0.0 , Lc1};
Point(2) = { -e1-e2, h1 , 0.0 , Lc1};
......@@ -93,21 +94,26 @@ Plane Surface(22) = {21};
Line Loop(23) = {11,-12,13,14,1,2,-3,4,5,6,7,-8,9,10};
Plane Surface(24) = {23,21};
// As a general rule, if a surface has N holes, it is defined by N+1
// line loops: the first loop defines the exterior boundary; the other
// loops define the boundaries of the holes.
// Finally, we can add some comments by embedding a post-processing
// view containing some strings, and change the color of some mesh
// entities:
View "comments" {
// 10 pixels from the left and 15 pixels from the top of the graphic
// window:
T2(10,15,0){StrCat("File created on ", Today)};
// Add a text string in window coordinates, 10 pixels from the left
// and 10 pixels from the bottom:
T2(10, -10, 0){ "Copyright (C) My Company" };
// 10 pixels from the left and 10 pixels from the bottom of the
// graphic window:
T2(10,-10,0){"Copyright (C) My Company"};
// Add another text string in window coordinates, 10 pixels from the
// left and 15 pixels from the top, using the StrCat() function to
// concatenate a string with the current date:
T2(10, 15, 0){ StrCat("File created on ", Today) };
// in the model, at (X,Y,Z) = (0.0,0.11,0.0):
T3(0,0.11,0,0){"Hole"};
// Add a text string in model coordinates at (X,Y,Z) = (0, 0.11, 0):
T3(0, 0.11, 0, 0){ "Hole" };
};
Color Grey50{ Surface{ 22 }; }
......
......@@ -6,27 +6,28 @@
*
*********************************************************************/
// Again, we start be defining some characteristic lengths:
// We start by defining some target mesh sizes:
lcar1 = .1;
lcar2 = .0005;
lcar3 = .055;
// If we wanted to change these lengths globally (without changing the
// above definitions), we could give a global scaling factor for all
// characteristic lengths on the command line with the `-clscale'
// If we wanted to change these mesh sizes globally (without changing
// the above definitions), we could give a global scaling factor for
// all characteristic lengths on the command line with the `-clscale'
// option (or with `Mesh.CharacteristicLengthFactor' in an option
// file). For example, with:
//
// > gmsh t5.geo -clscale 1
//
// this input file produces a mesh of approximately 3,000 nodes and
// 15,000 tetrahedra. With
// this input file produces a mesh of approximately 1,300 nodes and
// 11,000 tetrahedra. With
//
// > gmsh t5.geo -clscale 0.2
//
// the mesh counts approximately 600,000 nodes and 3.6 million
// tetrahedra.
// the mesh counts approximately 350,000 nodes and 2.1 million
// tetrahedra. You can check mesh statistics in the graphical user
// interface with the `Tools->Statistics' menu.
// We proceed by defining some elementary entities describing a
// truncated cube:
......@@ -125,6 +126,8 @@ For t In {1:5}
x += 0.166 ;
z += 0.166 ;
// We call the `CheeseHole' function:
Call CheeseHole ;
// We define a physical volume for each hole:
......@@ -134,7 +137,7 @@ For t In {1:5}
// We also print some variables on the terminal (note that, since
// all variables are treated internally as floating point numbers,
// the format string should only contain valid floating point format
// specifiers):
// specifiers like `%g', `%f', '%e', etc.):
Printf("Hole %g (center = {%g,%g,%g}, radius = %g) has number %g!",
t, x, y, z, r, thehole) ;
......@@ -149,9 +152,10 @@ theloops[0] = newreg ;
Surface Loop(theloops[0]) = {35,31,29,37,33,23,39,25,27} ;
// The volume of the cube, without the 5 holes, is now defined by 6
// surface loops (the exterior surface and the five interior loops).
// To reference an array of variables, its identifier is followed by
// '[]':
// surface loops: the first surface loop defines the exterior surface;
// the surface loops other than the first one define holes. (Again,
// to reference an array of variables, its identifier is followed by
// square brackets):
Volume(186) = {theloops[]} ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment