Fixed phi-field generation from STL and added rotation capability

Open Walid Hambli requested to merge wmh25/nektar:feature/IncNS_SPM into master

Issue/feature addressed

The Phi-field generation from an STL file returned a lot of misfits and only run in serial. Moreover, no motion was possible for the immersed body.

Proposed solution

Fixed the generation of phi-field from STL files with an additional robust test. Added parallel processing capability. Implemented a method to rotated the immersed geometry.


A ray is traced between mesh points and the solid STL closed surface and the number of intersection is counted. When it is even, it means the mesh point is outside the immersed body. Shared the complete domain boundaries among all processors, fixing parallel interpolation. Phi-field samples are pre-generated at determined angular positions. A linear interpolation is then operated at each time step between the samples to reconstruct the rotative motion. Fourier interpolation has also been envisaged but resulted in Gibbs oscillations.


Added serial and parallel tests for the generation of the phi-field from an STL (quarter box)

Suggested reviewers

Spencer Sherwin, Dave Moxey


The algorithm to determine the distance between mesh points and the STL surface could be improved since the robust test increases computation time.


  • Functions and classes, or changes to them, are documented.
  • User guide/documentation is updated.
  • Changelog is updated.
  • Suitable tests added for new functionality.
  • Contributed code is correctly formatted. (See the contributing guidelines).
  • License added to any new files.
  • No extraneous files have been added (e.g. compiler output or test data files).
Edited by Walid Hambli

Merge request reports