airinnova / pytornado

:airplane: An implementation of the vortex-lattice method (VLM)
https://pytornado.readthedocs.io/
Apache License 2.0
25 stars 7 forks source link

Issue using geometry-definition instead of vertices-definition #27

Open morihab opened 3 years ago

morihab commented 3 years ago

Hi there, I tried to define my airplane with the geometry definition instead of vertices as winglets are easier to define this way, but somehow this does not work. PyTornado thinks that I have provided vertices, allthough I didn't (I double checked). It jumps into loops which should only be used when vertices are provided, e.g. .local/lib/python3.8/site-packages/pytornado/objects/aircraft.py", line 1081 or so. See the content of my terminal below.

First error message was:

moritz@ThinkPad-L460:~/Documents/Akaflieg/fs36_pytornado/pytornado$ pytornado -vcr settings/template.json
[2020-12-04 18:25:10 INFO] @ pytornado.stdfun.run | ========== pytornado 0.5.4 ==========
[2020-12-04 18:25:10 INFO] @ pytornado.fileio.native.aircraft | Reading aircraft model from file '.../fs36.json'...
Traceback (most recent call last):
  File "/home/moritz/.local/bin/pytornado", line 104, in <module>
    main()
  File "/home/moritz/.local/bin/pytornado", line 79, in main
    stdrun.standard_run(args)
  File "/home/moritz/.local/lib/python3.8/site-packages/pytornado/stdfun/run.py", line 99, in standard_run
    aircraft = io.cpacs.aircraft.load(settings) if settings.aircraft_is_cpacs else io.native.aircraft.load(settings)
  File "/home/moritz/.local/lib/python3.8/site-packages/pytornado/fileio/native/aircraft.py", line 81, in load
    for key, value in segment_entry['vertices'].items():
KeyError: 'vertices'

I then changed the part in /.../lib/python3.8/site-packages/pytornado/fileio/native/aircraft.py so that it only jumps into it if there are vertices definded but still an error remains:


moritz@ThinkPad-L460:~/Documents/Akaflieg/fs36_pytornado/pytornado$ pytornado -vcr settings/template.json
[2020-12-04 17:59:35 INFO] @ pytornado.stdfun.run | ========== pytornado 0.5.4 ==========
[2020-12-04 17:59:35 INFO] @ pytornado.fileio.native.aircraft | Reading aircraft model from file '.../fs36.json'...
[2020-12-04 17:59:35 INFO] @ pytornado.objects.aircraft | Checking reference values...
[2020-12-04 17:59:35 INFO] @ pytornado.objects.aircraft | Checking vertex coordinates...
[2020-12-04 17:59:35 INFO] @ pytornado.objects.aircraft | Checking geometric properties...
[2020-12-04 17:59:35 INFO] @ pytornado.objects.aircraft | Checking airfoil properties...
[2020-12-04 17:59:35 INFO] @ pytornado.objects.aircraft | Checking discretisation properties...
[2020-12-04 17:59:35 INFO] @ pytornado.objects.aircraft | Reference points provided: a, b, c, d
[2020-12-04 17:59:35 INFO] @ pytornado.objects.aircraft | --> Point A = nan
[2020-12-04 17:59:35 INFO] @ pytornado.objects.aircraft | --> Point B = nan
[2020-12-04 17:59:35 INFO] @ pytornado.objects.aircraft | --> Point C = nan
[2020-12-04 17:59:35 INFO] @ pytornado.objects.aircraft | --> Point D = nan
Traceback (most recent call last):
  File "/home/moritz/.local/bin/pytornado", line 104, in <module>
    main()
  File "/home/moritz/.local/bin/pytornado", line 79, in main
    stdrun.standard_run(args)
  File "/home/moritz/.local/lib/python3.8/site-packages/pytornado/stdfun/run.py", line 99, in standard_run
    aircraft = io.cpacs.aircraft.load(settings) if settings.aircraft_is_cpacs else io.native.aircraft.load(settings)
  File "/home/moritz/.local/lib/python3.8/site-packages/pytornado/fileio/native/aircraft.py", line 118, in load
    aircraft.generate()
  File "/home/moritz/.local/lib/python3.8/site-packages/pytornado/objects/aircraft.py", line 264, in generate
    wing.generate()
  File "/home/moritz/.local/lib/python3.8/site-packages/pytornado/objects/aircraft.py", line 398, in generate
    segment.generate()
  File "/home/moritz/.local/lib/python3.8/site-packages/pytornado/objects/aircraft.py", line 1087, in generate
    d_x = self.vertices['d'][0] - self.vertices['a'][0]
IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed

Thank you very much for your help, would be great if I could use PyTornado for my work on the glider prototype fs36!