-- FreeFem++ v4.14 (mer. 06 mars 2024 16:59:04 CET - git v4.14-1-g2b2052ae) file : convect.edp Load: lg_fem lg_mesh lg_mesh3 eigenvalue 1 : // convect.edp 2 : // 3 : // Discussion: 4 : // 5 : // Demonstrate a pure convection problem: the quantity U is convected by 6 : // a rotating velocity field. 7 : // 8 : // Freefem++ has a "convect" command, of the form 9 : // 10 : // convect ( ?, ?, ? ) 11 : // 12 : // Licensing: 13 : // 14 : // This code is distributed under the MIT license. 15 : // 16 : // Modified: 17 : // 18 : // 23 July 2015 19 : // 20 : // Author: 21 : // 22 : // Olivier Pironneau 23 : // 24 : cout << "\n"; 25 : cout << "convect():\n"; 26 : cout << " FreeFem++ version:\n"; 27 : cout << " A simple demonstration of the convect() command ... : .\n"; 28 : 29 : int n = 20; 30 : int M = 4 * n; 31 : real x0 = 0.25; 32 : real y0 = 0.25; *** Warning The identifier y0 hide a Global identifier 33 : real dt = 2.0 * pi / M; 34 : // 35 : // Th: a square mesh on [-1,+1]x[-1,+1]. 36 : // 37 : mesh Th = square ( n, n, [ 2 * x - 1, 2 * y - 1 ] ); 38 : // 39 : // Plot the mesh. 40 : // 41 : plot ( Th, wait = true, ps = "convect_mesh.ps" ); 42 : // 43 : // Vh: a finite element space on Vh, using piecewise quadratics. 44 : // 45 : fespace Vh ( Th, P2 ); 46 : // 47 : // u, uold: trial functions. 48 : // 49 : Vh u; 50 : Vh uold; 51 : // 52 : // v: test function. 53 : // 54 : Vh v; 55 : // 56 : // A: defines the problem in variational form. 57 : // 58 : problem A ( u, v ) = 59 : int2d ( Th ) ( u * v ) 60 : - int2d ( Th ) ( convect ( [ y, -x ], -dt, uold ) * v ) 61 : + on ( 1, 2, 3, 4, u = 0 ); 62 : // 63 : // uold: the initial condition as a Gaussian centered at (0.25,0.25). 64 : // 65 : uold = exp ( - 50.0 * ( ( x - x0 ) ^ 2 + ( y - y0 ) ^ 2 ) ); 66 : plot ( uold, dim = 32, fill = true, value = true, ps = "convect_uh.ps" ); 67 : // 68 : // Carry out convection M times, using a time step of 2 pi / M. 69 : // 70 : for ( int m = 0; m < M; m++ ) 71 : { 72 : A; 73 : if ( m < M - 1 ) 74 : 75 : plot ( u, dim = 3d, fill = true, value = true ); 76 : uold = u; 77 : } 78 : // 79 : // Terminate. 80 : // 81 : cout << "\n"; 82 : cout << "convect():\n"; 83 : cout << " Normal end of execution.\n"; 84 : 85 : exit ( 0 ); 86 : sizestack + 1024 =3008 ( 1984 ) convect(): FreeFem++ version: A simple demonstration of the convect() command. -- Square mesh : nb vertices =441 , nb triangles = 800 , nb boundary edges 80 -- Solve : min -0.000570276 max 0.963694 -- Solve : min -0.000774021 max 1.03331 -- Solve : min -0.000419468 max 1.03694 -- Solve : min -0.000550527 max 1.00365 -- Solve : min -0.00137988 max 0.970126 -- Solve : min -0.00299261 max 0.989691 -- Solve : min -0.00311437 max 0.972145 -- Solve : min -0.00243086 max 0.981955 -- Solve : min -0.00372498 max 0.961182 -- Solve : min -0.00497791 max 0.990063 -- Solve : min -0.00571548 max 0.950288 -- Solve : min -0.00589514 max 0.96898 -- Solve : min -0.00553617 max 0.972141 -- Solve : min -0.00471544 max 1.02548 -- Solve : min -0.00355647 max 1.00053 -- Solve : min -0.00351799 max 0.997581 -- Solve : min -0.00407961 max 0.970482 -- Solve : min -0.0039932 max 0.976052 -- Solve : min -0.00355531 max 0.979249 -- Solve : min -0.00354004 max 0.943529 -- Solve : min -0.00353155 max 0.96981 -- Solve : min -0.00394059 max 0.964664 -- Solve : min -0.00474541 max 0.957868 -- Solve : min -0.00513037 max 0.969909 -- Solve : min -0.00515096 max 0.97708 -- Solve : min -0.00489676 max 1.01501 -- Solve : min -0.004475 max 0.981214 -- Solve : min -0.0137472 max 0.972353 -- Solve : min -0.0176474 max 0.950414 -- Solve : min -0.0167208 max 0.989823 -- Solve : min -0.0133602 max 0.963658 -- Solve : min -0.00944062 max 0.972361 -- Solve : min -0.00877683 max 0.970251 -- Solve : min -0.0141308 max 1.01679 -- Solve : min -0.0145925 max 0.994002 -- Solve : min -0.0128848 max 0.963747 -- Solve : min -0.0132994 max 0.926969 -- Solve : min -0.0158651 max 0.960378 -- Solve : min -0.015736 max 0.97293 -- Solve : min -0.0140937 max 0.94515 -- Solve : min -0.0132394 max 0.959081 -- Solve : min -0.0137376 max 0.959631 -- Solve : min -0.0141902 max 0.91919 -- Solve : min -0.0145759 max 0.946556 -- Solve : min -0.0148631 max 0.978937 -- Solve : min -0.0150175 max 1.01419 -- Solve : min -0.0150082 max 0.980502 -- Solve : min -0.0148131 max 0.986768 -- Solve : min -0.0144223 max 0.971747 -- Solve : min -0.013839 max 1.01399 -- Solve : min -0.0130786 max 0.989616 -- Solve : min -0.0121671 max 0.99291 -- Solve : min -0.0111375 max 0.976505 -- Solve : min -0.010027 max 1.03096 -- Solve : min -0.00887386 max 1.01487 -- Solve : min -0.00771457 max 0.930241 -- Solve : min -0.00700207 max 0.962879 -- Solve : min -0.00693019 max 0.942545 -- Solve : min -0.00688345 max 0.956461 -- Solve : min -0.00686823 max 0.992394 -- Solve : min -0.0086658 max 0.97598 -- Solve : min -0.00854057 max 0.932827 -- Solve : min -0.00848884 max 0.96224 -- Solve : min -0.00883458 max 0.95577 -- Solve : min -0.00988088 max 0.94645 -- Solve : min -0.0103417 max 0.990197 -- Solve : min -0.0160991 max 0.966287 -- Solve : min -0.0288073 max 0.985234 -- Solve : min -0.0320878 max 0.965404 -- Solve : min -0.0293942 max 1.01385 -- Solve : min -0.0237427 max 0.997619 -- Solve : min -0.0174262 max 0.971647 -- Solve : min -0.0180306 max 0.961907 -- Solve : min -0.0201898 max 0.964846 -- Solve : min -0.0188016 max 0.95179 -- Solve : min -0.0252886 max 0.904718 -- Solve : min -0.0305882 max 0.939913 -- Solve : min -0.030583 max 0.919398 -- Solve : min -0.027671 max 0.963402 -- Solve : min -0.023566 max 1.00768 convect(): Normal end of execution. current line = 85 exit(0) err code 0 , mpirank 0 CodeAlloc : nb ptr 3959, size :523024 mpirank: 0 Ok: Normal End