Rheolef  7.2
an efficient C++ finite element environment
 
Loading...
Searching...
No Matches
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
66if test $# -eq 0; then
67 echo "usage: mkgeo_couette <n>" >&2
68 exit 1
69fi
70n=$1
71nn=`expr $n + $n`
72radius_ratio=0.5
73basename="couette"
74name=${basename}-${n}
75bamgcad=${name}.bamgcad
76echo "! file \"$bamgcad\" created." >&2
77
78cat > $bamgcad << EOF1
79MeshVersionFormatted
800
81
82Dimension
832
84
85Vertices
86$nn
87EOF1
88
89
90echo | 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
99cat >> $bamgcad << EOF2
100Edges
101$nn
102EOF2
103
104echo | 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
111cat >> $bamgcad << EOF3
112SubDomain 1
1132 1 1 0
114EOF3
115
116
117bamg=$name.bamg
118command="bamg -g $bamgcad -o $bamg"
119echo "! $command"
120eval $command
121
122dmn=$basename.dmn
123echo "! file \"$dmn\" created." >&2
124cat > $dmn << EOF4
125EdgeDomainNames
1262
127exterior
128interior
129EOF4
130
131geo=$name.geo
132command="bamg2geo $bamg $dmn > $geo"
133echo "! $command"
134eval $command
135