Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not getting the converged values #2

Open
ckesanapalli opened this issue Feb 6, 2019 · 8 comments
Open

Not getting the converged values #2

ckesanapalli opened this issue Feb 6, 2019 · 8 comments

Comments

@ckesanapalli
Copy link

ckesanapalli commented Feb 6, 2019

I tried to run the demo code in the ReadMe file, but for the command


>>> from xfoil import XFoil
>>> xf = XFoil()
>>> from xfoil.test import naca0012
>>> xf.airfoil = naca0012
 Number of input coordinate points: 160
 Clockwise ordering
 Max thickness =     0.000000  at x =   0.000
 Max camber    =     0.000000  at x =   0.000

  LE  x,y  =  -0.06001  -0.06001  |   Chord =   0.08487
  TE  x,y  =   0.00000   0.00000  |

 Current airfoil nodes set from buffer airfoil nodes ( 160 )

>>> xf.Re = 1e6
>>> xf.max_iter = 40

But for the following command,

a, cl, cd, cm, co = xf.aseq(0, 1, 0.5)

I got the output as

 Calculating wake trajectory ...
 Calculating source influence matrix ...

 Solving the BL system ...

 Initializing BL ...
    side            1  ...
 TRCHEK2: N2 convergence failed.
 x:  0.08352  0.08353  0.08353  N:  0.000  9.000    NaN  Nx:     NaN   dN:       NaN
 Calculating wake trajectory ...
 Calculating source influence matrix ...

 Solving the BL system ...

 Initializing BL ...
    side            1  ...
 TRCHEK2: N2 convergence failed.
 x:  0.08352  0.08353  0.08353  N:  0.000  9.000    NaN  Nx:     NaN   dN:       NaN

The values are
print(a, cl, cd, cm, co)

[nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan
 nan nan] [nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan
 nan nan] [nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan
 nan nan] [nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan
 nan nan] [nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan
 nan nan]

May I know how to resolve this issue

@daniel-de-vries: Your python code is really great and looks really apt for my project. I would really appreciate if you could help me resolving this issue.

@maidmentdaniel
Copy link

maidmentdaniel commented Feb 17, 2019

I get a bunch of nan's too. I'm not sure why.

from xfoil import XFoil
from xfoil.test import naca0012


xf = XFoil()
xf.airfoil = naca0012
xf.Re = 1e6
xf.max_iter = 40
a, cl, cd, cm, co = xf.aseq(-20, 20, 0.5)

returns:
output

@ajwahab
Copy link
Contributor

ajwahab commented Feb 18, 2019

Encountering the same on macOS 10.14.3. Noticed that the max thickness, chord, LE, and TE values differ from those given in README.md.
What I get:

>>> xf.airfoil = naca0012

 Number of input coordinate points: 160
 Clockwise ordering
 Max thickness =     0.000000  at x =   0.000
 Max camber    =     0.000000  at x =   0.000

  LE  x,y  =  -0.06001  -0.06001  |   Chord =   0.08487
  TE  x,y  =   0.00000   0.00000  |

What the README.md indicates I should be getting:

>>>  xf.airfoil = naca0012

 Number of input coordinate points: 160
 Counterclockwise ordering
 Max thickness =     0.120008  at x =   0.308
 Max camber    =     0.000000  at x =   0.033

  LE  x,y  =  -0.00000   0.00000  |   Chord =   1.00000
  TE  x,y  =   1.00000   0.00000  |

Seeing that the thickness, among other values, is computed from the airfoil coordinates, perhaps there is an issue with how the naca0012 coordinate array in test.py is being parsed by the fortran routines?

Seems to work just fine on Ubuntu 18.04, though aseq now also outputs 5 values (minimum pressure coefficient co was recently added in [4354e48]), so README.md should be updated to:

>>>  a, cl, cd, cm, co = xf.aseq(-20, 20, 0.5)

This project is fantastic!

@ckesanapalli
Copy link
Author

@ninfinity How did you install xfoil module it in ubuntu. I am trying to install in ubuntu but I am getting a bunch of errors.

@ajwahab
Copy link
Contributor

ajwahab commented Feb 21, 2019

Try my fork of the project. I’ve submitted a pull request that includes a minor edit that lowers the minimum cmake version requirement to 3.10, which seems to be the current default in Ubuntu 18.04.

@ckesanapalli
Copy link
Author

@ninfinity : can you give me instructions on how to install your version. I am trying but I am getting error.

home/chaitu1351/anaconda3/lib/python3.7/distutils/dist.py:274: UserWarning: Unknown distribution option: 'zip_save'
      warnings.warn(msg)
    error: can't copy 'build/lib.linux-x86_64-3.7/xfoil/xfoil.cpython-37m-x86_64-linux-gnu.so': doesn't exist or not a regular file
    ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=/home/chaitu1351/src/xfoil/build/lib.linux-x86_64-3.7/xfoil', '-DCMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE=build/temp.linux-x86_64-3.7', '-DPYTHON_EXECUTABLE=/home/chaitu1351/anaconda3/bin/python']

@Nick-Zhang1996
Copy link

@maidmentdaniel @ckesanapalli @ninfinity The problem you're having is resulted from an improper call to self._lib.get_airfoil() in xfoil.py. Somehow the memory buffer used for x and y are entangled and the function gets same array for x and y. If you check xf.airfoil you'll see xf.airfoil.x is actually set to the values of xf.airfoil.y. I suspect this is a bug with ctypes library, and by changing platform I believe @ninfinity switched to a different version of ctypes, which fixed the problem. I have a fix in my fork of this library and I have absolutely no idea why it works. If you come across this issue, my version may help you.

@wzc001
Copy link

wzc001 commented Jul 11, 2021

Excuse me,I also encountered this problem(NAN). Have you solved it?

@ckesanapalli
Copy link
Author

Nope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants