question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

problem with the frequency of ansys calculated and scipy calculated are different

See original GitHub issue

Hello, everyone,

I have a problem with the frequency calculated. when I use ansys calculated I can get [2871,6168,8689,11468] When I try to get the mass and stiffness matrix from a .full file with the scipy.sparse.linalg.eigsh module to calculate, Python give me [15.811 15.812 15.813 15.814]. I think they should be the same.

Here is the code I use for testing:

import pyansys
import os
import scipy
from scipy.sparse import linalg
import numpy as np

fullfile = os.path.join('G:\STIFF', 'CURVE.full')
full = pyansys.read_binary(fullfile)
dof_ref, k, m = full.load_km()   # returns upper triangle only

k += scipy.sparse.triu(k, 1).T
m += scipy.sparse.triu(m, 1).T

k += scipy.sparse.diags(np.random.random(k.shape[0])/1E20, shape=k.shape)

w, v = linalg.eigsh(k, k=20, M=m, sigma=10000)

f = np.real(w)**0.5/(2*np.pi)
print('First four natural frequencies')
for i in range(4):
    print('{:.3f} Hz'.format(f[i]))

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
FredAnscommented, Oct 16, 2020

Hi, For what I see, this mathematical problem seems to be a bit hard to solve, and I see the Mapdl Lanczos algorithm making a lot of iterations to converge. My feeling is that scipy func gives wrong results, because of the numerical difficulties.

I’ve checked using an alternative Modal Algorithm for Symmetric Matrices ( MODOPT,SUBSPACE,4,1), an I get very close solutions to Lanczos, but SUBSPACE converge faster because it’s more robust in this numerical situation :

FREQUENCY RANGE REQUESTED= 4 MODES ABOVE 1.00000 HERTZ

1     8.528801109020
2     12.49936641695
3     14.83630288045
4     17.04379504882
1reaction
akaszynskicommented, Oct 15, 2020

I’m running into the same issue as you in regards to the python solve. However, when solving this within MAPDL using MAPDL Math, I’m ending up with a different set of eigenvalues than you:


! read in matrices
*SMAT, stiff, D, import, full, file.full, STIFF
*SMAT, mass, D, import, full, file.full, mass

! solve
/SOLU
ANTYPE,MODAL
MODOPT,LANB,4,1
*VEC, MYVEC, D, ALLOC, 0
*eig,STIFF,MASS,,MYVEC 

Which returns:

  FREQUENCIES AT CURRENT LANCZOS CYCLE
     1  0.85280110E+01     2  0.12485649E+02     3  0.14800782E+02
     4  0.17033644E+02     5  0.21613667E+02     6  0.22647486E+02
     7  0.26119110E+02     8  0.29797630E+02     9  0.30706920E+02
    10  0.31378644E+02    11  0.33062955E+02    12  0.34077783E+02
    13  0.36827381E+02    14  0.42039170E+02

     number of steps      :      2
     eigenvalues found    :     14
     total no. eigenvalues:     14

  LANCZOS CYCLE NUMBER =   2

     new shift:  1.4948D+04     modes still needed:        0
  Allocate a [4] Vector : MYVEC

 *** ANSYS - ENGINEERING ANALYSIS SYSTEM  RELEASE Release 18.2.2   18.2.2   ***
 ANSYS Mechanical Enterprise                       
 88888888  VERSION=LINUX x64     12:22:41  OCT 15, 2020 CP=      0.752

                                                                               



 *** FREQUENCIES FROM BLOCK LANCZOS ITERATION ***

  MODE    FREQUENCY (HERTZ)      


   FREQUENCY RANGE REQUESTED=    4 MODES ABOVE   1.00000     HERTZ

    1     8.528010965666    
    2     12.48564886186    
    3     14.80078189537    
    4     17.03364386520    

Please note that I’m running this on ANSYS v18.2, and there might be a fundamental difference in full files between v17 and v18.2. Can you try running the above on v17?

Pinging @FredAns. Is there something we’re potentially missing here?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Modal analysis natural frequency results percentage ...
i am doing my project using a multi leaf spring. I have done modal analysis to obtain the natural frequency, and i also...
Read more >
Ansys modal analysis soultion not matching test results
I have modelled conveyor drives and connecting pulley & structure in ANSYS and used modal analysis to identify natural frequencies in the model....
Read more >
Frequency Domain - Ansys Learning Forum
Now I want to convert it to the frequency domain. ... Running that calculation in the other direction, the highest frequency you can...
Read more >
Inconsistent loss calculations with HFSS field calculator
My problem happens when I try to calculate the quality factor using the HFSS field calculator (it is useless in this simplified case,...
Read more >
How to know the natural frequency of a structure such as a ...
The natural frequency of the cantilever is a calculation based on its mass and stiffness so air or water are irrelevant. If you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found