Allrun 1.57 KB
Newer Older
Henry's avatar
Henry committed
1
#!/bin/sh
Henry's avatar
Henry committed
2
cd ${0%/*} || exit 1    # Run from this directory
Henry's avatar
Henry committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

setControlDict()
{
    sed \
    -e "s/\(deltaT[ \t]*\) 5e-06;/\1 1e-05;/g" \
    -e "s/\(endTime[ \t]*\) 0.005;/\1 0.015;/g" \
    -e "s/\(writeInterval[ \t]*\) 10;/\1 50;/g" \
    -i system/controlDict
}

setCombustionProperties()
{
    sed \
    -e "s/\(laminarFlameSpeedCorrelation[ \t]*\) Gulders;/\1 RaviPetersen;/g" \
    -e "s/\(fuel[ \t]*\) Propane;/\1 HydrogenInAir;/g" \
    -i constant/combustionProperties
}

# Do moriyoshiHomogeneous
( cd moriyoshiHomogeneous && foamRunTutorials )

# Clone case for second phase
cloneCase moriyoshiHomogeneous moriyoshiHomogeneousPart2

# Modify and execute
(
    cd moriyoshiHomogeneousPart2 || exit

34
35
36
37
38
39
40
    # The following 2 command lines are a generic implementation of the
    # following command:
    #     cp -r ../moriyoshiHomogeneous/0.005 .

    lastTimeStep=$(foamListTimes -case ../moriyoshiHomogeneous -latestTime)
    cp -r ../moriyoshiHomogeneous/$lastTimeStep .

Henry's avatar
Henry committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
    setControlDict
    runApplication `getApplication`
)

# Clone case for hydrogen
cloneCase moriyoshiHomogeneous moriyoshiHomogeneousHydrogen

# Modify and execute
(
    cd moriyoshiHomogeneousHydrogen || exit

    setCombustionProperties
    mv constant/thermophysicalProperties \
       constant/thermophysicalProperties.propane
    mv constant/thermophysicalProperties.hydrogen \
       constant/thermophysicalProperties
    runApplication `getApplication`
)

60
#------------------------------------------------------------------------------