34#include "Grid/grid_dist_id.hpp"
35#include "Matrix/SparseMatrix.hpp"
36#include "Vector/Vector.hpp"
37#include "FiniteDifference/FDScheme.hpp"
38#include "FiniteDifference/util/common.hpp"
39#include "FiniteDifference/eq.hpp"
40#include "Solvers/umfpack_solver.hpp"
41#include "Solvers/petsc_solver.hpp"
46 static const unsigned int dims = 3;
49 static const unsigned int nvar = 4;
52 static const bool boundary[];
71 static const int grid_type = STAGGERED_GRID;
74const bool lid_nn::boundary[] = {NON_PERIODIC,NON_PERIODIC,NON_PERIODIC};
116 typedef void const_field;
118 static float val() {
return 1.0;}
123constexpr unsigned int v[] = {0,1,2};
124constexpr unsigned int P = 3;
125constexpr unsigned int ic = 3;
227#include "Vector/vector_dist.hpp"
228#include "data_type/aggregate.hpp"
230int main(
int argc,
char* argv[])
254 openfpm_init(&argc,&argv);
257 constexpr int velocity = 0;
258 constexpr int pressure = 1;
267 long int sz[] = {36,12,12};
269 szu[0] = (size_t)sz[0];
270 szu[1] = (size_t)sz[1];
271 szu[2] = (size_t)sz[2];
352 fd.impose(
ic_eq(),0.0, EQ_4, {0,0,0},{sz[0]-2,sz[1]-2,sz[2]-2},
true);
353 fd.impose(
Prs(), 0.0, EQ_4, {0,0,0},{0,0,0});
354 fd.impose(
vx_eq(),0.0, EQ_1, {1,0},{sz[0]-2,sz[1]-2,sz[2]-2});
355 fd.impose(
vy_eq(),0.0, EQ_2, {0,1},{sz[0]-2,sz[1]-2,sz[2]-2});
356 fd.impose(
vz_eq(),0.0, EQ_3, {0,0,1},{sz[0]-2,sz[1]-2,sz[2]-2});
360 fd.impose(
v_x(),0.0, EQ_1, {0,0,0}, {0,sz[1]-2,sz[2]-2});
361 fd.impose(
v_x(),0.0, EQ_1, {sz[0]-1,0,0},{sz[0]-1,sz[1]-2,sz[2]-2});
364 fd.impose(
avg_y_vx_f(),0.0, EQ_1, {0,-1,0}, {sz[0]-1,-1,sz[2]-2});
365 fd.impose(
avg_y_vx(),0.0, EQ_1, {0,sz[1]-1,0},{sz[0]-1,sz[1]-1,sz[2]-2});
368 fd.impose(
avg_z_vx_f(),0.0, EQ_1, {0,-1,-1}, {sz[0]-1,sz[1]-1,-1});
369 fd.impose(
avg_z_vx(),0.0, EQ_1, {0,-1,sz[2]-1},{sz[0]-1,sz[1]-1,sz[2]-1});
373 fd.impose(
avg_x_vy_f(),0.0, EQ_2, {-1,0,0}, {-1,sz[1]-1,sz[2]-2});
374 fd.impose(
avg_x_vy(),1.0, EQ_2, {sz[0]-1,0,0},{sz[0]-1,sz[1]-1,sz[2]-2});
377 fd.impose(
v_y(), 0.0, EQ_2, {0,0,0}, {sz[0]-2,0,sz[2]-2});
378 fd.impose(
v_y(), 0.0, EQ_2, {0,sz[1]-1,0},{sz[0]-2,sz[1]-1,sz[2]-2});
381 fd.impose(
avg_z_vy(),0.0, EQ_2, {-1,0,sz[2]-1}, {sz[0]-1,sz[1]-1,sz[2]-1});
382 fd.impose(
avg_z_vy_f(),0.0, EQ_2, {-1,0,-1}, {sz[0]-1,sz[1]-1,-1});
386 fd.impose(
avg_x_vz_f(),0.0, EQ_3, {-1,0,0}, {-1,sz[1]-2,sz[2]-1});
387 fd.impose(
avg_x_vz(),1.0, EQ_3, {sz[0]-1,0,0},{sz[0]-1,sz[1]-2,sz[2]-1});
390 fd.impose(
avg_y_vz(),0.0, EQ_3, {-1,sz[1]-1,0},{sz[0]-1,sz[1]-1,sz[2]-1});
391 fd.impose(
avg_y_vz_f(),0.0, EQ_3, {-1,-1,0}, {sz[0]-1,-1,sz[2]-1});
394 fd.impose(
v_z(),0.0, EQ_3, {0,0,0}, {sz[0]-2,sz[1]-2,0});
395 fd.impose(
v_z(),0.0, EQ_3, {0,0,sz[2]-1},{sz[0]-2,sz[1]-2,sz[2]-1});
404 fd.impose(
Prs(), 0.0, EQ_4, {-1,-1,-1},{-1,sz[1]-1,sz[2]-1});
405 fd.impose(
Prs(), 0.0, EQ_4, {sz[0]-1,-1,-1},{sz[0]-1,sz[1]-1,sz[2]-1});
408 fd.impose(
Prs(), 0.0, EQ_4, {0,sz[1]-1,-1}, {sz[0]-2,sz[1]-1,sz[2]-1});
409 fd.impose(
Prs(), 0.0, EQ_4, {0,-1 ,-1}, {sz[0]-2,-1, sz[2]-1});
412 fd.impose(
Prs(), 0.0, EQ_4, {0,0,sz[2]-1}, {sz[0]-2,sz[1]-2,sz[2]-1});
413 fd.impose(
Prs(), 0.0, EQ_4, {0,0,-1}, {sz[0]-2,sz[1]-2,-1});
416 fd.impose(
v_x(), 0.0, EQ_1, {-1,-1,-1},{-1,sz[1]-1,sz[2]-1});
417 fd.impose(
v_y(), 0.0, EQ_2, {-1,-1,-1},{sz[0]-1,-1,sz[2]-1});
418 fd.impose(
v_z(), 0.0, EQ_3, {-1,-1,-1},{sz[0]-1,sz[1]-1,-1});
441 auto x = solver.
solve(fd.getA(),fd.getB());
459 fd.template copy<velocity,pressure>(x,{0,0},{sz[0]-1,sz[1]-1,sz[2]-1},g_dist);
461 g_dist.write(
"lid_driven_cavity_p_umfpack");
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.
Sparse Matrix implementation stub object when OpenFPM is compiled with no linear algebra support.
This is a distributed grid.
stub when library compiled without eigen
static Vector< T > solve(const SparseMatrix< T, id_type, impl > &A, const Vector< T, impl > &b)
stub solve
[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.