Switching from AVL to machup

203 views
Skip to first unread message

Charles Dhainaut

unread,
Jul 20, 2020, 4:18:23 AM7/20/20
to machup...@googlegroups.com


I am a naval engineer working on appendages design for racing yachts and interested in switching from AVL to Machup. We developed a full process of wing parametrization and optimization around AVL but we are limited by AVL for some applications and I would like to benchmark Machup against it.

A few questions first:
- Is there flexibility in the way wings can be defined ? One limitation of AVL is that we can only see the lift distribution on the Y-axis. IN our case we can work on flat y-axis wings, z-axis wings, but also wings with a lot of curvatures...
- Is there a possibility to define wings from a list of points containing leading edge and trailing edge points ?
- Is it possible to discretize the wing so we can use different section polars at different points ? AVL takes only 3 points to define the full CDCL curve which is very approximative. How is it with machup?


What do you advise us ? Which version of Machup should we try ?

Thanks,
Regards,

Cory

unread,
Jul 20, 2020, 11:43:26 AM7/20/20
to MachUp Forum
Hi Charles

We would advise using MachUpX. It's the most accurate and flexible and is under active development. Within MachUpX, you should be able to do everything you're looking for. Specifically:

- MachUpX will give you the lift and drag distribution for each lifting surface as a function of span regardless of the specific geometry.
- You can define the wing using a set of quarter-chord points and a distribution of chord lengths. We don't currently have functionality for defining the wing relative to the leading or trailing edges.
- MachUpX uses the AirfoilDatabase module (alos produced by the AeroLab) to handle section properties. Not only will it accept a linear model with a quadratic drag polar (what you have described AVL as using), but you can also specify the lift, drag, and moment coefficients at any number of angles of attack and AirfoilDatabase will interpolate off of that data. Within MachUpX, you can specify any number of sections along the span of the wing, and it will linearly interpolate between them.

Does that answer your questions?

Charles Dhainaut

unread,
Jul 20, 2020, 12:04:29 PM7/20/20
to MachUp Forum
Hi Cory,

Thank you very much for your answer.
Thats good news for the section polars.
Concerning the definition of the geometry, maybe you have an idea of how we could process.
- The first method we use is to give to AVL a single input per flying condition for the wings ; it means angle of attack and sideslip angle are always 0 ; but we rotate the geometries to the corresponding angles of interest (rake, pitch, yaw). As the chord must always be parallel to the X axis in AVL, we can only use this method for a very small range of angles otherwise the geometry can't be well defined
- The second method would be to keep the geometry in the correct coordinate system for AVL/Machup but calculating the transformation of coordinate system (from the angles we use rake, pitch, yaw -> alpha and beta).  Then, we would also need to have the results in the Euler coordinate system instead of the flow coordinate system. Any chance we can have that with Machup?

Last questions. I see in the documentation that chord and distribution are defined as a fraction of the span axis (= y axis). What happens if I have duplicate values for Y ? For example, what happens if my dihedral curve (YZ plane)ok like this? How do I define the chord and twist distribution ?


Thanks again


Cory

unread,
Jul 20, 2020, 12:28:10 PM7/20/20
to MachUp Forum
Hi Charles

When defining geometry in MachUpX, you always define it in the body-fixed frame. You can then specify the full state of the body (position, body-fixed velocity, angular rates, and orientation) when creating the input. So if I understand your concern, you should be able to do what you need to by defining a single geometry and then changing the direction of the freestream velocity vector (either using alpha and beta or by giving the vector components directly).  You then have the option of getting the results in the body-fixed (Euler), stability, or wind (flow) coordinate systems. If I understand you correctly, this all corresponds to your second method.

As for geometry distributions, I need to clarify this in the documentation. They are given as a function of span, which is defined as displacement along the wing locus of quarter-chord points projected into the y-z plane. So this is not necessarily the same as the y-axis for all wings. For example, in the plot you sent, the span is the distance along that curve, rather than just the y-axis. You'd have to recalculate your span distribution to account for this, but that will allow you to put in the dihedral distribution you showed.

