Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nektar
Nektar
Commits
b36fb4de
Commit
b36fb4de
authored
Feb 19, 2013
by
Pavel Burovskiy
Browse files
Making SRHS parallel
parent
b05b8408
Changes
3
Hide whitespace changes
Inline
Side-by-side
library/MultiRegions/GlobalLinSysIterative.cpp
View file @
b36fb4de
...
...
@@ -141,6 +141,10 @@ namespace Nektar
const
AssemblyMapSharedPtr
&
plocToGloMap
,
const
int
nDir
)
{
// Get the communicator for performing data exchanges
LibUtilities
::
CommSharedPtr
vComm
=
m_expList
.
lock
()
->
GetComm
()
->
GetRowComm
();
// Get vector sizes
int
nNonDir
=
nGlobal
-
nDir
;
Array
<
OneD
,
NekDouble
>
tmp
;
...
...
@@ -161,9 +165,12 @@ namespace Nektar
// check the input vector (rhs) is not zero
NekDouble
rhsNorm
=
Vmath
::
Dot
(
nNonDir
,
pInput
+
nDir
,
pInput
+
nDir
);
NekDouble
rhsNorm
=
Vmath
::
Dot2
(
nNonDir
,
pInput
+
nDir
,
pInput
+
nDir
,
m_map
+
nDir
);
vComm
->
AllReduce
(
rhsNorm
,
Nektar
::
LibUtilities
::
ReduceSum
);
if
(
rhsNorm
<
NekConstants
::
kNekZeroTol
)
{
...
...
@@ -188,19 +195,25 @@ namespace Nektar
// \alpha_i = \tilda{x_i}^T b^n
// projected x, px = \sum \alpha_i \tilda{x_i}
Array
<
OneD
,
NekDouble
>
alpha
(
m_prevLinSol
.
size
(),
0.0
);
for
(
int
i
=
0
;
i
<
m_prevLinSol
.
size
();
i
++
)
{
NekDouble
alphai
=
Vmath
::
Dot
(
nNonDir
,
m_prevLinSol
[
i
],
pInput
+
nDir
);
alpha
[
i
]
=
Vmath
::
Dot2
(
nNonDir
,
m_prevLinSol
[
i
],
pInput
+
nDir
,
m_map
+
nDir
);
}
vComm
->
AllReduce
(
alpha
,
Nektar
::
LibUtilities
::
ReduceSum
);
if
(
alphai
<
NekConstants
::
kNekZeroTol
)
for
(
int
i
=
0
;
i
<
m_prevLinSol
.
size
();
i
++
)
{
if
(
alpha
[
i
]
<
NekConstants
::
kNekZeroTol
)
{
continue
;
}
NekVector
<
NekDouble
>
xi
(
nNonDir
,
m_prevLinSol
[
i
],
eWrapper
);
px
+=
alpha
i
*
xi
;
px
+=
alpha
[
i
]
*
xi
;
}
// pb = b^n - A px
...
...
@@ -235,6 +248,10 @@ namespace Nektar
const
Array
<
OneD
,
const
NekDouble
>
&
in
,
const
int
nDir
)
{
// Get the communicator for performing data exchanges
LibUtilities
::
CommSharedPtr
vComm
=
m_expList
.
lock
()
->
GetComm
()
->
GetRowComm
();
// Get vector sizes
int
nNonDir
=
nGlobal
-
nDir
;
...
...
@@ -243,9 +260,11 @@ namespace Nektar
v_DoMatrixMultiply
(
in
,
tmpAx_s
);
const
NekDouble
anorm_sq
=
Vmath
::
Dot
(
nNonDir
,
in
+
nDir
,
tmpAx_s
+
nDir
);
NekDouble
anorm_sq
=
Vmath
::
Dot2
(
nNonDir
,
in
+
nDir
,
tmpAx_s
+
nDir
,
m_map
+
nDir
);
vComm
->
AllReduce
(
anorm_sq
,
Nektar
::
LibUtilities
::
ReduceSum
);
return
std
::
sqrt
(
anorm_sq
);
}
...
...
@@ -261,11 +280,16 @@ namespace Nektar
// Get vector sizes
int
nNonDir
=
nGlobal
-
nDir
;
// Get the communicator for performing data exchanges
LibUtilities
::
CommSharedPtr
vComm
=
m_expList
.
lock
()
->
GetComm
()
->
GetRowComm
();
// Check the solution is non-zero
NekDouble
solNorm
=
Vmath
::
Dot
(
nNonDir
,
newX
+
nDir
,
newX
+
nDir
);
NekDouble
solNorm
=
Vmath
::
Dot2
(
nNonDir
,
newX
+
nDir
,
newX
+
nDir
,
m_map
+
nDir
);
vComm
->
AllReduce
(
solNorm
,
Nektar
::
LibUtilities
::
ReduceSum
);
if
(
solNorm
<
NekConstants
::
kNekZeroTol
)
{
...
...
@@ -293,19 +317,26 @@ namespace Nektar
{
v_DoMatrixMultiply
(
newX
,
tmpAx_s
);
}
Array
<
OneD
,
NekDouble
>
alpha
(
m_prevLinSol
.
size
(),
0.0
);
for
(
int
i
=
0
;
i
<
m_prevLinSol
.
size
();
i
++
)
{
NekDouble
alphai
=
Vmath
::
Dot
(
nNonDir
,
m_prevLinSol
[
i
],
tmpAx_s
+
nDir
);
alpha
[
i
]
=
Vmath
::
Dot2
(
nNonDir
,
m_prevLinSol
[
i
],
tmpAx_s
+
nDir
,
m_map
+
nDir
);
}
vComm
->
AllReduce
(
alpha
,
Nektar
::
LibUtilities
::
ReduceSum
);
if
(
alphai
<
NekConstants
::
kNekZeroTol
)
for
(
int
i
=
0
;
i
<
m_prevLinSol
.
size
();
i
++
)
{
if
(
alpha
[
i
]
<
NekConstants
::
kNekZeroTol
)
{
continue
;
}
NekVector
<
NekDouble
>
xi
(
nNonDir
,
m_prevLinSol
[
i
],
eWrapper
);
px
-=
alpha
i
*
xi
;
px
-=
alpha
[
i
]
*
xi
;
}
...
...
solvers/IncNavierStokesSolver/CMakeLists.txt
View file @
b36fb4de
...
...
@@ -57,6 +57,7 @@ IF( NEKTAR_SOLVER_INCNAVIERSTOKES )
ADD_NEKTAR_TEST
(
Hex_channel_m3
)
ADD_NEKTAR_TEST
(
Hex_channel_m8
)
ADD_NEKTAR_TEST
(
Hex_channel_m8_srhs
)
ADD_NEKTAR_TEST
(
Hex_channel_m8_srhs_par
)
ADD_NEKTAR_TEST
(
Tet_channel_m3
)
ADD_NEKTAR_TEST
(
Tet_equitri
)
ADD_NEKTAR_TEST
(
Prism_channel_m6
)
...
...
solvers/IncNavierStokesSolver/Tests/Hex_channel_m8_srhs_par.tst
0 → 100644
View file @
b36fb4de
<?xml version="1.0" encoding="utf-8"?>
<test>
<description>
3D channel flow, Hexahedral elements, P=8, Successive RHS(5), par(2)
</description>
<executable>
IncNavierStokesSolver
</executable>
<parameters>
Hex_channel_m8_srhs.xml
</parameters>
<processes>
2
</processes>
<files>
<file
description=
"Session File"
>
Hex_channel_m8_srhs.xml
</file>
</files>
<metrics>
<metric
type=
"L2"
id=
"1"
>
<value
variable=
"u"
tolerance=
"1e-8"
>
2.73101e-11
</value>
<value
variable=
"v"
tolerance=
"1e-8"
>
2.23013e-11
</value>
<value
variable=
"w"
tolerance=
"1e-8"
>
6.29721e-10
</value>
<value
variable=
"p"
tolerance=
"1e-8"
>
1.94395e-09
</value>
</metric>
<metric
type=
"Linf"
id=
"2"
>
<value
variable=
"u"
tolerance=
"1e-8"
>
1.55008e-10
</value>
<value
variable=
"v"
tolerance=
"1e-8"
>
1.58963e-10
</value>
<value
variable=
"w"
tolerance=
"1e-8"
>
8.27366e-08
</value>
<value
variable=
"p"
tolerance=
"1e-8"
>
2.42343e-08
</value>
</metric>
</metrics>
</test>
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