@@ -41,7 +41,8 @@ a(u,v) := \int_{\Omega} \left( \nabla u : \nabla v + r^{-2} u_r v_r \right) r dr
41
41
b(q,v) := \int_{\Omega} q \left( \mathrm{div}(v) + r^{-1} u_r \right) r dr dz
42
42
\end{aligned}
43
43
```
44
- where the usual Cartesian differential operators can be used.
44
+ where the usual Cartesian differential operators can be used. The factor ``2\pi`` from the
45
+ integral over the rotation angle drops out on both sides.
45
46
46
47
47
48
=#
@@ -52,16 +53,6 @@ using GradientRobustMultiPhysics
52
53
using ExtendableGrids
53
54
using GridVisualize
54
55
55
- # # data for axisymmetric Hagen-Poiseuille flow
56
- function exact_pressure! (μ)
57
- function closure (result,x)
58
- result[1 ] = 4 * μ* (1 - x[1 ])
59
- end
60
- end
61
- function exact_velocity! (result,x)
62
- result[1 ] = (1.0 - x[2 ]^ 2 );
63
- result[2 ] = 0.0 ;
64
- end
65
56
66
57
# # custom bilinearform a for the axisymmetric Stokes problem
67
58
function ASLaplaceOperator (μ)
@@ -108,14 +99,36 @@ function ASPressureOperatorTransposed()
108
99
end
109
100
110
101
# # everything is wrapped in a main function
111
- function main (; verbosity = 0 , Plotter = nothing , μ = 1 )
102
+ # # problem = 1 is Hagen-Poiseuille
103
+ # # problem = 2 is stagnation point flow without solid surface
104
+ # # μ = viscosity
105
+ # # k = parameter for problem = 2
106
+ function main (; problem = 1 , k = 1 , verbosity = 0 , Plotter = nothing , μ = 1 )
112
107
113
108
# # set log level
114
109
set_verbosity (verbosity)
115
110
111
+ # # boundary/comparison data for axisymmetric Hagen-Poiseuille flow
112
+ function exact_pressure! (result, x)
113
+ if problem == 1 # Hagen-Poiseuille
114
+ result[1 ] = 4 * μ* (1 - x[1 ])
115
+ elseif problem == 2 # stagnation point flow without solid surface
116
+ result[1 ] = k
117
+ end
118
+ end
119
+ function exact_velocity! (result, x)
120
+ if problem == 1 # Hagen-Poiseuille
121
+ result[1 ] = (1.0 - x[2 ]^ 2 );
122
+ result[2 ] = 0.0 ;
123
+ elseif problem == 2 # stagnation point flow without solid surface
124
+ result[1 ] = - 2 * k* x[1 ]
125
+ result[2 ] = k* x[2 ]
126
+ end
127
+ end
128
+
116
129
# # negotiate data functions to the package
117
130
u = DataFunction (exact_velocity!, [2 ,2 ]; name = " u" , dependencies = " X" , bonus_quadorder = 2 )
118
- p = DataFunction (exact_pressure! (μ) , [1 ,2 ]; name = " p" , dependencies = " X" , bonus_quadorder = 1 )
131
+ p = DataFunction (exact_pressure!, [1 ,2 ]; name = " p" , dependencies = " X" , bonus_quadorder = 1 )
119
132
120
133
# # grid
121
134
xgrid = uniform_refine (grid_unitsquare (Triangle2D), 5 );
@@ -132,9 +145,14 @@ function main(; verbosity = 0, Plotter = nothing, μ = 1)
132
145
add_operator! (Problem, [2 ,1 ], ASPressureOperatorTransposed ())
133
146
134
147
# # boundary conditions
135
- add_boundarydata! (Problem, 1 , [4 ], BestapproxDirichletBoundary; data = u)
136
- add_boundarydata! (Problem, 1 , [3 ], HomogeneousDirichletBoundary)
137
- add_boundarydata! (Problem, 1 , [1 ], HomogeneousDirichletBoundary; mask = (0 ,1 ))
148
+ if problem == 1
149
+ add_boundarydata! (Problem, 1 , [3 ,4 ], InterpolateDirichletBoundary; data = u)
150
+ add_boundarydata! (Problem, 1 , [1 ], HomogeneousDirichletBoundary; mask = (0 ,1 ))
151
+ elseif problem == 2
152
+ add_boundarydata! (Problem, 1 , [2 ], InterpolateDirichletBoundary; data = u)
153
+ add_boundarydata! (Problem, 1 , [4 ], HomogeneousDirichletBoundary; mask = (1 ,0 ))
154
+ add_boundarydata! (Problem, 1 , [1 ], HomogeneousDirichletBoundary; mask = (0 ,1 ))
155
+ end
138
156
@show Problem
139
157
140
158
# # generate FESpaces
@@ -152,8 +170,9 @@ function main(; verbosity = 0, Plotter = nothing, μ = 1)
152
170
153
171
# # plot
154
172
p = GridVisualizer (; Plotter = Plotter, layout = (1 ,2 ), clear = true , resolution = (1000 ,500 ))
155
- scalarplot! (p[1 ,1 ],xgrid,view (nodevalues (Solution[1 ]; abs = true ),1 ,:), levels = 9 )
156
- scalarplot! (p[1 ,2 ],xgrid,view (nodevalues (Solution[2 ]),1 ,:), levels = 11 , title = " p_h" )
173
+ scalarplot! (p[1 ,1 ],xgrid,view (nodevalues (Solution[1 ]; abs = true ),1 ,:), levels = 6 , xlabel = " z" , ylabel = " r" )
174
+ vectorplot! (p[1 ,1 ],xgrid,evaluate (PointEvaluator (Solution[1 ], Identity)), spacing = 0.1 , clear = false )
175
+ scalarplot! (p[1 ,2 ],xgrid,view (nodevalues (Solution[2 ]),1 ,:), levels = 5 , xlabel = " z" , ylabel = " r" , title = " p_h" )
157
176
end
158
177
159
178
end
0 commit comments