Thanks a lot Chris and Kristoffer. It works now.
On Wednesday, 24 August 2016 14:29:52 UTC+10, Nguyen Vinh Phu wrote: > > Hello all, > > I am implementing a finite element solver in Julia. I have computed the > stiffness matrix (as a sparse matrix K) and the force vector (F). I have > some non zero boundary conditions on > the unknown. In Matlab, here is what I do: > > bcwt=mean(diag(K)); % a measure of the average size of an element in K > % used to keep the conditioning of the K matrix > udofs=fixedNode; % global indecies of the fixed displacements > f=f-K(:,udofs)*uFixed; % modify the force vector > K(udofs,:)=0; > K(:,udofs)=0; > K(udofs,udofs)=bcwt*speye(length(udofs)); % put ones*bcwt on the diagonal > f(udofs)=bcwt*speye(length(udofs))*uFixed; > U=K\f; > > I implemented the above in Julia and I got several errors associated with > the following > > f=f-K(:,udofs)*uFixed; % modify the force vector > K(udofs,:)=0; > K(:,udofs)=0; > K(udofs,udofs)=bcwt*speye(length(udofs)); % put ones*bcwt on the diagonal > f(udofs)=bcwt*speye(length(udofs))*uFixed; > > I would appreciate very much if someone can help. Thanks. > > Best regards, > Phu > >
