示例#1
0
    def __init__(self, custom_settings):

        # Set defaults and validate custom settings.
        ##TODO : solving_strategy_settings must be time_integration_settings (GiD interface changes needed)
        implicit_solver_settings = KratosMultiphysics.Parameters("""
        {
            "solving_strategy_settings":{
                "bossak_factor" :-0.3,
                "dynamic_factor": 1.0,
                "lumped_mass_matrix" : true,
                "consistent_mass_matrix" : false,
                "rayleigh_damping": false,
                "rayleigh_alpha": 0.0,
                "rayleigh_beta" : 0.0
            }
        }
        """)

        # Validate and transfer settings
        if (custom_settings.Has("solving_strategy_settings")):
            from json_settings_utility import JsonSettingsUtility
            JsonSettingsUtility.TransferMatchingSettingsToDestination(
                custom_settings["solving_strategy_settings"],
                implicit_solver_settings["solving_strategy_settings"])

        self.implicit_solver_settings = implicit_solver_settings[
            "solving_strategy_settings"]

        # Construct the base solver.
        super(ImplicitMonolithicSolver, self).__init__(custom_settings)
    def __init__(self, custom_settings):
        # Set defaults and validate custom settings.
        eigensolver_settings = KratosMultiphysics.Parameters("""
        {
            "eigensolver_settings" : {
                "solver_type": "FEAST",
                "print_feast_output": true,
                "perform_stochastic_estimate": true,
                "solve_eigenvalue_problem": true,
                "compute_modal_contribution": false,
                "lambda_min": 0.0,
                "lambda_max": 1.0,
                "search_dimension": 10,
                "linear_solver_settings": {
                    "solver_type": "complex_skyline_lu_solver"
                }
            }
        }
        """)

        # Validate and transfer settings
        from json_settings_utility import JsonSettingsUtility
        JsonSettingsUtility.TransferMatchingSettingsToDestination(custom_settings, eigensolver_settings)
        self.eigensolver_settings = eigensolver_settings["eigensolver_settings"]

        # Correction for the eigen solver parameters input
        self.compute_modal_contribution = self.eigensolver_settings["compute_modal_contribution"].GetBool()
        self.eigensolver_settings.RemoveValue("compute_modal_contribution")

        # Construct the base solver.
        super(EigenSolver, self).__init__(custom_settings)

        print("::[Eigen_Scheme]:: "+self.settings["time_integration_settings"]["integration_method"].GetString()+" Scheme Ready")
示例#3
0
    def __init__(self, custom_settings):

        # Set defaults and validate custom settings.
        ##TODO : solving_strategy_settings must be time_integration_settings (GiD interface changes needed)
        explicit_solver_settings = KratosMultiphysics.Parameters("""
        {
           "solving_strategy_settings":{
               "time_step_prediction_level": 0,
               "max_delta_time": 1.0e-5,
               "fraction_delta_time": 0.9,
               "rayleigh_damping": false,
               "rayleigh_alpha": 0.0,
               "rayleigh_beta" : 0.0
           }

        }
        """)

        # Validate and transfer settings
        if( custom_settings.Has("solving_strategy_settings") ):
            from json_settings_utility import JsonSettingsUtility
            JsonSettingsUtility.TransferMatchingSettingsToDestination(custom_settings["solving_strategy_settings"], explicit_solver_settings["solving_strategy_settings"])
        self.explicit_solver_settings = explicit_solver_settings["solving_strategy_settings"]

        # Validate the remaining settings in the base class.
        if not custom_settings["solving_strategy_settings"].Has("integration_method"): # Override defaults in the base class.
            custom_settings["solving_strategy_settings"].AddEmptyValue("integration_method")
            custom_settings["solving_strategy_settings"]["integration_method"].SetString("CentralDifferences")

        # Construct the base solver.
        super(ExplicitMonolithicSolver, self).__init__(custom_settings)

        print("::[Explicit_Scheme]:: "+self.settings["time_integration_settings"]["integration_method"].GetString()+" Scheme Ready")
示例#4
0
    def __init__(self, Model, custom_settings):

        # Set defaults and validate custom settings.
        static_settings = KratosMultiphysics.Parameters("""
        {

        }
        """)

        # Validate and transfer settings
        from json_settings_utility import JsonSettingsUtility
        JsonSettingsUtility.TransferMatchingSettingsToDestination(
            custom_settings, static_settings)
        time_integration_settings = custom_settings[
            "time_integration_settings"]

        # Validate the remaining settings in the base class.
        if not time_integration_settings.Has("integration_method"):
            time_integration_settings.AddEmptyValue("integration_method")
            time_integration_settings["integration_method"].SetString(
                "Static")  # Override defaults in the base class.

        # Construct the base solver.
        # Calling base class of ImplicitMonolithicSolver it is ok.
        super(BaseSolver.ImplicitMonolithicSolver,
              self).__init__(Model, custom_settings)
    def __init__(self, custom_settings):
        default_settings = KratosMultiphysics.Parameters("""
        {
            "dofs": [],
            "time_integration_settings":{
                "solution_type": "Dynamic",
  	        "analysis_type": "Non-linear",
                "time_integration": "Implicit",
                "integration_method": "Newmark",
                "time_integration_order": 1,
                "buffer_size": 2
            },
            "solving_strategy_settings":{
                "builder_type": "block_builder",
                "line_search": false,
                "implex": false,
                "compute_reactions": true,
                "move_mesh_flag": true,
                "clear_storage": false,
                "reform_dofs_at_each_step": false,
                "max_iteration": 10
            },
            "convergence_criterion_settings":{
                "convergence_criterion": "Residual_criterion",
                "variable_relative_tolerance": 1.0e-4,
                "variable_absolute_tolerance": 1.0e-9,
                "residual_relative_tolerance": 1.0e-4,
                "residual_absolute_tolerance": 1.0e-9,
                "separate_dofs": false
            },
            "linear_solver_settings":{
                "solver_type": "SuperLUSolver",
                "max_iteration": 500,
                "tolerance": 1e-9,
                "scaling": false,
                "verbosity": 1
            }
        }
        """)

        # Check and fix supplied settings compatibility (experimental)
        from json_settings_utility import JsonSettingsUtility
        JsonSettingsUtility.CheckAndFixNotMatchingSettings(custom_settings,default_settings)

        # Overwrite the default settings with user-provided parameters
        self.settings = custom_settings
        self.settings.ValidateAndAssignDefaults(default_settings)

        # Validate and assign other values
        self.settings["time_integration_settings"].ValidateAndAssignDefaults(default_settings["time_integration_settings"])
        self.settings["solving_strategy_settings"].ValidateAndAssignDefaults(default_settings["solving_strategy_settings"])
        self.settings["convergence_criterion_settings"].ValidateAndAssignDefaults(default_settings["convergence_criterion_settings"])
        self.settings["linear_solver_settings"].ValidateAndAssignDefaults(default_settings["linear_solver_settings"])

        # Echo level
        self.echo_level = 0
    def __init__(self, Model, custom_settings):
        default_settings = KratosMultiphysics.Parameters("""
        {
            "solving_model_part": "computing_domain",
            "dofs": [],
            "time_integration_settings":{
                "solution_type": "Dynamic",
  	        "analysis_type": "Non-linear",
                "time_integration": "Implicit",
                "integration_method": "Newmark",
                "time_integration_order": 1,
                "buffer_size": 2
            },
            "convergence_criterion_settings":{
                "convergence_criterion": "Residual_criterion",
                "variable_relative_tolerance": 1.0e-4,
                "variable_absolute_tolerance": 1.0e-9,
                "residual_relative_tolerance": 1.0e-4,
                "residual_absolute_tolerance": 1.0e-9,
                "separate_dofs": true
            },
            "solving_strategy_settings":{
                "builder_type": "block_builder",
                "line_search": false,
                "line_search_type": 0,
                "implex": false,
                "compute_reactions": true,
                "move_mesh_flag": true,
                "iterative_update": true,
                "clear_storage": false,
                "reform_dofs_at_each_step": false,
                "adaptive_solution": false,
                "max_iteration": 10
            },
            "linear_solver_settings":{
                "solver_type": "SuperLUSolver",
                "max_iteration": 500,
                "tolerance": 1e-9,
                "scaling": false,
                "verbosity": 1
            },
            "processes": []
        }
        """)

        # Linear solver settings can have different number of settings
        if(custom_settings.Has("linear_solver_settings")):
            default_settings.RemoveValue("linear_solver_settings")
            default_settings.AddValue("linear_solver_settings",custom_settings["linear_solver_settings"])

        # Check and fix supplied settings compatibility (experimental)
        from json_settings_utility import JsonSettingsUtility
        JsonSettingsUtility.CheckAndFixNotMatchingSettings(custom_settings,default_settings)

        # Overwrite the default settings with user-provided parameters
        self.settings = custom_settings
        self.settings.ValidateAndAssignDefaults(default_settings)

        # Validate and assign other values
        self.settings["time_integration_settings"].ValidateAndAssignDefaults(default_settings["time_integration_settings"]) #default values in factory
        self.settings["solving_strategy_settings"].ValidateAndAssignDefaults(default_settings["solving_strategy_settings"])
        #self.settings["convergence_criterion_settings"].ValidateAndAssignDefaults(default_settings["convergence_criterion_settings"]) #default values in factory
        self.settings["linear_solver_settings"].ValidateAndAssignDefaults(default_settings["linear_solver_settings"])
        #print("Monolithic Solver Settings",self.settings.PrettyPrintJsonString())

        # Model
        self.model = Model

        # Echo level
        self.echo_level = 0