Ejemplo n.º 1
0
    def ModifyProperties(self, properties, param=0):

        if param:
            return

        if not properties.Has(COMPUTE_WEAR):
            properties.SetValue(COMPUTE_WEAR, False)

        if properties.Has(CLUSTER_FILE_NAME):
            cluster_file_name = properties[CLUSTER_FILE_NAME]
            [name, list_of_coordinates, list_of_radii, size, volume,
             inertias] = cluster_file_reader.ReadClusterFile(cluster_file_name)
            pre_utils = PreUtilities(self.spheres_model_part)
            pre_utils.SetClusterInformationInProperties(
                name, list_of_coordinates, list_of_radii, size, volume,
                inertias, properties)
            self.Procedures.KratosPrintInfo(properties)
            if not properties.Has(BREAKABLE_CLUSTER):
                properties.SetValue(BREAKABLE_CLUSTER, False)

        if properties.Has(DEM_TRANSLATIONAL_INTEGRATION_SCHEME_NAME):
            translational_scheme_name = properties[
                DEM_TRANSLATIONAL_INTEGRATION_SCHEME_NAME]
        else:
            translational_scheme_name = self.DEM_parameters[
                "TranslationalIntegrationScheme"].GetString()

        translational_scheme, error_status, summary_mssg = self.GetTranslationalScheme(
            translational_scheme_name)

        translational_scheme.SetTranslationalIntegrationSchemeInProperties(
            properties, True)

        if properties.Has(DEM_ROTATIONAL_INTEGRATION_SCHEME_NAME):
            rotational_scheme_name = properties[
                DEM_ROTATIONAL_INTEGRATION_SCHEME_NAME]
        else:
            rotational_scheme_name = self.DEM_parameters[
                "RotationalIntegrationScheme"].GetString()

        rotational_scheme, error_status, summary_mssg = self.GetRotationalScheme(
            translational_scheme_name, rotational_scheme_name)
        rotational_scheme.SetRotationalIntegrationSchemeInProperties(
            properties, True)
Ejemplo n.º 2
0
    def ModifyProperties(self, properties, param = 0):

        if not param:
            DiscontinuumConstitutiveLaw = globals().get(properties[DEM_DISCONTINUUM_CONSTITUTIVE_LAW_NAME])()
            coefficient_of_restitution = properties[COEFFICIENT_OF_RESTITUTION]

            type_of_law = DiscontinuumConstitutiveLaw.GetTypeOfLaw()

            write_gamma = False

            write_AlphaFunction = False

            if (type_of_law == 'Linear'):
                gamma = self.RootByBisection(self.coeff_of_rest_diff, 0.0, 16.0, 0.0001, 300, coefficient_of_restitution)
                write_gamma = True

            elif (type_of_law == 'Hertz'):
                gamma = self.GammaForHertzThornton(coefficient_of_restitution)
                write_gamma = True

            elif (type_of_law == 'Conical_damage'):
                gamma = self.GammaForHertzThornton(coefficient_of_restitution)
                write_gamma = True
                conical_damage_alpha = properties[CONICAL_DAMAGE_ALPHA]
                AlphaFunction = self.SinAlphaConicalDamage(conical_damage_alpha)
                write_AlphaFunction = True
                if not properties.Has(LEVEL_OF_FOULING):
                    properties[LEVEL_OF_FOULING] = 0.0

            else:
                pass

            if write_gamma == True:
                properties[DAMPING_GAMMA] = gamma

            if write_AlphaFunction == True:
                properties[CONICAL_DAMAGE_ALPHA_FUNCTION] = AlphaFunction

            if properties.Has(CLUSTER_FILE_NAME):
                cluster_file_name = properties[CLUSTER_FILE_NAME]
                [name, list_of_coordinates, list_of_radii, size, volume, inertias] = cluster_file_reader.ReadClusterFile(cluster_file_name)
                pre_utils = PreUtilities(self.spheres_model_part)
                pre_utils.SetClusterInformationInProperties(name, list_of_coordinates, list_of_radii, size, volume, inertias, properties)
                self.Procedures.KratosPrintInfo(properties)
                if not properties.Has(BREAKABLE_CLUSTER):
                    properties.SetValue(BREAKABLE_CLUSTER, False)

            DiscontinuumConstitutiveLaw.SetConstitutiveLawInProperties(properties, True)

        if properties.Has(DEM_TRANSLATIONAL_INTEGRATION_SCHEME_NAME):
            translational_scheme_name = properties[DEM_TRANSLATIONAL_INTEGRATION_SCHEME_NAME]
        else:
            translational_scheme_name = self.DEM_parameters["TranslationalIntegrationScheme"].GetString()

        if properties.Has(FRICTION):
            self.Procedures.KratosPrintWarning("-------------------------------------------------")
            self.Procedures.KratosPrintWarning("  WARNING: Property FRICTION is deprecated since April 6th, 2020, ")
            self.Procedures.KratosPrintWarning("  replace with STATIC_FRICTION and DYNAMIC_FRICTION")
            self.Procedures.KratosPrintWarning("  Automatic replacement is done now.")
            self.Procedures.KratosPrintWarning("-------------------------------------------------")
            properties[STATIC_FRICTION] = properties[FRICTION]
            properties[DYNAMIC_FRICTION] = properties[FRICTION]

        translational_scheme, error_status, summary_mssg = self.GetTranslationalScheme(translational_scheme_name)

        translational_scheme.SetTranslationalIntegrationSchemeInProperties(properties, True)

        if properties.Has(DEM_ROTATIONAL_INTEGRATION_SCHEME_NAME):
            rotational_scheme_name = properties[DEM_ROTATIONAL_INTEGRATION_SCHEME_NAME]
        else:
            rotational_scheme_name = self.DEM_parameters["RotationalIntegrationScheme"].GetString()

        rotational_scheme, error_status, summary_mssg = self.GetRotationalScheme(translational_scheme_name, rotational_scheme_name)
        rotational_scheme.SetRotationalIntegrationSchemeInProperties(properties, True)

        if not properties.Has(ROLLING_FRICTION_WITH_WALLS):
            properties[ROLLING_FRICTION_WITH_WALLS] = properties[ROLLING_FRICTION]
Ejemplo n.º 3
0
    def SetVariablesAndOptions(self):

        # Setting ProcessInfo variables
        for name in self.all_model_parts.model_parts.keys():
            self.all_model_parts.Get(name).ProcessInfo.SetValue(IS_RESTARTED, self._GetInputType() == 'rest')

        # DIMENSION PARAMETERS
        self.spheres_model_part.ProcessInfo.SetValue(DOMAIN_SIZE, self.dimension)

        # SIMULATION FLAGS
        self.spheres_model_part.ProcessInfo.SetValue(IS_TIME_TO_PRINT, False)
        self.spheres_model_part.ProcessInfo.SetValue(VIRTUAL_MASS_OPTION, self.virtual_mass_option)
        self.spheres_model_part.ProcessInfo.SetValue(CRITICAL_TIME_OPTION, self.critical_time_option)
        self.spheres_model_part.ProcessInfo.SetValue(CASE_OPTION, self.case_option)
        self.spheres_model_part.ProcessInfo.SetValue(TRIHEDRON_OPTION, self.trihedron_option)
        self.SetOneOrZeroInProcessInfoAccordingToBoolValue(self.spheres_model_part, ROTATION_OPTION, self.rotation_option)
        self.SetOneOrZeroInProcessInfoAccordingToBoolValue(self.spheres_model_part, BOUNDING_BOX_OPTION, self.bounding_box_option)
        self.spheres_model_part.ProcessInfo.SetValue(SEARCH_CONTROL, self.search_control)
        self.spheres_model_part.ProcessInfo.SetValue(FIX_VELOCITIES_FLAG, self.fix_velocities_flag)
        self.spheres_model_part.ProcessInfo.SetValue(NEIGH_INITIALIZED, 0)
        self.spheres_model_part.ProcessInfo.SetValue(CLEAN_INDENT_OPTION, self.clean_init_indentation_option)
        self.spheres_model_part.ProcessInfo.SetValue(BOUNDING_BOX_START_TIME, self.bounding_box_start_time)
        self.spheres_model_part.ProcessInfo.SetValue(BOUNDING_BOX_STOP_TIME, self.bounding_box_stop_time)
        self.spheres_model_part.ProcessInfo.SetValue(COMPUTE_STRESS_TENSOR_OPTION, self.compute_stress_tensor_option)
        self.spheres_model_part.ProcessInfo.SetValue(PRINT_STRESS_TENSOR_OPTION, self.print_stress_tensor_option)
        self.spheres_model_part.ProcessInfo.SetValue(CONTINUUM_OPTION, self.continuum_type)
        self.spheres_model_part.ProcessInfo.SetValue(IMPOSED_Z_STRAIN_VALUE, 0.0) # A default value

        self.spheres_model_part.ProcessInfo.SetValue(DOMAIN_IS_PERIODIC, 0) #TODO: DOMAIN_IS_PERIODIC should be a bool, and should have the suffix option
        if "PeriodicDomainOption" in self.DEM_parameters.keys():
            if self.DEM_parameters["PeriodicDomainOption"].GetBool():
                self.spheres_model_part.ProcessInfo.SetValue(DOMAIN_IS_PERIODIC, 1) #TODO: DOMAIN_IS_PERIODIC should be a bool, and should have the suffix option

        self.spheres_model_part.ProcessInfo.SetValue(DOMAIN_MIN_CORNER, self.bottom_corner)
        self.spheres_model_part.ProcessInfo.SetValue(DOMAIN_MAX_CORNER, self.top_corner)
        self.spheres_model_part.ProcessInfo.SetValue(GRAVITY, self.gravity)

        # GLOBAL MATERIAL PROPERTIES
        self.spheres_model_part.ProcessInfo.SetValue(NODAL_MASS_COEFF, self.nodal_mass_coeff)
        self.SetOneOrZeroInProcessInfoAccordingToBoolValue(self.spheres_model_part, ROLLING_FRICTION_OPTION, self.rolling_friction_option)
        self.spheres_model_part.ProcessInfo.SetValue(GLOBAL_DAMPING, self.global_damping)

        # SEARCH-RELATED
        self.spheres_model_part.ProcessInfo.SetValue(SEARCH_RADIUS_INCREMENT, self.search_increment)
        self.spheres_model_part.ProcessInfo.SetValue(SEARCH_RADIUS_INCREMENT_FOR_WALLS, self.search_increment_for_walls)
        self.spheres_model_part.ProcessInfo.SetValue(COORDINATION_NUMBER, self.coordination_number)
        self.spheres_model_part.ProcessInfo.SetValue(LOCAL_RESOLUTION_METHOD, self.local_resolution_method)
        if self.contact_mesh_option:
            self.spheres_model_part.ProcessInfo.SetValue(CONTACT_MESH_OPTION, 1)
        else:
            self.spheres_model_part.ProcessInfo.SetValue(CONTACT_MESH_OPTION, 0)

        # PRINTING VARIABLES

        self.spheres_model_part.ProcessInfo.SetValue(PRINT_EXPORT_ID, self.print_export_id)

        # TIME RELATED PARAMETERS
        self.spheres_model_part.ProcessInfo.SetValue(DELTA_TIME, self.delta_time)

        #-----os.chdir('..')   # check functionality

        for properties in self.spheres_model_part.Properties:
            self.ModifyProperties(properties)

        for properties in self.inlet_model_part.Properties:
            self.ModifyProperties(properties)

        for submp in self.inlet_model_part.SubModelParts:
            if submp.Has(CLUSTER_FILE_NAME):
                cluster_file_name = submp[CLUSTER_FILE_NAME]
                [name, list_of_coordinates, list_of_radii, size, volume, inertias] = cluster_file_reader.ReadClusterFile(cluster_file_name)
                pre_utils = PreUtilities(self.spheres_model_part)
                props_id = submp[PROPERTIES_ID]
                for prop in self.inlet_model_part.Properties:
                    if prop.Id == props_id:
                        properties = prop
                        break
                pre_utils.SetClusterInformationInProperties(name, list_of_coordinates, list_of_radii, size, volume, inertias, properties)
                if not properties.Has(BREAKABLE_CLUSTER):
                    properties.SetValue(BREAKABLE_CLUSTER, False)

        for properties in self.cluster_model_part.Properties:
            self.ModifyProperties(properties)

        for properties in self.fem_model_part.Properties:
            self.ModifyProperties(properties, 1)

        # RESOLUTION METHODS AND PARAMETERS
        # Creating the solution strategy
        self.settings = ExplicitSolverSettings()
        self.settings.r_model_part = self.spheres_model_part
        self.settings.contact_model_part = self.contact_model_part
        self.settings.fem_model_part = self.fem_model_part
        self.settings.inlet_model_part = self.inlet_model_part
        self.settings.cluster_model_part = self.cluster_model_part