Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
dedbb1e1
Commit
dedbb1e1
authored
Feb 10, 2013
by
Matthieu Schaller
Browse files
Added an improved version of the time step estimator to the theory file.
Former-commit-id: 7b2668c51f7510f061943e7e2c072b82538a0f3a
parent
faaf4fc8
Changes
1
Hide whitespace changes
Inline
Side-by-side
theory/latex/sph.tex
View file @
dedbb1e1
...
...
@@ -33,6 +33,7 @@ Every particle contains the following information:
Smoothing length
&
Secondary
&$
h
$
&
$
[
m
]
$
\\
Smoothing length derivative
&
Tertiary
&$
\frac
{
dh
}{
dt
}$
&
$
[
m
\cdot
s
^{
-
1
}
]
$
\\
Time step
&
Secondary
&
$
\Delta
t
$
&
$
[
s
]
$
\\
Signal velocity
&
Secondary
&
$
v
_{
sig
}$&
$
[
m
\cdot
s
^{
-
1
}
]
$
\\
\hline
Artificial viscosity
&
Primary
&
$
\alpha
$
&
$
[-]
$
\\
Artificial conductivity
&
Primary
&
$
\alpha
_
u
$
&
$
[-]
$
\\
...
...
@@ -51,7 +52,7 @@ $\frac{P}{\rho\Omega}$ instead of $\Omega$ may be options worth exploring. \\
The four quantities in the second part of the table are used in improved state-of-the-art implementations of SPH. In a
first approximation, they can be neglected.
\\
In what follows, we will use
$
\vec
{
r
}_{
ij
}
=
\vec
{
x
_
i
}
-
\vec
{
x
_
j
}$
and
$
\hat
{
r
}_{
ij
}
=
\vec
{
r
}_{
ij
}
/
x
|
\vec
{
r
}_{
ij
}
|
$
In what follows, we will use
$
\vec
{
r
}_{
ij
}
=
\vec
{
x
_
i
}
-
\vec
{
x
_
j
}$
and
$
\hat
{
r
}_{
ij
}
=
\vec
{
r
}_{
ij
}
/
|
\vec
{
r
}_{
ij
}
|
$
to simplify the notation.
\section
{
Kernel function
}
...
...
@@ -180,18 +181,24 @@ First, the pressure has to be evaluated evaluated using the equation of state
P
_
i =
\rho
_
i u
_
i (
\gamma
- 1)
\end{equation}
where
$
\gamma
$
is the polytropic index. Usually,
$
\gamma
=
\frac
{
5
}{
3
}$
.
where
$
\gamma
$
is the polytropic index. Usually,
$
\gamma
=
\frac
{
5
}{
3
}$
. The speed of sound in the particle is then
obtained using
\begin{equation}
c
_
i =
\sqrt
{
\frac
{
\gamma
P
_
i
}{
\rho
_
i
}}
=
\sqrt
{
\gamma
(
\gamma
-1)u
_
i
}
.
\end{equation}
The second loop is used to compute the accelerations (tertiary quantities). The exact expressions are
\begin{eqnarray}
\vec
{
a
_
i
}
&
=
&
-
\sum
_
j m
_
j
\left
[
\frac
{
P
_
i
}{
\Omega
_
i
\rho
_
i
^
2
}
\vec
{
\nabla
_
r
}
W(
\vec
{
r
}_{
ij
}
, h
_
i) +
\frac
{
P
_
j
}{
\Omega
_
j
\rho
_
j
^
2
}
\vec
{
\nabla
_
r
}
W(
\vec
{
r
}_{
ij
}
, h
_
j)
\right
]
\label
{
eq:acceleration
}
\\
\frac
{
du
_
i
}{
dt
}
&
=
&
\frac
{
P
_
i
}{
\
textcolor
{
red
}{
\
Omega
_
i
}
\rho
_
i
^
2
}
\sum
_
j m
_
j
\frac
{
du
_
i
}{
dt
}
&
=
&
\frac
{
P
_
i
}{
\Omega
_
i
\rho
_
i
^
2
}
\sum
_
j m
_
j
(
\vec
{
v
_
i
}
-
\vec
{
v
_
j
}
)
\cdot\vec
{
\nabla
_
r
}
W(
\vec
{
r
}_{
ij
}
, h
_
i)
\label
{
eq:dudt
}
\\
\frac
{
dh
_
i
}{
dt
}
&
=
&
\frac
{
h
_
i
}{
3
}
\sum
_
j
\frac
{
m
_
j
}{
\rho
_
j
}
\left
(
\vec
{
v
_
j
}
-
\vec
{
v
_
i
}
\right
)
\cdot\vec
{
\nabla
_
r
}
W(
\vec
{
r
}_{
ij
}
,
h
_
i)
\cdot\vec
{
\nabla
_
r
}
W(
\vec
{
r
}_{
ij
}
,
h
_
i)
\\
v
_{
sig,i
}
&
=
&
c
_
i + c
_
j +
\max
_
j(0,
\hat
{
r
}_{
ij
}
\cdot
(
\vec
{
v
}_
j -
\vec
{
v
}
_
i)
)
\end{eqnarray}
In practice the loop is here performed over all pairs of particles such that
$
|
\vec
{
r
}_{
ij
}
| <
\zeta
h
_
i
$
or
...
...
@@ -200,20 +207,15 @@ h_j$. In general, the equations are more involved as they will contain terms to
thermal conduction. These terms are pure functions of the properties of particles
$
i
$
and
$
j
$
and are thus very simple
to insert once the code is stabilized.
\\
The time steps are computed using the speed of sound inside each ``kernel volume'' surrounding the particle:
\begin{equation}
c
_
i =
\sqrt
{
\frac
{
\gamma
P
_
i
}{
\rho
_
i
}}
=
\sqrt
{
\gamma
(
\gamma
-1)u
_
i
}
\end{equation}
The time step is then given by the Courant relation:
The time step is given by the Courant relation where the cell size is the smoothing length and the velocitiy is the
signal speed:
\begin{equation}
\Delta
t
_
i = C
_{
CFL
}
\frac
{
h
_
i
}{
c
_
i
}
\Delta
t
_
i = C
_{
CFL
}
\frac
{
2
h
_
i
}{
v
_{
sig,i
}}
.
\label
{
eq:dt
}
\end{equation}
where t
he Courant parameter (
$
C
_{
DFL
}$
)usually takes a value between
$
0
.
2
$
and
$
0
.
3
$
. The integration in time can then
T
he Courant parameter (
$
C
_{
DFL
}$
)usually takes a value between
$
0
.
2
$
and
$
0
.
3
$
. The integration in time can then
take place. The
leapfrog integrator is usually used as it behaves well when coupled to gravity.
\\
In the case where only one global time step is used for all particles, the minimal time step of all particles is reduced
...
...
@@ -262,7 +264,7 @@ energy $u_{i,pred}$ for BOTH particles. \\
\textbf
{
New time step
}
Calculate the next time step.
\begin{equation*}
\Delta
t
^{
n+1
}
= C
_{
CFL
}
\frac
{
h
_
i
}{
c
_
i
}
,
\qquad
c
_
i =
\sqrt
{
\gamma
(
\gamma
-1)u
_{
i,pred
}}
\Delta
t
^{
n+1
}
= C
_{
CFL
}
\frac
{
2
h
_
i
}{
v
_{
sig,i
}}
\end{equation*}
...
...
@@ -273,8 +275,8 @@ energy $u_{i,pred}$ for BOTH particles. \\
\textbf
{
Second kick
}
Kick the particle for the second half-step.
\begin{eqnarray*}
v
_
i
^{
n+1
}
&
=
&
v
_
i
^{
n+1/2
}
+
\frac
{
1
}{
2
}
a
_
i
^{
\textcolor
{
red
}{
n+1
}
}
\Delta
t
^{
\textcolor
{
red
}{
n
}
}
\\
u
_
i
^{
n+1
}
&
=
&
u
_
i
^{
n+1/2
}
+
\frac
{
1
}{
2
}
\frac
{
du
_
i
^{
\textcolor
{
red
}{
n+1
}}
}
{
dt
}
\Delta
t
^{
\textcolor
{
red
}{
n
}
}
\\
v
_
i
^{
n+1
}
&
=
&
v
_
i
^{
n+1/2
}
+
\frac
{
1
}{
2
}
a
_
i
^{
n+1
}
\Delta
t
^{
n
}
\\
u
_
i
^{
n+1
}
&
=
&
u
_
i
^{
n+1/2
}
+
\frac
{
1
}{
2
}
\frac
{
du
_
i
^{
n+1
}}{
dt
}
\Delta
t
^{
n
}
\\
v
_{
i,pred
}
&
=
&
v
_
i
^{
n+1
}
\\
u
_{
i,pred
}
&
=
&
u
_
i
^{
n+1
}
\\
\end{eqnarray*}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment