| 1 |
#!/bin/sh -eu |
| 2 |
# the -e option to stop on error |
| 3 |
# we are with awk to do real operation in the shell |
| 4 |
# |
| 5 |
bamg=../../bamg |
| 6 |
NSC2KE=s/NSC2KE |
| 7 |
|
| 8 |
# for awk because in french the number 1/1000 is written 0,001 not 0.001 |
| 9 |
# to be sure the RADIXCHAR is '.' (cf. Native Language Support) |
| 10 |
LANG=C |
| 11 |
export LANG |
| 12 |
|
| 13 |
# some VAR |
| 14 |
ifin=20 |
| 15 |
j=0 |
| 16 |
INIT=0 |
| 17 |
LastIteration=0 |
| 18 |
NBITER=500 |
| 19 |
# --------- |
| 20 |
HMIN=1e-6 |
| 21 |
HMINGLOBAL=$HMIN |
| 22 |
HCOEF=1 |
| 23 |
# ------- |
| 24 |
ERR=0.1 |
| 25 |
ERRCOEF=0.8608916593317348 |
| 26 |
ERRGLOBAL=0.01 |
| 27 |
# ----------- |
| 28 |
# end of some parameters |
| 29 |
# ---------- |
| 30 |
# clean of the output file |
| 31 |
rm -f [A-Z]* |
| 32 |
|
| 33 |
# create the geometry file |
| 34 |
awk -f naca.awk </dev/null >MESH_g.msh |
| 35 |
|
| 36 |
# create the initial mesh MESH_0.amdba |
| 37 |
$bamg -g MESH_g.msh -o MESH_$j.msh -hmax 1 -oamdba MESH_$j.amdba |
| 38 |
|
| 39 |
while [ $j -lt $ifin ] ; do |
| 40 |
# i = j + 1 |
| 41 |
i=`expr $j + 1` |
| 42 |
|
| 43 |
# LastIteration = LastIteration + NBITER |
| 44 |
LastIteration=`expr $LastIteration + $NBITER` |
| 45 |
|
| 46 |
|
| 47 |
## set the current MESH |
| 48 |
rm -f MESH |
| 49 |
ln -s MESH_$j.amdba MESH |
| 50 |
|
| 51 |
## create the DATA file for NSC2KE form file data |
| 52 |
## change 2 lines for initialisation |
| 53 |
rm -f DATA |
| 54 |
sed -e "s/^INIT/$INIT/" -e "s/^LastIteration/$LastIteration/" <data >DATA |
| 55 |
|
| 56 |
echo "--------- NSC2KE iteration $j -----------" |
| 57 |
$NSC2KE |
| 58 |
|
| 59 |
## find the nb of vertices in the file MESH |
| 60 |
nbv=`head -1 MESH|awk '{print $1}'` |
| 61 |
|
| 62 |
## create the bb file for interpolation |
| 63 |
echo "2 4 $nbv 2" > SOL_$j.bb |
| 64 |
cat SOL_NS >> SOL_$j.bb |
| 65 |
|
| 66 |
## create the bb file for metric construction |
| 67 |
## in file SOL_NS on each line i we have ro ro*u ro*v energy |
| 68 |
## at vertex i |
| 69 |
## + a last line with 2 number last iteration and last time |
| 70 |
echo "2 1 $nbv 2" > MACH.bb |
| 71 |
awk 'NF==4 { print sqrt($2*$2+$3*$3)/$1}' SOL_NS >> MACH.bb |
| 72 |
|
| 73 |
## put all the residual in one file |
| 74 |
cat RESIDUAL >>RESIDU |
| 75 |
|
| 76 |
## set HMIN = MAX($HMINGLOBAL,$HMIN*$HCOEF) |
| 77 |
HMIN=`awk "END {c=$HMIN*$HCOEF;c=c<$HMINGLOBAL ?$HMINGLOBAL:c; print c};" </dev/null` |
| 78 |
ERR=`awk "END {c=$ERR*$ERRCOEF;c=c<$ERRGLOBAL ?$ERRGLOBAL:c; print c};" </dev/null` |
| 79 |
|
| 80 |
echo " -b MESH_$j.msh -err $ERR -errg 0.05 -AbsError |
| 81 |
-hmin $HMIN -hmax 1 -Mbb SOL_$j.bb -o MESH_$i.msh |
| 82 |
-oamdba MESH_$i.amdba -raison 2.5 -rbb SOL_$j.bb |
| 83 |
-splitpbedge -maxsubdiv 1.8 |
| 84 |
-wbb INIT_$i.bb -v 4 ">DATA_bamg |
| 85 |
|
| 86 |
echo --- bamg parameters --- |
| 87 |
cat DATA_bamg |
| 88 |
echo ---------------------- |
| 89 |
$bamg |
| 90 |
|
| 91 |
## creation of the INIT_NS for NSC2KE |
| 92 |
## remove fisrt line form bb file and add the last line of SOL_NS |
| 93 |
sed 1d <INIT_$i.bb >INIT_NS |
| 94 |
tail -1 SOL_NS >>INIT_NS |
| 95 |
|
| 96 |
# change i and not initialisation |
| 97 |
j=$i |
| 98 |
INIT=1 |
| 99 |
done |