Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hyteg
hyteg
Commits
fb0af1df
Commit
fb0af1df
authored
Jan 13, 2022
by
Marcel Koch
Browse files
use ILU+ISAI as smoother for amgx
parent
891ae108
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/hyteg/ginkgo/GinkgoBlockSolver.hpp
View file @
fb0af1df
...
...
@@ -7,8 +7,9 @@
#include <ginkgo/core/matrix/identity.hpp>
#include <ginkgo/core/matrix/zero.hpp>
#include <ginkgo/core/multigrid/amgx_pgm.hpp>
#include <ginkgo/core/preconditioner/ilu.hpp>
#include <ginkgo/core/preconditioner/isai.hpp>
#include <ginkgo/core/preconditioner/jacobi.hpp>
#include <ginkgo/core/solver/bicgstab.hpp>
#include <ginkgo/core/solver/gmres.hpp>
#include <ginkgo/core/solver/ir.hpp>
#include <ginkgo/core/solver/multigrid.hpp>
...
...
@@ -74,6 +75,7 @@ class GinkgoBlockSolver : public Solver< OperatorType >
public:
using
FunctionType
=
typename
OperatorType
::
srcType
;
using
valueType
=
typename
FunctionType
::
valueType
;
using
indexType
=
int32_t
;
using
mtx
=
gko
::
distributed
::
Matrix
<
valueType
,
int32_t
>
;
using
csr
=
gko
::
matrix
::
Csr
<
valueType
,
int32_t
>
;
...
...
@@ -241,9 +243,17 @@ class GinkgoBlockSolver : public Solver< OperatorType >
}
else
if
(
velocityPreconditionerType_
==
2
)
{
using
lower_isai
=
gko
::
preconditioner
::
Isai
<
gko
::
preconditioner
::
isai_type
::
general
,
valueType
,
indexType
>
;
using
upper_isai
=
gko
::
preconditioner
::
Isai
<
gko
::
preconditioner
::
isai_type
::
general
,
valueType
,
indexType
>
;
auto
ilu_gen
=
gko
::
share
(
gko
::
preconditioner
::
Ilu
<
lower_isai
,
upper_isai
>::
build
()
//.with_factorization_factory( gko::factorization::Ilu< valueType >::build().on( solver_exec_ ) ) // doesn't make a lot of difference
.
on
(
solver_exec_
)
);
auto
smoother_gen
=
gko
::
share
(
gko
::
solver
::
Ir
<
valueType
>::
build
()
.
with_solver
(
jac
_gen
)
.
with_solver
(
ilu
_gen
)
.
with_relaxation_factor
(
0.9
)
.
with_criteria
(
gko
::
stop
::
Iteration
::
build
().
with_max_iters
(
2u
).
on
(
solver_exec_
)
)
.
on
(
solver_exec_
)
);
...
...
@@ -257,7 +267,7 @@ class GinkgoBlockSolver : public Solver< OperatorType >
b_pre_v
=
gko
::
share
(
gko
::
solver
::
Multigrid
::
build
()
.
with_max_levels
(
9u
)
.
with_min_coarse_rows
(
1
0u
)
.
with_min_coarse_rows
(
50
0u
)
.
with_pre_smoother
(
smoother_gen
)
.
with_post_uses_pre
(
true
)
.
with_mg_level
(
gko
::
share
(
mg_level_gen
)
)
...
...
@@ -266,6 +276,19 @@ class GinkgoBlockSolver : public Solver< OperatorType >
.
with_criteria
(
gko
::
stop
::
Iteration
::
build
().
with_max_iters
(
1u
).
on
(
solver_exec_
)
)
.
on
(
solver_exec_
)
->
generate
(
gko
::
share
(
device_monolithic_pre
->
create_submatrix
(
block_v_span
,
block_v_span
)
)
)
);
if
(
printInfo_
)
{
auto
amg
=
gko
::
as
<
gko
::
solver
::
Multigrid
>
(
b_pre_v
);
WALBERLA_LOG_INFO_ON_ROOT
(
"[Ginkgo AMGX] Number of levels: "
<<
amg
->
get_mg_level_list
().
size
()
+
1
)
for
(
int
i
=
0
;
i
<
amg
->
get_mg_level_list
().
size
();
++
i
)
{
WALBERLA_LOG_INFO_ON_ROOT
(
"[Ginkgo AMGX] Level "
<<
amg
->
get_mg_level_list
().
size
()
-
i
<<
" of size "
<<
amg
->
get_mg_level_list
()[
i
]
->
get_fine_op
()
->
get_size
()
);
}
WALBERLA_LOG_INFO_ON_ROOT
(
"[Ginkgo AMGX] Level 0 of size "
<<
amg
->
get_coarsest_solver
()
->
get_size
()
);
}
}
else
{
...
...
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