8#ifndef OPENFPM_NUMERICS_SRC_FINITEDIFFERENCE_EQ_UNIT_TEST_HPP_ 
    9#define OPENFPM_NUMERICS_SRC_FINITEDIFFERENCE_EQ_UNIT_TEST_HPP_ 
   11#define BOOST_TEST_DYN_LINK 
   12#include <boost/test/unit_test.hpp> 
   14#include "Laplacian.hpp" 
   15#include "FiniteDifference/eq.hpp" 
   16#include "FiniteDifference/sum.hpp" 
   17#include "FiniteDifference/mul.hpp" 
   18#include "Grid/grid_dist_id.hpp" 
   19#include "Decomposition/CartDecomposition.hpp" 
   20#include "Vector/Vector.hpp" 
   21#include "Solvers/umfpack_solver.hpp" 
   22#include "data_type/aggregate.hpp" 
   23#include "FiniteDifference/FDScheme.hpp" 
   25constexpr unsigned int x = 0;
 
   26constexpr unsigned int y = 1;
 
   27constexpr unsigned int z = 2;
 
   28constexpr unsigned int V = 0;
 
   30BOOST_AUTO_TEST_SUITE( eq_test_suite )
 
   37        static const unsigned int dims = 2;
 
   40        static const unsigned int nvar = 3;
 
   43        static const bool boundary[];
 
   61        static const int grid_type = STAGGERED_GRID;
 
   64    const bool lid_nn::boundary[] = {NON_PERIODIC,NON_PERIODIC};
 
   73        typedef void const_field;
 
   75        static float val()  {
return 1.0;}
 
   79    constexpr unsigned int v[] = {0,1};
 
   80    constexpr unsigned int P = 2;
 
   81    constexpr unsigned int ic = 2;
 
  146    template<
typename solver_type,
typename l
id_nn> 
void lid_driven_cavity_2d()
 
  156        constexpr int velocity = 0;
 
  157        constexpr int pressure = 1;
 
  166        long int sz[] = {256,64};
 
  168        szu[0] = (size_t)sz[0];
 
  169        szu[1] = (size_t)sz[1];
 
  191        fd.impose(
ic_eq(),0.0, EQ_3, {0,0},{sz[0]-2,sz[1]-2},
true);
 
  192        fd.impose(
Prs(),  0.0, EQ_3, {0,0},{0,0});
 
  195        fd.impose(
vx_eq(),0.0, EQ_1, {1,0},{sz[0]-2,sz[1]-2});
 
  196        fd.impose(
vy_eq(),0.0, EQ_2, {0,1},{sz[0]-2,sz[1]-2});
 
  200        fd.impose(
v_x(),0.0, EQ_1, {0,0},{0,sz[1]-2});
 
  201        fd.impose(
avg_vy_f(),0.0, EQ_2 , {-1,0},{-1,sz[1]-1});
 
  203        fd.impose(
v_x(),0.0, EQ_1, {sz[0]-1,0},{sz[0]-1,sz[1]-2});
 
  204        fd.impose(
avg_vy(),1.0, EQ_2,    {sz[0]-1,0},{sz[0]-1,sz[1]-1});
 
  207        fd.impose(
avg_vx_f(),0.0, EQ_1, {0,-1},{sz[0]-1,-1});
 
  208        fd.impose(
v_y(), 0.0, EQ_2, {0,0},{sz[0]-2,0});
 
  210        fd.impose(
avg_vx(),0.0, EQ_1,   {0,sz[1]-1},{sz[0]-1,sz[1]-1});
 
  211        fd.impose(
v_y(), 0.0, EQ_2, {0,sz[1]-1},{sz[0]-2,sz[1]-1});
 
  220        fd.impose(
Prs(), 0.0, EQ_3, {-1,-1},{sz[0]-1,-1});
 
  221        fd.impose(
Prs(), 0.0, EQ_3, {-1,sz[1]-1},{sz[0]-1,sz[1]-1});
 
  222        fd.impose(
Prs(), 0.0, EQ_3, {-1,0},{-1,sz[1]-2});
 
  223        fd.impose(
Prs(), 0.0, EQ_3, {sz[0]-1,0},{sz[0]-1,sz[1]-2});
 
  226        fd.impose(
v_x(), 0.0, EQ_1, {-1,-1},{-1,sz[1]-1});
 
  227        fd.impose(
v_y(), 0.0, EQ_2, {-1,-1},{sz[0]-1,-1});
 
  230        auto x = solver.solve(fd.getA(),fd.getB());
 
  236        fd.template copy<velocity,pressure>(x,{0,0},{sz[0]-1,sz[1]-1},g_dist);
 
  238        std::string s = std::string(demangle(
typeid(solver_type).name()));
 
  243        g_dist.write(s + 
"lid_driven_cavity_p" + std::to_string(v_cl.
getProcessingUnits()) + 
"_grid");
 
  245#if !(defined(SE_CLASS3) || defined(TEST_COVERAGE_MODE)) 
  249        g_dist2.load(
"test/lid_driven_cavity_reference.hdf5");
 
  251        auto it2 = g_dist2.getDomainIterator();
 
  258            test &= fabs(g_dist2.template getProp<velocity>(p)[0] - g_dist.template getProp<velocity>(p)[0]) < 3.5e-5;
 
  259            test &= fabs(g_dist2.template getProp<velocity>(p)[1] - g_dist.template getProp<velocity>(p)[1]) < 3.5e-5;
 
  261            test &= fabs(g_dist2.template getProp<pressure>(p) - g_dist.template getProp<pressure>(p)) < 3.0e-4;
 
  265                std::cout << g_dist2.template getProp<velocity>(p)[0] << 
"   " << g_dist.template getProp<velocity>(p)[0] << std::endl;
 
  266                std::cout << g_dist2.template getProp<velocity>(p)[1] << 
"   " << g_dist.template getProp<velocity>(p)[1] << std::endl;
 
  268                std::cout << g_dist2.template getProp<pressure>(p) << 
"   " << g_dist.template getProp<pressure>(p) << std::endl;
 
  276        BOOST_REQUIRE_EQUAL(test,
true);
 
  283BOOST_AUTO_TEST_CASE(lid_driven_cavity)
 
  285#if defined(HAVE_EIGEN) && defined(HAVE_SUITESPARSE) 
  286    lid_driven_cavity_2d<umfpack_solver<double>,
lid_nn>();
 
  290BOOST_AUTO_TEST_SUITE_END()
 
This class represent an N-dimensional box.
 
This class decompose a space into sub-sub-domains and distribute them across processors.
 
Derivative second order on h (spacing)
 
Class that contain Padding information on each direction positive and Negative direction.
 
Test structure used for several test.
 
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.
 
[Definition of the system]
 
[Definition of the system]
 
It ancapsulate the minus operation.
 
It model an expression expr1 * expr2.
 
It model an expression expr1 + ... exprn.