Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaem committed Feb 19, 2024
1 parent b9741fe commit b032db0
Show file tree
Hide file tree
Showing 27 changed files with 484 additions and 472 deletions.
17 changes: 14 additions & 3 deletions demo/OrrSommerfeld_eigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def assemble(self, scale=None):
v = TestFunction(test)
u = TrialFunction(trial)

Re = self.Re
a = self.alfa
g = 1j*a*Re

# (u'', v)_w
K = inner(v, Dx(u, 0, 2))

Expand All @@ -91,11 +95,18 @@ def assemble(self, scale=None):
# (u, v)_w
M = inner(v, u)

Re = self.Re
a = self.alfa
B = -Re*a*1j*(K-a**2*M)
A = Q-2*a**2*K+(a**4 - 2*a*Re*1j)*M - 1j*a*Re*(K2-a**2*K1)

# Alternatively:
#A1 = lambda f: Dx(f, 0, 4)-2*a**2*Dx(f, 0, 2)+(a**4-2*g)*f-g*(1-x**2)*(Dx(f, 0, 2)-f)
#B1 = lambda f: -g*(Dx(f, 0, 2)-f)
#A = inner(A1(u), v)
#B = inner(B1(u), v)
#A = sum(A[1:], A[0])
#B = sum(B[1:], B[0])
A, B = A.diags().toarray(), B.diags().toarray()

if scale is not None and not (scale[0] == 0 and scale[1] == 0):
assert isinstance(scale, tuple)
assert len(scale) == 2
Expand Down Expand Up @@ -147,7 +158,7 @@ def get_eigval(nx, eigvals, verbose=False):
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(description='Orr Sommerfeld parameters')
parser.add_argument('--N', type=int, default=120,
parser.add_argument('--N', type=int, default=400,
help='Number of discretization points')
parser.add_argument('--Re', default=8000.0, type=float,
help='Reynolds number')
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/DrivenCavity/drivencavity.do.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The nonlinear steady Navier Stokes equations are given in strong form as
!et
where $\bs{u}, p$ and $\nu$ are, respectively, the
fluid velocity vector, pressure and kinematic viscosity. The domain
$\Omega = [-1, 1]^2$ and the nonlinear term $\bs{u} \bs{u}$ is the
$\Omega = (-1, 1)^2$ and the nonlinear term $\bs{u} \bs{u}$ is the
outer product of vector $\bs{u}$ with itself. Note that the final
$\int_{\Omega} p dx = 0$ is there because there is no Dirichlet boundary
condition on the pressure and the system of equations would otherwise be
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/KleinGordon/kleingordon.do.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ t=0)}{\partial t} = u_t^0. label{eq:init}
The spatial coordinates are here denoted as $\boldsymbol{x} = (x, y, z)$, and
$t$ is time. The parameter $\gamma=\pm 1$ determines whether the equations are focusing
($+1$) or defocusing ($-1$) (in the movie we have used $\gamma=1$).
The domain $\Omega=[-2\pi, 2\pi]^3$ is triply
The domain $\Omega=[-2\pi, 2\pi)^3$ is triply
periodic and initial conditions will here be set as

