-
Notifications
You must be signed in to change notification settings - Fork 3
Added water boundary for multiline or interpolation #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
413b637
d2959fd
3221d7a
de2303e
e39bec7
6a37653
b294ac2
77d97de
378c38f
c4b2d4f
2504591
e35a1d6
6b7ca0a
b415925
5ce7913
146cabd
66b75ce
c777d92
e29e362
0c8b780
f1d015f
7a11f0f
c9176ad
7d8faad
88ae886
5f7d4f8
eb0035f
4213f54
6029481
6e0a47b
e37a685
9debbcd
bd9de50
3aa693a
f66c240
76215f6
69471dc
f242e1f
ed709c6
5b42cf6
362b18b
2589965
7d6a909
d7f3baf
2a09730
a1aaf7d
65dca64
cc021bc
46a8d6a
d544a77
969c1c7
160d28f
0059216
bd1b8ad
02fccb9
bc4e7f2
967323d
6c88023
fd8c73c
ed25784
81e7fae
4ba941b
a9a369b
5061302
68e207b
5cfac04
7dfb1f4
02e2df6
3f7eda1
16285b4
09ed8c8
b9e9b10
0b1a778
abff48c
1f718ad
13fbb46
69a55ea
434a846
20cb836
c79315c
98619e4
4847c0c
ef0befa
a68dd26
6680d25
d9b2f13
4208a73
50ca8d4
2ab0081
9e609ce
5e9d9fe
e34fe6a
b432ff8
5bae45e
27a30e6
ce08092
7ed085b
4e0d78a
5c90b46
7735db1
7d3bddc
5b745d5
ccf1bd3
a1b6017
cad8783
93601fe
8b796da
6bfbf5b
4c67140
ec29191
b5cf60b
5910fa1
d1bcb19
9450cd0
c0eb110
c82fd71
3c1a6a4
fc668a7
f9d12c0
b853a1b
5faeaa2
fb3d28c
b845a5a
3267d89
2dd7e68
0bb2d81
f362b8e
0d2b18d
c65a5da
bbd104f
1f2c6a9
434e8be
3205797
ad590a7
a835731
40a982e
a14722c
82c1139
b9dbb5f
0a1c388
21222ff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| numpy==1.24.2 | ||
| gmsh_utils @ git+https://github.com/StemVibrations/gmsh_utils@main | ||
| gmsh_utils @ git+https://github.com/StemVibrations/gmsh_utils@vakantie_branch |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| from typing import Dict, Any | ||
|
|
||
| from stem.water_boundaries import WaterBoundary, PhreaticMultiLineBoundary, InterpolateLineBoundary, \ | ||
| WaterBoundaryParameters, PhreaticLine | ||
|
|
||
|
|
||
| class KratosWaterBoundariesIO: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cna you add the docstring for this class and init
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing attributes :)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm I really don't understand what is missing |
||
| """ | ||
| Class to create the water boundary process dictionary for the ProjectParameters.json file in Kratos | ||
|
|
||
|
|
||
| """ | ||
|
|
||
| def __init__(self, domain: str): | ||
| """ | ||
| Constructor of KratosWaterBoundariesIO class | ||
|
|
||
| Args: | ||
| domain: Name of the Kratos domain | ||
|
|
||
|
|
||
| """ | ||
| self.domain = domain | ||
|
|
||
| def __create_phreatic_line_dict(self, name: str, type: str, water_boundary: PhreaticLine) -> Dict[str, Any]: | ||
| """ | ||
| Creates a dictionary containing the phreatic line parameters | ||
|
|
||
|
|
||
| Args: | ||
| - name: Name of the boundary | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. types |
||
| - type: Type of the boundary | ||
| - water_boundary: Phreatic line boundary object | ||
|
|
||
| Returns: | ||
| - Dict[str, Any]: dictionary containing the phreatic line parameters | ||
|
|
||
| """ | ||
| boundary_dict_phreatic_line: Dict[str, Any] = { | ||
| "python_module": "apply_scalar_constraint_table_process", | ||
| "kratos_module": "KratosMultiphysics.GeoMechanicsApplication", | ||
| "process_name": "ApplyScalarConstraintTableProcess", | ||
| "Parameters": { | ||
| "model_part_name": f"{self.domain}.{name}", | ||
| "variable_name": "WATER_PRESSURE", | ||
| "is_fixed": water_boundary.is_fixed, | ||
| "table": [0, 0], | ||
| "fluid_pressure_type": type, | ||
| "gravity_direction": water_boundary.gravity_direction, | ||
| "out_of_plane_direction": water_boundary.out_of_plane_direction, | ||
| "specific_weight": water_boundary.specific_weight, | ||
| "first_reference_coordinate": water_boundary.first_reference_coordinate, | ||
| "second_reference_coordinate": water_boundary.second_reference_coordinate, | ||
| "value": water_boundary.value, | ||
| } | ||
| } | ||
| return boundary_dict_phreatic_line | ||
|
|
||
| def __create_phreatic_multi_line_dict(self, name: str, type: str, water_boundary: PhreaticMultiLineBoundary) -> \ | ||
| Dict[str, Any]: | ||
| """ | ||
| Creates a dictionary containing the phreatic multi line parameters | ||
|
|
||
| Args: | ||
| - name: Name of the boundary | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. types |
||
| - type: Type of the boundary | ||
| - water_boundary: Multi line phreatic line boundary object | ||
|
|
||
| Returns: | ||
| - Dict[str, Any]: dictionary containing the phreatic line parameters | ||
|
|
||
| """ | ||
| parameters: Dict[str, Any] = { | ||
| "model_part_name": f"{self.domain}.{name}", | ||
| "variable_name": "WATER_PRESSURE", | ||
| "table": [0, 0, 0], | ||
| "value": water_boundary.water_pressure, | ||
| "is_fixed": water_boundary.is_fixed, | ||
| "gravity_direction": water_boundary.gravity_direction, | ||
| "out_of_plane_direction": water_boundary.out_of_plane_direction, | ||
| "fluid_pressure_type": type, | ||
| "specific_weight": water_boundary.specific_weight, | ||
| "x_coordinates": water_boundary.x_coordinates, | ||
| "y_coordinates": water_boundary.y_coordinates, | ||
| "z_coordinates": water_boundary.z_coordinates, | ||
| } | ||
| boundary_dict_multi_line: Dict[str, Any] = { | ||
| "python_module": "apply_scalar_constraint_table_process", | ||
| "kratos_module": "KratosMultiphysics.GeoMechanicsApplication", | ||
| "process_name": "ApplyScalarConstraintTableProcess", | ||
| "Parameters": parameters, | ||
| } | ||
| return boundary_dict_multi_line | ||
|
|
||
| def __create_interpolation_line_dict(self, name: str, type: str, water_boundary: InterpolateLineBoundary) -> Dict[ | ||
| str, Any]: | ||
| """ | ||
| Creates a dictionary containing the interpolation line parameters | ||
|
|
||
| Args: | ||
| - name: Name of the boundary | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. types |
||
| - type: Type of the boundary | ||
| - water_boundary: Interpolation line boundary object | ||
|
|
||
| Returns: | ||
| - Dict[str, Any]: dictionary containing the phreatic line parameters | ||
|
|
||
| """ | ||
|
|
||
| boundary_dict_interpolate: Dict[str, Any] = { | ||
| "python_module": "apply_scalar_constraint_table_process", | ||
| "kratos_module": "KratosMultiphysics.GeoMechanicsApplication", | ||
| "process_name": "ApplyScalarConstraintTableProcess", | ||
| "Parameters": { | ||
| "model_part_name": f"{self.domain}.{name}", | ||
| "variable_name": "WATER_PRESSURE", | ||
| "is_fixed": water_boundary.is_fixed, | ||
| "table": 0, | ||
| "fluid_pressure_type": type, | ||
| "gravity_direction": water_boundary.gravity_direction, | ||
| "out_of_plane_direction": water_boundary.out_of_plane_direction, | ||
| } | ||
| } | ||
| return boundary_dict_interpolate | ||
|
|
||
| def __create_water_boundary_dict(self, name: str, type: str, water_boundary: WaterBoundaryParameters) -> Dict[ | ||
| str, Any]: | ||
| """ | ||
| Creates a dictionary containing the water boundary parameters | ||
|
|
||
| Args: | ||
| - name: name of the water boundary | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. types |
||
| - type: type of the water boundary | ||
| - water_boundary: water boundary object | ||
|
|
||
| Returns: | ||
| - Dict[str, Any]: dictionary containing the water boundary parameters | ||
|
|
||
| """ | ||
| if isinstance(water_boundary, PhreaticMultiLineBoundary): | ||
| temp_phreatic_multi_line: PhreaticMultiLineBoundary = water_boundary | ||
| boundary_dict_multi_line: Dict[str, Any] = self.__create_phreatic_multi_line_dict(name, type, | ||
| temp_phreatic_multi_line) | ||
| return boundary_dict_multi_line | ||
| elif isinstance(water_boundary, InterpolateLineBoundary): | ||
| temp_interpolate_line: InterpolateLineBoundary = water_boundary | ||
| boundary_dict_interpolate_line: Dict[str, Any] = self.__create_interpolation_line_dict(name, type, | ||
| temp_interpolate_line) | ||
| return boundary_dict_interpolate_line | ||
| elif isinstance(water_boundary, PhreaticLine): | ||
| temp_phreatic_line: PhreaticLine = water_boundary | ||
| boundary_dict_phreatic_line: Dict[str, Any] = self.__create_phreatic_line_dict(name, type, | ||
| temp_phreatic_line) | ||
| return boundary_dict_phreatic_line | ||
| else: | ||
| raise NotImplementedError("This type of boundary is not implemented") | ||
|
|
||
| def create_water_boundary_dict(self, water_boundary: WaterBoundary) -> Dict[str, Any]: | ||
| """ | ||
| Creates a dictionary containing the water boundary parameters | ||
|
|
||
| Args: | ||
| - water_boundary: water boundary object | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. type |
||
|
|
||
| Returns: | ||
| - Dict[str, Any]: dictionary containing the water boundary parameters | ||
|
|
||
| """ | ||
| return self.__create_water_boundary_dict(water_boundary.name, | ||
| water_boundary.water_boundary.type, | ||
| water_boundary.water_boundary) | ||
Uh oh!
There was an error while loading. Please reload this page.