Cory

Charles Dhainaut

unread,
Aug 3, 2020, 4:43:07 AM8/3/20
to MachUp Forum
Hi Cory,

Thanks for that answer.
I started to dig into MachupX, forked it and did some changes so we can use our wing formulation and input files containing leading edge and trailing edge points. It seems to work fine so far!

Another important topic for us would be to have the possibility to enforce a zero-lift condition at the free surface, as described here:

Do you have any advise for us to implement that into MachupX ?

Thanks a lot again
Cheers,
Charles

Cory

unread,
Aug 6, 2020, 12:28:53 PM8/6/20
to MachUp Forum
Hi Charles

I'm not sure how to implement that in MachUpX. My thought would be to make an anti-mirror image of the hydrofoil across the free surface (i.e. opposite orientation, angle of attack, section properties, etc.) and then examine how that affects the behavior of the hydrofoil. But I'm not sure if that would achieve the desired effect.

I believe a colleague of mine did some work for people in the yachting community a couple years ago to add this sort of capability into MachUp Pro. I don't know what the results of that were. I'll reach out to him and get his input.

Cory

Cory

unread,
Aug 6, 2020, 12:30:50 PM8/6/20
to MachUp Forum
Hi Charles

I also need to amend a previous post. I have recently added functionality to MachUpX to give the body x, y, and z force and moment distributions along the span of the wing segment. Hopefully this will help your investigation.

Cory

Charles Dhainaut

unread,
Aug 10, 2020, 3:58:36 AM8/10/20
to MachUp Forum
Hi Cory,

It makes sense to do the anti mirror image like you are saying. I will give a try and try to benchmark it VS other methods.

By the way;  I continued to play a bit with Machup. I was just wondering of a more straightforward way to perform calculations for target CLs. It seems that I am obliged to get the AoA for each CL want, and then solve forces for that AoAs. Am I doing too complicated or is this the correct way ?
Thanks

Cory

unread,
Aug 11, 2020, 11:22:59 AM8/11/20
to MachUp Forum
Hi Charles

Do you mean getting all the forces and moments at a specific CL? It sounds like you're going about it the right way. Are you using scene.target_CL() to get the angle of attack? If so, you can pass that the keyword argument set_state=True and this will set the wing at that angle of attack. Then you can call scene.solve_forces() to get all the forces and moments.

Thanks

Cory

ch.dh...@gmail.com

unread,
Aug 25, 2020, 9:33:52 AM8/25/20
to MachUp Forum
Hi Cory,

Its exactly what I wanted to do, thanks.

I am trying to define a density profile like indicated on the documentation:
"rho": [
[0.0, 1.225],
[2000.0, 1.0066],
[4000.0, 0.81935],
["m", "kg/m^3"]
]

Whenever I start try to solve the forces with this profile or another, I get this error:

/mnt/sda2/Work/CDYYY-Dev/python-utils/pyWings/planform.py:55: RuntimeWarning: invalid value encountered in true_divide
  return vector / np.linalg.norm(vector)
/home/charles/miniconda3/envs/default/lib/python3.8/site-packages/numpy/linalg/linalg.py:2159: RuntimeWarning: invalid value encountered in det
  r = _umath_linalg.det(a, signature=signature)
