def __InitializePeriodicConditions(self, model_part, scalar_variable):
        properties = model_part.CreateNewProperties(
            model_part.NumberOfProperties() + 1)
        pcu = KratosCFD.PeriodicConditionUtilities(
            model_part, model_part.ProcessInfo[Kratos.DOMAIN_SIZE])
        pcu.AddPeriodicVariable(properties, scalar_variable)

        index = model_part.NumberOfConditions()
        for condition in self.fluid_model_part.Conditions:
            if condition.Is(Kratos.PERIODIC):
                index += 1
                node_id_list = [node.Id for node in condition.GetNodes()]
                periodic_condition = model_part.CreateNewCondition(
                    "PeriodicCondition", index, node_id_list, properties)
                periodic_condition.Set(Kratos.PERIODIC)
Exemplo n.º 2
0
def InitializePeriodicConditions(base_model_part,
                                 model_part,
                                 variables_list,
                                 periodic_condition_name="PeriodicCondition"):

    properties = model_part.CreateNewProperties(
        model_part.NumberOfProperties() + 1)

    pcu = KratosCFD.PeriodicConditionUtilities(
        model_part, model_part.ProcessInfo[Kratos.DOMAIN_SIZE])
    for variable in variables_list:
        pcu.AddPeriodicVariable(properties, variable)

    index = model_part.NumberOfConditions()
    for condition in base_model_part.Conditions:
        if condition.Is(Kratos.PERIODIC):
            index += 1
            node_id_list = [node.Id for node in condition.GetNodes()]
            periodic_condition = model_part.CreateNewCondition(
                periodic_condition_name, index, node_id_list, properties)
            periodic_condition.Set(Kratos.PERIODIC)