-- FreeFem++ v4.6 (Thu Apr 2 15:47:38 CEST 2020 - git v4.6) Load: lg_fem lg_mesh lg_mesh3 eigenvalue 1 : // channel_stokes_steady.edp 2 : // 3 : // Discussion: 4 : // 5 : // Solve the steady Stokes equations. 6 : // 7 : // Location: 8 : // 9 : // http://people.sc.fsu.edu/~jburkardt/freefem_src/channel_stokes_steady/channel_stokes_steady.edp 10 : // 11 : // Modified: 12 : // 13 : // 18 May 2015 14 : // 15 : // Author: 16 : // 17 : // Florian De Vuyst 18 : // 19 : // Reference: 20 : // 21 : // Florian De Vuyst, 22 : // Numerical modeling of transport problems using freefem++ software - 23 : // with examples in biology, CFD, traffic flow and energy transfer, 24 : // HAL id: cel-00842234 25 : // https://cel.archives-ouvertes.fr/cel-00842234 26 : // 27 : cout << "\n"; 28 : cout << "channel_stokes_steady:\n"; 29 : cout << " FreeFem++ version.\n"; 30 : cout << " Solve Stokes equations for steady flow in a cha ... : nnel.\n"; 31 : 32 : real Re = 600.0; 33 : real nu = 1.0 / Re; 34 : real Lx = 12.0; 35 : real Ly = 5.0; 36 : real dt = 0.5; 37 : // 38 : // Set the boundary. 39 : // 40 : border c1 ( t=0,1 ) { x=t*Lx; y=0; } 41 : border c2 ( t=0,1 ) { x=Lx; y=t*Ly; } 42 : border c3 ( t=1,0 ) { x=t*Lx; y=Ly; } 43 : border c4 ( t=1,0 ) { x=0; y=t*Ly; } 44 : border c5 ( t=2*pi,0 ) { x=4+0.2*cos(t); y=Ly/2+0.2*sin(t); } 45 : border c6 ( t=0,1 ) { x=5+Lx/2*t; y=Ly/2+0.4; } 46 : border c7 ( t=0,1 ) { x=5+Lx/2*t; y=Ly/2-0.4; } 47 : // 48 : // Make the mesh. 49 : // 50 : mesh Th = buildmesh 51 : ( 52 : c1(80)+c2(40)+c3(80)+c4(20)+c5(60)+c6(100)+c7(100) 53 : ); 54 : 55 : plot ( Th, wait = 1, ps = "channel_stokes_steady_mesh.ps" ); 56 : // 57 : // Define discrete velocity space Uh and discrete pressure space Vh. 58 : // 59 : fespace Uh ( Th, P2 ); 60 : fespace Vh ( Th, P1 ); 61 : Uh u; 62 : Uh v; 63 : Uh uh; 64 : Uh vh; 65 : Uh uold; 66 : Uh vold; 67 : Vh p; 68 : Vh ph; 69 : Vh uplot; 70 : Vh vplot; 71 : Vh vort; 72 : // 73 : // Define the weak form of the steady state Stokes equations. 74 : // 75 : real eps = 1.0E-10; 76 : 77 : problem stokes ( [u,v,p], [uh,vh,ph] ) = 78 : int2d(Th) ( nu*dx(u)*dx(uh) + nu*dy(u)*dy(uh) ) 79 : + int2d(Th) (nu*dx(v)*dx(vh) + nu*dy(v)*dy(vh) ) 80 : - int2d(Th) (p*dx(uh)) 81 : - int2d(Th) (p*dy(vh)) 82 : - int1d(Th, c2) (nu*dx(u)*N.x*uh+nu*dy(u)*N.y*uh) 83 : - int1d(Th, c2) (nu*dx(v)*N.x*vh+nu*dy(v)*N.y*vh) 84 : + int2d(Th) (dx(u)*ph + dy(v)*ph) 85 : + int2d(Th) (eps*p*ph) 86 : + on ( c1, c3, c5, u=0, v=0) 87 : + on ( c4, u=4.0 * y/Ly * (1-y/Ly), v=0 ); 88 : // 89 : // Solve the equations. 90 : // 91 : stokes; 92 : // 93 : // Plot the velocity vector field. 94 : // 95 : uplot = u; 96 : vplot = v; 97 : plot ( Th, [uplot,vplot], wait = 1, fill = 1, 98 : ps = "channel_stokes_steady_velocity.ps", cmm = "channel_stokes_steady velocity" ); 99 : // 100 : // Plot the pressure field. 101 : // 102 : plot ( Th, p, wait = 1, fill = 1, ps = "channel_stokes_steady_pressure.ps", 103 : cmm = "channel_stokes_steady pressure" ); 104 : // 105 : // Terminate. 106 : // 107 : cout << "\n"; 108 : cout << "channel_stokes_steady:\n"; 109 : cout << " Normal end of execution.\n"; 110 : 111 : sizestack + 1024 =3768 ( 2744 ) channel_stokes_steady: FreeFem++ version. Solve Stokes equations for steady flow in a channel. -- mesh: Nb of Triangles = 16814, Nb of Vertices 8547 -- Solve : min -3.46506e-34 max 1.02772 min -0.251782 max 0.251782 min -0.00431818 max 0.0166723 channel_stokes_steady: Normal end of execution. times: compile 0.005592s, execution 11.6418s, mpirank:0 CodeAlloc : nb ptr 3952, size :496656 mpirank: 0 Ok: Normal End