~ubuntu-branches/ubuntu/saucy/rheolef/saucy

« back to all changes in this revision

Viewing changes to nfem/ptst/form_2Ds_Ds_tst.sh

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito, Pierre Saramito, Sylvestre Ledru
  • Date: 2012-05-14 14:02:09 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120514140209-dzbdlidkotyflf9e
Tags: 6.1-1
[ Pierre Saramito ]
* New upstream release 6.1 (minor changes):
  - support arbitrarily polynomial order Pk
  - source code supports g++-4.7 (closes: #671996)

[ Sylvestre Ledru ]
* update of the watch file

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
SRCDIR=${SRCDIR-"."}
 
23
TOP_SRCDIR=${TOP_SRCDIR-"../.."}
 
24
SRCDIR=${SRCDIR-"."}
 
25
NPROC_MAX=${NPROC_MAX-"3"}
 
26
DATADIR=$SRCDIR
 
27
BINDIR="../pbin"
 
28
SBINDIR="../sbin"
 
29
. "${TOP_SRCDIR}/config/loop_mpirun.sh"
 
30
 
 
31
status=0
 
32
 
 
33
epsilon="1e-12";     # tolrerance to machine precision
 
34
 
 
35
# ===================================================
 
36
# 1) 2D tests
 
37
# ===================================================
 
38
# ---------------------------------------------------
 
39
# 1.1) test on a side of a square
 
40
# ---------------------------------------------------
 
41
u="'cos(y)'   'sin(y)+1'"; # note: expressions containing * may be quotted
 
42
v="'cos(y)^2' 'y^3'"
 
43
n="1 0"
 
44
qorder="10"
 
45
# geo                   err_P1  err_P2  err_P3
 
46
L="
 
47
carre-bamg-v2.right     4e-3    2e-6    6e-8
 
48
carre-100-dom-v2.right  4e-5    2e-10   2e-11
 
49
"
 
50
while test "$L" != ""; do
 
51
  geo=`echo $L | awk '{print $1}'`
 
52
  L=`echo $L | awk '{for (i=2; i <= NF; i++) print $i}'`
 
53
  for Pk in P1 P2 P3; do
 
54
    err=`echo $L | awk '{print $1}'`
 
55
    L=`echo $L | awk '{for (i=2; i <= NF; i++) print $i}'`
 
56
    loop_mpirun "./form_2Ds_Ds_tst $DATADIR/${geo} $Pk $qorder $err $u $v $n 2>/dev/null >/dev/null"
 
57
    if test $? -ne 0; then status=1; fi
 
58
  done
 
59
done
 
60
# ---------------------------------------------------
 
61
# 1.2) test on a circle
 
62
# ---------------------------------------------------
 
63
u="x^3     'x^2*y'"; # note: expressions containing * may be quotted
 
64
v="'x*y^2' x^3    "
 
65
n="x y"
 
66
qorder="12"
 
67
# geo                   err_P1  err_P2
 
68
L="
 
69
circle_s-40-fix         6e-3    3e-5
 
70
"
 
71
while test "$L" != ""; do
 
72
  geo=`echo $L | awk '{print $1}'`
 
73
  L=`echo $L | awk '{for (i=2; i <= NF; i++) print $i}'`
 
74
  for Pk in P1 P2; do 
 
75
    err=`echo $L | awk '{print $1}'`
 
76
    L=`echo $L | awk '{for (i=2; i <= NF; i++) print $i}'`
 
77
    loop_mpirun "./form_2Ds_Ds_tst $DATADIR/${geo}-${Pk} $Pk $qorder $err $u $v $n 2>/dev/null >/dev/null"
 
78
    if test $? -ne 0; then status=1; fi
 
79
  done
 
80
done
 
81
# ------------------------------------------------------
 
82
# 1.3) banded level set: test on the circle
 
83
# ------------------------------------------------------
 
84
run "$SBINDIR/mkgeo_grid_2d -v4 -t 40 -a -2 -b 2 -c -2 -d 2 2>/dev/null | $BINDIR/geo -upgrade - > mesh-2d-40.geo 2>/dev/null"
 
85
qorder="6"
 
86
# geo           err_P1
 
87
L="
 
88
mesh-2d-40      0.0055
 
89
"
 
90
while test "$L" != ""; do
 
91
  geo=`echo $L | awk '{print $1}'`
 
92
  L=`echo $L | awk '{for (i=2; i <= NF; i++) print $i}'`
 
93
  for Pk in P1; do
 
94
    err=`echo $L | awk '{print $1}'`
 
95
    L=`echo $L | awk '{for (i=2; i <= NF; i++) print $i}'`
 
96
    loop_mpirun "./form_2Ds_Ds_tst $DATADIR/${geo} $Pk $qorder $err $u $v $n 2>/dev/null >/dev/null"
 
97
    if test $? -ne 0; then status=1; fi
 
98
  done
 
99
done
 
100
run "rm -f mesh-2d-40.geo"
 
101
# ===================================================
 
102
# 2) 3D tests
 
103
# ===================================================
 
104
# ---------------------------------------------------
 
105
# 2.1) test on the right face of a cube
 
106
# ---------------------------------------------------
 
107
u="'cos(1+x+z)' 'sin(2*x+z)^2' 'cos(x-z)^3'" ; # note: expressions may be quotted
 
108
v="'sin(x)^3'   'cos(x)^2'     'z^3'"
 
109
n="0 1 0"
 
110
qorder="12"
 
111
# geo                   err_P1  err_P2  err_P3  err_P4
 
112
L="
 
113
cube-10-dom-v2.right    2e-2    7e-3    5e-7    2e-9
 
114
cube-P-5-dom-v2.right   6e-2    6e-5    3e-5    4e-8
 
115
my_cube_TPH-5-v2.right  9e-2    1e-4    8e-5    8e-8
 
116
"
 
117
while test "$L" != ""; do
 
118
  geo=`echo $L | awk '{print $1}'`
 
119
  L=`echo $L | awk '{for (i=2; i <= NF; i++) print $i}'`
 
120
  for Pk in P1 P2 P3 P4; do 
 
121
    err=`echo $L | awk '{print $1}'`
 
122
    L=`echo $L | awk '{for (i=2; i <= NF; i++) print $i}'`
 
123
    loop_mpirun "./form_2Ds_Ds_tst $DATADIR/${geo} $Pk $qorder $err $u $v $n 2>/dev/null >/dev/null"
 
124
    if test $? -ne 0; then status=1; fi
 
125
  done
 
126
done
 
127
# ---------------------------------------------------
 
128
# 2.2) test on the surface of a sphere
 
129
# ---------------------------------------------------
 
130
u=" z    x^2 'x*y'"; # note: expressions containing * may be quotted
 
131
v="'x*y' x^2  z"
 
132
n="x y z"
 
133
qorder="12"
 
134
# geo                   err_P1  err_P2
 
135
L="
 
136
sphere_s-10-fix         0.0008  0.0004
 
137
sphere_s_q-10-fix       0.0300  0.0003
 
138
"
 
139
while test "$L" != ""; do
 
140
  geo=`echo $L | awk '{print $1}'`
 
141
  L=`echo $L | awk '{for (i=2; i <= NF; i++) print $i}'`
 
142
  for Pk in P1 P2; do 
 
143
    err=`echo $L | awk '{print $1}'`
 
144
    L=`echo $L | awk '{for (i=2; i <= NF; i++) print $i}'`
 
145
    loop_mpirun "./form_2Ds_Ds_tst $DATADIR/${geo}-${Pk} $Pk $qorder $err $u $v $n 2>/dev/null >/dev/null"
 
146
    if test $? -ne 0; then status=1; fi
 
147
  done
 
148
done
 
149
# ------------------------------------------------------
 
150
# 2.3) banded level set: test on the sphere
 
151
# ------------------------------------------------------
 
152
run "$SBINDIR/mkgeo_grid_3d -v4 -T 20 -a -2 -b 2 -c -2 -d 2 -f -2 -g 2  2>/dev/null| $BINDIR/geo -upgrade - > mesh-3d-20.geo 2>/dev/null"
 
153
qorder="6"
 
154
# geo                   err_P1
 
155
L="
 
156
mesh-3d-20              0.14
 
157
"
 
158
while test "$L" != ""; do
 
159
  geo=`echo $L | awk '{print $1}'`
 
160
  L=`echo $L | awk '{for (i=2; i <= NF; i++) print $i}'`
 
161
  for Pk in P1; do
 
162
    err=`echo $L | awk '{print $1}'`
 
163
    L=`echo $L | awk '{for (i=2; i <= NF; i++) print $i}'`
 
164
    loop_mpirun "./form_2Ds_Ds_tst $DATADIR/${geo} $Pk $qorder $err $u $v $n 2>/dev/null >/dev/null"
 
165
    if test $? -ne 0; then status=1; fi
 
166
  done
 
167
done
 
168
run "rm -f mesh-3d-20.geo"
 
169
 
 
170
exit $status