From eb65469deae4ea35d5615e87bbc5d2a6493f0619 Mon Sep 17 00:00:00 2001 From: Braden Frigoletto Date: Wed, 24 Jan 2024 15:24:27 -0500 Subject: [PATCH] updated model history storage - output correction given its own group in hdf5 file --- tmr/pytacsadapt.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/tmr/pytacsadapt.py b/tmr/pytacsadapt.py index f2dd5a7..48e67d0 100644 --- a/tmr/pytacsadapt.py +++ b/tmr/pytacsadapt.py @@ -327,8 +327,8 @@ def __init__( # initialize the storage for saving model info self.mesh_history = {} # mesh size (ndof) - self.output_history = {} # outputs/corrected outputs - self.error_history = {} # error estimates + self.output_history = {} # outputs + self.error_history = {} # error estimates and output corrections self.adaptation_history = { "threshold": {}, # refine/coarsen thresholds "element_errors": {}, @@ -661,10 +661,10 @@ def estimateOutputError(self, writeSolution=False): ) # update histories - self.output_history[ - f"{self.fine.prob_name}_{self.fine.output_name}" - ] += output_correction - self.error_history[f"adapt_iter_{self.fine.refine_iter}"] = error_estimate + self.error_history[f"adapt_iter_{self.fine.refine_iter}_error"] = error_estimate + self.error_history[ + f"adapt_iter_{self.fine.refine_iter}_correction" + ] = output_correction # write out the nodal error field if writeSolution: @@ -908,7 +908,20 @@ def writeModelHistory(self, filename=""): # store the error estimate history h5["error_estimate_history"] = np.array( - list(self.error_history.values()) + [ + self.error_history[key] + for key in self.error_history.keys() + if "error" in key + ] + ) + + # store the output correction history + h5["output_correction_history"] = np.array( + [ + self.error_history[key] + for key in self.error_history.keys() + if "correction" in key + ] ) # store the adaptation refinement histories