Xero64 / pyxfoil

Run XFoil from within Python and work with results.
MIT License
4 stars 1 forks source link

Resfile path #2

Open CarrieWe opened 2 months ago

CarrieWe commented 2 months ago

Hi there, Thank you for the code! I came across with an issue when trying to run it. for "xfoil.run_result(ali,mach=mach,re=re)", I received error of "result.read_result(resfilepath)

File C:xxpath\Lib\site-packages\pyxfoil\xfoilresult.py:31 in read_result with open(resfile, 'rt') as f:

FileNotFoundError: [Errno 2] No such file or directory: 'C:\xxpath\1.000000__0.000000_49_4.res" Could you please advise why this happened and how to solve it? Thank you so much!

Xero64 commented 1 month ago

Hi, I would be happy to help.

Have you set the working directory of pyxfoil to where you want the temporary files to go? In that folder should be a ".dat" file with your airfoil name and a ".ses" file. The session file is run through "xfoil.exe < 1.0000000.000000_49_4.ses" to generate the "1.0000000.000000_49_4.res" output, but sometimes Xfoil dosn't converge and generate an output. You may need more panels in your airfoil.

` python from pyxfoil import set_workdir

set_workdir('C:\Xfoil_WIP') `

A way to debug is to run Xfoil from your terminal using "xfoil.exe < 1.000000__0.000000_49_4.ses" but delete the quit command at the end of the session file so that you can see what is wrong for yourself.

Also, try without a Reynold's number which removes boundary layer convergence and if it does give you a result then it is highly likely that Xfoil is not converging to a solution for your given inputs.

I hope this helps. Let me know.

CarrieWe commented 1 month ago

Hi, thank you so much for your reply! I really appreciate your help. I did set some working directories but I'm not too sure if I have set it right. My code is "from pyxfoil import Xfoil, set_workdir, set_xfoilexe set_workdir('C:/ProgramData/anaconda3/venv') # Sets the working directory for pyxfoil. set_xfoilexe('C:/ProgramData/anaconda3/venv/Scripts/XFOIL6.99/xfoil.exe') xfoil = Xfoil('NACA 0012') dat='../NACA_0012_50.dat' xfoil.points_from_dat(dat) xfoil.set_ppar(50) al = [-2.0, 0.0, 4.0, 6.0] mach = 0.1 re =10000 for ali in al: rescase = xfoil.run_result(ali, mach=mach)" And this is what looks like in the folder. image Removing Reynolds number did remove the previous FileNotFound error, but it will come back no matter what Reynolds number I put in. I also got errors "WARNING: Poor input coordinate distribution Excessive panel angle 52.0 at i = 26 Repaneling with PANE and/or PPAR suggested (doing GDES,CADD before repaneling may improve excessively coarse LE spacing" and "File xfoil.def not found" Do I need to adjust the panel numbers? How can I do that?

Xero64 commented 1 month ago

Hi

For an inviscid solution you can solve for 50 panels like you have set, but for the viscous boundary layer solution you need a higher panel count and smaller panel angles. So, xfoil.set_ppar(160) should fix it.

Try that and let me know if it fixes the problem.

CarrieWe commented 1 month ago

Hi, thanks for that, but once I add back reynolds number to run_result, the previous error message of " result.read_result(resfilepath)

File C:\ProgramData\anaconda3\Lib\site-packages\pyxfoil\xfoilresult.py:31 in read_result with open(resfile, 'rt') as f:

FileNotFoundError: [Errno 2] No such file or directory: 'C:/ProgramData/anaconda3/venv\1.000000__0.00000049-2_0.1_10000.res'" came back and no matter how high I set the panel count to. It shows " VISCAL: Convergence failed Type "!" to continue iterating" in the console.

Xero64 commented 1 month ago

The expected "1.0000000.00000049-2_0.1_10000.res" result file tells me that you only have 49 panels for this airfoil. Are you sure you are setting ppar for it? If you set it to 160 then the file sure be "1.0000000.000000160-2_0.1_10000.res". Check the "1.000000__0.00000049-2_0.1_10000.ses" session file and make sure the ppar parameter is specified with n = 160. See example below:

` load C:/Xfoil_WIP\NACA_0012_160.dat ppar n 160

oper mach 0 visc 100000 alfa 0 dump C:/Xfoil_WIP\NACA_0012_160_160_0_0_100000.res mach 0.0 visc

quit `