-- FreeFem++ v4.6 (Thu Apr 2 15:47:38 CEST 2020 - git v4.6) Load: lg_fem lg_mesh lg_mesh3 eigenvalue 1 : // Location: 2 : // 3 : // http://people.sc.fsu.edu/~jburkardt/freefem_src/driven_cavity_navier_stokes/driven_cavity_navier_stokes.edp 4 : // 5 : // Discussion: 6 : // 7 : // Steady Navier-Stokes problem in a cavity. 8 : // 9 : // - uxx - uyy + u ux + v uy + px = uf 10 : // - vxx - vyy + u vx + v vy + py = vf 11 : // ux + vy = pf 12 : // 13 : // u = 1 along top wall. 14 : // 15 : // Licensing: 16 : // 17 : // This code is distributed under the GNU LGPL license. 18 : // 19 : // Modified: 20 : // 21 : // 22 May 2020 22 : // 23 : // Reference: 24 : // 25 : // John Chrispell, Jason Howell, 26 : // Finite Element Approximation of Partial Differential Equations 27 : // Using FreeFem++, or, How I Learned to Stop Worrying and Love 28 : // Numerical Analysis. 29 : // 30 : // Frederic Hecht, 31 : // New development in FreeFem++, 32 : // Journal of Numerical Mathematics, 33 : // Volume 20, Number 3-4, 2012, pages 251-265. 34 : // 35 : cout << "\n"; 36 : cout << "driven_cavity_stokes:\n"; 37 : cout << " FreeFem++ version.\n"; 38 : // 39 : // eps: the penalty coefficient for the continuity equation. 40 : // 41 : real eps = 1.0E-10; 42 : // 43 : // n: the number of nodes in each spatial direction. 44 : // 45 : int n = 30; 46 : // 47 : // Th: the triangulation of the square. 48 : // 49 : mesh Th = square ( n, n ); 50 : // 51 : // Vh: the finite element space for 2D velocity vector (piecewise linear "bubble") 52 : // 53 : fespace Vh ( Th, P1b ); 54 : // 55 : // Qh: the finite element space for the scalar pressure (piecewise linear). 56 : // 57 : fespace Qh ( Th, P1 ); 58 : // 59 : // u1, u1o, u2, u2o: velocity trial functions. 60 : // 61 : Vh u1, u1o, u2, u2o; 62 : // 63 : // p: pressure trial functions. 64 : // 65 : Qh p; 66 : // 67 : // v1, v2: velocity test functions. 68 : // 69 : Vh v1, v2; 70 : // 71 : // q: pressure test functions. 72 : // 73 : Qh q; 74 : // 75 : // Define the problem. 76 : // 77 : problem navierstokes ( [u1,u2,p], [v1,v2,q] ) 78 : = int2d ( Th, qforder = 3 ) 79 : ( 80 : dx(u1) * dx(v1) 81 : + dy(u1) * dy(v1) 82 : + dx(p) * v1 83 : + u1*dx(u1o) * v1 84 : + u2*dy(u1o) * v1 85 : + u1o*dx(u1) * v1 86 : + u2o*dy(u1) * v1 87 : + dx(u2) * dx(v2) 88 : + dy(u2) * dy(v2) 89 : + dy(p) * v2 90 : + u1*dx(u2o) * v2 91 : + u2*dy(u2o) * v2 92 : + u1o*dx(u2) * v2 93 : + u2o*dy(u2) * v2 94 : + dx(u1) * q 95 : + dy(u2) * q 96 : - eps * p * q 97 : ) 98 : - int2d ( Th, qforder = 3 ) 99 : ( 100 : u1o*dx(u1o) * v1 101 : + u2o*dy(u1o) * v1 102 : + u1o*dx(u2o) * v2 103 : + u2o*dy(u2o) * v2 104 : ) 105 : + on ( 1, 2, 4, u1 = 0.0 ) 106 : + on ( 3, u1 = 1.0 ) 107 : + on ( 1, 2, 3, 4, u2 = 0.0 ); 108 : // 109 : // Initialize u1 and u2. 110 : // 111 : u1 = 0.0; 112 : u2 = 0.0; 113 : // 114 : // Seek a solution [u1,u2,p] of the nonlinear equations via a fixed point iteration. 115 : // 116 : for ( int i = 0; i < 10; i++ ) 117 : { 118 : u1o = u1; 119 : u2o = u2; 120 : navierstokes; 121 : } 122 : // 123 : // Plot the velocity vectors, using 1 color for the vectors. 124 : // 125 : plot ( [ u1, u2 ], nbarrow = 1, ps = "driven_cavity_navier_stokes_velocity.ps" ); 126 : // 127 : // Plot the pressure. 128 : // 129 : plot ( p, ps = "driven_cavity_navier_stokes_pressure.ps" ); 130 : // 131 : // Terminate. 132 : // 133 : cout << "\n"; 134 : cout << "driven_cavity_navier_stokes:\n"; 135 : cout << " Normal end of execution.\n"; 136 : 137 : exit ( 0 ); 138 : sizestack + 1024 =4200 ( 3176 ) driven_cavity_stokes: FreeFem++ version. -- Square mesh : nb vertices =961 , nb triangles = 1800 , nb boundary edges 120 -- Solve : min -0.190866 max 1 min -0.326409 max 0.313182 min -487.151 max 399.511 -- Solve : min -0.190704 max 1 min -0.327774 max 0.311796 min -486.503 max 399.2 -- Solve : min -0.190704 max 1 min -0.327774 max 0.311796 min -486.503 max 399.2 -- Solve : min -0.190704 max 1 min -0.327774 max 0.311796 min -486.503 max 399.2 -- Solve : min -0.190704 max 1 min -0.327774 max 0.311796 min -486.503 max 399.2 -- Solve : min -0.190704 max 1 min -0.327774 max 0.311796 min -486.503 max 399.2 -- Solve : min -0.190704 max 1 min -0.327774 max 0.311796 min -486.503 max 399.2 -- Solve : min -0.190704 max 1 min -0.327774 max 0.311796 min -486.503 max 399.2 -- Solve : min -0.190704 max 1 min -0.327774 max 0.311796 min -486.503 max 399.2 -- Solve : min -0.190704 max 1 min -0.327774 max 0.311796 min -486.503 max 399.2 driven_cavity_navier_stokes: Normal end of execution. current line = 137 exit(0) err code 0 , mpirank 0 CodeAlloc : nb ptr 3676, size :483792 mpirank: 0 Ok: Normal End