!bt
Expand Down
4 changes: 2 additions & 2 deletions docs/demos/KuramatoSivashinsky/kuramatosivashinsky.do.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ FIGURE: [https://rawgit.com/spectralDNS/spectralutilities/master/movies/Kuramato

The Kuramato-Sivashinsky (KS) equation is known for its chaotic bahaviour, and it is
often used in study of turbulence or turbulent combustion. We will here solve
the KS equation in a doubly periodic domain $[-30\pi, 30\pi]^2$, starting from a
the KS equation in a doubly periodic domain $\Omega=[-30\pi, 30\pi)^2$, starting from a
single Gaussian pulse
!bt
\begin{align}
\frac{\partial u(\bs{x},t)}{\partial t} &+ \nabla^2 u(\bs{x},t) + \nabla^4
u(\bs{x},t) + |\nabla u(\bs{x},t)|^2 = 0 \quad \text{for }\, \bs{x} \in \Omega=[-30 \pi, 30\pi]^2
u(\bs{x},t) + |\nabla u(\bs{x},t)|^2 = 0 \quad \text{for }\, \bs{x} \in \Omega
label{eq:ks} \\
u(\bs{x}, 0) &= \exp(-0.01 \bs{x} \cdot \bs{x}) \notag
\end{align}
Expand Down
8 changes: 4 additions & 4 deletions docs/demos/Moebius/moebius.do.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ regular periodic boundary conditions
\end{equation}
!et
will apply cite{Kalvoda2020}, and we can discretize using Fourier
exponentials in the $\theta$-direction. Since the reference domain of Fourier
exponentials is $[-\pi, \pi]$ we define $\varphi = \theta /(2 R)$, such that
the computational domain is $(\varphi, t) \in \mathbb{I}^2 = [-\pi, \pi] \times [-1, 1]$,
exponentials in the $\theta$-direction. Since the reference domain of periodic Fourier
exponentials is $[-\pi, \pi)$ we define $\varphi = \theta /(2 R)$, such that
the computational domain is $(\varphi, t) \in \mathbb{I}^2 = [-\pi, \pi) \times (-1, 1)$,
with the parametrization

!bt
Expand All @@ -65,7 +65,7 @@ with the parametrization
z(\varphi, t) &= -t \sin {\varphi}.
\end{align}
!et
Note that the reference domain corresponds to $(\theta, t) \in = [-2\pi R, 2\pi R] \times [-1, 1]$.
Note that the reference domain corresponds to $(\theta, t) \in = [-2\pi R, 2\pi R) \times (-1, 1)$.
It is also trivial to adjust the $t$-domain with an affine map for a more narrow or
wider strip, but this added complexity is not discussed here. One can simply
choose the width of the strip below when choosing function space for the
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/Poisson/poisson.do.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Poisson's equation is given as

!bt
\begin{align}
\nabla^2 u(x) &= f(x) \quad \text{for }\, x \in [-1, 1], label{eq:poisson}\\
\nabla^2 u(x) &= f(x) \quad \text{for }\, x \in (-1, 1), label{eq:poisson}\\
u(-1)&=a, u(1)=b, \notag
\end{align}
!et
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/Poisson3D/poisson3d.do.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ u(x, y, 2\pi) &= u(x, y, 0),
\end{align}
!et
where $u(\bs{x})$ is the solution and $f(\bs{x})$ is a function. The domain
$\Omega = [-1, 1]\times [0, 2\pi]^2$.
$\Omega = (-1, 1)\times [0, 2\pi)^2$.

To solve Eq. (ref{eq:3d:poisson}) with the Galerkin method we will make use of
smooth basis functions, $v(\bs{x})$, that satisfy the given boundary
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/PolarHelmholtz/polarhelmholtz.do.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ We use polar coordinates $(\theta, r)$, defined as
\end{align}
!et

which leads to a Cartesian product mesh $(\theta, r) \in [0, 2\pi) \times [0, a]$
which leads to a Cartesian product mesh $(\theta, r) \in [0, 2\pi) \times (0, a)$
suitable for numerical implementations. Note that the
two directions are ordered with $\theta$ first and then $r$, which is less common
than $(r, \theta)$. This has to do with the fact that we will need to
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/RayleighBenard/rayleighbenard.do.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TOC: off
===== The Rayleigh Bénard equations =====
label{demo:rayleighbenard}

The governing equations solved in domain $\Omega=[-1, 1]\times [0, 2\pi]$ are
The governing equations solved in domain $\Omega=(-1, 1)\times [0, 2\pi)$ are

!bt
\begin{align}
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/Stokes/stokes.do.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Stokes' equations are given in strong form as
!et
where $\bs{u}$ and $p$ are, respectively, the
fluid velocity vector and pressure, and the domain
$\Omega = [0, 2\pi]^2 \times [-1, 1]$. The flow is assumed periodic
$\Omega = [0, 2\pi)^2 \times (-1, 1)$. The flow is assumed periodic
in $x$ and $y$-directions, whereas there is a no-slip homogeneous Dirichlet
boundary condition on $\bs{u}$ on the boundaries of the $z$-direction, i.e.,
$\bs{u}(x, y, \pm 1) = (0, 0, 0)$. (Note that we can configure shenfun with
Expand Down
4 changes: 2 additions & 2 deletions docs/demos/Tau/tau.do.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ TOC: off

===== The tau method for Poisson's equation in 1D =====

Poisson's equation is given on a domain $[-1, 1]$ as
Poisson's equation is given on a domain $\Omega = (-1, 1)$ as

!bt
\begin{align}
\nabla^2 u(x) &= f(x) \quad \text{for }\, x \in [-1, 1], label{eq:poisson}\\
\nabla^2 u(x) &= f(x) \quad \text{for }\, x \in \Omega, label{eq:poisson}\\
u(-1)&=a, u(1)=b, \notag
\end{align}
!et
Expand Down
2 changes: 1 addition & 1 deletion docs/source/drivencavity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The nonlinear steady Navier Stokes equations are given in strong form as
where :math:`\boldsymbol{u}, p` and :math:`\nu` are, respectively, the
fluid velocity vector, pressure and kinematic viscosity. The domain
:math:`\Omega = [-1, 1]^2` and the nonlinear term :math:`\boldsymbol{u} \boldsymbol{u}` is the
:math:`\Omega = (-1, 1)^2` and the nonlinear term :math:`\boldsymbol{u} \boldsymbol{u}` is the
outer product of vector :math:`\boldsymbol{u}` with itself. Note that the final
:math:`\int_{\Omega} p dx = 0` is there because there is no Dirichlet boundary
condition on the pressure and the system of equations would otherwise be
Expand Down

0 comments on commit b032db0

Please sign in to comment.