Exemple #1
0
 def ModifyAfterSolverInitialize(self):
     """Here is where the ROM_BASIS is imposed to each node"""
     super().ModifyAfterSolverInitialize()
     computing_model_part = self._solver.GetComputingModelPart()
     with open('RomParameters.json') as f:
         data = json.load(f)
         nodal_dofs = len(data["rom_settings"]["nodal_unknowns"])
         nodal_modes = data["nodal_modes"]
         counter = 0
         rom_dofs = self.project_parameters["solver_settings"][
             "rom_settings"]["number_of_rom_dofs"].GetInt()
         for node in computing_model_part.Nodes:
             aux = KratosMultiphysics.Matrix(nodal_dofs, rom_dofs)
             for j in range(nodal_dofs):
                 Counter = str(node.Id)
                 for i in range(rom_dofs):
                     aux[j, i] = nodal_modes[Counter][j][i]
             node.SetValue(romapp.ROM_BASIS, aux)  # ROM basis
             counter += 1
     if self.hyper_reduction_element_selector != None:
         if self.hyper_reduction_element_selector.Name == "EmpiricalCubature":
             self.ResidualUtilityObject = romapp.RomResidualsUtility(
                 self._GetSolver().GetComputingModelPart(),
                 self.project_parameters["solver_settings"]["rom_settings"],
                 self._GetSolver().get_solution_scheme())
Exemple #2
0
 def ModifyAfterSolverInitialize(self):
     super().ModifyAfterSolverInitialize()
     if self.hyper_reduction_element_selector != None:
         if self.hyper_reduction_element_selector.Name == "EmpiricalCubature":
             self.ResidualUtilityObject = romapp.RomResidualsUtility(
                 self._GetSolver().GetComputingModelPart(),
                 self.project_parameters["solver_settings"]["rom_settings"],
                 KratosMultiphysics.
                 ResidualBasedIncrementalUpdateStaticScheme())
 def _create_builder_and_solver(self):
     linear_solver = self.get_linear_solver()
     rom_parameters = self.settings["rom_settings"]
     builder_and_solver = romapp.ROMBuilderAndSolver(
         linear_solver, rom_parameters)
     return builder_and_solver