5#define BOOST_TEST_DYN_LINK
7#include <boost/test/unit_test.hpp>
10#include "BoundaryConditions/MethodOfImages.hpp"
11#include "BoundaryConditions/SurfaceNormal.hpp"
12#include "libForTesting/HelpFunctionsForTestingNBCs.hpp"
14BOOST_AUTO_TEST_SUITE(MethodOfImagesTestSuite)
16 BOOST_AUTO_TEST_CASE(DiffusionWithNoFluxNBCs)
18 const size_t dims = 2;
19 const double L_low = 0.0;
20 const double L_up = 1.0;
21 const double R_disk = 0.25;
22 const double D = 0.005;
23 const double a = R_disk;
25 const double tmax = 20;
26 constexpr size_t Phi_SDF = 0, dPhi = 1, dPhi_magn = 2, SurfaceNormal = 3, Conc_n = 4, Conc_nplus1 = 5, Lap_conc = 6,
27 Radius = 7, Conc_exact = 8,
Error = 9;
28 constexpr size_t x = 0, y = 1;
33 auto &v_cl = create_vcluster();
38 const size_t Phi_0_grid = 0;
39 const size_t Phi_SDF_grid = 1;
44 size_t sz[dims] = {N, N};
49 grid_in_type g_dist(sz, box, ghost);
50 g_dist.setPropNames({
"Phi_0",
"Phi_SDF"});
51 g_dist.load(
"/Users/jstark/Desktop/diffusion/simple_geometries/get_diffusion_space/disk_analytical_sdf"
52 "/output_circle_" + std::to_string(N) +
"/grid_disk_analyticalSdf.bin");
54 double p_spacing = g_dist.spacing(x);
60 size_t bc[dims] = {NON_PERIODIC, NON_PERIODIC};
62 std::cout <<
"Ghost layer thickness: " << p_spacing * 10 << std::endl;
63 typedef aggregate<double, double[dims], double, Point<dims, double>, double, double, double, double, double,
double>
66 vd_type vd(0, box, bc, ghost_vd);
67 vd.setPropNames({
"Phi_SDF",
"dPhi",
"dPhi_magn",
"SurfaceNormal",
"Conc_n",
"Conc_n+1",
"Lap_conc",
"Radius",
68 "Conc_exact",
"Error"});
72 double dlow = 0, dup = 2*L_up;
73 get_diffusion_domain<Phi_SDF_grid, Phi_SDF, dPhi, dPhi_magn>(g_dist, vd, dlow, dup);
81 double center_disk [] = {0.5, 0.5};
82 get_radius<Radius>(vd, center_disk);
86 get_IC_Eq28<Radius, Conc_n>(vd, a);
88 vd.template ghost_get<Conc_n>(KEEP_PROPERTIES);
93 size_t mirror_width = 3;
96 if (v_cl.rank() == 0) std::cout <<
"Width of mirror layer: " << mirror_width <<
" particles." << std::endl;
97 double b_low = 0, b_up = mirror_width * p_spacing;
99 get_source_particle_ids<Phi_SDF>(vd, keys_source, b_low, b_up);
101 get_surface_normal_sdf_subset<Phi_SDF, dPhi, SurfaceNormal>(vd, keys_source);
104 NBCs.get_mirror_particles(vd);
110BOOST_AUTO_TEST_SUITE_END()
This class represent an N-dimensional box.
Derivative second order on h (spacing)
Class for getting mirror particles to impose Neumann BCs.
This is a distributed grid.
Implementation of 1-D std::vector like structure.
Out-of-bound policy kill the program.
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...