1% Testing divand in 2 dimensions with advection. 2 3% grid of background field 4[xi,yi] = ndgrid(linspace(-1,1,30)); 5 6x = .4; 7y = .4; 8f =1; 9 10mask = ones(size(xi)); 11pm = ones(size(xi)) / (xi(2,1)-xi(1,1)); 12pn = ones(size(xi)) / (yi(1,2)-yi(1,1)); 13 14u = ones(size(xi)); 15v = u; 16 17a = 5; 18u = a*yi; 19v = -a*xi; 20 21fi = divand(mask,{pm,pn},{xi,yi},{x,y},f,.2,200,'velocity',{u,v}); 22 23if abs( fi(18,24) - 0.89935) > 1e-3 24 error('unexpected large difference'); 25end 26 27 28 29% Copyright (C) 2014 Alexander Barth <a.barth@ulg.ac.be> 30% 31% This program is free software; you can redistribute it and/or modify it under 32% the terms of the GNU General Public License as published by the Free Software 33% Foundation; either version 2 of the License, or (at your option) any later 34% version. 35% 36% This program is distributed in the hope that it will be useful, but WITHOUT 37% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 38% FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 39% details. 40% 41% You should have received a copy of the GNU General Public License along with 42% this program; if not, see <http://www.gnu.org/licenses/>. 43