Merge branch 'master' of ssh://opencfd@repo.or.cz/srv/git/OpenFOAM-1.5.x
[OpenFOAM-1.5.x.git] / tutorials / icoFoam / Allrun
blobfcea17d98e2001b2f2eff9570382ffa96710caa5
1 #!/bin/sh
2 # Source tutorial run functions
3 . $WM_PROJECT_DIR/bin/tools/RunFunctions
5 # Get application name from directory
6 application=`basename $PWD`
8 cavityCases="cavity cavityFine cavityGrade cavityHighRe cavityClipped"
10 runMapFields ()
12 echo "Running mapFields from $1 to $2"
13 mapFields $1 -case $2 -sourceTime latestTime > $2/log.mapFields 2>&1
16 runMapFieldsConsistent ()
18 echo "Running mapFields from $1 to $2"
19 mapFields $1 -case $2 -sourceTime latestTime -consistent > $2/log.mapFields 2>&1
22 runFluentMeshToFoam ()
24 echo "fluentMeshToFoam: converting mesh $2"
25 fluentMeshToFoam $2 -case $1 > $1/log.fluentMeshToFoam 2>&1
28 copySolutionDirs ()
30 echo "Copying $2/0* directory to $1"
31 cp -r $2/0* $1
34 setCavityFine ()
36 blockMeshDict="$case/constant/polyMesh/blockMeshDict"
37 controlDict="$case/system/controlDict"
38 sed s/"20 20 1"/"41 41 1"/g $blockMeshDict > temp.$$
39 mv temp.$$ $blockMeshDict
40 sed \
41 -e s/"\(startTime[ \t]*\) 0;"/"\1 0.5;"/g \
42 -e s/"\(endTime[ \t]*\) 0.5;"/"\1 0.7;"/g \
43 -e s/"\(deltaT[ \t]*\) 0.005;"/"\1 0.0025;"/g \
44 -e s/"\(writeControl[ \t]*\) timeStep;"/"\1 runTime;"/g \
45 -e s/"\(writeInterval[ \t]*\) 20;"/"\1 0.1;"/g \
46 $controlDict > temp.$$
47 mv temp.$$ $controlDict
50 setCavityHighRe ()
52 echo "Setting cavityHighRe to generate a secondary vortex"
53 controlDict="$case/system/controlDict"
54 transportProperties="$case/constant/transportProperties"
55 sed \
56 -e s/"\(startFrom[ \t]*\) startTime;"/"\1 latestTime;"/g \
57 -e s/"\(endTime[ \t]*\) 0.5;"/"\1 2.0;"/g \
58 $controlDict > temp.$$
59 mv temp.$$ $controlDict
60 sed s/"0.01"/"0.001"/g $transportProperties > temp.$$
61 mv temp.$$ $transportProperties
64 for case in $cavityCases
66 if [ "$case" = "cavityFine" ]
67 then
68 cloneCase cavity $case
69 setCavityFine
72 if [ "$case" = "cavityHighRe" ]
73 then
74 cloneCase cavity $case
75 setCavityHighRe
76 copySolutionDirs $case cavity
79 (cd $case && runApplication blockMesh)
81 if [ "$case" = "cavityFine" -o "$case" = "cavityGrade" ]
82 then
83 runMapFieldsConsistent $previousCase $case
86 if [ "$case" = "cavityClipped" ]
87 then
88 cp -r $case/0 $case/0.5
89 runMapFields cavity $case
90 if [ ".`grep nonuniform $case/0.5/U`" != "." ]
91 then
92 sed -f resetFixedWallsScr $case/0.5/U > $case/0.5/U.temp
93 mv $case/0.5/U.temp $case/0.5/U
97 previousCase="$case"
99 (cd $case && runApplication $application)
100 done
102 # elbow case for testing Fluent-FOAM conversion tools
104 runFluentMeshToFoam elbow elbow/elbow.msh
105 (cd elbow && runApplication $application)
106 (cd elbow && runApplication foamMeshToFluent)
107 (cd elbow && runApplication foamDataToFluent)