Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
dedbb1e1
Commit
dedbb1e1
authored
12 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Added an improved version of the time step estimator to the theory file.
Former-commit-id: 7b2668c51f7510f061943e7e2c072b82538a0f3a
parent
faaf4fc8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
theory/latex/sph.tex
+19
-17
19 additions, 17 deletions
theory/latex/sph.tex
with
19 additions
and
17 deletions
theory/latex/sph.tex
+
19
−
17
View file @
dedbb1e1
...
@@ -33,6 +33,7 @@ Every particle contains the following information:
...
@@ -33,6 +33,7 @@ Every particle contains the following information:
Smoothing length
&
Secondary
&$
h
$
&
$
[
m
]
$
\\
Smoothing length
&
Secondary
&$
h
$
&
$
[
m
]
$
\\
Smoothing length derivative
&
Tertiary
&$
\frac
{
dh
}{
dt
}$
&
$
[
m
\cdot
s
^{
-
1
}
]
$
\\
Smoothing length derivative
&
Tertiary
&$
\frac
{
dh
}{
dt
}$
&
$
[
m
\cdot
s
^{
-
1
}
]
$
\\
Time step
&
Secondary
&
$
\Delta
t
$
&
$
[
s
]
$
\\
Time step
&
Secondary
&
$
\Delta
t
$
&
$
[
s
]
$
\\
Signal velocity
&
Secondary
&
$
v
_{
sig
}$&
$
[
m
\cdot
s
^{
-
1
}
]
$
\\
\hline
\hline
Artificial viscosity
&
Primary
&
$
\alpha
$
&
$
[-]
$
\\
Artificial viscosity
&
Primary
&
$
\alpha
$
&
$
[-]
$
\\
Artificial conductivity
&
Primary
&
$
\alpha
_
u
$
&
$
[-]
$
\\
Artificial conductivity
&
Primary
&
$
\alpha
_
u
$
&
$
[-]
$
\\
...
@@ -51,7 +52,7 @@ $\frac{P}{\rho\Omega}$ instead of $\Omega$ may be options worth exploring. \\
...
@@ -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
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.
\\
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.
to simplify the notation.
\section
{
Kernel function
}
\section
{
Kernel function
}
...
@@ -180,18 +181,24 @@ First, the pressure has to be evaluated evaluated using the equation of state
...
@@ -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)
P
_
i =
\rho
_
i u
_
i (
\gamma
- 1)
\end{equation}
\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
The second loop is used to compute the accelerations (tertiary quantities). The exact expressions are
\begin{eqnarray}
\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) +
\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
{
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)
(
\vec
{
v
_
i
}
-
\vec
{
v
_
j
}
)
\cdot\vec
{
\nabla
_
r
}
W(
\vec
{
r
}_{
ij
}
, h
_
i)
\label
{
eq:dudt
}
\\
\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
)
\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
}
,
\cdot\vec
{
\nabla
_
r
}
W(
\vec
{
r
}_{
ij
}
,
h
_
i)
\\
h
_
i)
v
_{
sig,i
}
&
=
&
c
_
i + c
_
j +
\max
_
j(0,
\hat
{
r
}_{
ij
}
\cdot
(
\vec
{
v
}_
j -
\vec
{
v
}
_
i)
)
\end{eqnarray}
\end{eqnarray}
In practice the loop is here performed over all pairs of particles such that
$
|
\vec
{
r
}_{
ij
}
| <
\zeta
h
_
i
$
or
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
...
@@ -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
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.
\\
to insert once the code is stabilized.
\\
The time steps are computed using the speed of sound inside each ``kernel volume'' surrounding the particle:
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}
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:
\begin{equation}
\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
}
\label
{
eq:dt
}
\end{equation}
\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
take place. The
leapfrog integrator is usually used as it behaves well when coupled to gravity.
\\
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
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. \\
...
@@ -262,7 +264,7 @@ energy $u_{i,pred}$ for BOTH particles. \\
\textbf
{
New time step
}
Calculate the next time step.
\textbf
{
New time step
}
Calculate the next time step.
\begin{equation*}
\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*}
\end{equation*}
...
@@ -273,8 +275,8 @@ energy $u_{i,pred}$ for BOTH particles. \\
...
@@ -273,8 +275,8 @@ energy $u_{i,pred}$ for BOTH particles. \\
\textbf
{
Second kick
}
Kick the particle for the second half-step.
\textbf
{
Second kick
}
Kick the particle for the second half-step.
\begin{eqnarray*}
\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
}
}
\\
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
^{
\textcolor
{
red
}{
n+1
}}
}
{
dt
}
\Delta
t
^{
\textcolor
{
red
}{
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
}
\\
v
_{
i,pred
}
&
=
&
v
_
i
^{
n+1
}
\\
u
_{
i,pred
}
&
=
&
u
_
i
^{
n+1
}
\\
u
_{
i,pred
}
&
=
&
u
_
i
^{
n+1
}
\\
\end{eqnarray*}
\end{eqnarray*}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment