-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAllrun_sine
executable file
·43 lines (36 loc) · 2.1 KB
/
Allrun_sine
1
2
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
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Get application name
application=`getApplication`
fraction=1.0
discharge=5.0
disturbancefraction=0.05
Uh=5.6
waterdepth=`python -c "print($discharge/$Uh)"`
xx=`python -c "print($waterdepth*4*25)"`
disperiod=4
segment=`python -c "print($xx/$disperiod/4)"`
pival=3.14159
runApplication blockMesh
#runApplication setFields
#disU=`python -c "print($Uh*(1-$disturbancefraction))"`
#disH=`python -c "print($discharge/$disU)"`
funkySetFields -field alpha.water -expression "$fraction" -time 0 -keepPatches -condition "pos().x<$xx&&pos().y<$waterdepth+$disturbancefraction*$waterdepth*sin(2*$pival/$xx*pos().x)"
funkySetFields -field U -expression "vector($discharge/($waterdepth+$disturbancefraction*$waterdepth*sin(2*$pival/$xx*pos().x)),0,0)" -time 0 -keepPatches -condition "pos().x<$xx&&pos().y<$waterdepth+$disturbancefraction*$waterdepth*sin(2*$pival/$xx*pos().x)"
#disU=`python -c "print($Uh*(1-$disturbancefraction))"`
#disH=`python -c "print($discharge/$disU)"`
#funkySetFields -field alpha.water -expression "$fraction" -time 0 -keepPatches -condition "pos().x>($segment*(4*$disperiod-1))&&pos().x<($segment*(4*$disperiod))&&pos().y<$disH"
#funkySetFields -field U -expression "vector($disU,0,0)" -time 0 -keepPatches -condition "pos().x>($segment*(4*$disperiod-1))&&pos().x<($segment*(4*$disperiod))&&pos().y<$disH"
#
#looplimit=`python -c "print($disperiod*2-1)"`
# for num in $(seq 1 $looplimit)
# do
# disU=`python -c "print($Uh*(1-((-1 if $num%2 else 1))*$disturbancefraction))"`
# disH=`python -c "print($discharge/$disU)"`
# funkySetFields -field alpha.water -expression "$fraction" -time 0 -keepPatches -condition "pos().x>($segment*(1+2*($num-1)))&&pos().x<($segment*(1+(2*$num)))&&pos().y<$disH"
# funkySetFields -field U -expression "vector($disU,0,0)" -time 0 -keepPatches -condition "pos().x>($segment*(1+(2*($num-1))))&&pos().x<($segment*(1+(2*$num)))&&pos().y<$disH"
# done
runApplication $application
#------------------------------------------------------------------------------