Skip to content

Commit

Permalink
updated model history storage
Browse files Browse the repository at this point in the history
- output correction given its own group in hdf5 file
  • Loading branch information
bradenfrigoletto24 committed Jan 24, 2024
1 parent 2f9cb55 commit eb65469
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions tmr/pytacsadapt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {},
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit eb65469

Please sign in to comment.