Skip to content

Migrate plotting utilities away from Mayavi/TVTK to VTK#328

Merged
Ben Preston (ben-l-p) merged 10 commits into
developfrom
dev_rewrite_vtk
Dec 4, 2025
Merged

Migrate plotting utilities away from Mayavi/TVTK to VTK#328
Ben Preston (ben-l-p) merged 10 commits into
developfrom
dev_rewrite_vtk

Conversation

@ben-l-p

Copy link
Copy Markdown
Collaborator

Also includes merging main to develop as this should have been done earlier. Some tests are failing with this branch due to changes in the linearised aerodynamic system which are under investigation.

Ben Preston (ben-l-p) and others added 9 commits March 20, 2025 17:27
Merge develop into main for new version release
V2.4 breakes the LinearAeroelastic tests, since the solver is not imported. This pull request restores the working environment for linear simulations
Fixed import issue for linear assembler
…and the plotting utilities in Modal. Included a few other small changes
…Small fix to beamplot where some beam elements were ordered incorrectly.
@ben-l-p

Ben Preston (ben-l-p) commented Oct 27, 2025

Copy link
Copy Markdown
Collaborator Author

The linear test which was previously failing was because the aerogridplot post processor was changing the wake array data in place for the solution. I have left Mayavi as a dependency as there are a few little bits of legacy code which use it, but it is no longer used in the key routines (beam plot, aero grid plot and plotting modes). Should now be ready to merge - and we should also merge into main as I don't believe main works at the moment due to TVTK depreciations.

@wong-hl Hui Ling Wong (wong-hl) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor stylistic comments. I have faith that the math and everything else is correct


def discretise_domain(self):
"""
r"""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have the docs just been broken for all these equations?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I make a few of the docstrings in the code to raw strings because I was getting annoyed by warnings saying there is an invalid escape sequence (because of https://stackoverflow.com/questions/52335970/how-to-fix-syntaxwarning-invalid-escape-sequence-in-python when maths symbols are used, for example \omega). Now, if this breaks the docs on git, I need to check...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually add two backslashes, i.e. \\, when I have the maths so I don't need to make it a raw string. I thought not having the backslashes meant that it just wouldn't build and display the maths properly

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either option works for viewing the maths in my IDE, and using raw strings means the maths is the same as what it would be in Latex., and functions like this don't appear in the GitHub docs anyway. This would be a different story if it was a string that actually needed escape sequence characters. I think having either approach in this case shouldn't do us any harm.

Comment thread sharpy/postproc/aerogridplot.py Outdated
Comment thread sharpy/postproc/aerogridplot.py Outdated
Comment on lines +229 to +230
zeta_star = np.moveaxis(self.data.aero.timestep_info[self.ts].zeta_star[i_surf], 0, -1).copy() # [m*+1, n+1, 3]
gamma = self.data.aero.timestep_info[self.ts].gamma_star[i_surf].copy() # [m*, n]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is me nitpicking but the comment of m*+1 is not really clear what it is. The +1 is what's throwing me off. And should the one comment in the line below be m* or just m

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change this, thanks for spotting. In my own codes, I usually denote the shape of arrays with respect to other variables in such comments, but I get why it doesn't make much sense here!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shape is really useful ngl. It's not trivial to visualise it from the code so the comments are welcome. I just don't understand what this one means 😅

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For your reference, I'm here using the standard SHARPy discretisation notation, which is M panels in the chord wise direction, N in the span wise direction, and a wake of length M* panels. I should probably use m_star rather than m* as that can look like multiplication. As we're working with vertex, we have to add one to the number of panels. I'll add this to the comments!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! It's m_star I thought it was a multiplication. It makes sense now.

Comment thread sharpy/sharpy_main.py Outdated
@ben-l-p Ben Preston (ben-l-p) merged commit af3d324 into develop Dec 4, 2025
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants