~ubuntu-branches/ubuntu/trusty/rheolef/trusty

« back to all changes in this revision

Viewing changes to nfem/sbin/mkgeo_grid

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito
  • Date: 2012-04-06 09:12:21 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120406091221-m58me99p1nxqui49
Tags: 6.0-1
* New upstream release 6.0 (major changes):
  - massively distributed and parallel support
  - full FEM characteristic method (Lagrange-Gakerkin method) support
  - enhanced users documentation 
  - source code supports g++-4.7 (closes: #667356)
* debian/control: dependencies for MPI distributed solvers added
* debian/rules: build commands simplified
* debian/librheolef-dev.install: man1/* to man9/* added
* debian/changelog: package description rewritted (closes: #661689)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# This file is part of Rheolef.
 
4
#
 
5
# Copyright (C) 2000-2009 Pierre Saramito 
 
6
#
 
7
# Rheolef is free software; you can redistribute it and/or modify
 
8
# it under the terms of the GNU General Public License as published by
 
9
# the Free Software Foundation; either version 2 of the License, or
 
10
# (at your option) any later version.
 
11
#
 
12
# Rheolef is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU General Public License
 
18
# along with Rheolef; if not, write to the Free Software
 
19
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
20
#
 
21
# -------------------------------------------------------------------------
 
22
 
 
23
#Prog:mkgeo_grid
 
24
#NAME: @code{mkgeo_grid} -- build a strutured mesh of a parallelotope, in 1d, 2d or 3d
 
25
#@pindex mkgeo_grid
 
26
#@pindex geo
 
27
#@cindex mesh
 
28
#@fiindex @file{.geo} mesh
 
29
#SYNOPSIS:
 
30
#@example
 
31
#       mkgeo_grid @var{options} [@var{nx} [@var{ny} [@var{nz}]]]
 
32
#@end example
 
33
#EXAMPLE: 
 
34
#@noindent
 
35
#  The following command build a triangular based 2d 10x10 grid
 
36
#  of the unit square:
 
37
#@example
 
38
#       mkgeo_grid -t 10 > square-10.geo
 
39
#       geo square-10.geo
 
40
#@end example
 
41
#@noindent
 
42
#  or in one comand line:
 
43
#@example
 
44
#       mkgeo_grid -t 10 | geo -
 
45
#@end example
 
46
#DESCRIPTION:       
 
47
#  @noindent
 
48
#  This command is usefull when testing programs on simple geometries.
 
49
#  It avoid the preparation of an input file for a mesh generator.
 
50
#  The optional @var{nx}, @var{ny} and @var{nz} arguments are integer
 
51
#  that specifies the subdivision in each direction. By default 
 
52
#  @var{nx}=10, @var{ny}=@var{nx} and @var{nz}=@var{ny}.
 
53
#  The mesh files goes on standard output.
 
54
#
 
55
#  @noindent
 
56
#  The command supports all the possible element types: edges, triangles,
 
57
#  rectangles, tetraedra, prisms and hexahedra.
 
58
#ELEMENT TYPE OPTIONS:
 
59
#@table @code
 
60
#@itemx -e
 
61
#       1d mesh using edges.
 
62
#@itemx -t
 
63
#       2d mesh using triangles.
 
64
#@itemx -q
 
65
#       2d mesh using quadrangles (rectangles).
 
66
#@itemx -T
 
67
#       3d mesh using tetraedra.
 
68
#@itemx -P
 
69
#       3d mesh using prisms.
 
70
#@itemx -H
 
71
#       3d mesh using hexahedra.
 
72
#@end table
 
73
#THE GEOMETRY:
 
74
#  @noindent
 
75
#  The geometry can be any [a,b] segment, [a,b]x[c,d] rectangle
 
76
#  or [a,b]x[c,d]x[f,g] parallelotope. By default a=c=f=0 and b=d=g=1, thus,
 
77
#  the unit boxes are considered. For instance, the following
 
78
#  command meshes the [-2,2]x[-1.5, 1.5] rectangle:
 
79
#@example
 
80
#       mkgeo_grid -t 10 -a -2 -b 2 -c -1.5 -d 1.5 | geo -
 
81
#@end example
 
82
#@table @code
 
83
#@itemx -a @var{float}
 
84
#@itemx -b @var{float}
 
85
#@itemx -c @var{float}
 
86
#@itemx -d @var{float}
 
87
#@itemx -f @var{float}
 
88
#@itemx -g @var{float}
 
89
#@end table
 
90
#BOUNDARY DOMAINS:
 
91
#@table @code
 
92
#@itemx -sides
 
93
#@itemx -nosides
 
94
#  The boundary sides are representd by domains: @code{left}, @code{right},
 
95
#  @code{top}, @code{bottom},@code{front} and @code{back}.
 
96
#@itemx -boundary
 
97
#@itemx -noboundary
 
98
#  This option defines a domain named @code{boundary} that groups all sides.
 
99
#@end table
 
100
#By default, both sides and the whole boundary are defined as domains:
 
101
#@example
 
102
#       mkgeo_grid -t 10 > square.geo 
 
103
#       geo square.geo
 
104
#       mkgeo_grid -t 10 -nosides > square.geo 
 
105
#       geo square.geo
 
106
#       mkgeo_grid -t 10 -noboundary > square.geo 
 
107
#       geo square.geo
 
108
#       mkgeo_grid -t 10 -noboundary -nosides > square.geo 
 
109
#       geo square.geo
 
110
#@end example
 
111
#REGIONS:
 
112
#@table @code
 
113
#@itemx -region
 
114
#@itemx -noregion
 
115
#  The whole domain is splitted into two subdomains: @code{east} and @code{west},
 
116
#  This option is used for testing computations with subdomains (e.g. transmission
 
117
#  problem; see the user manual).
 
118
#@end table
 
119
#@example
 
120
#       mkgeo_grid -t 10 -region | geo -
 
121
#@end example
 
122
#CORNERS:
 
123
#@table @code
 
124
#@itemx -corner
 
125
#@itemx -nocorner
 
126
#  The corners (four in 2D and eight in 3D) are defined as OD-domains.
 
127
#  This could be usefull for some special boundary conditions.
 
128
#@end table
 
129
#@example
 
130
#       mkgeo_grid -t 10 -corner | geo -
 
131
#       mkgeo_grid -T  5 -corner | geo -
 
132
#@end example
 
133
#
 
134
#COORDINATE SYSTEM OPTION:
 
135
#   Most of rheolef codes are coordinate-system independant.
 
136
#   The coordinate system is specified in the geometry file @file{.geo}.
 
137
#@table @code
 
138
#@cindex axisymmetric coordinate system
 
139
#@itemx -zr
 
140
#@itemx -rz
 
141
#       the 2d mesh is axisymmetric: @code{zr} (resp. @code{rz}) stands when the symmetry is related
 
142
#       to the first (resp. second) coordinate.
 
143
#@end table
 
144
#
 
145
#FILE FORMAT OPTION:
 
146
#@table @code
 
147
#@end table
 
148
#
 
149
#DATE:
 
150
#    2 february 2004
 
151
#END:
 
152
 
 
153
usage="mkgeo_grid
 
154
        [-{abcdfg} float]
 
155
        [-{eptqTPH}]
 
156
        [nx [ny nz]]]
 
157
        [-[no]sides]
 
158
        [-[no]boundary]
 
159
        [-[no]region]
 
160
        [-[no]corner]
 
161
        [-rz|-zr]
 
162
        [-v4]
 
163
"
 
164
 
 
165
if test $# -eq 0; then
 
166
  echo ${usage} >&2
 
167
  exit 0
 
168
fi
 
169
 
 
170
args=""
 
171
dim=""
 
172
sys_coord="cartesian"
 
173
new_format=`rheolef-config --is-distributed 2>/dev/null`
 
174
GEO_BIN=${GEO_BIN-"geo"}
 
175
while test $# -ne 0; do
 
176
  case $1 in
 
177
  -h) echo ${usage} >&2; exit 0;;
 
178
  -e)       dim="1d"; args="$args $1";;
 
179
  -[tq])    dim="2d"; args="$args $1";;
 
180
  -[TPH])   dim="3d"; args="$args $1";;
 
181
  [\-\+0-9e]*)    args="$args $1";;
 
182
  -[abcdfg]) args="$args $1 $2"; shift;;
 
183
  -rz)       args="$args $1"; sys_coord="rz";;
 
184
  -zr)       args="$args $1"; sys_coord="zr";;
 
185
  -sides | -boundary | -region | -corner | -nosides | -noboundary | -noregion | -nocorner)
 
186
             args="$args $1";;
 
187
  *) echo ${usage} >&2; exit 1;;
 
188
  esac
 
189
  shift
 
190
done
 
191
if test ${new_format} = true; then
 
192
  args="$args -v4"
 
193
fi
 
194
#echo "! GEO_BIN=${GEO_BIN}" >&2
 
195
#echo "! new_format=${new_format}" >&2
 
196
pkgbindir=`rheolef-config --pkglibdir`
 
197
 
 
198
if test $sys_coord != "cartesian" -a $dim != 2d; then
 
199
  echo "mkgeo_grid: incompatible $dim geometry and non-cartesian \"${sys_coord}\"coordinate system" >&2
 
200
  exit 1
 
201
fi
 
202
 
 
203
command="$pkgbindir/mkgeo_grid_$dim $args 2>/dev/null"
 
204
if test $dim = 3d || test ${new_format} = true; then
 
205
  command="$command | ${GEO_BIN} -upgrade -geo - 2>/dev/null"
 
206
fi
 
207
#echo "! $command" >&2
 
208
eval $command
 
209
status=$?
 
210
if test $status -ne 0; then
 
211
  echo "$0: command failed" 1>&2
 
212
  exit $status
 
213
fi