Skip to content

Commit

Permalink
FIX: thetaFm conversion (#40)
Browse files Browse the repository at this point in the history
The track files store the direction of motion in degrees, but the wind
field calculations require it in radians. This fix converts the bearing
into radians within `wind.windmodels.WindFieldModel()`. Required an
update to the test data as well.
  • Loading branch information
wcarthur committed Oct 3, 2017
1 parent 5f051d6 commit c044158
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions tests/test_data/windFieldTestData.pck

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions wind/windmodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ class HubbertWindField(WindFieldModel):

def field(self, R, lam, vFm, thetaFm, thetaMax=0.):
V = self.velocity(R)
thetaFm = np.pi/2. - thetaFm
thetaFm = np.pi/2. - np.pi * thetaFm / 180.
Km = .70
inflow = -np.sign(self.f) * 25. * np.ones(np.shape(R))
core = np.where(R < self.rMax)
Expand Down Expand Up @@ -981,7 +981,7 @@ def field(self, R, lam, vFm, thetaFm, thetaMax=0.):
motion.
"""
V = self.velocity(R)
thetaFm = np.pi/2. - thetaFm
thetaFm = np.pi/2. - np.pi * thetaFm / 180.
inflow = 25. * np.ones(np.shape(R))
mid = np.where(R < 1.2 * self.rMax)
inflow[mid] = 10. + 75. * (R[mid] / self.rMax - 1.)
Expand Down Expand Up @@ -1041,7 +1041,7 @@ def field(self, R, lam, vFm, thetaFm, thetaMax=0.):
Z = self.vorticity(R)
K = 50. # Diffusivity
Cd = 0.002 # Constant drag coefficient
thetaFm = np.pi/2. - thetaFm
thetaFm = np.pi/2. - np.pi * thetaFm / 180.
Vm = np.abs(V).max()
if (vFm > 0) and (Vm/vFm < 5.):
Umod = vFm * (1. - (1. - Vm/vFm)/5.)
Expand Down

0 comments on commit c044158

Please sign in to comment.