// -*- c++ -*- // This file is part of ff3d - http://www.freefem.org/ff3d // Copyright (C) 2003 Laboratoire J.-L. Lions UPMC Paris // 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: potential-fluid-flow.ff,v 1.1 2003/09/26 07:55:59 ArceneL Exp $ // A real-world test case from Stephane Del Pino's PhD Thesis, // paragraph 4.1.3: the potential flow of a fluid. vertex a = (0,0,0); vertex b = (5,10,2); vector n = (25,50,10); mesh M = structured(n,a,b); scene S = pov("potential-fluid-flow.pov"); domain Omega = domain(S,outside(<1,0,0>) and outside(<0,1,0>) and outside(<0,0,1>)); // Characteristic function for the domain function Ki = 1-one(<0,1,0>); // Penalisation parameter double eps = 1e-3; solve(phi) in Omega by M krylov(type=cg,precond=diagonal),memory(matrix=none){ test(psi) int(Ki*grad(phi)*grad(psi)) + int(M)(1/eps*phi*psi*(one(<1,0,0>) + one(<0,0,1>))) = int(M)(1/eps*psi*one(<1,0,0>)); }; save(medit,"potential-fluid-flow-phi",M); save(medit,"potential-fluid-flow-phi",phi,M); function u = dx(phi); save(medit,"potential-fluid-flow-u",M); save(medit,"potential-fluid-flow-u",u,M); function v = dy(phi); save(medit,"potential-fluid-flow-v",M); save(medit,"potential-fluid-flow-v",v,M); function w = dz(phi); save(medit,"potential-fluid-flow-w",M); save(medit,"potential-fluid-flow-w",w,M);