Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
O
openfpm_numerics
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openfpm
openfpm_numerics
Commits
d508988c
Commit
d508988c
authored
Jun 30, 2017
by
incardon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding missing files
parent
15bd7db0
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
701 additions
and
0 deletions
+701
-0
src/Solvers/petsc_solver_AMG_report.hpp
src/Solvers/petsc_solver_AMG_report.hpp
+587
-0
src/Solvers/petsc_solver_unit_tests.cpp
src/Solvers/petsc_solver_unit_tests.cpp
+114
-0
No files found.
src/Solvers/petsc_solver_AMG_report.hpp
0 → 100644
View file @
d508988c
This diff is collapsed.
Click to expand it.
src/Solvers/petsc_solver_unit_tests.cpp
0 → 100644
View file @
d508988c
/*
* petsc_solver_unit_tests.hpp
*
* Created on: Jun 19, 2017
* Author: i-bird
*/
#ifndef OPENFPM_NUMERICS_SRC_SOLVERS_PETSC_SOLVER_UNIT_TESTS_CPP_
#define OPENFPM_NUMERICS_SRC_SOLVERS_PETSC_SOLVER_UNIT_TESTS_CPP_
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#include "petsc_solver_report_unit_tests.hpp"
#include "Grid/grid_dist_id.hpp"
#include "Matrix/SparseMatrix.hpp"
#include "Vector/Vector.hpp"
#include "FiniteDifference/Laplacian.hpp"
#include "FiniteDifference/FDScheme.hpp"
#include "Solvers/petsc_solver.hpp"
BOOST_AUTO_TEST_SUITE
(
mg_solvers_test
)
BOOST_AUTO_TEST_CASE
(
laplacian_3D_int_zero_mg
)
{
constexpr
unsigned
int
phi
=
0
;
typedef
Field
<
phi
,
poisson_nn_helm
>
phi_f
;
Vcluster
&
v_cl
=
create_vcluster
();
if
(
v_cl
.
getProcessingUnits
()
!=
3
)
return
;
Ghost
<
3
,
long
int
>
g
(
2
);
Ghost
<
3
,
long
int
>
stencil_max
(
2
);
Box
<
3
,
float
>
domain
({
0.0
,
0.0
,
0.0
},{
1.0
,
1.0
,
1.0
});
periodicity
<
3
>
p
({
PERIODIC
,
PERIODIC
,
PERIODIC
});
typedef
Lap
<
phi_f
,
poisson_nn_helm
,
CENTRAL_SYM
>
poisson
;
grid_dist_id
<
3
,
float
,
aggregate
<
float
>>
psi
({
64
,
64
,
64
},
domain
,
g
,
p
);
grid_dist_id
<
3
,
float
,
aggregate
<
float
>>
psi2
(
psi
.
getDecomposition
(),{
64
,
64
,
64
},
g
);
// Fill B
size_t
center_x
=
psi
.
size
(
0
)
/
2
;
size_t
center_y
=
psi
.
size
(
1
)
/
2
;
size_t
center_z
=
psi
.
size
(
2
)
/
2
;
auto
it
=
psi
.
getDomainIterator
();
while
(
it
.
isNext
())
{
auto
key
=
it
.
get
();
auto
gkey
=
it
.
getGKey
(
key
);
float
sx
=
(
float
)(
gkey
.
get
(
0
))
-
center_x
;
float
sy
=
(
float
)(
gkey
.
get
(
1
))
-
center_y
;
float
sz
=
(
float
)(
gkey
.
get
(
2
))
-
center_z
;
float
gs
=
100.0
*
exp
(
-
((
sx
*
sx
)
+
(
sy
*
sy
)
+
(
sz
*
sz
))
/
100.0
);
psi
.
get
<
0
>
(
key
)
=
sin
(
2
*
M_PI
*
sx
/
psi
.
size
(
0
))
*
sin
(
2
*
M_PI
*
sy
/
psi
.
size
(
1
))
*
sin
(
2
*
M_PI
*
sz
/
psi
.
size
(
2
))
*
gs
;
psi2
.
get
<
0
>
(
key
)
=
sin
(
2
*
M_PI
*
sx
/
psi
.
size
(
0
))
*
sin
(
2
*
M_PI
*
sy
/
psi
.
size
(
1
))
*
sin
(
2
*
M_PI
*
sz
/
psi
.
size
(
2
))
*
gs
;
++
it
;
}
FDScheme
<
poisson_nn_helm
>
fd
(
stencil_max
,
domain
,
psi
);
fd
.
template
impose_dit
<
0
>(
poisson
(),
psi
,
psi
.
getDomainIterator
());
petsc_solver
<
double
>
solver
;
solver
.
setSolver
(
KSPBCGS
);
solver
.
setAbsTol
(
0.01
);
solver
.
setMaxIter
(
500
);
////////
solver
.
setPreconditioner
(
PCHYPRE_BOOMERAMG
);
solver
.
setPreconditionerAMG_nl
(
6
);
solver
.
setPreconditionerAMG_maxit
(
3
);
solver
.
setPreconditionerAMG_relax
(
"SOR/Jacobi"
);
solver
.
setPreconditionerAMG_cycleType
(
"V"
,
6
,
6
);
solver
.
setPreconditionerAMG_coarsen
(
"HMIS"
);
solver
.
setPreconditionerAMG_coarsenNodalType
(
0
);
timer
tm_solve
;
tm_solve
.
start
();
auto
x_
=
solver
.
solve
(
fd
.
getA
(),
fd
.
getB
());
tm_solve
.
stop
();
fd
.
template
copy
<
phi
>(
x_
,
psi
);
psi
.
write
(
"AMG_psi"
);
bool
check
=
compare
(
"AMG_psi_"
+
std
::
to_string
(
v_cl
.
getProcessUnitID
())
+
".vtk"
,
"test/AMG_psi_test_"
+
std
::
to_string
(
v_cl
.
getProcessUnitID
())
+
".vtk"
);
BOOST_REQUIRE_EQUAL
(
check
,
true
);
// Resolve
timer
tm_solve2
;
tm_solve2
.
start
();
auto
x2_
=
solver
.
solve
(
fd
.
getB
());
tm_solve2
.
stop
();
fd
.
template
copy
<
phi
>(
x_
,
psi2
);
psi2
.
write
(
"AMG_psi2"
);
check
=
compare
(
"AMG_psi2_"
+
std
::
to_string
(
v_cl
.
getProcessUnitID
())
+
".vtk"
,
"test/AMG_psi2_test_"
+
std
::
to_string
(
v_cl
.
getProcessUnitID
())
+
".vtk"
);
BOOST_REQUIRE_EQUAL
(
check
,
true
);
}
BOOST_AUTO_TEST_SUITE_END
()
#endif
/* OPENFPM_NUMERICS_SRC_SOLVERS_PETSC_SOLVER_UNIT_TESTS_CPP_ */
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