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
acc2d1ad
Commit
acc2d1ad
authored
24 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
33274809
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tutorial/tutorial.html
+37
-14
37 additions, 14 deletions
tutorial/tutorial.html
with
37 additions
and
14 deletions
tutorial/tutorial.html
+
37
−
14
View file @
acc2d1ad
...
...
@@ -22,7 +22,7 @@
<H1>
README 1/9
</H1>
[
<A
HREF=
"#top"
>
top
</A>
][prev][
<A
HREF=
"#file2"
>
next
</A>
]
<PRE>
$Id: tutorial.html,v 1.
2
2000-12-1
0 15:08:32
geuzaine Exp $
$Id: tutorial.html,v 1.
3
2000-12-1
1 22:15:53
geuzaine Exp $
Here are the examples in the Gmsh tutorial. These examples are
commented (both C and C++-style comments can be used in Gmsh input
...
...
@@ -560,7 +560,7 @@ Physical Surface(2) = {24};
*
* Gmsh tutorial 5
*
* Characteristic lengths, Functions, Loops
* Characteristic lengths,
Arrays of variables,
Functions, Loops
*
*********************************************************************/
</FONT></I>
...
...
@@ -660,13 +660,21 @@ Function CheeseHole
l7 = newreg; Line Loop(l7) = {c2,c7,c12}; Ruled Surface(newreg) = {l7};
l8 = newreg; Line Loop(l8) = {-c6,-c9,c2}; Ruled Surface(newreg) = {l8};
l9 = newreg; Surface Loop(l9) = {l8+1, l5+1, l1+1, l2+1, -(l3+1), -(l7+1), l6+1, l4+1};
thehole = newreg; Volume(thehole) = {l9};
<I><FONT
COLOR=
"#B22222"
>
// Arrays of variables can be manipulated in the same way as classical
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// variables. Warning: accessing an uninitialized element in an array
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// will produce an unpredictable result.
</FONT></I>
theloops[t] = newreg ;
Surface Loop(theloops[t]) = {l8+1, l5+1, l1+1, l2+1, -(l3+1), -(l7+1), l6+1, l4+1};
thehole = newreg ;
Volume(thehole) = theloops[t] ;
Return
x = 0; y = 0.75; z = 0; r = 0.09;
x = 0
; y = 0.75
; z = 0
; r = 0.09
;
<I><FONT
COLOR=
"#B22222"
>
// A For loop is used to generate five holes in the cube:
</FONT></I>
...
...
@@ -679,27 +687,37 @@ For t In {1:5}
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// defining a function, we could have define a file containing the
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// same code, and used the Include command to include this file.
</FONT></I>
Call CheeseHole;
Call CheeseHole
;
<I><FONT
COLOR=
"#B22222"
>
// A physical volume is defined for each cheese hole
</FONT></I>
Physical Volume (t) = thehole ;
<I><FONT
COLOR=
"#B22222"
>
// The Printf function permits to print the value of variables on the
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// terminal:
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// terminal
, in a way similar to the 'printf' C function
:
</FONT></I>
Printf(
"
The cheese hole has number %g!
"
, thehole);
Printf(
"
The cheese hole %g (center = {%g,%g,%g}, radius = %g) has number %g!
"
,
t, x, y, z, r, thehole) ;
<I><FONT
COLOR=
"#B22222"
>
// Note: All Gmsh variables are treated internally as double precision
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// numbers. The format string should thus only contain valid double
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// precision number format specifiers (see the C or C++ language
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// reference for more details).
</FONT></I>
EndFor
<I><FONT
COLOR=
"#B22222"
>
// This is the surface loop for the exterior surface of the cube:
</FONT></I>
Surface Loop(185) = {35,31,29,37,33,23,39,25,27};
theloops[0] = newreg ;
Surface Loop(theloops[0]) = {35,31,29,37,33,23,39,25,27} ;
<I><FONT
COLOR=
"#B22222"
>
// The volume of the cube, without the 5 cheese holes, is defined by 6
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// surface loops (the exterior surface and the five interior loops):
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// surface loops (the exterior surface and the five interior loops).
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// To reference an array of variables, its identifier is followed by
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// '[]':
</FONT></I>
Volume(186) = {
185,184,155,126,97,68}
;
Volume(186) = {
theloops[]}
;
<I><FONT
COLOR=
"#B22222"
>
// This physical volume assigns the region number 10 to the tetrahedra
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// paving the cube (but not the holes, whose elements were tagged from
...
...
@@ -1040,8 +1058,8 @@ General.Axes = 0 ;
</FONT></I>
PostProcessing.View[0].Name =
"
This is a very stupid demonstration...
"
;
PostProcessing.View[0].IntervalsType = 2 ;
PostProcessing.View[0].Offset =
{0,0,
0.05
}
;
PostProcessing.View[0].Raise =
{0,0,0}
;
PostProcessing.View[0].Offset
2
= 0.05 ;
PostProcessing.View[0].Raise
2
=
0
;
PostProcessing.View[0].Light = 1 ;
PostProcessing.View[1].Name =
"
...of Gmsh's scripting capabilities
"
;
...
...
@@ -1063,7 +1081,7 @@ For num In {1:255}
t = (PostProcessing.View[0].TimeStep
<
PostProcessing.View[0].NbTimeStep-1) ? t+1 : 0 ;
PostProcessing.View[0].Raise +=
{0,0,
0.001*t
}
;
PostProcessing.View[0].Raise
2
+= 0.001*t ;
<I><FONT
COLOR=
"#B22222"
>
// It is possible to nest loops:
</FONT></I>
...
...
@@ -1082,6 +1100,11 @@ For num In {1:255}
</FONT></I>
If (!(num % 20))
<I><FONT
COLOR=
"#B22222"
>
// The Sprintf function permits to create complex strings using
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// variables (since all Gmsh variables are treated internally as
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// double precision numbers, the format should only contain valid
</FONT></I><I><FONT
COLOR=
"#B22222"
>
// double precision number format specifiers):
</FONT></I>
Print Sprintf(
"
t8-%g.gif
"
, num);
<I><FONT
COLOR=
"#B22222"
>
// print the scene in a gif file
</FONT></I>
EndIf
...
...
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