Skip to content

Commit

Permalink
Add embedding vol and solution time to tecplot output (#133)
Browse files Browse the repository at this point in the history
* undo

* added solution time and embedding vol to output

* redo formatting

Co-authored-by: Hannah Hajdik <hajdik@umich.edu>
  • Loading branch information
Josh Anibal and hajdik authored Apr 25, 2022
1 parent 389391b commit e727de8
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions pygeo/parameterization/DVGeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2572,14 +2572,17 @@ def addVariablesPyOpt(
optProb, globalVars, localVars, sectionlocalVars, spanwiselocalVars, ignoreVars, freezeVars
)

def writeTecplot(self, fileName):
def writeTecplot(self, fileName, solutionTime=None):
"""Write the (deformed) current state of the FFD's to a tecplot file,
including the children
Parameters
----------
fileName : str
Filename for tecplot file. Should have a .dat extension
SolutionTime : float
Solution time to write to the file. This could be a fictitious time to
make visualization easier in tecplot.
"""

# Name here doesn't matter, just take the first one
Expand All @@ -2591,7 +2594,7 @@ def writeTecplot(self, fileName):
vol_counter = 0

# Write master volumes:
vol_counter += self._writeVols(f, vol_counter)
vol_counter += self._writeVols(f, vol_counter, solutionTime)

closeTecplot(f)
if len(self.points) > 0:
Expand Down Expand Up @@ -2641,7 +2644,7 @@ def writeLinks(self, fileName):

closeTecplot(f)

def writePointSet(self, name, fileName):
def writePointSet(self, name, fileName, solutionTime=None):
"""
Write a given point set to a tecplot file
Expand All @@ -2653,14 +2656,17 @@ def writePointSet(self, name, fileName):
fileName : str
Filename for tecplot file. Should have no extension, an
extension will be added
SolutionTime : float
Solution time to write to the file. This could be a fictitious time to
make visualization easier in tecplot.
"""
if self.isChild:
raise Error('Must call "writePointSet" from parent DVGeo.')
else:
coords = self.update(name, childDelta=True)
fileName = fileName + "_%s.dat" % name
f = openTecplot(fileName, 3)
writeTecplot1D(f, name, coords)
writeTecplot1D(f, name, coords, solutionTime)
closeTecplot(f)

def writePlot3d(self, fileName):
Expand Down Expand Up @@ -4146,14 +4152,16 @@ def _cascadedDVJacobian(self, config=None):

return Jacobian

def _writeVols(self, handle, vol_counter):
def _writeVols(self, handle, vol_counter, solutionTime):
for i in range(len(self.FFD.vols)):
writeTecplot3D(handle, "vol%d" % i, self.FFD.vols[i].coef)
writeTecplot3D(handle, "FFD_vol%d" % i, self.FFD.vols[i].coef, solutionTime)
self.FFD.vols[i].computeData(recompute=True)
writeTecplot3D(handle, "embedding_vol", self.FFD.vols[i].data, solutionTime)
vol_counter += 1

# Write children volumes:
for iChild in range(len(self.children)):
vol_counter += self.children[iChild]._writeVols(handle, vol_counter)
vol_counter += self.children[iChild]._writeVols(handle, vol_counter, solutionTime)

return vol_counter

Expand Down

0 comments on commit e727de8

Please sign in to comment.