Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various small changes #241

Merged
merged 9 commits into from
May 16, 2024
2 changes: 1 addition & 1 deletion pygeo/constraints/areaConstraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(
if geograd_parallel is None:
raise ImportError("Geograd package must be installed to use triangulated surface constraint")

super().__init__(name, 2, -1e10, 0.0, scale, None, addToPyOpt)
super().__init__(name, 2, None, 0.0, scale, None, addToPyOpt)

self.comm = comm

Expand Down
10 changes: 5 additions & 5 deletions pygeo/parameterization/DVGeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ def addRefAxis(
"rot0axis": rot0axis,
}
nAxis = len(curve.coef)
elif xFraction or yFraction or zFraction:
elif xFraction is not None or yFraction is not None or zFraction is not None:
A-CGray marked this conversation as resolved.
Show resolved Hide resolved
# Some assumptions
# - FFD should be a close approximation of geometry surface so that
# xFraction roughly corresponds to airfoil LE, TE, or 1/4 chord
Expand Down Expand Up @@ -594,22 +594,22 @@ def addRefAxis(
pts_vec[ct_, :] = p_rot

# Temporary ref axis node coordinates - aligned with main system of reference
if xFraction:
if xFraction is not None:
# getting the bounds of the FFD section
x_min = np.min(pts_vec[:, 0])
x_max = np.max(pts_vec[:, 0])
x_node = xFraction * (x_max - x_min) + x_min # chordwise
else:
x_node = np.mean(pts_vec[:, 0])

if yFraction:
if yFraction is not None:
y_min = np.min(pts_vec[:, 1])
y_max = np.max(pts_vec[:, 1])
y_node = y_max - yFraction * (y_max - y_min) # top-bottom
else:
y_node = np.mean(pts_vec[:, 1])

if zFraction:
if zFraction is not None:
z_min = np.min(pts_vec[:, 2])
z_max = np.max(pts_vec[:, 2])
z_node = z_max - zFraction * (z_max - z_min) # top-bottom
Expand Down Expand Up @@ -1518,7 +1518,7 @@ def addCompositeDV(self, dvName, ptSetName=None, u=None, scale=None, prependName
if ptSetName is None:
raise ValueError("If u and s need to be computed, you must specify the ptSetName")
self.computeTotalJacobian(ptSetName)
J_full = self.JT[ptSetName].todense() # this is in CSR format but we convert it to a dense matrix
J_full = self.JT[ptSetName].toarray() # this is in CSR format but we convert it to a dense matrix
u, s, _ = np.linalg.svd(J_full, full_matrices=False)
scale = np.sqrt(s)
# normalize the scaling
Expand Down