Allrun 2.37 KB
Newer Older
1
#!/bin/sh
Henry's avatar
Henry committed
2
cd ${0%/*} || exit 1    # Run from this directory
3

4
5
6
7
8
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

cavityCases="cavity cavityFine cavityGrade cavityHighRe cavityClipped"

9
runMapFields()
10
11
{
    echo "Running mapFields from $1 to $2"
12
    mapFields $1 -case $2 -sourceTime latestTime > $2/log.mapFields 2>&1
13
14
}

15
runMapFieldsConsistent()
16
17
{
    echo "Running mapFields from $1 to $2"
18
    mapFields $1 -case $2 -sourceTime latestTime -consistent > $2/log.mapFields 2>&1
19
20
}

21
copySolutionDirs()
22
23
24
25
26
{
    echo "Copying $2/0* directory to $1"
    cp -r $2/0* $1
}

27
setCavityFine()
28
{
29
    blockMeshDict="$caseName/system/blockMeshDict"
30
    controlDict="$caseName/system/controlDict"
31
32
33
    sed s/"20 20 1"/"41 41 1"/g $blockMeshDict > temp.$$
    mv temp.$$ $blockMeshDict
    sed \
andy's avatar
andy committed
34
35
    -e s/"\(startTime[ \t]*\) 0;"/"\1 0.5;"/g \
    -e s/"\(endTime[ \t]*\) 0.5;"/"\1 0.7;"/g \
36
37
38
39
40
41
42
    -e s/"\(deltaT[ \t]*\) 0.005;"/"\1 0.0025;"/g \
    -e s/"\(writeControl[ \t]*\) timeStep;"/"\1 runTime;"/g \
    -e s/"\(writeInterval[ \t]*\) 20;"/"\1 0.1;"/g \
    $controlDict > temp.$$
    mv temp.$$ $controlDict
}

43
setCavityHighRe()
44
45
{
    echo "Setting cavityHighRe to generate a secondary vortex"
46
47
    controlDict="$caseName/system/controlDict"
    transportProperties="$caseName/constant/transportProperties"
48
49
50
51
52
53
54
55
56
    sed \
    -e s/"\(startFrom[ \t]*\) startTime;"/"\1 latestTime;"/g \
    -e s/"\(endTime[ \t]*\) 0.5;"/"\1 2.0;"/g \
    $controlDict > temp.$$
    mv temp.$$ $controlDict
    sed s/"0.01"/"0.001"/g $transportProperties > temp.$$
    mv temp.$$ $transportProperties
}

57
58

for caseName in $cavityCases
59
do
60
    if [ "$caseName" = cavityFine ]
61
    then
62
        cloneCase cavity $caseName
63
64
65
        setCavityFine
    fi

66
    if [ "$caseName" = cavityHighRe ]
67
    then
68
        cloneCase cavity $caseName
69
        setCavityHighRe
70
        copySolutionDirs $caseName cavity
71
72
    fi

73
    ( cd $caseName && runApplication blockMesh )
74

75
76
77
78
79
    case "$caseName" in
    cavityFine | cavityGrade)
        runMapFieldsConsistent $previousCase $caseName
        ;;
    cavityClipped)
andy's avatar
andy committed
80
        cp -r $caseName/0 $caseName/0.5
81
82
83
84
85
        runMapFields cavity $caseName
        ;;
    esac

    previousCase="$caseName"
86
    ( cd $caseName && runApplication `getApplication` )
87
88
89
done


90
91
# elbow case for testing Fluent-FOAM conversion tools
(cd elbow && ./Allrun)
92
93

# ----------------------------------------------------------------- end-of-file