STEM-Vibrations 0.1__py3-none-any.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.
- STEM_Vibrations-0.1.dist-info/LICENSE.md +28 -0
- STEM_Vibrations-0.1.dist-info/METADATA +25 -0
- STEM_Vibrations-0.1.dist-info/RECORD +36 -0
- STEM_Vibrations-0.1.dist-info/WHEEL +5 -0
- STEM_Vibrations-0.1.dist-info/top_level.txt +1 -0
- stem/IO/__init__.py +0 -0
- stem/IO/io_utils.py +119 -0
- stem/IO/kratos_additional_processes_io.py +115 -0
- stem/IO/kratos_boundaries_io.py +78 -0
- stem/IO/kratos_io.py +1140 -0
- stem/IO/kratos_loads_io.py +113 -0
- stem/IO/kratos_material_io.py +393 -0
- stem/IO/kratos_output_io.py +293 -0
- stem/IO/kratos_solver_io.py +308 -0
- stem/IO/kratos_water_processes_io.py +73 -0
- stem/__init__.py +1 -0
- stem/__version__.py +4 -0
- stem/additional_processes.py +89 -0
- stem/boundary.py +239 -0
- stem/default_materials.py +75 -0
- stem/field_generator.py +184 -0
- stem/geometry.py +496 -0
- stem/globals.py +82 -0
- stem/load.py +342 -0
- stem/mesh.py +226 -0
- stem/model.py +1573 -0
- stem/model_part.py +152 -0
- stem/output.py +381 -0
- stem/plot_utils.py +330 -0
- stem/soil_material.py +321 -0
- stem/solver.py +546 -0
- stem/stem.py +144 -0
- stem/structural_material.py +261 -0
- stem/table.py +60 -0
- stem/utils.py +527 -0
- stem/water_processes.py +28 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023, StemVibrations
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: STEM-Vibrations
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: STEM model
|
|
5
|
+
Author: attr: stem.__author__
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE.md
|
|
12
|
+
Requires-Dist: numpy >=1.24
|
|
13
|
+
Requires-Dist: scipy >=1.10.1
|
|
14
|
+
Requires-Dist: plotly >=5.15.0
|
|
15
|
+
Provides-Extra: docs
|
|
16
|
+
Requires-Dist: Sphinx ==6.2.1 ; extra == 'docs'
|
|
17
|
+
Requires-Dist: sphinx-rtd-theme ==1.2.2 ; extra == 'docs'
|
|
18
|
+
Provides-Extra: testing
|
|
19
|
+
Requires-Dist: pytest >=7.2 ; extra == 'testing'
|
|
20
|
+
Requires-Dist: pytest-cov >=4.0 ; extra == 'testing'
|
|
21
|
+
Requires-Dist: tox >=4.4 ; extra == 'testing'
|
|
22
|
+
Requires-Dist: mypy >=1.1 ; extra == 'testing'
|
|
23
|
+
Requires-Dist: beautifulsoup4 >=4.12 ; extra == 'testing'
|
|
24
|
+
Requires-Dist: matplotlib ==3.7.4 ; extra == 'testing'
|
|
25
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
stem/__init__.py,sha256=e3S0EcDGJlWIp2hddSFjvt633jfeZ4W7VyAeLpfTWVM,37
|
|
2
|
+
stem/__version__.py,sha256=PwBX7IH4ybiznTUqyIJs-zWWCn2QhIpgMVhe-qDkK6M,114
|
|
3
|
+
stem/additional_processes.py,sha256=F8HRn-suP13lGbgJez5DHjWdScZKdnYkdKlJxOhm754,3930
|
|
4
|
+
stem/boundary.py,sha256=TKR3NK0T9X0t1WrkoveOPQAZU_XN44xHD1kcwnR48fQ,8646
|
|
5
|
+
stem/default_materials.py,sha256=RMUG8-EsdHuNQFsY5csZZD0jEpKPLop8IGHQveIPeK4,2693
|
|
6
|
+
stem/field_generator.py,sha256=-BvEnoPYoHBsirJlJPnlFcHI86zCSqlp-esqhnxBo3Y,7589
|
|
7
|
+
stem/geometry.py,sha256=phYvMCbCxdQLxVIZqQTn_b3tjjx1lelY88I2lRE3-Go,15863
|
|
8
|
+
stem/globals.py,sha256=76J6d5DtDiQb2Cf6EtgFjyRp5Y1hAiHNDNduq9HnpeQ,5534
|
|
9
|
+
stem/load.py,sha256=jZpNxJFH5EAxFD0Y1EgfRLRYp6dlNiTqJ308oSjC7YQ,13490
|
|
10
|
+
stem/mesh.py,sha256=JNy6ArOmuXML6cfzUCNkjeL0iPBP2nJqHfXSmTVx7l8,7600
|
|
11
|
+
stem/model.py,sha256=yfcb1xIgxMsbupP-7516MMeuAPUkVvS7bsxRa6Ax5JY,73097
|
|
12
|
+
stem/model_part.py,sha256=RAhZdRDoXbr__7Kc-eYsxgn28lVpKhTHhZIGP1xiEtc,5624
|
|
13
|
+
stem/output.py,sha256=8nTE_fMRWmqN12pFBjY2Z8_HYCVgGQy17AIU2yxHTM0,15556
|
|
14
|
+
stem/plot_utils.py,sha256=4W7ZYmStGanuez4J_saK6IQf-Yj9qMB9saKl9Mo65Qc,14696
|
|
15
|
+
stem/soil_material.py,sha256=X8pcra4tjQeIJIQ96AYU3bT4CnY3EsI7SxTw8ldbIlo,11106
|
|
16
|
+
stem/solver.py,sha256=Wd0Ax1od1ixxe2rFI0oxK1Y_azrJcPXDSQInl63BjHM,18643
|
|
17
|
+
stem/stem.py,sha256=Ifs5iYrS0vgXeApES2k49txj1GjlJKVsCzxBIeF34Y0,5416
|
|
18
|
+
stem/structural_material.py,sha256=_Cdw7th173PqvX8luQJX4lCEEs2LojOPkVWG4e9dKGc,9775
|
|
19
|
+
stem/table.py,sha256=EOu6lxahi_z_1ep0_GbEi55xzPGStHd673nOv5DLub4,1901
|
|
20
|
+
stem/utils.py,sha256=myUcJmIo_TLZT9P6Q019Fef876gIHE7awqGr95aQUdE,21772
|
|
21
|
+
stem/water_processes.py,sha256=rbrb8RH-Z_yIs2QkWxRMlvfjpKwSKUvNKzZ5lmfZQ4w,706
|
|
22
|
+
stem/IO/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
+
stem/IO/io_utils.py,sha256=z5wCnN9OHG7_ysrfVAEMxthbFIs2S8EBUeQfAm1FOO4,5543
|
|
24
|
+
stem/IO/kratos_additional_processes_io.py,sha256=_z0_VmJZ7tRPQ1_a59WrdErRa8WWBbYQWt6uswFRND8,4230
|
|
25
|
+
stem/IO/kratos_boundaries_io.py,sha256=-gfyKiVsBwcuNvDMagiJkYmcuIRPouvwiXp9XEDRr5A,2814
|
|
26
|
+
stem/IO/kratos_io.py,sha256=BQCZXmwzm2thwABLSfzhOnZ9IVeQO3byRg2HANG-WIM,45874
|
|
27
|
+
stem/IO/kratos_loads_io.py,sha256=7buV36IEuUcjiM-sU7ApMtgVry8_zajoEq9hvdR-BKE,4637
|
|
28
|
+
stem/IO/kratos_material_io.py,sha256=KonYgIezy9Bg5kTAeORQXe1tSTC_4i_BQLp2-dFrcKs,17956
|
|
29
|
+
stem/IO/kratos_output_io.py,sha256=yYQQ2XnjG2orX789phs6mBKu0m2EeR50EGM_zgnWZrk,12472
|
|
30
|
+
stem/IO/kratos_solver_io.py,sha256=iaDbER1fMjs5eKvLmkzhDTubEcHD9s0wyD_yjBG1KGE,14713
|
|
31
|
+
stem/IO/kratos_water_processes_io.py,sha256=hud32aclzf4xcdu_oK5ZZM1sAbS3WlnVVYHcvv9cuWI,2592
|
|
32
|
+
STEM_Vibrations-0.1.dist-info/LICENSE.md,sha256=ItThzBSD9NsFiIjyl1NuS25EOwpbhoFf85S2wnDTAjY,1501
|
|
33
|
+
STEM_Vibrations-0.1.dist-info/METADATA,sha256=WsKAuN0kUEkWyzc0evF7j54hKrLBpsIuTrs-qPV9YD0,890
|
|
34
|
+
STEM_Vibrations-0.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
35
|
+
STEM_Vibrations-0.1.dist-info/top_level.txt,sha256=_Fv_hT3iFjDmFwOMcKq7iIsbarreb2UO1-H2frEcwHU,5
|
|
36
|
+
STEM_Vibrations-0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
stem
|
stem/IO/__init__.py
ADDED
|
File without changes
|
stem/IO/io_utils.py
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
from typing import Sequence, Dict, Any, List, Union, Optional, Tuple
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import json
|
|
4
|
+
from copy import deepcopy
|
|
5
|
+
|
|
6
|
+
from stem.table import Table
|
|
7
|
+
from stem.boundary import BoundaryParametersABC
|
|
8
|
+
from stem.load import LoadParametersABC
|
|
9
|
+
|
|
10
|
+
class IOUtils:
|
|
11
|
+
|
|
12
|
+
@staticmethod
|
|
13
|
+
def write_json_file(output_folder: str, file_name: str, dictionary: Dict[Any, Any]):
|
|
14
|
+
"""
|
|
15
|
+
Write a dictionary to a json file.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
- output_folder (str): output folder path
|
|
19
|
+
- file_name (str): name of the json file
|
|
20
|
+
- dictionary (Dict[Any, Any]): dictionary to be written to the json file
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
# write json file
|
|
24
|
+
output_folder_pth = Path(output_folder)
|
|
25
|
+
output_folder_pth.mkdir(exist_ok=True, parents=True)
|
|
26
|
+
|
|
27
|
+
output_path_file = output_folder_pth.joinpath(file_name)
|
|
28
|
+
json.dump(dictionary, open(output_path_file, "w"), indent=4)
|
|
29
|
+
|
|
30
|
+
@staticmethod
|
|
31
|
+
def create_value_and_table(part_name: str, parameters: Union["LoadParametersABC", "BoundaryParametersABC"]) \
|
|
32
|
+
-> Tuple[List[float], List[int]]:
|
|
33
|
+
"""
|
|
34
|
+
Assemble values and tables for the boundary condition from the `value` attribute of the boundary parameters.
|
|
35
|
+
If the displacement or rotation is time-dependent, a `table` is required. If the displacement or rotation is
|
|
36
|
+
constant, a `value` is required. Each direction (x,y,z), requires either a `table` or a `value`. When a `table`
|
|
37
|
+
is provided, the `value` is set to 0. If a `value` is provided, the `table` is set to 0.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
- part_name (str): name of the model part on which the boundary is applied.
|
|
41
|
+
- parameters (Union[:class:`stem.load.LoadParametersABC`, \
|
|
42
|
+
:class:`stem.boundary.BoundaryParametersABC`]): boundary parameters object.
|
|
43
|
+
|
|
44
|
+
Raises:
|
|
45
|
+
- ValueError: if table ids are not initialised.
|
|
46
|
+
- ValueError: when element in `parameters.value` is not of type int, float or Table.
|
|
47
|
+
- ValueError: when provided parameters class doesn't implement values (e.g. AbsorbingBoundary).
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
- _value (List[float]): list of values for the boundary condition or load
|
|
51
|
+
- _table (List[int]): list of table ids for the boundary condition \
|
|
52
|
+
or load
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
_value: List[float] = []
|
|
56
|
+
_table: List[int] = []
|
|
57
|
+
|
|
58
|
+
if hasattr(parameters, "value"):
|
|
59
|
+
|
|
60
|
+
# check the values per direction
|
|
61
|
+
for vv in parameters.value:
|
|
62
|
+
# if a table is provided, the value is set to 0
|
|
63
|
+
if isinstance(vv, Table):
|
|
64
|
+
if vv.id is None:
|
|
65
|
+
raise ValueError(f"Table id is not initialised for values in {parameters.__class__.__name__}"
|
|
66
|
+
f" in model part: {part_name}.")
|
|
67
|
+
_table.append(vv.id)
|
|
68
|
+
_value.append(0.0)
|
|
69
|
+
# if a value is provided, the table is set to 0
|
|
70
|
+
elif isinstance(vv, (int, float)):
|
|
71
|
+
_table.append(0)
|
|
72
|
+
_value.append(float(vv))
|
|
73
|
+
else:
|
|
74
|
+
raise ValueError(f"'value' attribute in {parameters.__class__.__name__} in model part "
|
|
75
|
+
f"`{part_name}`. The value ({vv}) is a `{vv.__class__.__name__}` object"
|
|
76
|
+
f" but only a Table, float or integer are valid inputs.")
|
|
77
|
+
|
|
78
|
+
else:
|
|
79
|
+
raise ValueError(f"Attribute `value` does not exist in class: {parameters.__class__.__name__}.")
|
|
80
|
+
|
|
81
|
+
return _value, _table
|
|
82
|
+
|
|
83
|
+
@staticmethod
|
|
84
|
+
def create_vector_constraint_table_process_dict(global_domain: str, part_name: str,
|
|
85
|
+
parameters: Union[LoadParametersABC, BoundaryParametersABC],
|
|
86
|
+
variable_name: str) -> Dict[str, Any]:
|
|
87
|
+
"""
|
|
88
|
+
Creates a dictionary containing the vector constraint table process parameters. The vector constraint table
|
|
89
|
+
process is used for loads and boundary conditions. This process applies either a constant value or a
|
|
90
|
+
time-dependent table to the load or boundary condition.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
- global_domain (str): name of the global domain
|
|
94
|
+
- part_name (str): name of the model part on which the load is applied
|
|
95
|
+
- parameters (Union[:class:`stem.load.LoadParametersABC`, \
|
|
96
|
+
:class:`stem.boundary.BoundaryParametersABC`]): boundary parameters object.
|
|
97
|
+
- variable_name (str): name of the variable to which the boundary condition or load is applied
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
- Dict[str, Any]: dictionary containing the load parameters
|
|
101
|
+
"""
|
|
102
|
+
|
|
103
|
+
# initialize load dictionary
|
|
104
|
+
load_dict: Dict[str, Any] = {
|
|
105
|
+
"python_module": "apply_vector_constraint_table_process",
|
|
106
|
+
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
|
|
107
|
+
"process_name": "ApplyVectorConstraintTableProcess",
|
|
108
|
+
"Parameters": deepcopy(parameters.__dict__),
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
load_dict["Parameters"]["model_part_name"] = f"{global_domain}.{part_name}"
|
|
112
|
+
load_dict["Parameters"]["variable_name"] = variable_name
|
|
113
|
+
|
|
114
|
+
# get tables and values
|
|
115
|
+
_value, _table = IOUtils.create_value_and_table(part_name, parameters)
|
|
116
|
+
load_dict["Parameters"]["table"] = _table
|
|
117
|
+
load_dict["Parameters"]["value"] = _value
|
|
118
|
+
|
|
119
|
+
return load_dict
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
from typing import Any, Dict, Union
|
|
2
|
+
|
|
3
|
+
from stem.additional_processes import *
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class KratosAdditionalProcessesIO:
|
|
7
|
+
"""
|
|
8
|
+
Class containing methods for additional Kratos processes
|
|
9
|
+
|
|
10
|
+
Attributes:
|
|
11
|
+
- domain (str): name of the Kratos domain
|
|
12
|
+
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, domain: str):
|
|
16
|
+
"""
|
|
17
|
+
Constructor of KratosBoundariesIO class
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
- domain (str): name of the Kratos domain
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
self.domain = domain
|
|
24
|
+
|
|
25
|
+
def __create_excavation_dict(
|
|
26
|
+
self, part_name: str, parameters: Excavation
|
|
27
|
+
) -> Dict[str, Any]:
|
|
28
|
+
"""
|
|
29
|
+
Creates a dictionary containing the parameters for the excavation process
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
- part_name (str): part name where the excavation is applied
|
|
33
|
+
- parameters (:class:`stem.additional_processes.Excavation`): excavation parameters object
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
- Dict[str, Any]: dictionary containing the additional process parameters
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
# initialize boundary dictionary
|
|
40
|
+
process_dict: Dict[str, Any] = {
|
|
41
|
+
"python_module": "apply_excavation_process",
|
|
42
|
+
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
|
|
43
|
+
"process_name": "ApplyExcavationProcess",
|
|
44
|
+
"Parameters": {},
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
process_dict["Parameters"]["model_part_name"] = f"{self.domain}.{part_name}"
|
|
48
|
+
process_dict["Parameters"]["variable_name"] = "EXCAVATION"
|
|
49
|
+
process_dict["Parameters"]["deactivate_soil_part"] = parameters.deactivate_body_model_part
|
|
50
|
+
|
|
51
|
+
return process_dict
|
|
52
|
+
|
|
53
|
+
def __create_parameter_field_dict(
|
|
54
|
+
self, part_name: str, parameters: ParameterFieldParameters
|
|
55
|
+
) -> Dict[str, Any]:
|
|
56
|
+
"""
|
|
57
|
+
Creates a dictionary containing the parameters for the parameter field process
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
- part_name (str): part name where the parameter field is applied
|
|
61
|
+
- parameters (:class:`stem.additional_processes.ParameterFieldParameters`): parameter field parameters object
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
- Dict[str, Any]: dictionary containing the additional process parameters
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
# initialize boundary dictionary
|
|
68
|
+
process_dict: Dict[str, Any] = {
|
|
69
|
+
"python_module": "set_parameter_field_process",
|
|
70
|
+
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
|
|
71
|
+
"process_name": "SetParameterFieldProcess",
|
|
72
|
+
"Parameters": {},
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
process_dict["Parameters"]["model_part_name"] = f"{self.domain}.{part_name}"
|
|
76
|
+
process_dict["Parameters"]["variable_name"] = parameters.property_name
|
|
77
|
+
process_dict["Parameters"]["func_type"] = parameters.function_type
|
|
78
|
+
|
|
79
|
+
# initialise to dummy
|
|
80
|
+
process_dict["Parameters"]["function"] = "dummy"
|
|
81
|
+
process_dict["Parameters"]["dataset"] = "dummy"
|
|
82
|
+
|
|
83
|
+
if parameters.function_type == "json_file":
|
|
84
|
+
|
|
85
|
+
process_dict["Parameters"]["dataset_file_name"] = parameters.field_file_name
|
|
86
|
+
elif parameters.function_type == "input":
|
|
87
|
+
process_dict["Parameters"]["function"] = parameters.tiny_expr_function
|
|
88
|
+
else:
|
|
89
|
+
raise ValueError(f"function type {parameters.function_type} not supported.")
|
|
90
|
+
|
|
91
|
+
return process_dict
|
|
92
|
+
|
|
93
|
+
def create_additional_processes_dict(
|
|
94
|
+
self, part_name: str, parameters: AdditionalProcessesParametersABC
|
|
95
|
+
) -> Union[Dict[str, Any], None]:
|
|
96
|
+
"""
|
|
97
|
+
Creates a dictionary containing the boundary parameters
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
- part_name (str): part name where the boundary condition is applied
|
|
101
|
+
- parameters (:class:`stem.additional_processes.AdditionalProcessesParametersABC`): additional process \
|
|
102
|
+
parameters object
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
- Dict[str, Any]: dictionary containing the parameters for the additional process
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
# add boundary parameters to dictionary based on boundary type.
|
|
109
|
+
|
|
110
|
+
if isinstance(parameters, Excavation):
|
|
111
|
+
return self.__create_excavation_dict(part_name, parameters)
|
|
112
|
+
elif isinstance(parameters, ParameterFieldParameters):
|
|
113
|
+
return self.__create_parameter_field_dict(part_name, parameters)
|
|
114
|
+
else:
|
|
115
|
+
raise NotImplementedError
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
from copy import deepcopy
|
|
2
|
+
from typing import Any, Dict, Union, List
|
|
3
|
+
|
|
4
|
+
from stem.boundary import *
|
|
5
|
+
from stem.IO.io_utils import IOUtils
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class KratosBoundariesIO:
|
|
9
|
+
"""
|
|
10
|
+
Class containing methods to write boundary conditions to Kratos
|
|
11
|
+
|
|
12
|
+
Attributes:
|
|
13
|
+
- domain (str): name of the Kratos domain
|
|
14
|
+
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(self, domain: str):
|
|
18
|
+
"""
|
|
19
|
+
Constructor of KratosBoundariesIO class
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
- domain (str): name of the Kratos domain
|
|
23
|
+
|
|
24
|
+
"""
|
|
25
|
+
self.domain = domain
|
|
26
|
+
|
|
27
|
+
def __create_absorbing_boundary_dict(
|
|
28
|
+
self, part_name: str, parameters: AbsorbingBoundary
|
|
29
|
+
) -> Dict[str, Any]:
|
|
30
|
+
"""
|
|
31
|
+
Creates a dictionary containing the absorbing boundary parameters
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
- part_name (str): part name where the boundary condition is applied
|
|
35
|
+
- parameters (:class:`stem.boundary.AbsorbingBoundary`): absorbing boundary parameters object
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
- Dict[str, Any]: dictionary containing the boundary parameters
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
# initialize boundary dictionary
|
|
42
|
+
boundary_dict: Dict[str, Any] = {
|
|
43
|
+
"python_module": "set_absorbing_boundary_parameters_process",
|
|
44
|
+
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
|
|
45
|
+
"process_name": "SetAbsorbingBoundaryParametersProcess",
|
|
46
|
+
"Parameters": deepcopy(parameters.__dict__),
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
boundary_dict["Parameters"]["model_part_name"] = f"{self.domain}.{part_name}"
|
|
50
|
+
|
|
51
|
+
return boundary_dict
|
|
52
|
+
|
|
53
|
+
def create_boundary_condition_dict(
|
|
54
|
+
self, part_name: str, parameters: BoundaryParametersABC
|
|
55
|
+
) -> Union[Dict[str, Any], None]:
|
|
56
|
+
"""
|
|
57
|
+
Creates a dictionary containing the boundary parameters
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
- part_name (str): part name where the boundary condition is applied
|
|
61
|
+
- parameters (:class:`stem.boundary.BoundaryParametersABC`): boundary parameters object
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
- Dict[str, Any]: dictionary containing the boundary parameters
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
# add boundary parameters to dictionary based on boundary type.
|
|
68
|
+
|
|
69
|
+
if isinstance(parameters, DisplacementConstraint):
|
|
70
|
+
return IOUtils.create_vector_constraint_table_process_dict(self.domain, part_name, parameters,
|
|
71
|
+
"DISPLACEMENT")
|
|
72
|
+
elif isinstance(parameters, RotationConstraint):
|
|
73
|
+
return IOUtils.create_vector_constraint_table_process_dict(self.domain, part_name, parameters,
|
|
74
|
+
"ROTATION")
|
|
75
|
+
elif isinstance(parameters, AbsorbingBoundary):
|
|
76
|
+
return self.__create_absorbing_boundary_dict(part_name, parameters)
|
|
77
|
+
else:
|
|
78
|
+
raise NotImplementedError
|