fastwater.general.geometry module

Geometry functions for manipulating vector field data.

fastwater.general.geometry.cart2cmplx(x, y)[source]

Coordinate conversion: Cartesian to Complex

Parameters
  • x (numpy.array, float) – cartesian x-coordinate

  • y (numpy.array, float) – cartesian y coordinate

Returns

cmplx – complex numbers (x + jy)

Return type

numpy.array, complex

fastwater.general.geometry.cart2pol(x, y)[source]

Coordinate conversion: Cartesian to Polar

Parameters
  • x (numpy.array, float) – cartesian x coordindate

  • y (numpy.array, float) – cartesian y coordinate

Returns

  • r (numpy.array, float) – polar cordinate radial distance

  • theta (numpy.array, float) – polar cordinate angle (in degrees)

fastwater.general.geometry.circSign2D(v1, v2)[source]

Calculate the direction of circulation around a pair of edge vectors in the x-y plane.

Parameters
  • v1 (numpy.array,float) – components of edge vector v1 in cartesian coordinates.

  • v2 (numpy.array,float) – components of edge vector v2 in cartesian coordinates.

Returns

csgn – sign of circulation direction (i.e. +/- 1).

Return type

float

fastwater.general.geometry.cmplx2cart(c)[source]

Coordinate conversion: Complex to Cartesian

Parameters

c (numpy.array, complex) – complex numbers (x + jy)

Returns

  • x (numpy.array, float) – cartesian x coordinate

  • y (numpy.array, float) – cartesian y cordinate

fastwater.general.geometry.cmplx2pol(x, angularUnits=0)[source]

Coordinate conversion: Complex to Polar

Parameters
  • x (numpy.array, complex) – complex numbers (x + jy)

  • anglularUnits (int) – angular units flag (0 = degress [default], 1 = radians)

Returns

  • radii (numpy.array, float) – polar coordinate radial values

  • angles (numpy.array, float) – polar coordinate angle values

fastwater.general.geometry.pol2cart(r, theta)[source]

Coordinate conversion: Polar to Cartesian

Parameters
  • r (numpy.array, float) – radial distance

  • theta (numpy.array, float) – angle in degrees

Returns

  • x (numpy.array, float) – cartesian x coordinate

  • y (numpy.array, float) – cartesian y coordinate

fastwater.general.geometry.pol2cmplx(radii, angles, angularUnits=0)[source]

Coordinate conversion: Polar to Complex

Parameters
  • radii (numpy.array, float) – polar coordinate radial distances

  • angles (numpy.array, float) – polar cordinate angles

  • anglularUnits (int) – angular units flag (0 = degress [default], 1 = radians)

Returns

cmplx – complex numbers (x + jy)

Return type

numpy.array, complex

fastwater.general.geometry.rotateVectorField(U, V, W, Theta)[source]

Rotate a set of vector field data about the z axis of the coordinate system.

Parameters
  • U (numpy.array, float) – array of vector field values along the x axis.

  • V (numpy.array, float) – array of vector field values along the y axis.

  • W (numpy.array, float) – array of vector field values along the z axis.

  • Theta (float) – rotation angle in degrees (including sign for rotation direction).

Returns

  • Ur (numpy.array, float) – array of vector field values along the x axis in rotated coordinates.

  • Vr (numpy.array, float) – array of vector field values along the y axis in rotated coordinates.

  • Wr (numpy.array, float) – array of vector field values along the z axis in rotated coordinates.

fastwater.general.geometry.unitVect(p1, p2)[source]

Get unit vector components parallel to the line join p1 and p1

Parameters
  • p1 (numpy.array,float) – vector containing cartesian coordinates of point p1.

  • p2 (numpy.array,float) – vector containing cartesian coordinates of point p1.

Returns

uVec – vector containing cartesian coordinates of unit vector along (p1,p1).

Return type

numpy.array, float