コード例 #1
0
    def ModifyProperties(self, properties, param = 0):

        if not param:
            DiscontinuumConstitutiveLawString = properties[DEM_DISCONTINUUM_CONSTITUTIVE_LAW_NAME]
            DiscontinuumConstitutiveLaw = globals().get(DiscontinuumConstitutiveLawString)()
            DiscontinuumConstitutiveLaw.SetConstitutiveLawInProperties(properties, True)

            coefficient_of_restitution = properties[COEFFICIENT_OF_RESTITUTION]

            type_of_law = DiscontinuumConstitutiveLaw.GetTypeOfLaw()

            write_gamma = 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' or type_of_law == 'Dependent_friction'):
                gamma = self.GammaForHertzThornton(coefficient_of_restitution)
                write_gamma = True

            else:
                pass

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

            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.KRATOSprint(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)

        if not properties.Has(ROLLING_FRICTION_WITH_WALLS):
            properties[ROLLING_FRICTION_WITH_WALLS] = properties[ROLLING_FRICTION]
コード例 #2
0
ファイル: sphere_strategy.py プロジェクト: tlming16/Kratos
    def ModifyProperties(self, properties):
        DiscontinuumConstitutiveLawString = properties[
            DEM_DISCONTINUUM_CONSTITUTIVE_LAW_NAME]
        DiscontinuumConstitutiveLaw = globals().get(
            DiscontinuumConstitutiveLawString)()
        DiscontinuumConstitutiveLaw.SetConstitutiveLawInProperties(
            properties, True)

        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

        else:
            pass

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

        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.KRATOSprint(properties)

        if properties.Has(DEM_INTEGRATION_SCHEME_NAME):
            scheme_name = properties[DEM_INTEGRATION_SCHEME_NAME]
        else:
            scheme_name = self.DEM_parameters["IntegrationScheme"].GetString()

        scheme, error_status, summary_mssg = self.GetScheme(scheme_name)
        scheme.SetIntegrationSchemeInProperties(properties, True)
コード例 #3
0
    def ModifyProperties(self, properties):
        DiscontinuumConstitutiveLawString = properties[
            DEM_DISCONTINUUM_CONSTITUTIVE_LAW_NAME]
        DiscontinuumConstitutiveLaw = globals().get(
            DiscontinuumConstitutiveLawString)()
        DiscontinuumConstitutiveLaw.SetConstitutiveLawInProperties(properties)

        coefficient_of_restitution = properties[COEFFICIENT_OF_RESTITUTION]

        type_of_law = DiscontinuumConstitutiveLaw.GetTypeOfLaw()

        write_gamma = 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

        else:
            pass

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

        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)
            print(properties)
コード例 #4
0
ファイル: sphere_strategy.py プロジェクト: yasodhar008/Kratos
    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(PARTICLE_FRICTION):
            self.Procedures.KratosPrintWarning(
                "---------------------------------------------------")
            self.Procedures.KratosPrintWarning(
                "  WARNING: Property PARTICLE_FRICTION is deprecated ")
            self.Procedures.KratosPrintWarning(
                "  since April 11th, 2018, replace with FRICTION")
            self.Procedures.KratosPrintWarning(
                "  Automatic replacement is done now.")
            self.Procedures.KratosPrintWarning(
                "---------------------------------------------------")
            properties[FRICTION] = properties[PARTICLE_FRICTION]
        if properties.Has(WALL_FRICTION):
            self.Procedures.KratosPrintWarning(
                "-------------------------------------------------")
            self.Procedures.KratosPrintWarning(
                "  WARNING: Property WALL_FRICTION is deprecated")
            self.Procedures.KratosPrintWarning(
                "  since April 11th, 2018, replace with FRICTION")
            self.Procedures.KratosPrintWarning(
                "  Automatic replacement is done now.")
            self.Procedures.KratosPrintWarning(
                "-------------------------------------------------")
            properties[FRICTION] = properties[WALL_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]