Closed IzzakQ closed 1 week ago
Hi
It appears to run correctly on my side. See if you can pull the latest code to see if that sorts it out.
Otherwise, have you edited the "Aircraft.json" file or are you referring to a different input Json file. If so, then perhaps one of the section inputs doesn't have an "xpos", "ypos", "zpos".
If you are willing to share your input file, then I am happy to look for you.
Let me know if your issue is resolved.
Yes, I have empty "xpos", "ypos", "zpos". Do you have working file for any simple aircraft?
{
"xpos": null,
"ypos": 0.21,
"zpos": null,
"chord": 0.35,
"angle": 0.0,
"numb": 5,
"bspace": "semi-cosine",
"airfoil": "NACA 2412"
},
{
"xpos": null,
"ypos": 0.8,
"zpos": null,
"chord": null,
"angle": null,
"numb": 20,
"bspace": "semi-cosine",
"airfoil": "NACA 2412"
},
{
"xpos": null,
"ypos": 1.8,
"zpos": null,
"chord": null,
"angle": null,
"numb": 15,
"bspace": "cosine",
"airfoil": "NACA 2412",
"controls": {
"aileron": {
"xhinge": 0.8,
"posgain": 1.0,
"neggain": 0.8,
"reverse": true,
"hvec": {"x": 0.0, "y": 0.0, "z": 0.0}
}
}
},
I suspect the issue is because you have an older version of pyvlm where a ValueError was returned rather than raised.
Please upgrade to the latest pyvlm, and latest pygeom using:
pip install pygeom --upgrade pip install pyvlm --upgrade
Let me know if that manages to sort out your issue.
These repositories are very much beta project until later releases, so I highly recommend cloning the repositories so that you can pull the latest main branch when need.
I try to run your project on Mac. It works more correctly, but I've same issue with running aircraft.json....
isak@MacBook-Air-Isak pyvlm % /usr/local/bin/python3 /Users/isak/Desktop/pyvlm/scripts/aircraft.py
# Lattice System Aircraft
| Name | Sref | cref | bref | xref | yref | zref |
| :------: | :---: | :--: | :--: | :---: | :---: | :---: |
| Aircraft | 1.358 | 0.31 | 4.5 | 1.175 | 0.000 | 0.000 |
| # Strips | # Panels | # Controls |
| :------: | :------: | :--------: |
| 252 | 1926 | 3 |
Traceback (most recent call last):
File "/Users/isak/Desktop/pyvlm/scripts/aircraft.py", line 22, in <module>
display_markdown(lres)
File "/Users/isak/Library/Python/3.12/lib/python/site-packages/IPython/core/display.py", line 145, in display_markdown
_display_mimetype('text/markdown', objs, **kwargs)
File "/Users/isak/Library/Python/3.12/lib/python/site-packages/IPython/core/display.py", line 86, in _display_mimetype
display_functions.display(*objs, raw=raw, metadata=metadata, include=[mimetype])
File "/Users/isak/Library/Python/3.12/lib/python/site-packages/IPython/core/display_functions.py", line 265, in display
print(*objs)
File "/Users/isak/Desktop/pyvlm/pyvlm/classes/latticeresult.py", line 980, in __str__
return self.to_mdobj()._repr_markdown_()
^^^^^^^^^^^^^^^
File "/Users/isak/Desktop/pyvlm/pyvlm/classes/latticeresult.py", line 910, in to_mdobj
report.add_heading(f'Lattice Result {self.name:s} for {self.sys.name:s}', 1)
^^^^^^^^^^^^^^^^^^
AttributeError: 'MDReport' object has no attribute 'add_heading'
Anyway, I've some questions to your project:
Hi
My apologies, I forgot that I referred to the latest py2md for markdown reports. You will need the latest py2md as well.
Install with pip install py2md --upgrade
.
In terms of your questions:
I also developed pyapm, which is a full 3D panel method. It uses the same input file as pyvlm. I have been working on pygeom to create geometry to blend fuselages with wings, to get their interaction correctly modelled. It is a side project but am hoping to be able to bring everything together at some point in the not-too-distant future. After that, the plan was for a GUI.
Hopefully with the pip install above, all the debugging issues are resolved. Let me know.
Yes, everything is correct except for a couple of lines that I managed to comment out and everything worked.
latticeresult_to_msh(lres, '../results/Aircraft.msh')
latticeresult_to_prf(lsys, '../results/Aircults/Aircraft_pressures.json')
The files themselves are not in your repository, as I understand.
As for the questions:
I'm trying to develop my own VLM solver based on XFLR5 and AVL examples, but since it's all closed code, I'm having some difficulties in implementation. Right now I am validating my project on the AGARD wing example and comparing polars to make sure the formulas are correct
In the future, I would like to join GUI development, but for now I want to get my hands on the simple stuff
P.S. Don't you find the data output a bit unreadable?
Hi
It is great to hear that you got it working.
To fix the two lines you commented: you just need to create a directory called results one directory up from your current directory or you can edit the path. They are written out from the code, so you don't need them. You can then open the "msh" file to view in GMSH as shown below.
Since I use Jupyter notebooks the markdown is displayed quite nicely. I am not sure of your exact setup, but I run the scripts in VS Code as an Interactive notebook. See the output below.
I suspect the issue is because you have an older version of pyvlm where a ValueError was returned rather than raised.
Please upgrade to the latest pyvlm, and latest pygeom using:
pip install pygeom --upgrade pip install pyvlm --upgrade
Let me know if that manages to sort out your issue.
These repositories are very much beta project until later releases, so I highly recommend cloning the repositories so that you can pull the latest main branch when need.
After use "pip upgrade" It's on Win Machine
Traceback (most recent call last):
File "d:\xero\scripts\aircraft.py", line 12, in <module>
lsys = latticesystem_from_json(jsonfilepath)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AkhmedovIA\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyvlm\classes\latticesystem.py", line 414, in latticesystem_from_json
sys = latticesystem_from_dict(sysdct)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AkhmedovIA\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyvlm\classes\latticesystem.py", line 472, in latticesystem_from_dict
lsys.mesh()
File "C:\Users\AkhmedovIA\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyvlm\classes\latticesystem.py", line 74, in mesh
lsid, lpid = srfc.mesh(lsid, lpid)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AkhmedovIA\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyvlm\classes\latticesurface.py", line 90, in mesh
lenc = len(self.cspc)
^^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
Hi
It is great to hear that you got it working.
To fix the two lines you commented: you just need to create a directory called results one directory up from your current directory or you can edit the path. They are written out from the code, so you don't need them. You can then open the "msh" file to view in GMSH as shown below.
- I developed my own solver because I wanted to add span load optimisation to the solver. Python was the best option to do so; and using the vector math of pygeom it simplifies everything quite substantially. Unless you plan to do something different with it then solvers like XFLR5 and AVL are ready to use and well documented. Not sure about XFLR5, but AVL is open source, and you can view the source code. It comes with the download as a zip file, but it is written in Fortran and therefore is only readable if you know Fortran. I got clues on where the control points are positioned, etc, but the math for VLM is widely available. I just needed to look in the AVL source to try and get an exact correlation. I am interested in your motivations for developing a solver of your own?
- That sounds like a plan. Currently I am working with k3d in Jupyter notebook to generate the 3D plots for a new code I am writing. It is good enough for me while I validate the new code to make sure everything is correct. I will keep in mind that you are interested in developing a GUI.
Since I use Jupyter notebooks the markdown is displayed quite nicely. I am not sure of your exact setup, but I run the scripts in VS Code as an Interactive notebook. See the output below.
WoW, your Interactive notebook on Jupyter looks awesome!
Yes, I agree with you that VLM has a wide knowledge base, but when creating my own solver, I could not make the results beat well against already known solvers (XFLR5, AVL). My motivation is to create almost the same solution as yours, but with the addition of a fuselage, control surfaces, flight range with a specified payload mass, Specific engine consumption, Cruising Mach number and much more.
So far, I am creating the output of Matplotlib graphs via PyQt5 and using the button to output and export these graphs to .*csv. I think that when visualizing data, you should not try to reinvent the wheel and it is better to use ready-made 2d and 3d visualization solutions. But for now, the main task is to solve the convergence with XFLR5. I got good convergence with the XFLR5 flat wing, but as soon as I add the NACA profiles, the convergence leaves much to be desired.....
Blue - XFLR5
Orange - my sol
As for the error you are getting on your Windows machine, I am not sure why that would be the case. I will try and add more error checking and validation on the weekend to pyvlm, but you will only be able to get the updates if you git clone
this repository and add the directory to the PythonPath environment variable. I don't think I will publish another update to pip install until I fix a few more issues on my list of issues.
All the best for your coding. It is such a great tool to learn new things.
Hi, thank you for your project! I want to run aircraft.py file from directory, but I've a problem
how can I solve it?