GeoscienceAustralia / tcrm

A statistical-parametric model for assessing wind hazard from tropical cyclones
http://geoscienceaustralia.github.io/tcrm
Other
80 stars 52 forks source link

Adjust lam for storm direction #126

Closed kieranricardo closed 2 years ago

kieranricardo commented 2 years ago

Hey @wcarthur I'm not 100% sure but I think this fixes a bug in the Kerpert model.

This PR adjusts lam for the storm motion direction in the calculation of the asymmetric surface wind components in the Kerpert linear boundary layer model. The paper uses a cylindrical coordinate system with a polar angle of zero corresponding to the direction of storm motion, and positive values of the polar angle corresponding to counterclockwise rotation (i think?), and this PR corrects for that.

wcarthur commented 2 years ago

No, this isn't necessary, as the asymmetry is calculated in a storm relative reference frame. The earth relative wind components are determined a couple of lines later (and then translated to cartesian coordinates):

usf = us + Vt * np.cos(lam - thetaFm)
vsf = vs - Vt * np.sin(lam - thetaFm)
phi = np.arctan2(usf, vsf)

# Surface winds, cartesian coordinates
Ux = np.sqrt(usf ** 2. + vsf ** 2.) * np.sin(phi - lam)
Vy = np.sqrt(usf ** 2. + vsf ** 2.) * np.cos(phi - lam)

See https://github.com/wcarthur/blmodel/blob/master/kepert.py for the original code (translated from MATLAB and updated from old pylab methods for plotting)

kieranricardo commented 2 years ago

@wcarthur ah so is lam supposed to be in storm relative coordinates?

i could be wrong but i think the windFieldValidaiton.py script assumes the opposite, so maybe the problem is in there.

https://github.com/GeoscienceAustralia/tcrm/blob/053ed7aae1b7cec88e36ea467da4c63bfb0a04c3/Evaluate/windFieldValidation.py#L44

wcarthur commented 2 years ago

Can you plot up an example wind field using your bug fix and the unmodified code? Do both storm relative winds and earth relative winds, and include magnitude and streamlines.

kieranricardo commented 2 years ago

Earth relative wind magnitudes:

image

kieranricardo commented 2 years ago

Storm relative wind magnitudes:

image

kieranricardo commented 2 years ago

Earth relative streamlines:

image

kieranricardo commented 2 years ago

Storm relative streamlines:

image

kieranricardo commented 2 years ago

@wcarthur I've put up the plots you asked for + I tweaked things slightly.

Also it looks like things are in polar coordinates (w/ positive bearing anticlockwise like in kerperts paper) so I updated the documentation

wcarthur commented 2 years ago

in https://github.com/GeoscienceAustralia/tcrm/pull/126#issuecomment-1022700093 - is thetaFm in the labels given as cartesian (east = 0, positive anticlockwise) or geographic (north = 0, positive clockwise) angles?

There's a separate issue here in the test suite where tests are failing, but the check is allowed to pass? See https://github.com/GeoscienceAustralia/tcrm/runs/4959342316?check_suite_focus=true#step:4:222 for the failing tests. Will require separate issue to resolve.

kieranricardo commented 2 years ago

@wcarthur I think this is ready now. and for record keeping like I mentioned yesterday these theta is specified in cartesian coordinates