📄 l2-derivative-projection-cartesian-q1.at
字号:
# This file is part of ff3d - http://www.freefem.org/ff3d# Copyright (C) 2005 Stephane Del Pino# This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2, or (at your option)# any later version.# This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.# You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software Foundation,# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # $Id: l2-derivative-projection-cartesian-q1.at,v 1.3 2006/03/18 16:19:45 delpinux Exp $AT_SETUP([L2-projection derivatives (cartesian Q1-FEM)])AT_DATA([test.ff],[[vertex a = (0,0,0);vertex b = (1,2,3);vertex n = (3,7,6);mesh M = structured(n,a,b);femfunction u(M) = x+2*y-6*z+3*x*y+2*x*z-y*z+2*x*y*z;function ux = 1+3*y+2*z+2*y*z;function uy = 2+3*x-z+2*x*z;function uz = -6+2*x-y+2*x*y;solve(dxu) in M cg(epsilon=1E-20), krylov(precond=diagonal){ pde(dxu) dxu = dx(u);}solve(dyu) in M cg(epsilon=1E-20), krylov(precond=diagonal){ pde(dyu) dyu = dy(u);}solve(dzu) in M cg(epsilon=1E-20), krylov(precond=diagonal){ pde(dzu) dzu = dz(u);}double l2errorx = sqrt(int[M]((dxu-ux)^2));if (l2errorx < 1E-8) cout << "dx(u): ok\n";else cout << "oops: dx(u) l2-error is " << l2errorx << "\n";double l2errory = sqrt(int[M]((dyu-uy)^2));if (l2errory < 1E-8) cout << "dy(u): ok\n";else cout << "oops: dy(u) l2-error is " << l2errory << "\n";double l2errorz = sqrt(int[M]((dzu-uz)^2));if (l2errorz < 1E-8) cout << "dz(u): ok\n";else cout << "oops: dz(u) l2-error is " << l2errorz << "\n";]])AT_CHECK([$abs_top_builddir/ff3d -V 0 -nw test.ff],0,[[dx(u): okdy(u): okdz(u): ok]])AT_CLEANUP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -