def _ConstructScheme(self, scheme_type, solution_type): self.main_model_part.ProcessInfo.SetValue( KratosGeo.VELOCITY_COEFFICIENT, 1.0) self.main_model_part.ProcessInfo.SetValue( KratosGeo.DT_PRESSURE_COEFFICIENT, 1.0) if (scheme_type.lower() == "newmark"): beta = self.settings["newmark_beta"].GetDouble() gamma = self.settings["newmark_gamma"].GetDouble() theta = self.settings["newmark_theta"].GetDouble() rayleigh_m = self.settings["rayleigh_m"].GetDouble() rayleigh_k = self.settings["rayleigh_k"].GetDouble() self.main_model_part.ProcessInfo.SetValue( KratosStructure.RAYLEIGH_ALPHA, rayleigh_m) self.main_model_part.ProcessInfo.SetValue( KratosStructure.RAYLEIGH_BETA, rayleigh_k) KratosMultiphysics.Logger.PrintInfo("UPwSolver, solution_type", solution_type) if (solution_type.lower() == "quasi-static" or solution_type.lower() == "quasi_static"): if (rayleigh_m < 1.0e-20 and rayleigh_k < 1.0e-20): KratosMultiphysics.Logger.PrintInfo( "UPwSolver, scheme", "Quasi-UnDamped.") scheme = KratosGeo.NewmarkQuasistaticUPwScheme( beta, gamma, theta) else: KratosMultiphysics.Logger.PrintInfo( "UPwSolver, scheme", "Quasi-Damped.") scheme = KratosGeo.NewmarkQuasistaticDampedUPwScheme( beta, gamma, theta) elif (solution_type.lower() == "dynamic"): KratosMultiphysics.Logger.PrintInfo("UPwSolver, scheme", "Dynamic.") scheme = KratosGeo.NewmarkDynamicUPwScheme(beta, gamma, theta) elif (solution_type.lower() == "k0-procedure" or solution_type.lower() == "k0_procedure"): if (rayleigh_m < 1.0e-20 and rayleigh_k < 1.0e-20): KratosMultiphysics.Logger.PrintInfo( "UPwSolver, scheme", "Quasi-UnDamped.") scheme = KratosGeo.NewmarkQuasistaticUPwScheme( beta, gamma, theta) else: KratosMultiphysics.Logger.PrintInfo( "UPwSolver, scheme", "Quasi-Damped.") scheme = KratosGeo.NewmarkQuasistaticDampedUPwScheme( beta, gamma, theta) else: raise Exception("Undefined solution type", solution_type) else: raise Exception( "Apart from Newmark, other scheme_type are not available.") return scheme
def _ConstructScheme(self, scheme_type, solution_type): self.main_model_part.ProcessInfo.SetValue( KratosGeo.VELOCITY_COEFFICIENT, 1.0) self.main_model_part.ProcessInfo.SetValue( KratosGeo.DT_PRESSURE_COEFFICIENT, 1.0) if (scheme_type.lower() == "newmark" or scheme_type.lower() == "newmark_flow"): theta = self.settings["newmark_theta"].GetDouble() rayleigh_m = self.settings["rayleigh_m"].GetDouble() rayleigh_k = self.settings["rayleigh_k"].GetDouble() self.main_model_part.ProcessInfo.SetValue( KratosStructure.RAYLEIGH_ALPHA, rayleigh_m) self.main_model_part.ProcessInfo.SetValue( KratosStructure.RAYLEIGH_BETA, rayleigh_k) KratosMultiphysics.Logger.PrintInfo( "GeoMechanics_Pw_Solver, solution_type", solution_type) if (solution_type.lower() == "transient-groundwater-flow" or solution_type.lower() == "transient_groundwater_flow"): KratosMultiphysics.Logger.PrintInfo( "GeoMechanics_Pw_Solver, scheme", "Newmark Transient groundwater flow.") scheme = scheme = KratosGeo.NewmarkQuasistaticPwScheme(theta) elif (solution_type.lower() == "steady-state-groundwater-flow" or solution_type.lower() == "steady_state_groundwater_flow"): KratosMultiphysics.Logger.PrintInfo( "GeoMechanics_Pw_Solver, scheme", "Newmark Steady-state groundwater flow.") scheme = scheme = KratosGeo.NewmarkQuasistaticPwScheme(theta) else: raise Exception("Undefined solution type", solution_type) elif (scheme_type.lower() == "backward_euler"): if (solution_type.lower() == "transient-groundwater-flow" or solution_type.lower() == "transient_groundwater_flow"): KratosMultiphysics.Logger.PrintInfo( "GeoMechanics_Pw_Solver, scheme", "Backward Euler Transient groundwater flow.") scheme = scheme = KratosGeo.BackwardEulerQuasistaticPwScheme() elif (solution_type.lower() == "steady-state-groundwater-flow" or solution_type.lower() == "steady_state_groundwater_flow"): KratosMultiphysics.Logger.PrintInfo( "GeoMechanics_Pw_Solver, scheme", "Backward Euler Steady-state groundwater flow.") scheme = scheme = KratosGeo.BackwardEulerQuasistaticPwScheme() else: raise Exception( "Apart from Newmark, other scheme_type are not available.") return scheme
def __init__(self, Model, settings): KratosMultiphysics.Process.__init__(self) self.model_part = Model[settings["model_part_name"].GetString()] variable_name = settings["variable_name"].GetString() self.components_process_list = [] if settings["active"][0].GetBool() == True: self.x_params = KratosMultiphysics.Parameters("{}") self.x_params.AddValue("model_part_name", settings["model_part_name"]) self.x_params.AddValue("append_file", settings["append_file"]) self.x_params.AddEmptyValue("variable_name").SetString( variable_name + "_X") self.components_process_list.append( KratosGeo.ApplyWriteScalarProcess(self.model_part, self.x_params)) if settings["active"][1].GetBool() == True: self.y_params = KratosMultiphysics.Parameters("{}") self.y_params.AddValue("model_part_name", settings["model_part_name"]) self.y_params.AddValue("append_file", settings["append_file"]) self.y_params.AddEmptyValue("variable_name").SetString( variable_name + "_Y") self.components_process_list.append( KratosGeo.ApplyWriteScalarProcess(self.model_part, self.y_params)) if settings["active"][2].GetBool() == True: self.z_params = KratosMultiphysics.Parameters("{}") self.z_params.AddValue("model_part_name", settings["model_part_name"]) self.z_params.AddValue("append_file", settings["append_file"]) self.z_params.AddEmptyValue("variable_name").SetString( variable_name + "_Z") self.components_process_list.append( KratosGeo.ApplyWriteScalarProcess(self.model_part, self.z_params))
def __init__(self, Model, settings ): KratosMultiphysics.Process.__init__(self) model_part = Model[settings["model_part_name"].GetString()] params = KratosMultiphysics.Parameters("{}") params.AddValue("model_part_name",settings["model_part_name"]) params.AddValue("variable_name",settings["variable_name"]) if settings.Has("deactivate_soil_part"): params.AddValue("deactivate_soil_part",settings["deactivate_soil_part"]) if settings.Has("gradual_excavation"): if settings["gradual_excavation"]: params.AddValue("gravity_direction",settings["gravity_direction"]) self.process = KratosGeo.ApplyGradualExcavationProcess(model_part, params) else: self.process = KratosGeo.ApplyExcavationProcess(model_part, params) else: self.process = KratosGeo.ApplyExcavationProcess(model_part, params)
def __init__(self, Model, settings ): KratosMultiphysics.Process.__init__(self) model_part = Model[settings["model_part_name"].GetString()] params = KratosMultiphysics.Parameters("{}") params.AddValue("model_part_name",settings["model_part_name"]) params.AddValue("gap_width_threshold",settings["gap_width_threshold"]) params.AddValue("consider_gap_closure",settings["consider_gap_closure"]) self.process = KratosGeo.GapClosureInterfaceProcess(model_part, params)
def __init__(self, Model, settings): KratosMultiphysics.Process.__init__(self) model_part = Model[settings["model_part_name"].GetString()] params = KratosMultiphysics.Parameters("{}") params.AddValue("model_part_name", settings["model_part_name"]) params.AddValue("dimension", settings["dimension"]) params.AddValue("stress_limit", settings["stress_limit"]) self.process = KratosGeo.PeriodicInterfaceProcess(model_part, params) if (settings["dimension"].GetInt() == 2): self.FindNodalNeigh = KratosMultiphysics.FindNodalNeighboursProcess( model_part, 2, 5) else: self.FindNodalNeigh = KratosMultiphysics.FindNodalNeighboursProcess( model_part, 10, 10)
def __init__(self, Model, settings): KratosMultiphysics.Process.__init__(self) self.model_part = Model[settings["model_part_name"].GetString()] self.params = KratosMultiphysics.Parameters("{}") self.params.AddValue("model_part_name", settings["model_part_name"]) self.params.AddValue("variable_name", settings["variable_name"]) if settings.Has("is_fixed"): self.params.AddValue("is_fixed", settings["is_fixed"]) if settings.Has("pressure_tension_cut_off"): self.params.AddValue("pressure_tension_cut_off", settings["pressure_tension_cut_off"]) if settings.Has("fluid_pressure_type"): # if settings["hydrostatic"].GetBool() == False: if settings["fluid_pressure_type"].GetString() == "Uniform": self.params.AddValue("value", settings["value"]) if settings["table"].GetInt() == 0: self.process = KratosMultiphysics.ApplyConstantScalarValueProcess( self.model_part, self.params) else: self.params.AddValue("table", settings["table"]) self.process = KratosGeo.ApplyDoubleTableProcess( self.model_part, self.params) elif settings["fluid_pressure_type"].GetString() == "Hydrostatic": self.params.AddValue("gravity_direction", settings["gravity_direction"]) self.params.AddValue("reference_coordinate", settings["reference_coordinate"]) self.params.AddValue("specific_weight", settings["specific_weight"]) if settings["table"].GetInt() == 0: self.process = KratosGeo.ApplyConstantHydrostaticPressureProcess( self.model_part, self.params) else: self.params.AddValue("table", settings["table"]) self.process = KratosGeo.ApplyHydrostaticPressureTableProcess( self.model_part, self.params) elif settings["fluid_pressure_type"].GetString( ) == "Phreatic_Line": self.params.AddValue("gravity_direction", settings["gravity_direction"]) self.params.AddValue("out_of_plane_direction", settings["out_of_plane_direction"]) self.params.AddValue("first_reference_coordinate", settings["first_reference_coordinate"]) self.params.AddValue("second_reference_coordinate", settings["second_reference_coordinate"]) self.params.AddValue("specific_weight", settings["specific_weight"]) if settings["table"][0].GetInt( ) == 0 and settings["table"][1].GetInt() == 0: self.process = KratosGeo.ApplyConstantPhreaticLinePressureProcess( self.model_part, self.params) else: self.params.AddValue("table", settings["table"]) self.process = KratosGeo.ApplyPhreaticLinePressureTableProcess( self.model_part, self.params) elif settings["fluid_pressure_type"].GetString( ) == "Interpolate_Line": self.params.AddValue("gravity_direction", settings["gravity_direction"]) self.params.AddValue("out_of_plane_direction", settings["out_of_plane_direction"]) if settings["table"].GetInt() == 0: self.process = KratosGeo.ApplyConstantInterpolateLinePressureProcess( self.model_part, self.params) else: self.process = KratosGeo.ApplyTimeDependentInterpolateLinePressureProcess( self.model_part, self.params) elif settings["fluid_pressure_type"].GetString( ) == "Phreatic_Surface": self.params.AddValue("gravity_direction", settings["gravity_direction"]) self.params.AddValue("first_reference_coordinate", settings["first_reference_coordinate"]) self.params.AddValue("second_reference_coordinate", settings["second_reference_coordinate"]) self.params.AddValue("third_reference_coordinate", settings["third_reference_coordinate"]) self.params.AddValue("specific_weight", settings["specific_weight"]) if settings["table"][0].GetInt( ) == 0 and settings["table"][1].GetInt( ) == 0 and settings["table"][2].GetInt() == 0: self.process = KratosGeo.ApplyConstantPhreaticSurfacePressureProcess( self.model_part, self.params) else: self.params.AddValue("table", settings["table"]) self.process = KratosGeo.ApplyPhreaticSurfacePressureTableProcess( self.model_part, self.params) else: raise Exception("unkown fluid_pressure_type!") else: self.params.AddValue("value", settings["value"]) if settings["table"].GetInt() == 0: self.process = KratosMultiphysics.ApplyConstantScalarValueProcess( self.model_part, self.params) else: self.params.AddValue("table", settings["table"]) self.process = KratosGeo.ApplyDoubleTableProcess( self.model_part, self.params)
def _ConstructSolver(self, builder_and_solver, strategy_type): self.main_model_part.ProcessInfo.SetValue(KratosGeo.IS_CONVERGED, True) self.main_model_part.ProcessInfo.SetValue( KratosMultiphysics.NL_ITERATION_NUMBER, 1) max_iters = self.settings["max_iterations"].GetInt() compute_reactions = self.settings["compute_reactions"].GetBool() reform_step_dofs = self.settings["reform_dofs_at_each_step"].GetBool() move_mesh_flag = self.settings["move_mesh_flag"].GetBool() if strategy_type.lower() == "newton_raphson": self.strategy_params = KratosMultiphysics.Parameters("{}") self.strategy_params.AddValue("loads_sub_model_part_list", self.loads_sub_sub_model_part_list) self.strategy_params.AddValue("loads_variable_list", self.settings["loads_variable_list"]) solving_strategy = KratosGeo.GeoMechanicsNewtonRaphsonStrategy( self.computing_model_part, self.scheme, self.linear_solver, self.convergence_criterion, builder_and_solver, self.strategy_params, max_iters, compute_reactions, reform_step_dofs, move_mesh_flag) elif strategy_type.lower() == "line_search": self.strategy_params = KratosMultiphysics.Parameters("{}") self.strategy_params.AddValue("max_iteration", self.settings["max_iterations"]) self.strategy_params.AddValue("compute_reactions", self.settings["compute_reactions"]) self.strategy_params.AddValue( "max_line_search_iterations", self.settings["max_line_search_iterations"]) self.strategy_params.AddValue("first_alpha_value", self.settings["first_alpha_value"]) self.strategy_params.AddValue("second_alpha_value", self.settings["second_alpha_value"]) self.strategy_params.AddValue("min_alpha", self.settings["min_alpha"]) self.strategy_params.AddValue("max_alpha", self.settings["max_alpha"]) self.strategy_params.AddValue( "line_search_tolerance", self.settings["line_search_tolerance"]) solving_strategy = KratosMultiphysics.LineSearchStrategy( self.computing_model_part, self.scheme, self.linear_solver, self.convergence_criterion, self.strategy_params) elif strategy_type.lower() == "arc_length": # Arc-Length strategy self.main_model_part.ProcessInfo.SetValue( KratosGeo.ARC_LENGTH_LAMBDA, 1.0) self.main_model_part.ProcessInfo.SetValue( KratosGeo.ARC_LENGTH_RADIUS_FACTOR, 1.0) self.strategy_params = KratosMultiphysics.Parameters("{}") self.strategy_params.AddValue("desired_iterations", self.settings["desired_iterations"]) self.strategy_params.AddValue("max_radius_factor", self.settings["max_radius_factor"]) self.strategy_params.AddValue("min_radius_factor", self.settings["min_radius_factor"]) self.strategy_params.AddValue("loads_sub_model_part_list", self.loads_sub_sub_model_part_list) self.strategy_params.AddValue("loads_variable_list", self.settings["loads_variable_list"]) solving_strategy = KratosGeo.GeoMechanicsRammArcLengthStrategy( self.computing_model_part, self.scheme, self.linear_solver, self.convergence_criterion, builder_and_solver, self.strategy_params, max_iters, compute_reactions, reform_step_dofs, move_mesh_flag) else: raise Exception("Undefined strategy type", strategy_type) return solving_strategy
def __init__(self, Model, settings): KratosMultiphysics.Process.__init__(self) self.model_part = Model[settings["model_part_name"].GetString()] variable_name = settings["variable_name"].GetString() self.components_process_list = [] if settings["active"][0].GetBool() == True: self.x_params = KratosMultiphysics.Parameters("{}") self.x_params.AddValue("model_part_name", settings["model_part_name"]) if settings.Has("is_fixed"): self.x_params.AddValue("is_fixed", settings["is_fixed"][0]) self.x_params.AddValue("value", settings["value"][0]) self.x_params.AddEmptyValue("variable_name").SetString( variable_name + "_X") if settings["table"][0].GetInt() == 0: self.components_process_list.append( KratosMultiphysics.ApplyConstantScalarValueProcess( self.model_part, self.x_params)) else: self.x_params.AddValue("table", settings["table"][0]) self.components_process_list.append( KratosGeo.ApplyComponentTableProcess( self.model_part, self.x_params)) if settings["active"][1].GetBool() == True: self.y_params = KratosMultiphysics.Parameters("{}") self.y_params.AddValue("model_part_name", settings["model_part_name"]) if settings.Has("is_fixed"): self.y_params.AddValue("is_fixed", settings["is_fixed"][1]) self.y_params.AddValue("value", settings["value"][1]) self.y_params.AddEmptyValue("variable_name").SetString( variable_name + "_Y") if settings["table"][1].GetInt() == 0: self.components_process_list.append( KratosMultiphysics.ApplyConstantScalarValueProcess( self.model_part, self.y_params)) else: self.y_params.AddValue("table", settings["table"][1]) self.components_process_list.append( KratosGeo.ApplyComponentTableProcess( self.model_part, self.y_params)) if settings["active"][2].GetBool() == True: self.z_params = KratosMultiphysics.Parameters("{}") self.z_params.AddValue("model_part_name", settings["model_part_name"]) if settings.Has("is_fixed"): self.z_params.AddValue("is_fixed", settings["is_fixed"][2]) self.z_params.AddValue("value", settings["value"][2]) self.z_params.AddEmptyValue("variable_name").SetString( variable_name + "_Z") if settings["table"][2].GetInt() == 0: self.components_process_list.append( KratosMultiphysics.ApplyConstantScalarValueProcess( self.model_part, self.z_params)) else: self.z_params.AddValue("table", settings["table"][2]) self.components_process_list.append( KratosGeo.ApplyComponentTableProcess( self.model_part, self.z_params))
def __init__(self, Model, settings): KratosMultiphysics.Process.__init__(self) self.model_part = Model[settings["model_part_name"].GetString()] self.components_process_list = [] if settings["active"][0].GetBool() == True: self.normal_params = KratosMultiphysics.Parameters("{}") self.normal_params.AddValue("model_part_name", settings["model_part_name"]) self.normal_params.AddValue("variable_name", settings["variable_name"]) if settings["fluid_pressure_type"].GetString() == "Uniform": self.normal_params.AddValue("value", settings["value"][0]) if settings["table"][0].GetInt() == 0: self.components_process_list.append( KratosMultiphysics.ApplyConstantScalarValueProcess( self.model_part, self.normal_params)) else: self.normal_params.AddValue("table", settings["table"][0]) self.components_process_list.append( KratosGeo.ApplyDoubleTableProcess( self.model_part, self.normal_params)) elif settings["fluid_pressure_type"].GetString() == "Hydrostatic": self.normal_params.AddValue("gravity_direction", settings["gravity_direction"]) self.normal_params.AddValue("reference_coordinate", settings["reference_coordinate"]) self.normal_params.AddValue("specific_weight", settings["specific_weight"]) if settings["table"][0].GetInt() == 0: self.components_process_list.append( KratosGeo. ApplyConstantBoundaryHydrostaticPressureProcess( self.model_part, self.normal_params)) else: self.normal_params.AddValue("table", settings["table"][0]) self.components_process_list.append( KratosGeo.ApplyBoundaryHydrostaticPressureTableProcess( self.model_part, self.normal_params)) elif settings["fluid_pressure_type"].GetString( ) == "Phreatic_Line": self.normal_params.AddValue("gravity_direction", settings["gravity_direction"]) self.normal_params.AddValue("out_of_plane_direction", settings["out_of_plane_direction"]) self.normal_params.AddValue( "first_reference_coordinate", settings["first_reference_coordinate"]) self.normal_params.AddValue( "second_reference_coordinate", settings["second_reference_coordinate"]) self.normal_params.AddValue("specific_weight", settings["specific_weight"]) if settings["table"].GetInt() == 0: self.process = KratosGeo.ApplyConstantBoundaryPhreaticLinePressureProcess( self.model_part, self.normal_params) else: self.normal_params.AddValue("table", settings["table"]) self.process = KratosGeo.ApplyBoundaryPhreaticLinePressureTableProcess( self.model_part, self.normal_params) elif settings["fluid_pressure_type"].GetString( ) == "Phreatic_Surface": self.normal_params.AddValue("gravity_direction", settings["gravity_direction"]) self.normal_params.AddValue( "first_reference_coordinate", settings["first_reference_coordinate"]) self.normal_params.AddValue( "second_reference_coordinate", settings["second_reference_coordinate"]) self.normal_params.AddValue( "third_reference_coordinate", settings["third_reference_coordinate"]) self.normal_params.AddValue("specific_weight", settings["specific_weight"]) if settings["table"].GetInt() == 0: self.process = KratosGeo.ApplyConstantBoundaryPhreaticSurfacePressureProcess( self.model_part, self.normal_params) else: self.normal_params.AddValue("table", settings["table"]) self.process = KratosGeo.ApplyBoundaryPhreaticSurfacePressureTableProcess( self.model_part, self.normal_params) else: raise Exception("unkown fluid_pressure_type!") if settings["active"][1].GetBool() == True: tangential_params = KratosMultiphysics.Parameters("{}") tangential_params.AddValue("model_part_name", settings["model_part_name"]) tangential_params.AddEmptyValue("variable_name").SetString( "TANGENTIAL_CONTACT_STRESS") # Note: this is not general tangential_params.AddValue("value", settings["value"][1]) if settings["table"][1].GetInt() == 0: self.components_process_list.append( KratosMultiphysics.ApplyConstantScalarValueProcess( self.model_part, tangential_params)) else: tangential_params.AddValue("table", settings["table"][1]) self.components_process_list.append( KratosGeo.ApplyDoubleTableProcess(self.model_part, tangential_params))