From: Boy Pardosi on 6 Aug 2010 02:00 Hi. I'm currently working on my Finite element code for seepage analysis. Here is the problem. K =stiffness matrix (m x m) ---->known x =global degree of freedom (m x 1) (matrix that to be solved) F= force matrix (m x 1)----> zeros Governing equation: K.x=F x can easily solved by K\F. Problem is some of x's elements are constant, say x=[1 2 a b 3 c] where a b and c are variables to be solved. How do i get around with this ? Thanks.
From: John D'Errico on 6 Aug 2010 07:09 "Boy Pardosi" <boypardosi(a)yahoo.co.id> wrote in message <i3g8dk$94e$1(a)fred.mathworks.com>... > Hi. > I'm currently working on my Finite element code for seepage analysis. > Here is the problem. > > K =stiffness matrix (m x m) ---->known > x =global degree of freedom (m x 1) (matrix that to be solved) > F= force matrix (m x 1)----> zeros > > Governing equation: > K.x=F > > x can easily solved by K\F. Problem is some of x's elements are constant, say > x=[1 2 a b 3 c] > where a b and c are variables to be solved. > > How do i get around with this ? > > Thanks. You simply need to eliminate those knowns from the problem, moving that part to the right hand side. Thus, suppose that we have the boolean vector known, that indicates the "known" elements. known = [1 1 0 0 1 0]; x = [1 2 nan nan 3 nan]'; I've stuffed NaNs into the solution vector where the unknowns will fall. The solution is simple enough, written in one line. x(~known) = K(:,~known)\(F - K(:,known)*x(known)) HTH, John
From: Bruno Luong on 6 Aug 2010 07:37 "Boy Pardosi" <boypardosi(a)yahoo.co.id> wrote in message <i3g8dk$94e$1(a)fred.mathworks.com>... > Hi. > I'm currently working on my Finite element code for seepage analysis. > Here is the problem. > > K =stiffness matrix (m x m) ---->known > x =global degree of freedom (m x 1) (matrix that to be solved) > F= force matrix (m x 1)----> zeros > > Governing equation: > K.x=F > > x can easily solved by K\F. Problem is some of x's elements are constant, say > x=[1 2 a b 3 c] > where a b and c are variables to be solved. > > How do i get around with this ? The trick people in FEM sometime use is do (this avoid to duplicate the stiffness matrix, which sometime is big after building): lockidx = [1 2 6]; K(lockidx ,:) = 0; xlock = [1 2 3]; F(lockidx ) = xlock; for ilock=lockidx K(ilock,ilock) = 1; end x = K\F; Depending on the solver, you might need to select the lock diagonal to different value (than 1) so as the conditioning of K does not degraded too much. The inconvenience is that some nice properties of K - such as being Hermitian - is no longer true after modification. To overcome that, you can lock by row and column, and translate the solution similar to John's suggestion. Bruno
|
Pages: 1 Prev: How to control a switch in a GUI Next: Not displaying graphs |