1
$\begingroup$

I was wondering what is, computationally speaking, the best way of counting the total number of DoFs in a model when dealing with elements of different kinds, especially SOLID and SHELLS that could actually be joined together. Those differ in the amount of DoFs per Node: SOLIDs having 3 and SHELLs having 6, and it's quite tricky to assess the correct amount of DoFs.

Having a .txt or .inp file of the actual model, I was thinking about iterating over each node and searching which elements it belongs to.

Is this the best possible way of getting this information in order to preallocate the Global Stiffness Matrix? Also, do FEA Solvers really preallocate the Global Stiffness Matrix?

$\endgroup$

2 Answers 2

3
$\begingroup$

In complex cases like what you suggest, the only way to count is to enumerate: You go over your mesh and enumerate every degree of freedom you encounter on a vertex/edge/face/cell that you haven't encountered yet. When you're done with all cells, you know how many degrees of freedom there are.

Through this process, you also know which degree of freedom is going to couple with which other, and that's the information you use to pre-allocate the sparsity pattern of the stiffness matrix. And yes, you absolutely have to pre-allocate because the alternative is to store data in formats that either use vastly more memory or are vastly slower.

$\endgroup$
5
  • $\begingroup$ Does this mean I have to do more than one pass on the mesh? Also, elements are stored in the usual TYPE, EID, NODES in my .txt file; what's the best structure to store a sparse matrix? $\endgroup$ Commented Oct 4 at 21:01
  • 1
    $\begingroup$ Yes, you do one pass to enumerate degrees of freedom, and another to build the sparsity pattern for the matrix. People generally use (variations of) Compressed Sparse Row format: en.wikipedia.org/wiki/… $\endgroup$ Commented Oct 4 at 21:31
  • $\begingroup$ Ok, but...nDoF tells me the size of the actual stiffness matrix, not how many NNZ are present...am I missing something? $\endgroup$ Commented Oct 5 at 10:20
  • $\begingroup$ @DanieleLeo No, you're not missing anything. You have to determine NNZ in that second pass. Perhaps this page is useful? dealii.org/developer/doxygen/deal.II/step_2.html $\endgroup$ Commented Oct 7 at 0:28
  • 1
    $\begingroup$ Got it! I was actually looking at Step II - III before reading your comment, very good work! $\endgroup$ Commented Oct 7 at 17:19
1
$\begingroup$

As you have to assemble a global matrix (or possible several "global" matrices) before solving your problem anyhow, you can just count the dimension of the vector of unknowns in the end. This number is the total number of DOFs.

By doing this you can be sure, that equivalent DOFs, i.e. DOFs that are geometrically at the same position in your computational domain, but happen to be part of several elements are not being counted more than once. This is because in the global system, these DOFs are already identified with each other.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.