Skip to content

Fix FieldConvert halfmodetofourier module with triangles

Ankang Gao requested to merge gaoak/nektar:fix/halfmodetofourier into master

Issue/feature addressed

1, The code breaks in version 5.2.0 if the mesh contains triangles. This is caused by a bug introduced by me in the !1247 (merged). The number of modes in the triangle element is not correctly computed.

2, In this module, an argument realmodetoimag is used to define variables that are imaginary modes. The variable number should be provided in the previous formation, such as realmodetoimag=1,2. Sometimes, the variable name is also convenient.

Proposed solution

1, GetNumberOfCoefficients is called to obtain the correct number of coefficients for both triangular and quadrilateral elements.

2, In the module ProcessGrad, a similar argument vars is also used to define a set of variables, and both variable number and variable name can be used. For example, 1,2, 1,w, v,2, and v,w are all valid. This feature is refactored into a function GenerateVariableSet and used for the realmodetoimag.

Implementation

The number of modes in one element is obtained by calling LibUtilities::GetNumberOfCoefficients.

The way of parsing the config option, realmodetoimag, is also optimized by calling GenerateVariableSet. This expanded the ways to define this argument. The previous formation, such as 1,2 is still supported.

Tests

A test has been added.

Suggested reviewers

Please suggest any people who would be appropriate to review your code.

Notes

Please add any other information that could be useful for reviewers.

Checklist

  • 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 Jacques Xing

Merge request reports