function [b] = assembRightSideStreamlineDiffusion(mesh, f, k, deltaT)

gradN(1,:) = [-1, -1];
gradN(2,:) = [1, 0]';
gradN(3,:) = [0, 1]';

b=zeros(mesh.NuDoF, 1);
if  length(k) == mesh.NuDoF
  temp1 = (k(1,mesh.T(:,1)) + k(1,mesh.T(:,2)) + k(1,mesh.T(:,3)))./3;
  temp2 = (k(2,mesh.T(:,1)) + k(2,mesh.T(:,2)) + k(2,mesh.T(:,3)))./3;
  clear 'k';
  k(1,:) = temp1;
  k(2,:) = temp2;
end

if length(f) == 1
  temp=f;
  f = ones(mesh.NuTri,1);
  f = temp*f;
  clear 'temp';
elseif length(f) == mesh.NuDoF
  temp = ( f(mesh.T(:,1)) + f(mesh.T(:,2)) + f(mesh.T(:,3)) )/3;
  f = temp; 
end

c = 0.5*f.*deltaT.*(abs(mesh.Bdet)./mesh.Bdet)';
for x=1:3
  MVProduct1=  squeeze(mesh.B(2,2,:))*gradN(x,1)-squeeze(mesh.B(2,1,:))*gradN(x,2);
  MVProduct2= -squeeze(mesh.B(1,2,:))*gradN(x,1)+squeeze(mesh.B(1,1,:))*gradN(x,2);
  K =  c'.*(k(1,:)'.*MVProduct1 + k(2,:)'.*MVProduct2);
  for i = 1:mesh.NuTri 
    b(mesh.T(i,x)) = b(mesh.T(i,x)) + K(i);
  end
end
