def test_one_mesh(self):
        mesh_description_3D = {"elements": {"Hexa": {"MyFancyElement": 0}}}

        meshes = [
            create_kratos_input_tui.SalomeMesh(self.mesh_hexa,
                                               mesh_description_3D, "domain")
        ]

        mdpa_file_name = "create_mdpa_one_mesh"
        create_kratos_input_tui.CreateMdpaFile(meshes, mdpa_file_name)

        CompareMdpaWithReferenceFile(mdpa_file_name, self)
    def test_multiple_meshes(self):
        mesh_description_3D = {
            "elements": {
                "Hexa": {
                    "MyFancyElement": 1
                }
            },
            "conditions": {
                "Hexa": {
                    "VolumeLoadCondition": 0
                }
            }
        }
        mesh_description_2D = {"conditions": {"Quadrangle": {"SideForce": 23}}}
        mesh_description_1D = {
            "conditions": {
                "Edge": {
                    "LineSupportDisp": 63,
                    "LineSupportRot": 7
                }
            }
        }
        mesh_description_0D = {"elements": {"Ball": {"PointMassBall": 4}}}

        meshes = [
            create_kratos_input_tui.SalomeMesh(self.mesh_hexa,
                                               mesh_description_3D, "domain"),
            create_kratos_input_tui.SalomeMesh(self.sub_mesh_hexa_f_1,
                                               mesh_description_2D,
                                               "side_faces"),
            create_kratos_input_tui.SalomeMesh(self.group_hexa_edges,
                                               mesh_description_1D,
                                               "supports"),
            create_kratos_input_tui.SalomeMesh(self.group_hexa_ball_elements,
                                               mesh_description_0D,
                                               "domain.point_masses")
        ]

        mdpa_file_name = "create_mdpa_multiple_meshes"
        create_kratos_input_tui.CreateMdpaFile(meshes, mdpa_file_name)

        CompareMdpaWithReferenceFile(mdpa_file_name, self)
Beispiel #3
0
# saving the study such that it can be loaded in Salome
salome.myStudy.SaveAs("Cantilever_Hexa.hdf", False,
                      False)  # args: use_multifile, use_acsii

if salome.sg.hasDesktop():
    salome.sg.updateObjBrowser()

# from here on using the plugin to create mdpa file
sys.path.append("../../")  # adding root folder of plugin to path
import create_kratos_input_tui

mesh_description_3D = {
    "elements": {
        "Hexa": {
            "SmallDisplacementElement3D8N": 0
        }
    }
}
mesh_description_0D = {"conditions": {"0D": {"PointLoadCondition3D1N": 0}}}

meshes = [
    create_kratos_input_tui.SalomeMesh(domain_1, mesh_description_3D,
                                       "domain"),
    create_kratos_input_tui.SalomeMesh(
        dirichlet_1, {}, "dirichlet"),  # no elements / conditions needed
    create_kratos_input_tui.SalomeMesh(group_0D_entities, mesh_description_0D,
                                       "neumann")
]

create_kratos_input_tui.CreateMdpaFile(meshes, "cantilever")
    smesh.SetName(Max_Size_domain_inner, 'Max Size_domain_inner')
    smesh.SetName(Max_Size_domain, 'Max Size_domain')
    smesh.SetName(Local_Length_cyl, 'Local Length_cyl')
    smesh.SetName(mesh_outlet, 'mesh_outlet')
    smesh.SetName(mesh_cyl_boundary, 'mesh_cyl_boundary')
    smesh.SetName(mesh_inlet, 'mesh_inlet')

    # https://docs.salome-platform.org/latest/tui/KERNEL/kernel_salome.html
    # saving the study such that it can be loaded in Salome
    salome.myStudy.SaveAs("flow_cylinder_{}.hdf".format(mesh_factor), False,
                          False)  # args: use_multifile, use_acsii

    meshes = [
        create_kratos_input_tui.SalomeMesh(domain_1, mesh_description_domain,
                                           "domain"),
        create_kratos_input_tui.SalomeMesh(mesh_inlet, mesh_description_wall,
                                           "inlet"),
        create_kratos_input_tui.SalomeMesh(mesh_outlet, mesh_description_wall,
                                           "outlet"),
        create_kratos_input_tui.SalomeMesh(mesh_walls, mesh_description_wall,
                                           "walls"),
        create_kratos_input_tui.SalomeMesh(mesh_cyl_boundary,
                                           mesh_description_wall,
                                           "cyl_boundary"),
    ]

    create_kratos_input_tui.CreateMdpaFile(
        meshes, "flow_cylinder_{}".format(mesh_factor))

if salome.sg.hasDesktop():
    salome.sg.updateObjBrowser()