CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

Efficient Conversion of Local Stiffness Matrix to Global Stiffness

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 14, 2010, 12:46
Default Efficient Conversion of Local Stiffness Matrix to Global Stiffness
  #1
New Member
 
JamesHird
Join Date: Sep 2010
Posts: 1
Rep Power: 0
nlane is on a distinguished road
Hi all,

I work with FEM and was once told by a professor that assembling the stiffness matrix should be roughly 10% of computation time while the solver eats the remaining computation time. This is not the case with my code as assembly for problems larger than 10^6 DOF seems to take as long as the solver. That said, I am looking to improve the section of the code which takes values at the local stiffness level and populates the global stiffness matrix. We are using sparse storage by rows so this involves repeated searching of blocks of column information to determine where in the global array local coefficients should be stored.

We use unstructured meshes so there is no order to the global node numbering but I am wondering if there is any a priori nodal renumbering?, or clever search strategy, etc? that could be employed to speed up this tedious but necessary part of the code.

Cheers
nlane is offline   Reply With Quote

Old   September 14, 2010, 14:29
Default
  #2
New Member
 
Join Date: May 2009
Posts: 28
Rep Power: 17
walli is on a distinguished road
Did you allocate the pattern of the sparse matrix before usage? It sounds a bit like there are many reallocations involved. Also, you should assemble into a small dense element matrix and add the local contributions all at once to the global system to avoid as many lookups as possible. If you did both of those things, then maybe your sparse matrix implementation is in some point inefficient. Did you try different implementations, e.g. PETSc, MTL, DUNE-ISTL, ...?
walli is offline   Reply With Quote

Old   September 14, 2010, 19:26
Default
  #3
pja
New Member
 
Join Date: Sep 2010
Posts: 3
Rep Power: 16
pja is on a distinguished road
This is what I do in my FEM code. It may be inefficient for problems
with that many DOF but it seems to work fine for up to 10^5 unknowns
which is what I have tried. Also the assembly process can
be made parallel fairly simply so that may be an option.


! Loop on element columns for element i
do j=1,elem_dof(i)

! Global column number
l=compr_map(elem_ft(i,j),1)

if(l.ne.0)then

! Loop on element rows
do k=1,elem_dof(i)

! Global row number
m=compr_map(elem_ft(i,k),1)

! CSC format
! Loop on row pointers for global column l

if(sparse_store.eq.0)then
add=.false.
search1:do ll=pointers(l),pointers(l+1)-1
if(indices(ll).eq.m)then
kk=ll
add=.true.
exit search1
endif
enddo search1

! CSR format
! Loop on column pointers for global column m
elseif(sparse_store.eq.1)then
add=.false.
if(m.ne.0)then
search2:do ll=irn(m),irn(m+1)-1
if(jcn(ll).eq.l)then
kk=ll
add=.true.
exit search2
endif
enddo search2
endif
endif

if(add)then
K_work(kk,1)=K_work(kk,1)+kelem(k,j)
if(iassemble.eq.0.or.iassemble.eq.1)then
Mass_work(kk,1)=Mass_work(kk,1)+melem(k,j)
if(damp_type.eq.1)then
Damp_work(kk,1)=Damp_work(kk,1)+delem(k,j)
endif
endif
endif

enddo
endif
enddo
endif
pja is offline   Reply With Quote

Reply

Tags
fem development


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Transient simulation not converging skabilan OpenFOAM Running, Solving & CFD 14 December 17, 2019 00:12
How to write k and epsilon before the abnormal end xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 16:33
Convergence moving mesh lr103476 OpenFOAM Running, Solving & CFD 30 November 19, 2007 15:09
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 03:58
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07


All times are GMT -4. The time now is 19:54.