Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
patapon
patapon
Commits
2f852a40
Commit
2f852a40
authored
Oct 07, 2020
by
ph
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up
parent
3d69f15a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
569 additions
and
3 deletions
+569
-3
mhd/doc/mhd_lbm.lyx
mhd/doc/mhd_lbm.lyx
+568
-2
mhd/vortex_kernels.cl
mhd/vortex_kernels.cl
+1
-1
No files found.
mhd/doc/mhd_lbm.lyx
View file @
2f852a40
...
...
@@ -2736,12 +2736,578 @@ literal "true"
solver.
Here we also used this test to evaluate the efficiency of the parallel
implementation.
The test case is built upon a single vortex, which is a stationary solution
of the MHD system, to which a constant drift velocity is added.
In the moving frame centered on
\begin_inset Formula $\mathbf{r}_{O}(t)=t\mathbf{u}_{\text{\text{drift}}}$
\end_inset
, with
\begin_inset Formula $\mathbf{u}_{\text{\text{drift}}}\in\mathbb{R}^{2}$
\end_inset
, the analytical solution reads in polar coordinates
\begin_inset Formula
\[
\begin{align*}\rho(r,\theta) & =\rho_{0},\\
\mathbf{u}(r,\theta) & =u_{0}[\mathbf{u}_{\text{\text{drift}}}+h(r)\mathbf{e}_{\theta}],\\
\mathbf{B}(r,\theta) & =b_{0}h(r)\mathbf{e}_{\theta},\\
p(r,\theta) & =p_{0}+\frac{b_{0}^{2}}{2}(1-h(r)),
\end{align*}
\]
\end_inset
with
\begin_inset Formula $b_{0}=\rho_{0}u_{0}^{2}$
\end_inset
.
The results shown below are obtained with
\begin_inset Formula $\gamma=5/3$
\end_inset
and the parameter set
\begin_inset Formula
\[
\rho_{0}=p_{0}=1,\ u_{0}=b_{0}=0.2,\ \mathbf{u}_{\text{drift}}=(1,1)^{T},\ h(r)=\exp[(1-r^{2})/2]
\]
\end_inset
.
\end_layout
\begin_layout Standard
The computational domain is the square
\begin_inset Formula $\Omega=]-L/2,L/2[\times]L/2,L2[$
\end_inset
, with
\begin_inset Formula $L=10$
\end_inset
.
We compute the solution at time
\begin_inset Formula $t=5$
\end_inset
.
The grid contains
\begin_inset Formula $N$
\end_inset
points in
\begin_inset Formula $x_{1}$
\end_inset
and
\begin_inset Formula $x_{2}$
\end_inset
directions.
For this smooth test case, we can take a relaxation parameter
\begin_inset Formula $\omega=2$
\end_inset
.
We compute the error
\begin_inset Formula $e_{N}$
\end_inset
in the normalized
\begin_inset Formula $L^{1}$
\end_inset
norm at the final time between the exact solution and the numerical solution
on the first component of the momentum (the other components of the solution
would give similar results):
\begin_inset Formula
\[
e_{N}=\frac{\int_{\Omega}\left|(\rho u_{1})_{\text{num}}-(\rho u_{1})_{\text{exact}}\right|}{L^{2}}.
\]
\end_inset
Asymptotically, the order of the scheme is evaluated by
\begin_inset Formula
\[
\beta\simeq\frac{\ln(e_{N}/e_{2N})}{\ln2}.
\]
\end_inset
The obtained numerical results are summed up in Table
\begin_inset CommandInset ref
LatexCommand ref
reference "tab:Convergence-and-performance"
plural "false"
caps "false"
noprefix "false"
\end_inset
, where we give the convergence study and a performance evaluation of the
implementation.
OpenCL permits to run the same code on a multicore CPU or a GPU.
It is also possible to adjust the number of used cores in the CPU version.
\end_layout
\begin_layout Standard
\begin_inset Float table
wide false
sideways false
status open
\begin_layout Plain Layout
\end_layout
\begin_layout Plain Layout
\noindent
\align center
\begin_inset Tabular
<lyxtabular version="3" rows="6" columns="7">
<features tabularvalignment="middle">
<column alignment="center" valignment="top">
<column alignment="center" valignment="top">
<column alignment="center" valignment="top">
<column alignment="center" valignment="top">
<column alignment="center" valignment="top">
<column alignment="center" valignment="top">
<column alignment="center" valignment="top">
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
N
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
128
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
256
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
512
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
1024
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
2048
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
4096
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
1 CPU
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
16 CPU
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
GPU
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\begin_inset Formula $L^{1}$
\end_inset
error
\begin_inset Formula $e_{N}$
\end_inset
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
conv.
rate
\begin_inset Formula $\beta$
\end_inset
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" rightline="true" usebox="none">
\begin_inset Text
\begin_layout Plain Layout
\end_layout
\end_inset
</cell>
</row>
</lyxtabular>
\end_inset
\begin_inset Caption Standard
\begin_layout Plain Layout
Convergence and performance study
\begin_inset CommandInset label
LatexCommand label
name "tab:Convergence-and-performance"
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Plain Layout
\end_layout
\end_inset
\color blue
TODO: convergence and accuracy test, perfs table.
\end_layout
\begin_layout Subsection
...
...
mhd/vortex_kernels.cl
View file @
2f852a40
...
...
@@ -177,7 +177,7 @@ void exact_sol(real *x, real t, real *w) {
real
gauss
(
real
r
)
{
return
r
<
6
?
exp
(
-r*r/2
)
:
0
;
return
exp
(
-r*r/2
)
;
}
...
...
Write
Preview
Markdown
is supported
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