Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
c4a77083
Commit
c4a77083
authored
15 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
improve comments (thanks to Takuya OSHIMA)
parent
28ab5d51
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tutorial/t4.geo
+25
-19
25 additions, 19 deletions
tutorial/t4.geo
tutorial/t5.geo
+16
-12
16 additions, 12 deletions
tutorial/t5.geo
with
41 additions
and
31 deletions
tutorial/t4.geo
+
25
−
19
View file @
c4a77083
...
@@ -6,22 +6,23 @@
...
@@ -6,22 +6,23 @@
*
*
*********************************************************************/
*********************************************************************/
// As usual, we start by defining some variables, some points and some
// As usual, we start by defining some variables:
// lines:
cm
=
1e-02
;
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
;
// We can use all the usual mathematical functions (note the
// capitalized first letters), plus some useful functions like
h1
=
5
*
cm
;
h2
=
10
*
cm
;
h3
=
5
*
cm
;
h4
=
2
*
cm
;
h5
=
4.5
*
cm
;
// 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
);
// Then we define some points and some lines using these variables:
ssin
=
Sqrt
(
1
-
ccos
^
2
);
Lc1
=
0.01
;
Lc2
=
0.003
;
Point
(
1
)
=
{
-
e1
-
e2
,
0.0
,
0.0
,
Lc1
};
Point
(
1
)
=
{
-
e1
-
e2
,
0.0
,
0.0
,
Lc1
};
Point
(
2
)
=
{
-
e1
-
e2
,
h1
,
0.0
,
Lc1
};
Point
(
2
)
=
{
-
e1
-
e2
,
h1
,
0.0
,
Lc1
};
...
@@ -93,21 +94,26 @@ Plane Surface(22) = {21};
...
@@ -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
};
Line
Loop
(
23
)
=
{
11
,
-
12
,
13
,
14
,
1
,
2
,
-
3
,
4
,
5
,
6
,
7
,
-
8
,
9
,
10
};
Plane
Surface
(
24
)
=
{
23
,
21
};
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
// Finally, we can add some comments by embedding a post-processing
// view containing some strings, and change the color of some mesh
// view containing some strings, and change the color of some mesh
// entities:
// entities:
View
"comments"
{
View
"comments"
{
//
10 pixels from the left and
1
5
pixels from the
top of the graphic
//
Add a text string in window coordinates,
1
0
pixels from the
left
//
window
:
//
and 10 pixels from the bottom
:
T2
(
10
,
15
,
0
){
StrCat
(
"File created on "
,
Today
)
};
T2
(
10
,
-
10
,
0
){
"Copyright (C) My Company"
};
// 10 pixels from the left and 10 pixels from the bottom of the
// Add another text string in window coordinates, 10 pixels from the
// graphic window:
// left and 15 pixels from the top, using the StrCat() function to
T2
(
10
,
-
10
,
0
){
"Copyright (C) My Company"
};
// 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):
//
Add a text string in model coordinates
at (X,Y,Z) = (0,
0.11,
0):
T3
(
0
,
0.11
,
0
,
0
){
"Hole"
};
T3
(
0
,
0.11
,
0
,
0
){
"Hole"
};
};
};
Color
Grey50
{
Surface
{
22
};
}
Color
Grey50
{
Surface
{
22
};
}
...
...
This diff is collapsed.
Click to expand it.
tutorial/t5.geo
+
16
−
12
View file @
c4a77083
...
@@ -6,27 +6,28 @@
...
@@ -6,27 +6,28 @@
*
*
*********************************************************************/
*********************************************************************/
//
Again, w
e start b
e
defining some
characteristic length
s:
//
W
e start b
y
defining some
target mesh size
s:
lcar1
=
.1
;
lcar1
=
.1
;
lcar2
=
.0005
;
lcar2
=
.0005
;
lcar3
=
.055
;
lcar3
=
.055
;
// If we wanted to change these
length
s globally (without changing
the
// If we wanted to change these
mesh size
s globally (without changing
// above definitions), we could give a global scaling factor for
all
//
the
above definitions), we could give a global scaling factor for
// characteristic lengths on the command line with the `-clscale'
//
all
characteristic lengths on the command line with the `-clscale'
// option (or with `Mesh.CharacteristicLengthFactor' in an option
// option (or with `Mesh.CharacteristicLengthFactor' in an option
// file). For example, with:
// file). For example, with:
//
//
// > gmsh t5.geo -clscale 1
// > gmsh t5.geo -clscale 1
//
//
// this input file produces a mesh of approximately
3,0
00 nodes and
// this input file produces a mesh of approximately
1,3
00 nodes and
// 1
5
,000 tetrahedra. With
// 1
1
,000 tetrahedra. With
//
//
// > gmsh t5.geo -clscale 0.2
// > gmsh t5.geo -clscale 0.2
//
//
// the mesh counts approximately 600,000 nodes and 3.6 million
// the mesh counts approximately 350,000 nodes and 2.1 million
// tetrahedra.
// 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
// We proceed by defining some elementary entities describing a
// truncated cube:
// truncated cube:
...
@@ -125,6 +126,8 @@ For t In {1:5}
...
@@ -125,6 +126,8 @@ For t In {1:5}
x
+=
0.166
;
x
+=
0.166
;
z
+=
0.166
;
z
+=
0.166
;
// We call the `CheeseHole' function:
Call
CheeseHole
;
Call
CheeseHole
;
// We define a physical volume for each hole:
// We define a physical volume for each hole:
...
@@ -134,7 +137,7 @@ For t In {1:5}
...
@@ -134,7 +137,7 @@ For t In {1:5}
// We also print some variables on the terminal (note that, since
// We also print some variables on the terminal (note that, since
// all variables are treated internally as floating point numbers,
// all variables are treated internally as floating point numbers,
// the format string should only contain valid floating point format
// 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!"
,
Printf
(
"Hole %g (center = {%g,%g,%g}, radius = %g) has number %g!"
,
t
,
x
,
y
,
z
,
r
,
thehole
)
;
t
,
x
,
y
,
z
,
r
,
thehole
)
;
...
@@ -149,9 +152,10 @@ theloops[0] = newreg ;
...
@@ -149,9 +152,10 @@ theloops[0] = newreg ;
Surface
Loop
(
theloops
[
0
])
=
{
35
,
31
,
29
,
37
,
33
,
23
,
39
,
25
,
27
}
;
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
// The volume of the cube, without the 5 holes, is now defined by 6
// surface loops (the exterior surface and the five interior loops).
// surface loops: the first surface loop defines the exterior surface;
// To reference an array of variables, its identifier is followed by
// 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
[]}
;
Volume
(
186
)
=
{
theloops
[]}
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment