function [f] = spreadForce(F, XIB, X, Y, dq, N, h); % % [f] = spreadForce(F, XIB, X, Y, N, h); % % Spreads a force on the Lagrangian points, XIB to the fluid % at pts (X,Y) % % Returns: % f = force on fluid % % Input: % F = force at Lagrangian points % XIB = location of Lagrangian points % X = N*N vector of X location of fluid mesh point % Y = ", but Y locations % dq = lagrangian point spacing % N = number of mesh points in each direction % h = mesh width % [idxs delta] = evalDelta(XIB, X, Y, N, h); f = zeros(N*N,2); % for each Langrangian point calculate the force to apply: for( l = 1:length(XIB(:,1)) ) f(idxs(l,:),1) = f(idxs(l,:),1) + F(l,1) * dq * delta(l,:)'; f(idxs(l,:),2) = f(idxs(l,:),2) + F(l,2) * dq * delta(l,:)'; end