Multidisciplinary analysis with Python, PreCICE and Calculix Crunchix

Table of Contents

precice coupling

In the previous posts, we developed a parametric structures model of a simple cantilevered composite wing using Python and CalculiX. We even did some design optimization using the OpenMDAO library. This time we add a simple parametric aerodynamics model to calculate the aero loads on the wing and couple it with our CalculiX structures model using the preCICE library and python API.

The example source code can be found on github (v0.0.4) and there is also a video run-through of the code updates, that includes a demo of the multidisciplinary analysis implementation and some sample results. 

Why do multidisciplinary simulation?

Most engineering problems involve more than one discipline – such as aerodynamics, structures, hydrodynamics, thermodynamics etc. For example, we want a wing to generate enough aerodynamic lift to keep an aircraft flying, whilst at the same time making sure that it is as light as possible without bending too much or even breaking apart.

Because the physical equations and simulation requirements that each discipline deals with are typically very different, we also have different simulation models and different analysis tools for each discipline. In fact, even within single disciplines, you may want to create several models of the same component to study the problem at different levels of scale and accuracy.

In reality of course there are no “disciplines” – this is just a convenient way for engineers to divide problems into smaller chunks that they can solve separately. The difficulty is to know when interactions between these different models should not – and cannot – be ignored.

For example, you may start by designing your wing shape and aerodynamic performance assuming that your wing is rigid. Separately, you may model the wing structure and check that it doesn’t break under the rigid wing aero loads. The structures analysis will also show you that the wing actually bends and twists under those aero loads. Since the wing shape is now different from your initial assumptions, you should probably recalculate the aero loads.

In fact, you may end-up going through this loop several times until you have a “converged” solution, where all forces balance out nicely (remember Newton’s 3rd Law?). Unfortunately, sometimes you may also find that you can never reach a converged solution – either entering a cycle or finding solutions that diverge more and more (for wings see flutter and divergence).

Now there are a number of multidisciplinary simulation solutions that can make it easier to catch these interactions early-on and avoid problems down the line – because you really want to avoid discovering unexpected interactions when you are physically testing your product for the first time. When that happens it is usually really bad news for your design, for your engineering team and for the project timelines…

Read on to find out how you can get started with multidisciplinary analysis using an open source library called preCICE.

Example part 5: Multidisciplinary analysis with Python, PreCICE and Calculix Crunchix

In this example, we once again use our parametric composite wing model and add a simple aerodynamic model that allows us to calculate approximate aerodynamic force distributions along the wing span.

The aerodynamic analysis is completely independent of our structures model (except for basic parameters like the span and chord dimensions of the wing) and can be run on its own to generate rigid wing aero loads. We use simple strip theory here, but this could be replaced with a higher fidelity aero model as required.

As shown in Figure below we use preCICE in this example to:

  1. interpolate the static aero forces onto the structures mesh (aero to structures)
  2. interpolate the the static wing deflections onto the aero mesh (structures to aero)
  3. iterate the coupled analyses until convergence is found or the max number of iterations is reached
precice coupling
Coupling structures and aero solvers through preCICE

To keep things as general as possible, we will couple both our structures and aerodynamics solvers manually using the preCICE API and python bindings. To help us understand what data is being exchanged, the python scripts do a lot of writing of arrays to file and reading of arrays from file – which is maybe not recommended for large models if you can avoid it. For the purpose of this example however it probably doesn’t matter too much. 

The video below introduces preCICE, runs you through the code updates and demos the coupled analysis execution and output.

Did we really have to do multidisciplinary analysis?

The simple answer is: it depends!

The first analysis we did was with the main composite fibre direction perfectly aligned with the span direction of the wing – maximising the bending stiffness and therefore minimising the deflections of the wing. The converged lift distribution for this stiff wing is only marginally different from the rigid wing lift.

However, for the same flight conditions, we found that the lift distribution and wing deflections can be very different if the main composite fibre direction is rotated – either by design or due to manufacturing variability. In the extreme case shown in the video, we find that rotating the fibres forward by 45 degrees, results in over 300% tip deflection increase, but with a 30% decrease in the lift generated at the tip.

In this second example, if we had assumed rigid wing aerodynamics, we would have significantly overestimated the wing loads and made it much heavier than needed.

On the contrary, if by mistake we had rotated the main composite fibre direction in the other direction (towards the trailing edge), we would have found that the lift at the tip would have increased (wash-in effect) compared to the rigid wing loads. In this case, we may have failed our wing unintentionally!

stiff wing tip displacements - precice
tip displacement convergence for a stiff wing
aero lift distribution for a stiff wing - precice
aero lift distribution for a stiff wing
flexible wing tip displacements - precice
tip displacement convergence for a flexible wing with washout
aero lift distribution for a flexible wing with washout - precice
aero lift distribution for a flexible wing with washout

To finish …

Using preCICE, we coupled our structures and aero models together and performed a multidisciplinary analysis. So, we now have a parametric aeroelastic composite wing model – albeit using a very simplistic aero model and making static analysis assumptions. 

If you fancy a challenge, you could try to put everything together that we have explored so far, by wrapping the design optimization around our multidisciplinary analysis!

From the author

Thanks for reading our blog. Feedback is a great way to learn, so if you have any questions or comments about this post or previous one, please get in touch! Olivia (Linkedin | Email)




Leave a Reply

Related Posts

Olivia Stodieck

Launching the Dapta Trial

Big News! After months of hard work, we can finally share a glimpse of what we have been working on. Not only that, but you can even try it out yourself. Here is an overview of what the Dapta app is all about.

Read More »