Traceback (most recent call last):
  File "hydrofoil.py", line 36, in <module>
    my_scene.target_CL(CL=-0.15, set_state=True)
  File "/mnt/sda2/Work/CDYYY-Dev/python-utils/MachupX/machupX/scene.py", line 3176, in target_CL
    CL = self.solve_forces(dimensional=False)[aircraft_name]["total"]["CL"]
  File "/mnt/sda2/Work/CDYYY-Dev/python-utils/MachupX/machupX/scene.py", line 1451, in solve_forces
    self._handle_error(e)
  File "/mnt/sda2/Work/CDYYY-Dev/python-utils/MachupX/machupX/scene.py", line 3104, in _handle_error
    raise error
  File "/mnt/sda2/Work/CDYYY-Dev/python-utils/MachupX/machupX/scene.py", line 1448, in solve_forces
    integrate_time = self._integrate_forces_and_moments(**kwargs)
  File "/mnt/sda2/Work/CDYYY-Dev/python-utils/MachupX/machupX/scene.py", line 933, in _integrate_forces_and_moments
    dF_inv = (self._rho*self._gamma)[:,np.newaxis]*np.cross(self._v_i, self._dl)
ValueError: operands could not be broadcast together with shapes (3,) (200,)


It works with a constant "rho" value

Thanks

Cory

unread,
Aug 25, 2020, 12:16:07 PM8/25/20
to MachUp Forum
Hi Charles

Thanks for pointing that out. I believe I have it fixed. Go ahead and install the latest version and let me know if it works.

Thanks

Cory

ch.dh...@gmail.com

unread,
Aug 26, 2020, 4:04:50 AM8/26/20
to MachUp Forum
Hey,
Thank you for fixing it, it works now.

I have other question concerning airfoils data. I am not sure to understand the way I need to structure the external file ? For example, if I have a csv file containing CL and CD data ? What If I have multiple files corresponding to different Reynolds/Turbulence levels ?

Thank you

ch.dh...@gmail.com

unread,
Aug 26, 2020, 4:07:30 AM8/26/20
to MachUp Forum
The way I would work in AVL was:
- Computing the polars of a certain airfoil with xfoil/RANS for different Re/Ncrit
- Picking the polars for the corresponding velocity/turbulence level

How can I do the same with Machup?
Thanks

Cory

unread,
Aug 26, 2020, 11:45:31 AM8/26/20
to MachUp Forum
Hi Charles

