Skip to content

r-adaption for curves

Dave Moxey requested to merge feature/r-adapt-curves into master

Issue/feature addressed

Added functionality to generate anisotropic meshes by using r-adaption in the variational optimisation framework on and around CAD curves rather than a provided interpolation field.

Proposed solution

By adapting the current implementation for r-adaption around shocks, elements on or around user-defined CAD curves will be scaled. The user must define the CAD curve IDs in a list, a scaling factor by which the Jacobian is scaled (see J. Macron 2020 for more details), and a radius of influence away from the curve. Any element which is on the curve, or has a vertex within the domain of influence, will be scaled accordingly. Following the same approach as the existing r-adaption implementation, the user can also provide a parameter, subiter, to select how often the adaption step will take place.

Implementation

The changes all take place within the process module ProcessVarOpti where three additional options are added: ``radaptcurvesfor the list of CAD curve IDs,radaptscale` for the scaling factor, and an optional parameter `radaptrad` to extend the domain of where the adaption should take place around the CAD curve if desired.

To reduce the searching of all elements against all curves in the list, each element has its bounding box checked against overlapping with the bounding box of each CAD curve in the ElUtil::PreUpdateMapping() stage. To accommodate this, a vector of pairs containing the CAD curves and their bounding boxes is created during the VarOpti module PreProcessing and stored as a member variable for the module. This is then passed to PreUpdateMapping, through a modified ElUtil pthread job, where each element's bounding box is checked if it overlaps with any CAD curve bounding box and only marked for potential r-adaption against the curves in its vicinity with ElUtil::SetScalingFromInput().

The main r-adaption process takes place in ElUtil::UpdateMapping() where each element is checked if it needs to be scaled, and if so the scaling is applied in the exact same manner as the existing r-adaption implementation. The checks for scaling are done only if the element was marked as a candidate in ElUtil::PreUpdateMapping() and then is checked either if any vertex is within the radaptrad distance from the CAD curve if it is set, or if it has a vertex that is on the CAD curve if radaptrad is not set.

Tests

2d-circle-square: need more relevant tests and a way of checking if the adaption processes worked - WIP. 2d dummy tokamak case: too long to be a good test for the testing suit so not included. 3D-sphere: semi-working. This feature was not intended for 3D but should work in principle. In testing the r-adaption works on the curves connecting the sphere to the plain using nq=2, but when upgrading the mesh to higher order with varopti (using nq>2 and no adaption) there is a division by zero fault at the start of the optimisation. The 3D test will be updated once this is resolved.

Notes

Contains changes also found in !1597 (merged) that was split out for faster merging.

Checklist

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

Merge request reports