Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-orthogonal mesh improvements #166

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open

Non-orthogonal mesh improvements #166

wants to merge 32 commits into from

Commits on Jan 27, 2023

  1. Small bugfix in find_intersection

    If both upper_wall and lower_wall are True, `len(contour) // 2` rather
    than `len(contour // 2)` should be used.
    bendudson committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    55cb29e View commit details
    Browse the repository at this point in the history
  2. MeshRegion.addPointAtWallToContours handle no intersection

    If a contour starts outside the wall then it can be that no
    intersection is found. Handle that case, leaving original contour.
    bendudson committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    0fc5357 View commit details
    Browse the repository at this point in the history
  3. Add Point2D,plot()

    Method to plot single points, for interactive debugging
    bendudson committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    f63a8a9 View commit details
    Browse the repository at this point in the history
  4. Improve robustness of non-orthogonal mesh generation

    Attempting to handle cases where no intersection is found
    bendudson committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    3e019b6 View commit details
    Browse the repository at this point in the history
  5. Add Mesh.plotCells method

    Plots cell corners joined together, and cell centers as points.
    
    Perhaps could use xlow, ylow points to provide a quadratic cell shape?
    bendudson committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    d5530b0 View commit details
    Browse the repository at this point in the history
  6. Add wall intersection finding to FineContour

    The idea is to first extend FineContour to the wall, then distort
    PsiContour's points along the FineContour curve.
    
    A divide-and-conquer algorithm is used to make finding intersections
    with a large number of points efficient.
    bendudson committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    f55a69b View commit details
    Browse the repository at this point in the history
  7. Black formatting

    bendudson committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    94cd821 View commit details
    Browse the repository at this point in the history
  8. MeshRegion add plotGridLines and plotCells

    Move plotting to MeshRegion so individual regions can be plotted.
    Mesh plotting methods iterate over and call MeshRegions.
    bendudson committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    9291e5d View commit details
    Browse the repository at this point in the history
  9. Revert change to PsiContour.get_distance

    Broke test case TestContour.test_append
    bendudson committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    c616500 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    0607d52 View commit details
    Browse the repository at this point in the history
  11. Add PsiContour.map and FineContour.getPoint

    FineContour.getPoint is the inverse of getDistance: It returns a
    Point2D if given a distance along the FineContour
    
    PsiContour.map takes a function that returns a distance shift, and
    returns a new PsiContour that shares the FineContour with the
    original. This will be used to perform mesh deformations.
    bendudson committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    94660c1 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    b6cb785 View commit details
    Browse the repository at this point in the history
  13. flake8 fixes

    bendudson committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    22d8d60 View commit details
    Browse the repository at this point in the history

Commits on Jan 28, 2023

  1. Enable MeshRegion to be passed contours

    If given, MeshRegion doesn't need to follow radial coordinate lines
    and create PsiContours.
    bendudson committed Jan 28, 2023
    Configuration menu
    Copy the full SHA
    f4c7f85 View commit details
    Browse the repository at this point in the history

Commits on Jan 30, 2023

  1. Add MeshRegion.map and Mesh.map

    Enables mapping of the mesh points using shift functions.
    bendudson committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    5c2468e View commit details
    Browse the repository at this point in the history
  2. Add plot_cells option to hypnotoad-geqdsk script

    Plots straight-sided cells connecting cell corners.
    
    Added script plotting options to possible options list, so that
    an exception isn't raised when they're used.
    bendudson committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    c302eeb View commit details
    Browse the repository at this point in the history
  3. Small fixes in FineContour and PsiContour

    - Ensure that psi is passed to get_fine_contour
    - Handle rounding errors near FineContour edges
    bendudson committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    661902a View commit details
    Browse the repository at this point in the history
  4. flake8 fix (line too long)

    bendudson committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    e647736 View commit details
    Browse the repository at this point in the history
  5. Enable BoutMesh.map() method

    Mesh.map() now creates an instance of self.__class__, so subclasses
    including BoutMesh can be mapped.
    bendudson committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    ddb59e5 View commit details
    Browse the repository at this point in the history
  6. PsiContour.map small improvements, fix

    Ensure that final index has ypos=1, to be consistent with upper_shift.
    Prevent crossing lines from going off end of FineContour
    bendudson committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    cb8a2f4 View commit details
    Browse the repository at this point in the history

Commits on Jan 31, 2023

  1. Add MeshRegion.wallAlignShiftFunction and setWallIntersections

    MeshRegion.setWallIntersections(Equilibrium) calls
    FineContour.setWallIntersections to calculate where contours
    intsersect walls.
    
    MeshRegion.wallAlignShiftFunction() creates a lambda function that
    shifts a MeshRegion to align to the wall. That can map cells to have
    zero size, but PsiContour.map prevents cells from crossing.
    bendudson committed Jan 31, 2023
    Configuration menu
    Copy the full SHA
    1a381a9 View commit details
    Browse the repository at this point in the history
  2. Simplify Equilibrium.plotWall()

    Change `axis` keyword to `ax` for consistency, return axis.
    bendudson committed Jan 31, 2023
    Configuration menu
    Copy the full SHA
    e9d4468 View commit details
    Browse the repository at this point in the history
  3. MeshRegionMapper and MeshMapper classes

    Use a polynomial basis to represent mesh point shifts within each
    MeshRegion.
    
    MeshRegionMapper generates new MeshRegion objects given a list of
    polynomial coefficients. The order of the polynomials in X and Y
    is set in the constructor.
    
    MeshMapper uses MeshRegionMapper to generate new Mesh objects, using
    a combined list of polynomial coefficients.
    bendudson committed Jan 31, 2023
    Configuration menu
    Copy the full SHA
    f4be4c0 View commit details
    Browse the repository at this point in the history
  4. MeshMapper combine shared PsiContours

    PsiContours that are shared between MeshRegions will in general
    not be mapped in the same way. These PsiContours are averaged
    in MeshMapper.generate to produce a consistent boundary between
    regions.
    bendudson committed Jan 31, 2023
    Configuration menu
    Copy the full SHA
    8c0e0e8 View commit details
    Browse the repository at this point in the history
  5. MeshMeasure and BoundaryDistance optimiser

    Optimises meshes by varying the distortion parameters to minimise a
    MeshMeasure. For now only one MeshMeasure: BoundaryDistance combines
    distances between the mesh and the wall.
    bendudson committed Jan 31, 2023
    Configuration menu
    Copy the full SHA
    494eda2 View commit details
    Browse the repository at this point in the history

Commits on Feb 1, 2023

  1. Add Orthogonality mesh measure

    Enables the optimiser to take into account the orthogonality of the
    mesh, by minimising tan(Beta) over the mesh, where Beta is the angle
    between coordinate lines.
    bendudson committed Feb 1, 2023
    Configuration menu
    Copy the full SHA
    e5a1d1e View commit details
    Browse the repository at this point in the history
  2. Mesh user_options and versioning arguments

    Can be used to disable some parts of Mesh construction in optimiser
    loop.
    bendudson committed Feb 1, 2023
    Configuration menu
    Copy the full SHA
    7362778 View commit details
    Browse the repository at this point in the history
  3. Reduce printed output when optimising

    Repeatedly creating regions and meshes, so reduce the amount of text
    printed each iteration
    bendudson committed Feb 1, 2023
    Configuration menu
    Copy the full SHA
    abe7cbe View commit details
    Browse the repository at this point in the history
  4. Mesh optimisation in script, PoloidalSpacing measure

    - PoloidalSpacing measures the ratio of the poloidal size of
      neighbouring cells, penalising variations
    - When PsiContours are merged on region boundaries, re-use the
      FineContour and distances that have already been calculated.
    - Add __str__ methods to the MeshMeasure subclasses
    - Add automatic optimisation to the `hypnotoad-geqdsk` script
    bendudson committed Feb 1, 2023
    Configuration menu
    Copy the full SHA
    81a48cd View commit details
    Browse the repository at this point in the history

Commits on Feb 2, 2023

  1. Output printing and plotting in script

    - In optimisation loop only print every 20th iteration
    - In hypnotoad-geqdsk script save the plotted cells to file
    bendudson committed Feb 2, 2023
    Configuration menu
    Copy the full SHA
    1128299 View commit details
    Browse the repository at this point in the history
  2. Black v23.1.0

    Changes some spacing, line breaks
    bendudson committed Feb 2, 2023
    Configuration menu
    Copy the full SHA
    7e2bd16 View commit details
    Browse the repository at this point in the history

Commits on Feb 3, 2023

  1. Configuration menu
    Copy the full SHA
    a317cba View commit details
    Browse the repository at this point in the history