Skip to content

Commit

Permalink
Triangulated surface constraint using geograd and multiple DVGeos per…
Browse files Browse the repository at this point in the history
… DVCon (mdolab#52)

Co-authored-by: Benjamin Brelje <[email protected]>
Co-authored-by: Anil Yildirim <[email protected]>
  • Loading branch information
3 people authored Feb 4, 2021
1 parent f314e8c commit fc9e9e5
Show file tree
Hide file tree
Showing 12 changed files with 34,675 additions and 188 deletions.
971 changes: 861 additions & 110 deletions pygeo/DVConstraints.py

Large diffs are not rendered by default.

17 changes: 15 additions & 2 deletions pygeo/DVGeometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class DVGeometry(object):
>>> DVGeo.addGeoDVLocal('shape', lower=-0.5, upper=0.5, axis='y')
>>>
"""
def __init__(self, fileName, complex=False, child=False, faceFreeze=None, *args, **kwargs):
def __init__(self, fileName, complex=False, child=False, faceFreeze=None, name=None, *args, **kwargs):

self.DV_listGlobal = OrderedDict() # Global Design Variable List
self.DV_listLocal = OrderedDict() # Local Design Variable List
Expand All @@ -105,6 +105,9 @@ def __init__(self, fileName, complex=False, child=False, faceFreeze=None, *args,
# Coefficient rotation matrix dict for Section Local variables
self.coefRotM = {}

# Name (used for ensuring design variables names are unique to pyoptsparse)
self.name = name

# Flags to determine if this DVGeometry is a parent or child
self.isChild = child
self.children = []
Expand Down Expand Up @@ -590,6 +593,10 @@ def addGeoDVGlobal(self, dvName, value, func, lower=None, upper=None,
configurations. The default value of None implies that the design
variable appies to *ALL* configurations.
"""
# if the parent DVGeometry object has a name attribute, prepend it
if self.name is not None:
dvName = self.name + '_' + dvName

if type(config) == str:
config = [config]
self.DV_listGlobal[dvName] = geoDVGlobal(
Expand Down Expand Up @@ -658,6 +665,9 @@ def addGeoDVLocal(self, dvName, lower=None, upper=None, scale=1.0,
>>> PS = geo_utils.PointSelect(type = 'y', pt1=[0,0,0], pt2=[10, 0, 10])
>>> nVar = DVGeo.addGeoDVLocal('shape_vars', lower=-1.0, upper=1.0, pointSelect=PS)
"""
if self.name is not None:
dvName = self.name + '_' + dvName

if type(config) == str:
config = [config]

Expand Down Expand Up @@ -824,6 +834,9 @@ class in geo_utils. Using pointSelect discards everything in volList.
>>> # moving in the 1 direction, within +/- 1.0 units
>>> DVGeo.addGeoDVSectionLocal('shape_vars', secIndex='k', lower=-1, upper=1, axis=1)
"""
if self.name is not None:
dvName = self.name + '_' + dvName

if type(config) == str:
config = [config]

Expand Down Expand Up @@ -3532,7 +3545,7 @@ def sectionFrame(self, sectionIndex, sectionTransform, sectionLink, ivol=0,
ax2 /= numpy.linalg.norm(ax2)
else:
raise Error('orient2 must be \'svd\' or \'ffd\'')

# Options for choosing in-plane axes
# 1. Align axis '0' with projection of the given vector on section
# plane.
Expand Down
Loading

0 comments on commit fc9e9e5

Please sign in to comment.