From b14bd1626173cf17c08216cabb9a66695e65a502 Mon Sep 17 00:00:00 2001 From: Anil Yildirim Date: Thu, 20 Jul 2023 13:51:39 -0400 Subject: [PATCH 1/5] added custom pointset option to setdvgeo --- baseclasses/solvers/pyAero_solver.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/baseclasses/solvers/pyAero_solver.py b/baseclasses/solvers/pyAero_solver.py index 26ad7a4..faaa849 100644 --- a/baseclasses/solvers/pyAero_solver.py +++ b/baseclasses/solvers/pyAero_solver.py @@ -80,7 +80,7 @@ def setMesh(self, mesh): pts = self.getSurfaceCoordinates(self.meshFamilyGroup) self.mesh.setSurfaceDefinition(pts, conn, faceSizes) - def setDVGeo(self, DVGeo, pointSetKwargs=None): + def setDVGeo(self, DVGeo, pointSetKwargs={}, customPointSetFamilies=None): """ Set the DVGeometry object that will manipulate 'geometry' in this object. Note that does not **strictly** need a @@ -96,6 +96,13 @@ def setDVGeo(self, DVGeo, pointSetKwargs=None): Keyword arguments to be passed to the DVGeo addPointSet call. Useful for DVGeometryMulti, specifying FFD projection tolerances, etc. + customPointSetKwargs : dict of dicts + Keyword arguments to be passed to the DVGeo addPointSet call for each surface family, + specified by the keys. The surface families need to be all part of the designSurfaceFamily. + Useful for DVGeometryMulti, specifying FFD projection tolerances, etc. + If this is provided together with pointSetKwargs, the regular pointSetKwargs + will be appended to each component's dictionary. + Examples -------- >>> CFDsolver = (comm=comm, options=CFDoptions) @@ -104,10 +111,11 @@ def setDVGeo(self, DVGeo, pointSetKwargs=None): self.DVGeo = DVGeo - if pointSetKwargs is None: - self.pointSetKwargs = {} - else: - self.pointSetKwargs = pointSetKwargs + # save the common kwargs dict. default is empty + self.pointSetKwargs = pointSetKwargs + + # save if we have customPointSetFamilies + self.customPointSetFamilies = customPointSetFamilies def getTriangulatedMeshSurface(self, groupName=None, **kwargs): """ From 7e24c4ed75443f2711600a59ea19feba80c37862 Mon Sep 17 00:00:00 2001 From: Anil Yildirim Date: Fri, 21 Jul 2023 10:26:16 -0400 Subject: [PATCH 2/5] set attribute even when dvgeo is not set --- baseclasses/solvers/pyAero_solver.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/baseclasses/solvers/pyAero_solver.py b/baseclasses/solvers/pyAero_solver.py index 7a6129f..09a31c2 100644 --- a/baseclasses/solvers/pyAero_solver.py +++ b/baseclasses/solvers/pyAero_solver.py @@ -54,8 +54,9 @@ def __init__( self.families = CaseInsensitiveDict() self._updateGeomInfo = False - # Initialize kwargs for addPointSet + # Initialize kwargs for addPointSet and customPointSetFamilies self.pointSetKwargs = None + self.customPointSetFamilies = None def setMesh(self, mesh): """ From a71bb6a8539d92be5f7312589ecb9334e87aa76c Mon Sep 17 00:00:00 2001 From: Anil Yildirim Date: Mon, 7 Aug 2023 14:55:30 -0400 Subject: [PATCH 3/5] updated docstring --- baseclasses/solvers/pyAero_solver.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/baseclasses/solvers/pyAero_solver.py b/baseclasses/solvers/pyAero_solver.py index 09a31c2..8cc52df 100644 --- a/baseclasses/solvers/pyAero_solver.py +++ b/baseclasses/solvers/pyAero_solver.py @@ -95,13 +95,16 @@ def setDVGeo(self, DVGeo, pointSetKwargs={}, customPointSetFamilies=None): pointSetKwargs : dict Keyword arguments to be passed to the DVGeo addPointSet call. Useful for DVGeometryMulti, specifying FFD projection tolerances, etc. + These arguments are used for all point sets added by this solver. - customPointSetKwargs : dict of dicts + customPointSetFamilies : dict of dicts Keyword arguments to be passed to the DVGeo addPointSet call for each surface family, specified by the keys. The surface families need to be all part of the designSurfaceFamily. Useful for DVGeometryMulti, specifying FFD projection tolerances, etc. If this is provided together with pointSetKwargs, the regular pointSetKwargs - will be appended to each component's dictionary. + will be appended to each component's dictionary. If the same argument + is also provided in pointSetKwargs, the value specified in customPointSetFamilies + will be used. Examples -------- From 01c54d9ac8fa859fe69859317ffa74c785afa8ae Mon Sep 17 00:00:00 2001 From: Anil Yildirim Date: Mon, 7 Aug 2023 15:52:09 -0400 Subject: [PATCH 4/5] address sabet's comments --- baseclasses/solvers/pyAero_solver.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/baseclasses/solvers/pyAero_solver.py b/baseclasses/solvers/pyAero_solver.py index 8cc52df..e8b488d 100644 --- a/baseclasses/solvers/pyAero_solver.py +++ b/baseclasses/solvers/pyAero_solver.py @@ -80,7 +80,7 @@ def setMesh(self, mesh): pts = self.getSurfaceCoordinates(self.meshFamilyGroup) self.mesh.setSurfaceDefinition(pts, conn, faceSizes) - def setDVGeo(self, DVGeo, pointSetKwargs={}, customPointSetFamilies=None): + def setDVGeo(self, DVGeo, pointSetKwargs=None, customPointSetFamilies=None): """ Set the DVGeometry object that will manipulate 'geometry' in this object. Note that does not **strictly** need a @@ -98,8 +98,12 @@ def setDVGeo(self, DVGeo, pointSetKwargs={}, customPointSetFamilies=None): These arguments are used for all point sets added by this solver. customPointSetFamilies : dict of dicts - Keyword arguments to be passed to the DVGeo addPointSet call for each surface family, - specified by the keys. The surface families need to be all part of the designSurfaceFamily. + This argument is used to split up the surface points added to the DVGeo by the solver into potentially + multiple subsets. The keys of the dictionary will be used to determine what families should be + added to the dvgeo object as separate point sets. The values of each key is another dictionary, which can be empty. + If desired, the inner dictionaries can contain custom kwargs for the addPointSet call for each surface family, + specified by the keys of the top level dictionary. + The surface families need to be all part of the designSurfaceFamily. Useful for DVGeometryMulti, specifying FFD projection tolerances, etc. If this is provided together with pointSetKwargs, the regular pointSetKwargs will be appended to each component's dictionary. If the same argument @@ -115,10 +119,16 @@ def setDVGeo(self, DVGeo, pointSetKwargs={}, customPointSetFamilies=None): self.DVGeo = DVGeo # save the common kwargs dict. default is empty - self.pointSetKwargs = pointSetKwargs + if pointSetKwargs is None: + self.pointSetKwargs = {} + else: + self.pointSetKwargs = pointSetKwargs # save if we have customPointSetFamilies - self.customPointSetFamilies = customPointSetFamilies + if customPointSetFamilies is None: + self.customPointSetFamilies = None + else: + self.customPointSetFamilies = customPointSetFamilies def getTriangulatedMeshSurface(self, groupName=None, **kwargs): """ From 11ffab575eb279748867e9a5dee22d0e9701a6f2 Mon Sep 17 00:00:00 2001 From: Anil Yildirim Date: Mon, 7 Aug 2023 15:58:43 -0400 Subject: [PATCH 5/5] simplify code --- baseclasses/solvers/pyAero_solver.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/baseclasses/solvers/pyAero_solver.py b/baseclasses/solvers/pyAero_solver.py index e8b488d..27c3ae6 100644 --- a/baseclasses/solvers/pyAero_solver.py +++ b/baseclasses/solvers/pyAero_solver.py @@ -124,11 +124,8 @@ def setDVGeo(self, DVGeo, pointSetKwargs=None, customPointSetFamilies=None): else: self.pointSetKwargs = pointSetKwargs - # save if we have customPointSetFamilies - if customPointSetFamilies is None: - self.customPointSetFamilies = None - else: - self.customPointSetFamilies = customPointSetFamilies + # save if we have customPointSetFamilies. this default is not mutable so we can just set it as is. + self.customPointSetFamilies = customPointSetFamilies def getTriangulatedMeshSurface(self, groupName=None, **kwargs): """