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

📄 test1.edp

📁 FreeFem++可以生成高质量的有限元网格。可以用于流体力学
💻 EDP
字号:
//Tutorial file test1.pde
// YOUR FIRST PROGRAM

border C(t=0,2*pi){x=cos(t); y=sin(t);}                    // the boundary
mesh Th = buildmesh (C(50));                // of the domain and its mesh
fespace Vh(Th,P1);      // Finite Element of degree 2 defined here for Vh
 Vh u,v;            // defines u and v as piecewise-P2 continuous functions
 func f= x*y;                       // definition of an algebraic function
 real cpu = clock();
 solve Poisson(u,v,solver=LU) =               // defines and solves the PDE
    int2d(Th)( dx(u)*dx(v) + dy(u)*dy(v))               //  bilinear part
    - int2d(Th)( f*v)                                   // right hand side
    + on(C,u=0)  ;                          // Dirichlet boundary condition

  plot(u,wait=1);
 cout << " CPU time = " << clock()-cpu << endl;

// ENDS HERE

// FOR THE PRO: The same done with total control over the algebra
varf a(u,v) = int2d(Th)( dx(u)*dx(v) + dy(u)*dy(v))+ on(C,u=0) ;
matrix A=a(Vh,Vh);  // stiffness matrix, see (\ref{eqn:Stiffness0})
varf b(u,v) = int2d(Th)( u*v ) ;
matrix B=b(Vh,Vh);
Vh F=f;
v[] = B*F[];
u[]=A^-1*v[];
plot(u,wait=1);

⌨️ 快捷键说明

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