8 #ifndef OPENFPM_NUMERICS_SRC_SOLVERS_PETSC_SOLVER_REPORT_UNIT_TESTS_HPP_ 9 #define OPENFPM_NUMERICS_SRC_SOLVERS_PETSC_SOLVER_REPORT_UNIT_TESTS_HPP_ 12 #include "Grid/grid_dist_id.hpp" 13 #include "Matrix/SparseMatrix.hpp" 14 #include "Vector/Vector.hpp" 15 #include "FiniteDifference/Laplacian.hpp" 16 #include "FiniteDifference/FDScheme.hpp" 17 #include "Solvers/petsc_solver.hpp" 18 #include "petsc_solver_AMG_report.hpp" 23 static const unsigned int dims = 3;
26 static const unsigned int nvar = 1;
49 BOOST_AUTO_TEST_SUITE( mg_solvers_report_test )
52 BOOST_AUTO_TEST_CASE( laplacian_3D_int_zero_mg_report )
54 constexpr
unsigned int phi = 0;
73 size_t center_x = psi.
size(0) / 2;
74 size_t center_y = psi.size(1) / 2;
75 size_t center_z = psi.size(2) / 2;
76 auto it = psi.getDomainIterator();
81 auto gkey = it.getGKey(key);
83 float sx = (float)(gkey.get(0))-center_x;
84 float sy = (float)(gkey.get(1))-center_y;
85 float sz = (float)(gkey.get(2))-center_z;
87 float gs = 100.0*exp(-((sx*sx)+(sy*sy)+(sz*sz))/100.0);
89 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;
90 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;
97 fd.template impose_dit<0>(poisson(),psi,psi.getDomainIterator());
103 rep.try_solve(fd.getA(),fd.getB());
106 BOOST_AUTO_TEST_SUITE_END()
Class to test AMG solvers.
size_t size() const
Return the total number of points in the grid.
Sparse Matrix implementation stub object when OpenFPM is compiled with no linear algebra support.
static const unsigned int dims
Number of dimansions of the problem.
SparseMatrix< double, int, PETSC_BASE > SparseMatrix_type
type of sparse grid that store the Matrix A
float stype
type of the space
Vector< double, PETSC_BASE > Vector_type
type of vector that store the solution
Implementation of VCluster class.
Sparse Matrix implementation.
This is a distributed grid.
static const unsigned int nvar
We have only one scalar unknown.
size_t getProcessingUnits()
Get the total number of processors.
Laplacian second order on h (spacing)
grid_dist_id< 3, float, aggregate< float > > b_grid
Grid that store the solution.
static const bool boundary[]
specify the boundary conditions
void setTergetAMGAccuracy(double t_a)
Set the target accuracy to score the AMG solver.