KratosCableNetApplication 10.4.2__2-cp38-cp38-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+
2
+ # Application dependent names and paths
3
+ from KratosMultiphysics import _ImportApplication
4
+ import KratosMultiphysics.StructuralMechanicsApplication
5
+ from KratosCableNetApplication import *
6
+ application = KratosCableNetApplication()
7
+ application_name = "KratosCableNetApplication"
8
+
9
+ _ImportApplication(application, application_name)
@@ -0,0 +1,24 @@
1
+ import KratosMultiphysics as Kratos
2
+ import KratosMultiphysics as Kratos
3
+ import collections.abc
4
+ import typing
5
+
6
+ class ApplyWeakSlidingProcess(Kratos.Process):
7
+ def __init__(self, arg0: Kratos.ModelPart, arg1: Kratos.Parameters) -> None:
8
+ """__init__(self: KratosCableNetApplication.ApplyWeakSlidingProcess, arg0: Kratos.ModelPart, arg1: Kratos.Parameters) -> None"""
9
+
10
+ class EdgeCableElementProcess(Kratos.Process):
11
+ def __init__(self, arg0: Kratos.ModelPart, arg1: Kratos.Parameters) -> None:
12
+ """__init__(self: KratosCableNetApplication.EdgeCableElementProcess, arg0: Kratos.ModelPart, arg1: Kratos.Parameters) -> None"""
13
+
14
+ class EmpiricalSpringElementProcess(Kratos.Process):
15
+ def __init__(self, arg0: Kratos.ModelPart, arg1: Kratos.Parameters, arg2: collections.abc.Sequence[typing.SupportsFloat]) -> None:
16
+ """__init__(self: KratosCableNetApplication.EmpiricalSpringElementProcess, arg0: Kratos.ModelPart, arg1: Kratos.Parameters, arg2: collections.abc.Sequence[typing.SupportsFloat]) -> None"""
17
+
18
+ class KratosCableNetApplication(Kratos.KratosApplication):
19
+ def __init__(self) -> None:
20
+ """__init__(self: KratosCableNetApplication.KratosCableNetApplication) -> None"""
21
+
22
+ class SlidingEdgeProcess(Kratos.Process):
23
+ def __init__(self, arg0: Kratos.ModelPart, arg1: Kratos.Parameters) -> None:
24
+ """__init__(self: KratosCableNetApplication.SlidingEdgeProcess, arg0: Kratos.ModelPart, arg1: Kratos.Parameters) -> None"""
@@ -0,0 +1,36 @@
1
+ import KratosMultiphysics as KratosMultiphysics
2
+ import KratosMultiphysics.CableNetApplication as CableNetApplication
3
+
4
+ def Factory(settings, Model):
5
+ if(type(settings) != KratosMultiphysics.Parameters):
6
+ raise Exception("expected input shall be a Parameters object, encapsulating a json string")
7
+ return ApplyWeakSlidingProcess(Model, settings["Parameters"])
8
+
9
+
10
+
11
+ class ApplyWeakSlidingProcess(KratosMultiphysics.Process):
12
+
13
+ def __init__(self, Model, settings ):
14
+ KratosMultiphysics.Process.__init__(self)
15
+ default_settings = KratosMultiphysics.Parameters("""
16
+ {
17
+ "model_part_name_slave" : "example_part_slave",
18
+ "model_part_name_master" : "example_part_master",
19
+ "computing_model_part_name" : "Structure",
20
+ "element_id" : 1,
21
+ "property_id" : 1,
22
+ "debug_info" : false
23
+ }
24
+ """)
25
+ default_settings.ValidateAndAssignDefaults(settings)
26
+ self.custom_process = CableNetApplication.ApplyWeakSlidingProcess(Model[settings["computing_model_part_name"].GetString()], settings)
27
+
28
+
29
+ def ExecuteInitialize(self):
30
+ self.custom_process.ExecuteInitialize()
31
+
32
+ def ExecuteInitializeSolutionStep(self):
33
+ self.custom_process.ExecuteInitializeSolutionStep()
34
+
35
+ def ExecuteFinalizeSolutionStep(self):
36
+ self.custom_process.ExecuteFinalizeSolutionStep()
@@ -0,0 +1,78 @@
1
+ import KratosMultiphysics as KratosMultiphysics
2
+ import KratosMultiphysics.CableNetApplication as CableNetApplication
3
+
4
+ from KratosMultiphysics import Logger
5
+
6
+ def Factory(settings, Model):
7
+ if(type(settings) != KratosMultiphysics.Parameters):
8
+ raise Exception("expected input shall be a Parameters object, encapsulating a json string")
9
+ return EdgeCableElementProcess(Model, settings["Parameters"])
10
+
11
+ class custom_node:
12
+ def __init__(self,start_distance,kratos_node):
13
+ self.start_distance = start_distance
14
+ self.kratos_node = kratos_node
15
+ def return_distance_to_line_start(self):
16
+ return self.start_distance
17
+
18
+ def return_node_distance_to_line_start(node):
19
+ return node.return_distance_to_line_start()
20
+
21
+
22
+
23
+ class EdgeCableElementProcess(KratosMultiphysics.Process):
24
+
25
+ def __init__(self, Model, settings ):
26
+ KratosMultiphysics.Process.__init__(self)
27
+ default_settings = KratosMultiphysics.Parameters("""
28
+ {
29
+ "edge_sub_model_part_name" : "Structure.example_part",
30
+ "element_type" : "cable",
31
+ "node_id_order" : [1,2,3],
32
+ "element_id" : 1,
33
+ "property_id" : 1
34
+ }
35
+ """)
36
+ default_settings.ValidateAndAssignDefaults(settings)
37
+
38
+ self.edge_model_part = Model[settings["edge_sub_model_part_name"].GetString()]
39
+
40
+ node_list = settings["node_id_order"].GetVector()
41
+ if len(node_list)==0:
42
+ node_list = self.CreateCorrectNodeOrder()
43
+ settings["node_id_order"].SetVector(node_list)
44
+
45
+ self.edge_cable_element_process = CableNetApplication.EdgeCableElementProcess(self.edge_model_part, settings)
46
+
47
+
48
+ def ExecuteInitialize(self):
49
+ self.edge_cable_element_process.ExecuteInitialize()
50
+ Logger.PrintInfo("Initialized","EdgeCableElementProcess")
51
+
52
+ def CreateCorrectNodeOrder(self):
53
+ ## find start/end nodes and calculate total distance
54
+ max_distance,end_points = 0, []
55
+ for node_i in self.edge_model_part.Nodes:
56
+ for node_j in self.edge_model_part.Nodes:
57
+ distance_i = (node_i.X0 - node_j.X0)*(node_i.X0 - node_j.X0)
58
+ distance_i += (node_i.Y0 - node_j.Y0)*(node_i.Y0 - node_j.Y0)
59
+ distance_i += (node_i.Z0 - node_j.Z0)*(node_i.Z0 - node_j.Z0)
60
+ distance_i = distance_i**0.5
61
+
62
+ if distance_i>max_distance:
63
+ max_distance=distance_i
64
+ end_points = [node_i,node_j]
65
+
66
+ ## create sorted node_list
67
+ custom_node_list = []
68
+ for node_i in self.edge_model_part.Nodes:
69
+ distance_i = (node_i.X0 - end_points[0].X0)*(node_i.X0 - end_points[0].X0)
70
+ distance_i += (node_i.Y0 - end_points[0].Y0)*(node_i.Y0 - end_points[0].Y0)
71
+ distance_i += (node_i.Z0 - end_points[0].Z0)*(node_i.Z0 - end_points[0].Z0)
72
+ distance_i = distance_i**0.5
73
+ custom_node_i = custom_node(distance_i,node_i)
74
+ custom_node_list.append(custom_node_i)
75
+
76
+ sorted_node_list = sorted(custom_node_list, key=return_node_distance_to_line_start)
77
+
78
+ return [node.kratos_node.Id for node in sorted_node_list]
@@ -0,0 +1,62 @@
1
+ import KratosMultiphysics as KratosMultiphysics
2
+ import KratosMultiphysics.CableNetApplication as CableNetApplication
3
+
4
+
5
+ from numpy import polyfit
6
+
7
+ from KratosMultiphysics import Logger
8
+
9
+
10
+
11
+ #/**
12
+ # * @class EmpiricalSpringElementProcess
13
+ # *
14
+ # * @brief This process creates a spring element w.r.t. to given displacement/load data points
15
+ # *
16
+ # * @author Klaus B Sautter
17
+ # */
18
+
19
+
20
+
21
+ def Factory(settings, Model):
22
+ if(type(settings) != KratosMultiphysics.Parameters):
23
+ raise Exception("expected input shall be a Parameters object, encapsulating a json string")
24
+ return EmpiricalSpringElementProcess(Model, settings["Parameters"])
25
+
26
+
27
+
28
+ class EmpiricalSpringElementProcess(KratosMultiphysics.Process):
29
+
30
+ def __init__(self, Model, settings):
31
+ KratosMultiphysics.Process.__init__(self)
32
+ default_settings = KratosMultiphysics.Parameters("""
33
+ {
34
+ "model_part_name" : "example_part",
35
+ "computing_model_part_name" : "Structure",
36
+ "node_ids" : [1,2],
37
+ "element_id" : 1,
38
+ "property_id" : 1,
39
+ "displacement_data" : [0.0,1.0,2.0,3.0],
40
+ "force_data" : [0.0,1.0,2.0,3.0],
41
+ "polynomial_order" : 3
42
+ }
43
+ """)
44
+ default_settings.ValidateAndAssignDefaults(settings)
45
+ self.function_fitted = polyfit(settings["displacement_data"].GetVector(),settings["force_data"].GetVector(),settings["polynomial_order"].GetInt())
46
+
47
+
48
+ # The computing model part
49
+ self.computing_model_part = Model[settings["computing_model_part_name"].GetString()]
50
+ self.custom_model_part = Model[settings["model_part_name"].GetString()]
51
+
52
+ self.empirical_spring_element_process = CableNetApplication.EmpiricalSpringElementProcess(self.custom_model_part, settings, self.function_fitted)
53
+
54
+
55
+ def ExecuteInitialize(self):
56
+ self.empirical_spring_element_process.ExecuteInitialize()
57
+
58
+ ## add new element in the computing MP
59
+ for element_i in self.custom_model_part.Elements:
60
+ self.computing_model_part.AddElement(element_i, 0)
61
+ Logger.PrintInfo("Initialized","EmpiricalSpringElementProcess")
62
+
@@ -0,0 +1,43 @@
1
+ import KratosMultiphysics as KratosMultiphysics
2
+ import KratosMultiphysics.CableNetApplication as CableNetApplication
3
+
4
+ def Factory(settings, Model):
5
+ if(type(settings) != KratosMultiphysics.Parameters):
6
+ raise Exception("expected input shall be a Parameters object, encapsulating a json string")
7
+ return SlidingEdgeProcess(Model, settings["Parameters"])
8
+
9
+
10
+
11
+ class SlidingEdgeProcess(KratosMultiphysics.Process):
12
+
13
+ def __init__(self, Model, settings ):
14
+ KratosMultiphysics.Process.__init__(self)
15
+ default_settings = KratosMultiphysics.Parameters("""
16
+ {
17
+ "constraint_name" : "LinearMasterSlaveConstraint",
18
+ "master_sub_model_part_name" : "master_connect",
19
+ "slave_sub_model_part_name" : "slave_connect",
20
+ "computing_model_part" : "Structure",
21
+ "variable_names" : ["DISPLACEMENT_Y","DISPLACEMENT_Z"],
22
+ "reform_every_step" : true,
23
+ "debug_info" : true,
24
+ "angled_initial_line" : false,
25
+ "follow_line" : false
26
+ }
27
+ """)
28
+ default_settings.ValidateAndAssignDefaults(settings)
29
+
30
+ # The computing model part
31
+ computing_model_part = Model["Structure"]
32
+ self.master_model_part = model_part_name.GetSubModelPart(settings["master_sub_model_part_name"].GetString())
33
+
34
+ self.sliding_edge_process = CableNetApplication.SlidingEdgeProcess(Model[settings["model_name"].GetString()], settings)
35
+
36
+
37
+
38
+ def ExecuteInitializeSolutionStep(self):
39
+ self.sliding_edge_process.ExecuteInitializeSolutionStep()
40
+
41
+
42
+ def ExecuteFinalizeSolutionStep(self):
43
+ self.sliding_edge_process.ExecuteFinalizeSolutionStep()
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.4
2
+ Name: KratosCableNetApplication
3
+ Version: 10.4.2
4
+ Summary: KRATOS Multiphysics ("Kratos") is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
5
+ Author-email: Kratos Team <kratos@listas.cimne.upc.edu>
6
+ License: BSD-4-Clause
7
+ Classifier: Programming Language :: C++
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Topic :: Scientific/Engineering
10
+ Requires-Python: >=3.8
11
+ Requires-Dist: kratosmultiphysics==10.4.2
12
+ Description-Content-Type: text/markdown
13
+
14
+ ## Cable Net Application
@@ -0,0 +1,12 @@
1
+ KratosMultiphysics/CableNetApplication/__init__.py,sha256=dNITtuf5xsLSeYo6IhH3MDDuNM3Gour5OSqA_xBXg5o,337
2
+ KratosMultiphysics/CableNetApplication/__init__.pyi,sha256=eoGZmaST6ZsU3Ahbayce5QHltFpjLnZKId-wJN6UVPI,1489
3
+ KratosMultiphysics/CableNetApplication/apply_weak_sliding_process.py,sha256=v6H11w3lz5xdfa_xdFE7VKZ30OxdT6aBRoeclO_3SH0,1506
4
+ KratosMultiphysics/CableNetApplication/edge_cable_element_process.py,sha256=U1cPqH4j7oIExHhFS7B02iS6P9UxWrZrwg9u-5Jd36E,3305
5
+ KratosMultiphysics/CableNetApplication/empirical_spring_element_process.py,sha256=0NsPO-fw92YwVCthCHoMfzUgVeiWwJrs1jUXDt_sCMU,2293
6
+ KratosMultiphysics/CableNetApplication/sliding_edge_process.py,sha256=xe6VeBGv2ZOiJRElVrVCHm_z_kHBAso0tHFUrjOS1ZA,1823
7
+ KratosMultiphysics/.libs/KratosCableNetApplication.pyd,sha256=1R7IsIp15dfVKvxBRTIzyVM4sQsCeb73by5vQWu5y9I,751104
8
+ KratosMultiphysics/.libs/KratosCableNetCore.dll,sha256=NMkOaoeUiEhu1QEwgxFsjSvbvvTvFInLRvmHf4ypmmA,881152
9
+ KratosMultiphysics/.libs/KratosCableNetCore.lib,sha256=MaHN9KJcKOKqhW7bPXKbJRedb_wreEZUqK6bbC9hKsQ,128944
10
+ kratoscablenetapplication-10.4.2.dist-info/METADATA,sha256=guLZjAYwNsmGNj8Yp1rldntdLzvLba_UrW9qFguuq80,697
11
+ kratoscablenetapplication-10.4.2.dist-info/WHEEL,sha256=L6OCO7x2__38eHbiV8z-OpI28zauuQBoqd16JISdNDg,108
12
+ kratoscablenetapplication-10.4.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: cp38-cp38-win_amd64
5
+ Build: 2