% Joins indexed equations at boundaries of two regions 
function dT = JoinFDEqs(dT,T,wght)
  for j=1:length(wght)                     % loop over shared nodes
    NetRate=0;
    Tmn=[];                                % array of Tmn in different regions
    [dd, nn, ww]=wght{j}{:};
    for i=1:length(dd)                     % loop over regions
      NetRate=NetRate+dT{dd(i)}(nn(i,1),nn(i,2))*ww(i);
      Tmn(end+1)=T{dd(i)}(nn(i,1),nn(i,2));
    end
    AvgT=mean(Tmn);
    for i=1:length(dd)                     % loop over regions
      dT{dd(i)}(nn(i,1),nn(i,2))=NetRate + ...
        AvgT-T{dd(i)}(nn(i,1),nn(i,2));    % adds "zero" (helps root finding)
    end
  end
end
