Skip to content

Commit

Permalink
Improve conical grain accuracy
Browse files Browse the repository at this point in the history
  • Loading branch information
reilleya committed Oct 2, 2021
1 parent db29c99 commit bdbe04f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions motorlib/grains/conical.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ def getFrustrumInfo(self, regDist):
forwardDiameter = self.props['forwardCoreDiameter'].getValue()
grainLength = self.props['length'].getValue()

exposedFaces = 0
inhibitedEnds = self.props['inhibitedEnds'].getValue()
if inhibitedEnds == 'Neither':
exposedFaces = 2
elif inhibitedEnds in ['Top', 'Bottom']:
exposedFaces = 1

# These calculations are easiest if we work in terms of the core's "large end" and "small end"
if self.isCoreInverted():
coreMajorDiameter, coreMinorDiameter = forwardDiameter, aftDiameter
Expand All @@ -46,13 +53,6 @@ def getFrustrumInfo(self, regDist):
regCoreMajorDiameter = coreMajorDiameter + (regDist * 2 * cos(angle))
regCoreMinorDiameter = coreMinorDiameter + (regDist * 2 * cos(angle))

exposedFaces = 0
inhibitedEnds = self.props['inhibitedEnds'].getValue()
if inhibitedEnds == 'Neither':
exposedFaces = 2
elif inhibitedEnds in ['Top', 'Bottom']:
exposedFaces = 1

# This is case where the larger core diameter has grown beyond the casting tube diameter. Once this happens,
# the diameter of the large end of the core is clamped at the grain diameter and the length is changed to keep
# the angle constant, which accounts for the regression of the grain at the major end.
Expand All @@ -63,6 +63,10 @@ def getFrustrumInfo(self, regDist):
effectiveReg = (regCoreMajorDiameter - grainDiameter) / 2
# Reduce the length of the frustrum by the axial component of the regression vector
grainLength -= (effectiveReg / sin(angle))
# Account for the change in length due to face regression before the major end hit the casting tube
grainLength -= exposedFaces * (grainDiameter - coreMajorDiameter) / 2
# Don't double count face regression
grainLength += exposedFaces * effectiveReg

# If the large end of the core hasn't reached the casting tube, we know that the small end hasn't either. In
# this case we just return the current core diameters, and a length calculated from the inhibitor configuration
Expand Down

0 comments on commit bdbe04f

Please sign in to comment.