Skip to content

Commit 58f38be

Browse files
committed
8*pi
1 parent a12adc1 commit 58f38be

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

demos/vlasov_poisson_1d/vp1d.py.rst

+15-12
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,18 @@ and the continuity equation becomes
7272
&= \int_\Omega \! f \nabla \cdot (q \vec{u}) \, \mathrm{d} x\\
7373
&\quad- \int_{\Gamma_\mathrm{int}} \! \widetilde{f}(q_+ \vec{u} \cdot \vec{n}_+
7474
+ 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
7676
\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
7878
\vec{n} \, \mathrm{d} s
7979
\qquad \forall q \in V,
8080
8181
where :math:`\Omega` is the computational domain in :math:`(x,v)`
8282
space, :math:`V` is the discontinuous finite element space,
8383
: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
8585
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
8787
exterior boundary where :math:`\vec{u}\cdot\vec{n}>0`, :math:`n` is
8888
the normal to each edge, :math:`\tilde{f}` is the upwind value of
8989
: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
151151
:math:`x_1` direction, ::
152152
153153
ncells = 50
154-
L = 4*pi
154+
L = 8*pi
155155
base_mesh = PeriodicIntervalMesh(ncells, L)
156156

157157
The mesh is then extruded upwards in the "velocity" direction. ::
158158
159159
H = 10.0
160160
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)
163162

164163
We want to have :math:`v=0` in the middle of the domain, so that we
165164
can have negative and positive velocities. This requires to edit the
@@ -181,15 +180,19 @@ specified through the ``vfamily``. ::
181180
Wbar = FunctionSpace(mesh, 'CG', 1, vfamily='R', vdegree=0)
182181

183182
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+
::
185191
186192
fn = Function(V)
187193
A = Constant(0.05)
188194
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)
193196

194197
We will need the (conserved) average :math:`\bar{f}` for the Poisson
195198
equation. ::

0 commit comments

Comments
 (0)