⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 navier_stokes_test.cc

📁 Flens库-一个在C++的矩阵运算库
💻 CC
字号:
#include <poisson_solver/flens_impl.h>#include <poisson_solver/examples/navier_stokes.h>#include <dirichlet_poisson.h>using namespace flens;using namespace std;typedef StaggeredGridVector2D<false, true>  GridTypeU;typedef StaggeredGridVector2D<true, false>  GridTypeV;typedef StaggeredGridVector2D<true, true>   GridTypeP;typedef GaussSeidelRedBlack<NeumannPoisson2D, GridTypeP>  Smoother;typedef StationaryIterativeSolver<Smoother>               DS;intmain(){    int l = 2;    int rh = (1<<l);    GridTypeU u(rh), fx(rh);    GridTypeV v(rh), fy(rh);    GridTypeP p(rh), rhs(rh);    setBoundaryCondition(rh, u.grid, v.grid);    cout << "u = " << u << endl;    cout << "v = " << v << endl;    double re = 1000;    double pr = 7;    double delta = 0.5;    double dt = computeTimeStep(rh, u.grid, v.grid, re, pr, delta);    cout << "dt = " << dt << endl;    double gamma = 0.9;    double gx = 0;    double gy = -9.81;    computeForce(rh, u.grid, v.grid, dt, gamma, re, gx, gy, fx.grid, fy.grid);    cout << "fx = " << fx << endl;    cout << "fy = " << fy << endl;    computePoissonRhs(rh, fx.grid, fy.grid, dt, rhs.grid);    cout << "rhs = " << rhs << endl;    NeumannPoisson2D NP(rh);    DS ds(NP, rhs, p);    ds.solve();    cout << "p = " << p << endl;    computeVelocity(rh, fx.grid, fy.grid, p.grid, dt, u.grid, v.grid);    cout << "u = " << u << endl;    cout << "v = " << v << endl;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -