Skip to content

BoundaryData class doesn't read points file properly #37

@rthedin

Description

@rthedin

When reading boundary data, the points file isn't always read correctly and thus it stops at an assertion. The function that reads the points file has this comment:

"""Detects y and z (1-D arrays) from a list of points on a
structured grid. Makes no assumptions about the point
ordering

but it does make assumptions on the ordering. In this function, the user can specify the number of points in the two directions and the code assumes certain order by doing
y = ylist.reshape((NY,NZ))[:,0]

If the user doesn't pass the number of points-- or rather, the points are in fact scrambled and the reshape above is not desirable-- it assumes one of the dimensions is varying faster in an ordered manner:

elif zlist[1]==zlist[0]:
# y changes faster, F-ordering
NY = np.nonzero(zlist > zlist[0])[0][0]

or,

elif ylist[1]==ylist[0]:
# z changes faster, C-ordering
NZ = np.nonzero(ylist > ylist[0])[0][0]

The issue is that it assumes that the slow-varying dimension is ordered. The number of points in the slow-varying dimension, obtained with, for example, NY = np.nonzero(zlist > zlist[0])[0][0] only gives the correct number of points in that dimension when zlist is equal to np.sort(zlist). The re-ordering index obtained by reading points need to be carried forward and used when reading the actual files U, T,`k', etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions