Skip to content

Commit

Permalink
Merge pull request #12241 from KratosMultiphysics/RomApp_hrom_util_me…
Browse files Browse the repository at this point in the history
…mory

[RomApp] Memory improvement in hrom_training_utility.py
  • Loading branch information
SADPR authored Apr 9, 2024
2 parents e80cff7 + 70673be commit e4f2e3b
Showing 1 changed file with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,26 +288,17 @@ def __GetHRomTrainingDefaultSettings(cls):
return default_settings

def __CalculateResidualBasis(self):
# Set up the residual snapshots matrix
residuals_snapshot_matrix = self._GetResidualsProjectedMatrix()

# Calculate the randomized and truncated SVD of the residual snapshots
# Calculate the randomized and truncated SVD of the residual snapshots #TODO add other SVD options
u,_,_,_ = RandomizedSingularValueDecomposition(COMPUTE_V=False).Calculate(
residuals_snapshot_matrix,
self._GetResidualsProjectedMatrix(),
self.element_selection_svd_truncation_tolerance)

return u



def _GetResidualsProjectedMatrix(self):
# Set up the residual snapshots matrix
n_steps = len(self.time_step_residual_matrix_container)
residuals_snapshot_matrix = self.time_step_residual_matrix_container[0]
for i in range(1,n_steps):
del self.time_step_residual_matrix_container[0] # Avoid having two matrices, numpy does not concatenate references.
residuals_snapshot_matrix = np.c_[residuals_snapshot_matrix,self.time_step_residual_matrix_container[0]]
return residuals_snapshot_matrix
return np.block(self.time_step_residual_matrix_container)



Expand Down

0 comments on commit e4f2e3b

Please sign in to comment.