Skip to content

Commit 4e14508

Browse files
committed
Changed the intermediate opt folder format to 0.0001, 00002, etc.
1 parent 217f5e1 commit 4e14508

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

dafoam/pyDAFoam.py

+6-11
Original file line numberDiff line numberDiff line change
@@ -657,11 +657,6 @@ def __init__(self):
657657

658658
## The sensitivity map will be saved to disk during optimization for the given design variable
659659
## names in the list. Currently only support design variable type FFD and Field
660-
## The surface sensitivity map is separated from the primal solution because they only have surface mesh.
661-
## They will be saved to folders such as 1e-11, 2e-11, 3e-11, etc,
662-
## When loading in paraview, you need to uncheck the "internalMesh", and check "allWalls" on the left panel
663-
## If your design variable is of field type, the sensitivity map will be saved along with the primal
664-
## solution because they share the same mesh. The sensitivity files read sens_objFuncName_designVarName
665660
## NOTE: this function only supports useAD->mode:reverse
666661
## Example:
667662
## "writeSensMap" : ["shapex", "shapey"]
@@ -2024,7 +2019,7 @@ def calcTotalDerivsFFD(self, objFuncName, designVarName, dFScaling=1.0, accumula
20242019
dFdXsFlatten = dFdXs.flatten()
20252020
XsFlatten = Xs.flatten()
20262021
size = len(dFdXsFlatten)
2027-
timeName = float(self.nSolveAdjoints) / 1e8
2022+
timeName = float(self.nSolveAdjoints) / 1e4
20282023
name = "sens_" + objFuncName + "_" + designVarName
20292024
self.solver.writeSensMapSurface(name, dFdXsFlatten, XsFlatten, size, timeName)
20302025
# assign the total derivative to self.adjTotalDeriv
@@ -2080,7 +2075,7 @@ def calcTotalDerivsField(self, objFuncName, designVarName, fieldType, dFScaling=
20802075

20812076
# check if we need to save the sensitivity maps
20822077
if designVarName in self.getOption("writeSensMap"):
2083-
timeName = float(self.nSolveAdjoints) / 1e8
2078+
timeName = float(self.nSolveAdjoints) / 1e4
20842079
dFdFieldArray = self.vec2Array(totalDeriv)
20852080
name = "sens_" + objFuncName + "_" + designVarName
20862081
self.solver.writeSensMapField(name, dFdFieldArray, fieldType, timeName)
@@ -3240,7 +3235,7 @@ def deletePrevPrimalSolTime(self):
32403235
def renameSolution(self, solIndex):
32413236
"""
32423237
Rename the primal solution folder to specific format for post-processing. The renamed time has the
3243-
format like 1e-8, 2e-8, etc. One can load these intermediate shapes and fields and
3238+
format like 0.0001, 0.0002, etc. One can load these intermediate shapes and fields and
32443239
plot them in paraview.
32453240
The way it is implemented is that we sort the solution folder and consider the largest time folder
32463241
as the solution folder and rename it
@@ -3259,12 +3254,12 @@ def renameSolution(self, solIndex):
32593254

32603255
latestTime = self.solver.getLatestTime()
32613256

3262-
if latestTime < 1e-4:
3263-
Info("Latest solution time %g less than 1e-4, not renamed." % latestTime)
3257+
if latestTime < 1.0:
3258+
Info("Latest solution time %g less than 1, not renamed." % latestTime)
32643259
renamed = False
32653260
return latestTime, renamed
32663261

3267-
distTime = "%g" % (solIndex / 1e8)
3262+
distTime = "%g" % (solIndex / 1e4)
32683263
targetTime = "%g" % latestTime
32693264

32703265
src = os.path.join(checkPath, targetTime)

0 commit comments

Comments
 (0)