The easiest way to do this would be for you to use AirfoilDatabase (https://github.com/usuaero/AirfoilDatabase) to generate your airfoil data. AirfoilDatabase uses Xfoil to automatically generate databases of airfoil coefficients as functions of angle of attack, Reynolds number, Mach number, and flap deflection. You also have control over Xfoil inputs such as Ncrit and Xtrip. The generated database can then be directly read into MachUpX to define the airfoil behavior. This is all explained in the documentation for MachUpX and AirfoilDatabase. Alternatively, you could examine the structure of the database produced by AirfoilDatabase (it's just ASCII text) and reformat your current data into that structure to pass to MachUpX.

Thanks

Cory

ch.dh...@gmail.com

unread,
Aug 27, 2020, 3:40:08 AM8/27/20
to MachUp Forum
Hi Cory,

We do have our own library to work on airfoils, running XFoil but also RANS simulations with transtion models to increase the precision on the polars. Would you mind please just share an example of database so I can save some time and just replicate the data structure ? Thank you

ch.dh...@gmail.com

unread,
Aug 27, 2020, 4:29:47 AM8/27/20
to MachUp Forum
Another question...What if we want to use different section polars for the different velocities simulated by MachupX ?
Thank you

Cory

unread,
Aug 27, 2020, 1:26:01 PM8/27/20
to MachUp Forum
Hi Charles

I've attached an example database here and I'll put one in the examples/ directory. Note that the angle of attack is given in radians.

These databases are Reynolds number dependent, which should allow for different polars at different velocities, as you asked.

Thanks

Cory
naca_0012_database.txt

ch.dh...@gmail.com

unread,
Aug 28, 2020, 5:14:42 AM8/28/20
to MachUp Forum
Hi Cory,

Thank you for the database file.
I am not sure I understand the way MachupX will interpret this data though:
1. Here for example you have many different Reynolds numbers. How can I know which Reynolds is going to be used on different part on the wing then ? For example, If I have a rectangular wing (ie constant chord) I want to run for 3 different velocities, I need to generate the full CL/CD polars for 3 Reynolds number only, correct ? How do MachupX is doing the link between the database I give and the corresponding velocities ?
2. If I want to run MachupX with different turbulent levels (Ncrit) how can I do that ?
3. Not really a technical question but... Any reason why you are not using a standard data format (like .csv for example) to make the data import/export (with pandas lib) easier by user?


Thanks again
Charles

Cory

unread,
Aug 28, 2020, 11:20:41 AM8/28/20
to MachUp Forum
Hi Charles

1. MachUpX determines the local Reynolds number of each section based on the local chord and velocity (including induced velocities). It will then linearly interpolate through the database to estimate the coefficient at the current angle of attack and Reynolds number. When creating the database, I recommend going a little above and below the range of global Reynolds numbers you're going to consider, since the section Reynolds number varies a bit.
2. Turbulence in MachUpX is handled only at the airfoil level. So whatever turbulence level your airfoil database was generated at will be the turbulence level of the simulation. You'd have to switch out airfoil database files for each turbulence level you want to test.
3. No particular reason. Under the hood of MachUpX, I use the numpy library for most computations. Using numpy.savetxt() and numpy.genfromtxt(), it was easiest to work with the data format I currently have set up. Would it be advantageous to format the database files differently? I honestly never considered that users would be dealing with formatting the database files themselves. I had assumed (for better or for worse) that users would use AirfoilDatabase to create the database files and wouldn't really care about the format.

Thanks

Cory

hugo

unread,
Sep 1, 2020, 8:10:27 AM9/1/20
to MachUp Forum
Hello Guys,

Any news on that matter ? I would also be interested to be able to model a free-surface condition in Machup X

Thanks,

Hugo

Cory

unread,
Sep 2, 2020, 10:57:35 AM9/2/20
to MachUp Forum
Hi Hugo, Charles

I spoke with my colleague who has worked on this problem in the past. He successfully implemented free-surface boundary conditions in MachUp Pro. He said he'll be uploading that code as a separate branch on Github sometime in the near future. As for MachUpX, there is currently no way to model free surface or wall boundary conditions. It may be quite some time before we are able to implement that. This is not currently a research priority for the AeroLab and I have very little bandwidth what with other projects I'm working on. I apologize because I know that such capabilities are vital for your work. I hope that sometime in the future we'll be able to incorporate this into MachUpX.

Thanks

Cory

hugo

unread,
Sep 8, 2020, 5:25:12 AM9/8/20
to MachUp Forum
Hi Cory.

Is Machup Pro available ? Is it open source as well ?
I wouldn't mind implementing it in MachUp X with some documentation from the implementation in Machup Pro.
Charles have you tried the solution you mentioned earlier in this thread ?

Thanks,

Hugo

Marco

unread,
Sep 8, 2020, 6:03:37 AM9/8/20
to machup...@googlegroups.com
you can find MachUpPro here

though I don't think that includes the free surface branch

Cory

unread,
Sep 8, 2020, 11:30:23 AM9/8/20
to MachUp Forum
Thanks for sharing the link Marco. I'm not sure when we're going to have the free-surface branch up.

Hugo, you're welcome to try adding it to MachUpX. If you can get it working well and have it well documented, I'd be happy to merge it in to the master branch.

hugo

unread,
Sep 9, 2020, 4:24:17 AM9/9/20
to MachUp Forum
Hi Cory, Marco,

Thanks for the link.
Would it be possible to have some information on how it has been implemented in Machup Pro ?

Hugo

Cory

unread,
Sep 15, 2020, 12:32:27 PM9/15/20
to MachUp Forum
Hi Hugo

My colleague will be creating a branch on Github that has the expanded MachUp Pro code and some documentation discussing its implementation. Unfortunately, he's also very busy these days and may not be able to get around to it for a while. I'm unfamiliar with the implementation, otherwise I would share that info with you.

Thanks

Cory

Reply all
Reply to author
Forward
0 new messages