Rheolef  7.1
an efficient C++ finite element environment
mkgeo_couette.sh
Go to the documentation of this file.
1 #!/bin/sh
2 #
3 # This file is part of Rheolef.
4 #
5 # Copyright (C) 2000-2018 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 # author: Pierre.Saramito@imag.fr
22 # date: 2 december 2019
23 
24 
65 
66 if test $# -eq 0; then
67  echo "usage: mkgeo_couette <n>" >&2
68  exit 1
69 fi
70 n=$1
71 nn=`expr $n + $n`
72 radius_ratio=0.5
73 basename="couette"
74 name=${basename}-${n}
75 bamgcad=${name}.bamgcad
76 echo "! file \"$bamgcad\" created." >&2
77 
78 cat > $bamgcad << EOF1
79 MeshVersionFormatted
80 0
81 
82 Dimension
83 2
84 
85 Vertices
86 $nn
87 EOF1
88 
89 
90 echo | awk -v n=$n -v radius_ratio=${radius_ratio} 'BEGIN {
91  pi = 3.14159265358979323846
92  r = radius_ratio
93  for (i = 0; i < n; i++)
94  printf ("%25.16g %25.16g 1\n", cos(2*i*pi/n), sin(2*i*pi/n))
95  for (i = 0; i < n; i++)
96  printf ("%25.16g %25.16g 1\n", r*cos(2*i*pi/n), r*sin(2*i*pi/n))
97 }' >> $bamgcad
98 
99 cat >> $bamgcad << EOF2
100 Edges
101 $nn
102 EOF2
103 
104 echo | awk -v n=$n 'BEGIN {
105  for (i = 0; i < n; i++)
106  printf ("%5d %5d 1\n", i+1, ((i+1)%n) + 1)
107  for (i = 0; i < n; i++)
108  printf ("%5d %5d 2\n", n + ((i+1)%n) + 1, n+i+1)
109 }' >> $bamgcad
110 
111 cat >> $bamgcad << EOF3
112 SubDomain 1
113 2 1 1 0
114 EOF3
115 
116 
117 bamg=$name.bamg
118 command="bamg -g $bamgcad -o $bamg"
119 echo "! $command"
120 eval $command
121 
122 dmn=$basename.dmn
123 echo "! file \"$dmn\" created." >&2
124 cat > $dmn << EOF4
125 EdgeDomainNames
126 2
127 exterior
128 interior
129 EOF4
130 
131 geo=$name.geo
132 command="bamg2geo $bamg $dmn > $geo"
133 echo "! $command"
134 eval $command
135