37#include "Grid/grid_dist_id.hpp"
38#include "Matrix/SparseMatrix.hpp"
39#include "Vector/Vector.hpp"
40#include "FiniteDifference/FDScheme.hpp"
41#include "FiniteDifference/util/common.hpp"
42#include "FiniteDifference/eq.hpp"
43#include "Solvers/petsc_solver.hpp"
44#include "Solvers/petsc_solver.hpp"
49 static const unsigned int dims = 2;
52 static const unsigned int nvar = 3;
55 static const bool boundary[];
74 static const int grid_type = STAGGERED_GRID;
77const bool lid_nn::boundary[] = {NON_PERIODIC,NON_PERIODIC};
117 typedef void const_field;
119 static float val() {
return 1.0;}
123constexpr unsigned int v[] = {0,1};
124constexpr unsigned int P = 2;
125constexpr unsigned int ic = 2;
206#include "Vector/vector_dist.hpp"
207#include "data_type/aggregate.hpp"
209int main(
int argc,
char* argv[])
233 openfpm_init(&argc,&argv);
236 constexpr int velocity = 0;
237 constexpr int pressure = 1;
246 long int sz[] = {96,32};
248 szu[0] = (size_t)sz[0];
249 szu[1] = (size_t)sz[1];
327 fd.impose(
ic_eq(),0.0, EQ_3, {0,0},{sz[0]-2,sz[1]-2},
true);
328 fd.impose(
Prs(), 0.0, EQ_3, {0,0},{0,0});
331 fd.impose(
vx_eq(),0.0, EQ_1, {1,0},{sz[0]-2,sz[1]-2});
332 fd.impose(
vy_eq(),0.0, EQ_2, {0,1},{sz[0]-2,sz[1]-2});
336 fd.impose(
v_x(),0.0, EQ_1, {0,0},{0,sz[1]-2});
337 fd.impose(
avg_vy_f(),0.0, EQ_2 , {-1,0},{-1,sz[1]-1});
339 fd.impose(
v_x(),0.0, EQ_1, {sz[0]-1,0},{sz[0]-1,sz[1]-2});
340 fd.impose(
avg_vy(),1.0, EQ_2, {sz[0]-1,0},{sz[0]-1,sz[1]-1});
343 fd.impose(
avg_vx_f(),0.0, EQ_1, {0,-1},{sz[0]-1,-1});
344 fd.impose(
v_y(), 0.0, EQ_2, {0,0},{sz[0]-2,0});
346 fd.impose(
avg_vx(),0.0, EQ_1, {0,sz[1]-1},{sz[0]-1,sz[1]-1});
347 fd.impose(
v_y(), 0.0, EQ_2, {0,sz[1]-1},{sz[0]-2,sz[1]-1});
356 fd.impose(
Prs(), 0.0, EQ_3, {-1,-1},{sz[0]-1,-1});
357 fd.impose(
Prs(), 0.0, EQ_3, {-1,sz[1]-1},{sz[0]-1,sz[1]-1});
358 fd.impose(
Prs(), 0.0, EQ_3, {-1,0},{-1,sz[1]-2});
359 fd.impose(
Prs(), 0.0, EQ_3, {sz[0]-1,0},{sz[0]-1,sz[1]-2});
362 fd.impose(
v_x(), 0.0, EQ_1, {-1,-1},{-1,sz[1]-1});
363 fd.impose(
v_y(), 0.0, EQ_2, {-1,-1},{sz[0]-1,-1});
391 solver.setMaxIter(1000);
393 solver.setRestart(200);
396 auto x = solver.try_solve(fd.getA(),fd.getB());
413 fd.template copy<velocity,pressure>(x,{0,0},{sz[0]-1,sz[1]-1},g_dist);
415 g_dist.write(
"lid_driven_cavity_p_petsc");
451int main(
int argc,
char* argv[])
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.
In case T does not match the PETSC precision compilation create a stub structure.
[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.