@@ -72,18 +72,18 @@ and the continuity equation becomes
72
72
&= \int _\Omega \! f \nabla \cdot (q \vec {u}) \, \mathrm {d} x\\
73
73
&\quad - \int _{\Gamma _\mathrm {int}} \! \widetilde {f}(q_+ \vec {u} \cdot \vec {n}_+
74
74
+ q_- \vec {u} \cdot \vec {n}_-) \, \mathrm {d} S\\
75
- &\quad - \int _{\Gamma _{ \mathrlap { \mathrm {ext, inflow}}} } q f_\mathrm {in} \vec {u} \cdot
75
+ &\quad - \int _{\Gamma _I } q f_\mathrm {in} \vec {u} \cdot
76
76
\vec {n} \, \mathrm {d} s\\
77
- &\quad - \int _{\Gamma _{ \mathrlap { \mathrm {ext, outflow}}} } q f \vec {u} \cdot
77
+ &\quad - \int _{\Gamma _O } q f \vec {u} \cdot
78
78
\vec {n} \, \mathrm {d} s
79
79
\qquad \forall q \in V,
80
80
81
81
where :math: `\Omega ` is the computational domain in :math: `(x,v)`
82
82
space, :math: `V` is the discontinuous finite element space,
83
83
:math: `\Gamma _\mathrm {int}` is the set of interior cell edges,
84
- :math: `\Gamma _{ \mathrlap { \mathrm {ext, inflow}}} ` is the part of
84
+ :math: `\Gamma _I ` is the part of
85
85
exterior boundary where :math: `\vec {u}\cdot \vec {n}<0 `,
86
- :math: `\Gamma _{ \mathrlap { \mathrm {ext, outflow}}} ` is the part of
86
+ :math: `\Gamma _O ` is the part of
87
87
exterior boundary where :math: `\vec {u}\cdot \vec {n}>0 `, :math: `n` is
88
88
the normal to each edge, :math: `\tilde {f}` is the upwind value of
89
89
:math: `f`, and :math: `f_{\mathrm {in}}` is the inflow boundary value
@@ -151,15 +151,14 @@ the vertical. Here we will use periodic boundary conditions in the
151
151
:math: `x_1 ` direction, ::
152
152
153
153
ncells = 50
154
- L = 4 *pi
154
+ L = 8 *pi
155
155
base_mesh = PeriodicIntervalMesh(ncells, L)
156
156
157
157
The mesh is then extruded upwards in the "velocity" direction. ::
158
158
159
159
H = 10.0
160
160
nlayers = 50
161
- mesh = ExtrudedMesh(base_mesh, layers=nlayers,
162
- layer_height=H/nlayers)
161
+ mesh = ExtrudedMesh(base_mesh, layers=nlayers, layer_height=H/nlayers)
163
162
164
163
We want to have :math: `v=0 ` in the middle of the domain, so that we
165
164
can have negative and positive velocities. This requires to edit the
@@ -181,15 +180,19 @@ specified through the ``vfamily``. ::
181
180
Wbar = FunctionSpace(mesh, 'CG', 1, vfamily='R', vdegree=0)
182
181
183
182
We create a :class: `~.Function ` to store the solution at the current
184
- time, and then set its initial condition. ::
183
+ time, and then set its initial condition,
184
+
185
+ .. math ::
186
+
187
+ f(x,v,0 ) = \frac {1 }{\sqrt {2 \pi }}v^2 \exp (-v^2 /2 )(1 + A\cos (kx)),
188
+ \quad A=0.05 , \quad k=0.5 .
189
+
190
+ ::
185
191
186
192
fn = Function(V)
187
193
A = Constant(0.05)
188
194
k = Constant(0.5)
189
- fn.interpolate(
190
- v**2*exp(-v**2/2)
191
- *(1 + A*cos(k*x))/(2*pi)**0.5
192
- )
195
+ fn.interpolate(v**2*exp(-v**2/2)*(1 + A*cos(k*x))/(2*pi)**0.5)
193
196
194
197
We will need the (conserved) average :math: `\bar {f}` for the Poisson
195
198
equation. ::
0 commit comments