File: swirl.gfs

package info (click to toggle)
gerris 20131206%2Bdfsg-21
  • links: PTS, VCS
  • area: main
  • in suites: 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 (159 lines) | stat: -rw-r--r-- 3,979 bytes parent folder | download | duplicates (2)
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
150
151
152
153
154
155
156
157
158
159
# Title: Boundary layer on a rotating disk
#
# Description:
#
# Von K\'arm\'an \cite{karman1921} showed that the steady flow of an
# incompressible liquid of kinematic viscosity $\nu$ induced by an
# infinite plane disk rotating at angular velocity $\Omega$ can be
# described by a similarity solution. In effect, using
# $\zeta=z\sqrt{\Omega/\nu}$ and setting the axial velocity $U$,
# radial velocity $V$ and azimuthal velocity $W$ as
# $$
# U=\sqrt{\nu \Omega} F(\zeta) \quad V=\Omega r H(\zeta) 
# \quad W = \Omega r G(\zeta)
# $$
# the Navier-Stokes equations reduce to a couple of ODEs:
# $$
# F'''-F\, F'' +F'^2/2 +2G^2  = 0 \quad \mbox{and} \quad G''-F\,G'+G\,F' = 0
# $$
# with boundary conditions
# $$
# F(0)=F'(0)=0 \: G(0)=1. \quad \mbox{and} \quad F'(\infty)=G(\infty)=0.
# $$
# where the prime denotes differentiation with respect to $\zeta$.
#
# In figure \ref{veloc} the analytical dimensionless axial and
# azimuthal velocities of Von K\'arm\'an are compared with the
# numerical solutions obtained with the axisymmetric solver including
# azimuthal velocity (swirl).
#
# \begin{figure}[htbp]
# \caption{\label{veloc} Profiles of dimensionless axial and azimuthal velocities.}
# \begin{center}
# \includegraphics[width=0.8\hsize]{profiles.eps}
# \end{center}
# \end{figure}
#
# Author: J.M. L\'opez-Herrera
# Command: gerris2D swirl.gfs
# Version: 111123
# Required files: analytical
# Running time: 1 minute
# Generated files: profiles.eps
#
4 3 GfsAxi GfsBox GfsGEdge { x = 0.5 } {
    PhysicalParams { L = 3 }
    SourceViscosity 0.2

    # the block below adds the azimuthal velocity (swirl) and
    # associated terms
    VariableTracer W
    SourceDiffusion W 0.2
    Init { istep = 1 } { W = W*(1. - dt*V/y) }
    Source V W*W/y

    Refine 5
    Time { end = 12 dtmax = 2e-2 }
    EventStop { step = 0.1 } U 1e-3 DU
#    OutputTime { istep = 10 } stderr
#    OutputProjectionStats { istep = 10 } stderr
#    OutputSimulation { istep = 10 } stdout
    OutputSimulation { start = end } end.txt { format = text variables = U,W }
    OutputSimulation { start = end } end.gfs

    EventScript { start = end } {
	awk 'BEGIN{ nu = 0.2 } {
               if ($2 != 0. && $1 != "#" && ($1*$1 + $2*$2) < 8.0)
                 print $1/sqrt(nu),-$4/sqrt(nu),$5/$2;
             }' < end.txt > nu
	if gnuplot <<EOF ; then :
    set term postscript eps lw 3 color solid 20 enhanced
    set output 'profiles.eps'
    set xlabel '{/Symbol z}'
    set key center right
    plot [0:6]'analytical' u 1:2 w l t '-F({/Symbol z})', 'nu' u 1:2 t 'Gerris', \
              'analytical' u 1:3 w l t 'G({/Symbol z})', 'nu' u 1:3 t 'Gerris'
EOF
	else
	    exit $GFS_STOP;
	fi

	if python3 <<EOF ; then :
from check import *
from sys import *
if (Curve('nu',1,2) - Curve('analytical',1,2)).normi() > 8e-3 or \
   (Curve('nu',1,3) - Curve('analytical',1,3)).normi() > 8e-3 :
    print((Curve('nu',1,2) - Curve('analytical',1,2)).normi())
    print((Curve('nu',1,3) - Curve('analytical',1,3)).normi())
    exit(1)
EOF
	else
	    exit $GFS_STOP;
	fi
    }
}
# box 1
GfsBox {
    left = Boundary {
	BcDirichlet U 0
	BcDirichlet V 0
	BcDirichlet W y
    }
    right = Boundary {
	BcNeumann U 0
	BcNeumann V 0
	BcNeumann W 0
        BcDirichlet P 0.
    }
    bottom = Boundary { BcDirichlet W 0 }
}
# box 2
GfsBox {
    left = Boundary {
	BcDirichlet U 0
	BcDirichlet V 0
	BcDirichlet W y
    }
    right = Boundary {
	BcNeumann U 0
	BcNeumann V 0
	BcNeumann W 0
        BcDirichlet P 0.
    }
}
# box 3
GfsBox {
    left = Boundary {
	BcDirichlet U 0
	BcDirichlet V 0
	BcDirichlet W y
    }
    right = Boundary {
	BcNeumann U 0
	BcNeumann V 0
	BcNeumann W 0
        BcDirichlet P 0.
    }
}
# box 4
GfsBox {
    left = Boundary {
	BcDirichlet U 0
	BcDirichlet V 0
	BcDirichlet W y
    }
    right = Boundary {
	BcNeumann U 0
	BcNeumann V 0
	BcNeumann W 0
        BcDirichlet P 0.
    }
    top = Boundary {
	BcNeumann U 0
	BcNeumann V 0
	BcNeumann W 0
    }
}
1 2 top
2 3 top
3 4 top