function[Data]=updateRHS(Mesh, Data) % updateRHS: Updates the right-hand side vector for the next iteration of % the contact algorithm % INPUT: % Mesh: Structure containing all the mesh parameters % Data: Structure containing all the data parameters % OUTPUT: % Data: Updated data structure % Retrive mesh parameters % Coordinate matrix coord=Mesh.coord_mat; % Retrieve data parameters % Number of free degrees of freedom nf=Data.nf; % Number of constraints nc=length(Data.body{1}.interface_dof); % Retrieve nodes making up the interfaces nodes1=Data.body{1}.interface_nodes; nodes2=Data.body{2}.interface_nodes; % Retrieve coordinates of nodes making up the interfaces coord1=coord(nodes1,:); coord2=coord(nodes2,:); Diff=multiplyR12(Data, coord2)-coord1; % Initialization b=zeros(nf+nc,1); b(1:nf)=Data.bc; b(nf+1:nf+nc)=reshape(Diff', [], 1); % Update data structure Data.b=b; Data.nc=nc; end