geodynamics / aspect

A parallel, extensible finite element code to simulate convection in both 2D and 3D models.
https://aspect.geodynamics.org/
Other
223 stars 235 forks source link

Changed python list comprehensions into numpy array operations #5762

Closed KerrMadeleine closed 4 months ago

KerrMadeleine commented 4 months ago

Instead of using python list comprehensions to loop through coordinate points of a mesh object to extract the x,y coordinate points and x,y velocity components, I used the numpy array functionality to transpose the Nxd array into a dxN one (where d is the dimension and N is the number of points in the mesh) and then take the first (x-component) and second (y-component) of that transposed array which results in the same Nx1 array as before, it just looks nicer (and is potentially faster). The images plotting the phi-component of the velocity are the same and show the before and after of making this change. vphi_new00025 vphi_00025

For new features/models or changes of existing features: