Example #1
0
    def _ExecuteCheckAndPrepare(self):

        self.computing_model_part_name = "porous_computational_model_part"

        # Create list of sub sub model parts (it is a copy of the standard lists with a different name)
        import json

        self.body_domain_sub_sub_model_part_list = []
        for i in range(
                self.settings["body_domain_sub_model_part_list"].size()):
            self.body_domain_sub_sub_model_part_list.append(
                "sub_" + self.settings["body_domain_sub_model_part_list"]
                [i].GetString())
        self.body_domain_sub_sub_model_part_list = KratosMultiphysics.Parameters(
            json.dumps(self.body_domain_sub_sub_model_part_list))

        self.loads_sub_sub_model_part_list = []
        for i in range(self.settings["loads_sub_model_part_list"].size()):
            self.loads_sub_sub_model_part_list.append(
                "sub_" +
                self.settings["loads_sub_model_part_list"][i].GetString())
        self.loads_sub_sub_model_part_list = KratosMultiphysics.Parameters(
            json.dumps(self.loads_sub_sub_model_part_list))

        # Auxiliary parameters object for the CheckAndPepareModelProcess
        params = KratosMultiphysics.Parameters("{}")
        params.AddEmptyValue("computing_model_part_name").SetString(
            self.computing_model_part_name)
        params.AddValue("problem_domain_sub_model_part_list",
                        self.settings["problem_domain_sub_model_part_list"])
        params.AddValue("processes_sub_model_part_list",
                        self.settings["processes_sub_model_part_list"])
        params.AddValue("body_domain_sub_model_part_list",
                        self.settings["body_domain_sub_model_part_list"])
        params.AddValue("body_domain_sub_sub_model_part_list",
                        self.body_domain_sub_sub_model_part_list)
        params.AddValue("loads_sub_model_part_list",
                        self.settings["loads_sub_model_part_list"])
        params.AddValue("loads_sub_sub_model_part_list",
                        self.loads_sub_sub_model_part_list)
        # CheckAndPrepareModelProcess creates the porous_computational_model_part
        from KratosMultiphysics.PoromechanicsApplication import check_and_prepare_model_process_poro
        check_and_prepare_model_process_poro.CheckAndPrepareModelProcess(
            self.main_model_part, params).Execute()

        # Constitutive law import
        materials_imported = self.import_constitutive_laws()
        if materials_imported:
            KratosMultiphysics.Logger.PrintInfo(
                "UPwSolver",
                "Constitutive law was successfully imported via json.")
        else:
            KratosMultiphysics.Logger.PrintInfo(
                "UPwSolver", "Constitutive law was not successfully imported.")
    def _ExecuteCheckAndPrepare(self):

        self.computing_model_part_name = "porous_computational_model_part"

        # Create list of sub sub model parts (it is a copy of the standard lists with a different name)
        import json

        self.body_domain_sub_sub_model_part_list = []
        for i in range(
                self.settings["body_domain_sub_model_part_list"].size()):
            self.body_domain_sub_sub_model_part_list.append(
                "sub_" + self.settings["body_domain_sub_model_part_list"]
                [i].GetString())
        self.body_domain_sub_sub_model_part_list = KratosMultiphysics.Parameters(
            json.dumps(self.body_domain_sub_sub_model_part_list))

        self.loads_sub_sub_model_part_list = []
        for i in range(self.settings["loads_sub_model_part_list"].size()):
            self.loads_sub_sub_model_part_list.append(
                "sub_" +
                self.settings["loads_sub_model_part_list"][i].GetString())
        self.loads_sub_sub_model_part_list = KratosMultiphysics.Parameters(
            json.dumps(self.loads_sub_sub_model_part_list))

        # Auxiliary parameters object for the CheckAndPepareModelProcess
        params = KratosMultiphysics.Parameters("{}")
        params.AddEmptyValue("computing_model_part_name").SetString(
            self.computing_model_part_name)
        params.AddValue("problem_domain_sub_model_part_list",
                        self.settings["problem_domain_sub_model_part_list"])
        params.AddValue("processes_sub_model_part_list",
                        self.settings["processes_sub_model_part_list"])
        params.AddValue("body_domain_sub_model_part_list",
                        self.settings["body_domain_sub_model_part_list"])
        params.AddValue("body_domain_sub_sub_model_part_list",
                        self.body_domain_sub_sub_model_part_list)
        params.AddValue("loads_sub_model_part_list",
                        self.settings["loads_sub_model_part_list"])
        params.AddValue("loads_sub_sub_model_part_list",
                        self.loads_sub_sub_model_part_list)
        # CheckAndPrepareModelProcess creates the porous_computational_model_part
        from KratosMultiphysics.PoromechanicsApplication import check_and_prepare_model_process_poro
        check_and_prepare_model_process_poro.CheckAndPrepareModelProcess(
            self.main_model_part, params).Execute()

        # Constitutive law import
        from KratosMultiphysics.PoromechanicsApplication import poromechanics_constitutivelaw_utility
        poromechanics_constitutivelaw_utility.SetConstitutiveLaw(
            self.main_model_part)
Example #3
0
    def _ExecuteAfterReading(self):

        self.computing_model_part_name = "mechanical_computing_domain"

        # Auxiliary Kratos parameters object to be called by the CheckAndPepareModelProcess
        aux_params = KratosMultiphysics.Parameters("{}")
        aux_params.AddEmptyValue("computing_model_part_name").SetString(self.computing_model_part_name)

        # CheckAndPrepareModelProcess creates the solid_computational_model_part
        from KratosMultiphysics.PoromechanicsApplication import check_and_prepare_model_process_poro
        check_and_prepare_model_process_poro.CheckAndPrepareModelProcess(self.main_model_part, aux_params).Execute()

        # Constitutive law import
        from KratosMultiphysics.DamApplication import dam_constitutive_law_utility
        dam_constitutive_law_utility.SetConstitutiveLaw(self.main_model_part)

        self.main_model_part.SetBufferSize( self.settings["buffer_size"].GetInt() )
        minimum_buffer_size = self.GetMinimumBufferSize()
        if(minimum_buffer_size > self.main_model_part.GetBufferSize()):
            self.main_model_part.SetBufferSize( minimum_buffer_size )