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;
49BOOST_AUTO_TEST_SUITE( mg_solvers_report_test )
52BOOST_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());
106BOOST_AUTO_TEST_SUITE_END()
This class represent an N-dimensional box.
Laplacian second order on h (spacing)
Sparse Matrix implementation.
size_t getProcessingUnits()
Get the total number of processors.
Implementation of VCluster class.
Sparse Matrix implementation stub object when OpenFPM is compiled with no linear algebra support.
This is a distributed grid.
Class to test AMG solvers.
void try_solve(SparseMatrix< double, int, PETSC_BASE > &A, const Vector< double, PETSC_BASE > &b)
Try to use AMG pre-conditioner and check how they they perform.
void setTergetAMGAccuracy(double t_a)
Set the target accuracy to score the AMG solver.
Vector< double, PETSC_BASE > Vector_type
type of vector that store the solution
float stype
type of the space
SparseMatrix< double, int, PETSC_BASE > SparseMatrix_type
type of sparse grid that store the Matrix A
static const bool boundary[]
specify the boundary conditions
static const unsigned int nvar
We have only one scalar unknown.
static const unsigned int dims
Number of dimansions of the problem.
grid_dist_id< 3, float, aggregate< float > > b_grid
Grid that store the solution.