File: cap.gfs

package info (click to toggle)
gerris 20131206%2Bdfsg-21
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,252 kB
  • sloc: ansic: 66,595; sh: 15,922; f90: 1,513; makefile: 1,150; fortran: 696; python: 493; awk: 104; lisp: 89; xml: 27
file content (149 lines) | stat: -rw-r--r-- 3,200 bytes parent folder | download | duplicates (5)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# Title: Spherical cap bubble
#
# Description:
#
# We now take Ar = 80 and Bo = 40. For these values, the bubble's shape is 
# that of a spherical cap, for which the terminal velocity is given 
# approximately as:
# \begin{equation}
#	\frac{U}{U_c} = 0.71\left[ 1-\frac{\rho_b}{\rho_f} \right]^{1/2} 
#   \approx 0.71.
# \end{equation}
# The characteristic velocity is $U_c = \sqrt{g D}$ and the characteristic
# time is $t_c = D/U_c$. 
# \begin{figure}\centering
# \includegraphics{vel.eps}
# \end{figure}
# 
# Author: Dustin Langewisch
# Command: bash bubble.sh cap.gfs
# Version: 130112
# Required files: bubble.sh bubble.gfv
# Running time: 7 min (4 processors)
# Generated files: vel.eps

## Density Ratio (rho_f / rho_v)
Define RHOR 1000.0
##
## Viscosity Ratio (mu_f / mu_v)
Define MUR 100.0
##
## Archimedes Number
Define Ar 80.0
##
## Bond Number
Define Bo 40.0
##
## Domain half-width (WIDTH*Diameter)
Define WIDTH 6.0
##
## Min/Max Refinement levels 
Define MINLEVEL 4
Define MIDLEVEL (MINLEVEL+2)
Define MAXLEVEL (MIDLEVEL+2)

Define VAR(T,min,max) (min + CLAMP(T,0,1)*(max-min))
##
## Density
Define RHO(T) VAR(T,1.0,1.0/RHOR)
##
## Viscosity (harmonic mean)
Define MUHARM(T)  1.0/VAR(T,1.0,MUR)

Define MAXTIME 35

8 7 GfsAxi GfsBox GfsGEdge { x = -1.0 } {

    Time { end = MAXTIME }
    PhysicalParams { L = WIDTH }

    GModule hypre

    Refine 6

    VariableTracerVOFHeight T

    VariableFiltered  T1 T 1
    VariableCurvature K T Kmax

    InitFraction  T ( -(x*x)-(y*y)+(.25) )

    PhysicalParams { alpha = 1.0/RHO(T1) }

    Source {} U -1.0

    SourceViscosity MUHARM(T1)/Ar

    SourceTension T 1.0/Bo K

    AdaptGradient  { istep = 1 } { 
	maxlevel = MAXLEVEL
	minlevel = MINLEVEL 
	cmax = 1e-2
    } T1

    AdaptVorticity { istep = 1 } { 
	maxlevel = MIDLEVEL
	minlevel = MINLEVEL
	cmax = 1e-2 
	cfactor = 1
    }

    EventBalance { istep = 10 } 0.1

    OutputProjectionStats { istep = 10 } stderr
    OutputDiffusionStats  { istep = 10 } stderr
    OutputBalance         { istep = 10 } stderr
    OutputTime            { istep = 10 } stderr

	## compute bubble volume (needed to compute centroid)
    SpatialSum { step = .1 } bubble_volume T

	## write bubble position and velocity
    OutputScalarSum { step = .1 } {
	awk '{
	  if (NR == 1) {
	     ## analytical solution (terminal velocity)
	     uex  = 0.71
	     print $3, $5, 0.0, uex;
	  }
          else {
	     print (t+$3)/2., $5, ($5-x)/($3-t), uex;
	  }
          t = $3; x = $5;
          fflush(stdout)
        }' > xv
    } { v = x*T/bubble_volume }

    OutputSimulation  { istep = 10  } stdout

    GfsEventScript { start = end } {
	gnuplot <<- EOF
			set key bottom right
			set xlabel "time"
			set ylabel "velocity"
			set term postscript eps lw 3 solid 20 colour
			set output "vel.eps"
			plot 'xv' u 1:3 title "computed", \
			       '' u 1:4 w l title "analytical approx."
		EOF
    }

}

GfsBox { bottom = Boundary }
GfsBox { bottom = Boundary }
GfsBox { bottom = Boundary }
GfsBox { bottom = Boundary }
GfsBox { bottom = Boundary }
GfsBox { bottom = Boundary }
GfsBox { bottom = Boundary }
GfsBox { bottom = Boundary }

1 2 right
2 3 right
3 4 right
4 5 right
5 6 right
6 7 right
7 8 right