KratosDemStructuresCouplingApplication 10.4.2__2-cp39-cp39-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.
Files changed (21) hide show
  1. KratosMultiphysics/.libs/KratosDemStructuresCouplingApplication.pyd +0 -0
  2. KratosMultiphysics/.libs/KratosDemStructuresCouplingCore.dll +0 -0
  3. KratosMultiphysics/.libs/KratosDemStructuresCouplingCore.lib +0 -0
  4. KratosMultiphysics/DemStructuresCouplingApplication/__init__.py +7 -0
  5. KratosMultiphysics/DemStructuresCouplingApplication/control_module_fem_dem_utility.py +109 -0
  6. KratosMultiphysics/DemStructuresCouplingApplication/control_module_process.py +29 -0
  7. KratosMultiphysics/DemStructuresCouplingApplication/dem_fem_coupling_algorithm.py +251 -0
  8. KratosMultiphysics/DemStructuresCouplingApplication/dem_fem_launcher.py +10 -0
  9. KratosMultiphysics/DemStructuresCouplingApplication/dem_main_script_ready_for_coupling_with_fem.py +29 -0
  10. KratosMultiphysics/DemStructuresCouplingApplication/dem_poromechanics_coupling_analysis_stage.py +424 -0
  11. KratosMultiphysics/DemStructuresCouplingApplication/dem_structures_coupling_gid_output.py +201 -0
  12. KratosMultiphysics/DemStructuresCouplingApplication/multiaxial_control_module_fem_dem_generalized_2d_utility.py +141 -0
  13. KratosMultiphysics/DemStructuresCouplingApplication/sand_production_post_process_tool.py +135 -0
  14. KratosMultiphysics/DemStructuresCouplingApplication/sp_dem_fem_coupling_algorithm.py +303 -0
  15. KratosMultiphysics/DemStructuresCouplingApplication/sp_dem_fem_launcher.py +10 -0
  16. KratosMultiphysics/DemStructuresCouplingApplication/sp_statistics.py +143 -0
  17. KratosMultiphysics/DemStructuresCouplingApplication/sp_statistics_2.py +139 -0
  18. KratosMultiphysics/DemStructuresCouplingApplication/stress_failure_check_utility.py +36 -0
  19. kratosdemstructurescouplingapplication-10.4.2.dist-info/METADATA +17 -0
  20. kratosdemstructurescouplingapplication-10.4.2.dist-info/RECORD +21 -0
  21. kratosdemstructurescouplingapplication-10.4.2.dist-info/WHEEL +5 -0
@@ -0,0 +1,7 @@
1
+ # Application dependent names and paths
2
+ from KratosMultiphysics import _ImportApplication
3
+ from KratosDemStructuresCouplingApplication import *
4
+ application = KratosDemStructuresCouplingApplication()
5
+ application_name = "KratosDemStructuresCouplingApplication"
6
+
7
+ _ImportApplication(application, application_name)
@@ -0,0 +1,109 @@
1
+ import KratosMultiphysics
2
+ import KratosMultiphysics.DemStructuresCouplingApplication as DemFem
3
+
4
+
5
+ class ControlModuleFemDemUtility():
6
+ def __init__(self, Model, spheres_model_part, test_number):
7
+
8
+ fem_main_model_part = Model["Structure"]
9
+ self.dem_main_model_part = spheres_model_part
10
+
11
+ self.components_utility_list = []
12
+
13
+ if not test_number:
14
+ return
15
+
16
+ if test_number == 1: # CTW16
17
+ compression_length = 0.00381
18
+ # face_area = 0.008062
19
+ alternate_axis_loading = False
20
+ limit_velocity = -50.0
21
+ elif test_number == 2: # CTW10
22
+ compression_length = 0.00381
23
+ # face_area = 0.007601
24
+ alternate_axis_loading = False
25
+ limit_velocity = -50.0
26
+ else: # Blind test
27
+ compression_length = 0.009144
28
+ # face_area = 0.088343
29
+ alternate_axis_loading = True
30
+ limit_velocity = -15.0
31
+
32
+ if fem_main_model_part.ProcessInfo[KratosMultiphysics.DOMAIN_SIZE] == 2:
33
+ self.fem_submodel_part = Model["Structure.Parts_Solid_part"]
34
+ settings = KratosMultiphysics.Parameters( """
35
+ {
36
+ "target_stress_table_id" : 1,
37
+ "initial_velocity" : 0.0,
38
+ "velocity_factor" : 1.0,
39
+ "compression_length" : 1.0,
40
+ "young_modulus" : 7.0e9,
41
+ "stress_increment_tolerance": 1.0e-3,
42
+ "update_stiffness": true,
43
+ "start_time" : 0.0,
44
+ "stress_averaging_time": 1.0e-5
45
+ } """ )
46
+ settings.AddEmptyValue("alternate_axis_loading")
47
+ settings["alternate_axis_loading"].SetBool(alternate_axis_loading)
48
+ settings.AddEmptyValue("limit_velocity")
49
+ settings["limit_velocity"].SetDouble(limit_velocity)
50
+ self.components_utility_list.append(DemFem.ControlModuleFemDem2DUtilities(self.fem_submodel_part, self.dem_main_model_part, settings))
51
+ else:
52
+ self.top_fem_model_part = Model["Structure.SurfacePressure3D_top_pressure"]
53
+ #self.top_fem_model_part = Model["Structure.SurfacePressure3D_sigmaZpos"]
54
+ self.top_dem_model_part = self.dem_main_model_part.GetSubModelPart("topdem")
55
+ top_settings = KratosMultiphysics.Parameters( """
56
+ {
57
+ "imposed_direction" : 2,
58
+ "alternate_axis_loading": false,
59
+ "target_stress_table_id" : 1,
60
+ "initial_velocity" : 0.0,
61
+ "limit_velocity" : -0.1,
62
+ "velocity_factor" : 0.5,
63
+ "young_modulus" : 7.0e9,
64
+ "stress_increment_tolerance": 100.0,
65
+ "update_stiffness": true,
66
+ "start_time" : 0.0,
67
+ "stress_averaging_time": 1.0e-5
68
+ } """ )
69
+
70
+ top_settings.AddEmptyValue("compression_length")
71
+ top_settings["compression_length"].SetDouble(compression_length)
72
+ self.components_utility_list.append(DemFem.ControlModuleFemDemUtilities(self.top_fem_model_part, self.top_dem_model_part, top_settings))
73
+
74
+ self.bot_fem_model_part = Model["Structure.SurfacePressure3D_bottom_pressure"]
75
+ #self.bot_fem_model_part = Model["Structure.SurfacePressure3D_sigmaZneg"]
76
+ self.bot_dem_model_part = self.dem_main_model_part.GetSubModelPart("botdem")
77
+ bot_settings = KratosMultiphysics.Parameters( """
78
+ {
79
+ "imposed_direction" : 2,
80
+ "alternate_axis_loading": false,
81
+ "target_stress_table_id" : 2,
82
+ "initial_velocity" : 0.0,
83
+ "limit_velocity" : 0.1,
84
+ "velocity_factor" : 0.5,
85
+ "young_modulus" : 7.0e9,
86
+ "stress_increment_tolerance": 100.0,
87
+ "update_stiffness": true,
88
+ "start_time" : 0.0,
89
+ "stress_averaging_time": 1.0e-5
90
+ } """ )
91
+
92
+ bot_settings.AddEmptyValue("compression_length")
93
+ bot_settings["compression_length"].SetDouble(compression_length)
94
+ self.components_utility_list.append(DemFem.ControlModuleFemDemUtilities(self.bot_fem_model_part, self.bot_dem_model_part, bot_settings))
95
+
96
+ def ExecuteInitialize(self):
97
+
98
+ for component in self.components_utility_list:
99
+ component.ExecuteInitialize()
100
+
101
+ def ExecuteInitializeSolutionStep(self):
102
+
103
+ for component in self.components_utility_list:
104
+ component.ExecuteInitializeSolutionStep()
105
+
106
+ def ExecuteFinalizeSolutionStep(self):
107
+
108
+ for component in self.components_utility_list:
109
+ component.ExecuteFinalizeSolutionStep()
@@ -0,0 +1,29 @@
1
+ import KratosMultiphysics
2
+ import KratosMultiphysics.DemStructuresCouplingApplication as DemFem
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 ControlModuleProcess(Model, settings["Parameters"])
8
+
9
+ ## All the processes python should be derived from "Process"
10
+
11
+ class ControlModuleProcess(KratosMultiphysics.Process):
12
+ def __init__(self, Model, settings ):
13
+ KratosMultiphysics.Process.__init__(self)
14
+
15
+ # Control module process acting on the imposed direction: 0 (X), 1 (Y), 2 (Z) or 3 (radial)
16
+ # The radial direction is valid only for the vertical walls of a right cylinder with the base
17
+ # on the 'X-Y' plane centered on (0,0). Negative target_stress means compression.
18
+
19
+ self.model_part = Model[settings["model_part_name"].GetString()]
20
+ self.control_module_process = DemFem.ControlModuleProcess(self.model_part, settings)
21
+
22
+ def ExecuteInitialize(self):
23
+ self.control_module_process.ExecuteInitialize()
24
+
25
+ def ExecuteInitializeSolutionStep(self):
26
+ self.control_module_process.ExecuteInitializeSolutionStep()
27
+
28
+ def ExecuteFinalizeSolutionStep(self):
29
+ self.control_module_process.ExecuteFinalizeSolutionStep()
@@ -0,0 +1,251 @@
1
+ import sys
2
+ import time as timer
3
+ import os
4
+ import weakref
5
+ import KratosMultiphysics as Kratos
6
+ from Kratos import Logger
7
+ import KratosMultiphysics.DEMApplication as Dem
8
+ sys.path.insert(0, '')
9
+ Logger.Print("Running under OpenMP........", label="DEM")
10
+ from KratosMultiphysics.DEMApplication import DEM_procedures
11
+ from KratosMultiphysics.DEMApplication import DEM_material_test_script
12
+ import KratosMultiphysics.StructuralMechanicsApplication as Structural
13
+ import KratosMultiphysics.DemStructuresCouplingApplication as DemFem
14
+ from KratosMultiphysics.DemStructuresCouplingApplication import dem_structures_coupling_gid_output
15
+
16
+ class Algorithm():
17
+
18
+ def __init__(self):
19
+ self.model = Kratos.Model()
20
+
21
+ from KratosMultiphysics.DemStructuresCouplingApplication.dem_main_script_ready_for_coupling_with_fem import StructuresCoupledDEMAnalysisStage
22
+ dem_parameters_file_name = "ProjectParametersDEM.json"
23
+
24
+ with open(dem_parameters_file_name,'r') as parameter_file:
25
+ parameters = Kratos.Parameters(parameter_file.read())
26
+
27
+ self.dem_solution = StructuresCoupledDEMAnalysisStage(self.model, parameters)
28
+ self.dem_solution.coupling_analysis = weakref.proxy(self)
29
+
30
+ from KratosMultiphysics.StructuralMechanicsApplication.structural_mechanics_analysis import StructuralMechanicsAnalysis
31
+ structural_parameters_file_name = "ProjectParameters.json"
32
+
33
+ with open(structural_parameters_file_name,'r') as parameter_file:
34
+ parameters = Kratos.Parameters(parameter_file.read())
35
+
36
+ # Create structural solver, main_model_part and added variables
37
+ self.structural_solution = StructuralMechanicsAnalysis(self.model, parameters)
38
+
39
+ self.AddDEMVariablesToStructural()
40
+
41
+ def AddDEMVariablesToStructural(self):
42
+ self.structural_solution._GetSolver().main_model_part.AddNodalSolutionStepVariable(DemFem.DEM_SURFACE_LOAD)
43
+ self.structural_solution._GetSolver().main_model_part.AddNodalSolutionStepVariable(DemFem.BACKUP_LAST_STRUCTURAL_VELOCITY)
44
+ self.structural_solution._GetSolver().main_model_part.AddNodalSolutionStepVariable(DemFem.BACKUP_LAST_STRUCTURAL_DISPLACEMENT)
45
+ self.structural_solution._GetSolver().main_model_part.AddNodalSolutionStepVariable(DemFem.SMOOTHED_STRUCTURAL_VELOCITY)
46
+ self.structural_solution._GetSolver().main_model_part.AddNodalSolutionStepVariable(Dem.DELTA_DISPLACEMENT)
47
+ self.structural_solution._GetSolver().main_model_part.AddNodalSolutionStepVariable(Dem.DEM_PRESSURE)
48
+ self.structural_solution._GetSolver().main_model_part.AddNodalSolutionStepVariable(Dem.DEM_NODAL_AREA)
49
+ self.structural_solution._GetSolver().main_model_part.AddNodalSolutionStepVariable(Dem.ELASTIC_FORCES)
50
+ self.structural_solution._GetSolver().main_model_part.AddNodalSolutionStepVariable(Dem.CONTACT_FORCES)
51
+ self.structural_solution._GetSolver().main_model_part.AddNodalSolutionStepVariable(Dem.TANGENTIAL_ELASTIC_FORCES)
52
+ self.structural_solution._GetSolver().main_model_part.AddNodalSolutionStepVariable(Dem.SHEAR_STRESS)
53
+ self.structural_solution._GetSolver().main_model_part.AddNodalSolutionStepVariable(Dem.NON_DIMENSIONAL_VOLUME_WEAR)
54
+ self.structural_solution._GetSolver().main_model_part.AddNodalSolutionStepVariable(Dem.IMPACT_WEAR)
55
+
56
+ def Run(self):
57
+ self.Initialize()
58
+ self.RunSolutionLoop()
59
+ self.Finalize()
60
+
61
+ def Initialize(self):
62
+ self.structural_solution.Initialize() # Reading mdpa
63
+ self.dem_solution.Initialize() # Adding DEM variables and reading
64
+
65
+ self._DetectStructuresSkin()
66
+ self._TransferStructuresSkinToDem()
67
+ self.dem_solution._GetSolver().Initialize()
68
+
69
+ mixed_mp = self.model.CreateModelPart('MixedPart')
70
+ filename = os.path.join(self.dem_solution.post_path, self.dem_solution.DEM_parameters["problem_name"].GetString())
71
+ self.gid_output = dem_structures_coupling_gid_output.DemStructuresCouplingGiDOutput(
72
+ filename,
73
+ True,
74
+ "Binary",
75
+ "Multiples",
76
+ True,
77
+ True,
78
+ self.structural_solution._GetSolver().GetComputingModelPart(),
79
+ self.dem_solution.spheres_model_part,
80
+ self.dem_solution.cluster_model_part,
81
+ self.dem_solution.rigid_face_model_part,
82
+ self.dem_solution.contact_model_part,
83
+ mixed_mp
84
+ )
85
+
86
+ structures_nodal_results = ["VOLUME_ACCELERATION","DEM_SURFACE_LOAD","REACTION"]
87
+ dem_nodal_results = ["IS_STICKY", "DEM_STRESS_TENSOR"]
88
+ clusters_nodal_results = []
89
+ rigid_faces_nodal_results = []
90
+ contact_model_part_results = ["CONTACT_FAILURE"]
91
+ mixed_nodal_results = ["DISPLACEMENT", "VELOCITY"]
92
+ gauss_points_results = ["CAUCHY_STRESS_TENSOR"]
93
+ self.gid_output.initialize_dem_fem_results(structures_nodal_results,
94
+ dem_nodal_results,
95
+ clusters_nodal_results,
96
+ rigid_faces_nodal_results,
97
+ contact_model_part_results,
98
+ mixed_nodal_results,
99
+ gauss_points_results)
100
+
101
+ def _DetectStructuresSkin(self):
102
+
103
+ skin_detection_parameters = Kratos.Parameters("""
104
+ {
105
+ "name_auxiliar_model_part" : "DetectedByProcessSkinModelPart",
106
+ "list_model_parts_to_assign_conditions" : []
107
+ }
108
+ """)
109
+
110
+ computing_model_part = self.structural_solution._GetSolver().GetComputingModelPart()
111
+ if (computing_model_part.ProcessInfo[Kratos.DOMAIN_SIZE] == 2):
112
+ skin_detection_parameters.AddEmptyValue("name_auxiliar_condition")
113
+ skin_detection_parameters["name_auxiliar_condition"].SetString('LineLoadFromDEMCondition')
114
+ self.structure_skin_detector = Kratos.SkinDetectionProcess2D(computing_model_part, skin_detection_parameters)
115
+ elif (computing_model_part.ProcessInfo[Kratos.DOMAIN_SIZE] == 3):
116
+ skin_detection_parameters.AddEmptyValue("name_auxiliar_condition")
117
+ skin_detection_parameters["name_auxiliar_condition"].SetString('SurfaceLoadFromDEMCondition')
118
+ self.structure_skin_detector = Kratos.SkinDetectionProcess3D(computing_model_part, skin_detection_parameters)
119
+ else:
120
+ print("No dimensions detected for the structures problem. Exiting.")
121
+ sys.exit()
122
+
123
+ self.structure_skin_detector.Execute()
124
+
125
+ def _TransferStructuresSkinToDem(self):
126
+ self.structural_mp = self.structural_solution._GetSolver().GetComputingModelPart()
127
+ self.skin_mp = self.structural_mp.GetSubModelPart("DetectedByProcessSkinModelPart")
128
+ dem_walls_mp = self.dem_solution.rigid_face_model_part.CreateSubModelPart("SkinTransferredFromStructure")
129
+ max_prop_id = 0
130
+ for prop in dem_walls_mp.Properties:
131
+ if prop.Id > max_prop_id:
132
+ max_prop_id = prop.Id
133
+ props = Kratos.Properties(max_prop_id + 1)
134
+ # NOTE: this should be more general
135
+ props[Dem.STATIC_FRICTION] = 0.2
136
+ props[Dem.DYNAMIC_FRICTION] = 0.2
137
+ props[Dem.WALL_COHESION] = 0.0
138
+ props[Dem.COMPUTE_WEAR] = False
139
+ props[Dem.SEVERITY_OF_WEAR] = 0.001
140
+ props[Dem.IMPACT_WEAR_SEVERITY] = 0.001
141
+ props[Dem.BRINELL_HARDNESS] = 200.0
142
+ props[Kratos.YOUNG_MODULUS] = 7e9
143
+ props[Kratos.POISSON_RATIO] = 0.16
144
+ dem_walls_mp.AddProperties(props)
145
+ DemFem.DemStructuresCouplingUtilities().TransferStructuresSkinToDem(self.skin_mp, dem_walls_mp, props)
146
+
147
+ def RunSolutionLoop(self):
148
+
149
+ self.dem_solution.step = 0
150
+ self.dem_solution.time = 0.0
151
+ self.dem_solution.time_old_print = 0.0
152
+ self.time_dem = 0.0
153
+ self.Dt_structural = self.structural_solution._GetSolver().settings["time_stepping"]["time_step"].GetDouble()
154
+
155
+ while self.structural_solution.time < self.structural_solution.end_time:
156
+
157
+ portion_of_the_force_which_is_new = 0.4
158
+ DemFem.DemStructuresCouplingUtilities().SmoothLoadTrasferredToFem(self.dem_solution.rigid_face_model_part, portion_of_the_force_which_is_new)
159
+
160
+ self.structural_solution.time = self.structural_solution._GetSolver().AdvanceInTime(self.structural_solution.time)
161
+
162
+ self.structural_solution.InitializeSolutionStep()
163
+ self.structural_solution._GetSolver().Predict()
164
+ self.structural_solution._GetSolver().SolveSolutionStep()
165
+ self.structural_solution.FinalizeSolutionStep()
166
+ self.structural_solution.OutputSolutionStep()
167
+
168
+ time_final_DEM_substepping = self.structural_solution.time
169
+
170
+ self.Dt_DEM = self.dem_solution.spheres_model_part.ProcessInfo.GetValue(Kratos.DELTA_TIME)
171
+
172
+ DemFem.InterpolateStructuralSolutionForDEM().SaveStructuralSolution(self.structural_mp)
173
+
174
+ DemFem.ComputeDEMFaceLoadUtility().ClearDEMFaceLoads(self.skin_mp)
175
+
176
+ for self.dem_solution.time_dem in self.yield_DEM_time(self.dem_solution.time, time_final_DEM_substepping, self.Dt_DEM):
177
+ self.dem_solution.time = self.dem_solution.time + self.dem_solution._GetSolver().dt
178
+
179
+ self.dem_solution.step += 1
180
+
181
+ self.dem_solution.DEMFEMProcedures.UpdateTimeInModelParts(self.dem_solution.all_model_parts, self.dem_solution.time, self.dem_solution._GetSolver().dt, self.dem_solution.step)
182
+
183
+ self.dem_solution.InitializeSolutionStep()
184
+
185
+ self.dem_solution._GetSolver().Predict()
186
+
187
+ DemFem.InterpolateStructuralSolutionForDEM().InterpolateStructuralSolution(self.structural_mp, self.Dt_structural, self.structural_solution.time, self.dem_solution._GetSolver().dt, self.dem_solution.time)
188
+
189
+ self.dem_solution.SolverSolve()
190
+
191
+ self.dem_solution.FinalizeSolutionStep()
192
+
193
+ DemFem.ComputeDEMFaceLoadUtility().CalculateDEMFaceLoads(self.skin_mp, self.dem_solution._GetSolver().dt, self.Dt_structural)
194
+
195
+ #### PRINTING GRAPHS ####
196
+ os.chdir(self.dem_solution.graphs_path)
197
+ self.dem_solution.post_utils.ComputeMeanVelocitiesInTrap("Average_Velocity.txt", self.dem_solution.time, self.dem_solution.graphs_path)
198
+
199
+ #old function, we can not use them now #TODO:update it
200
+ #self.dem_solution.materialTest.MeasureForcesAndPressure()
201
+ #self.dem_solution.materialTest.PrintGraph(self.dem_solution.time)
202
+
203
+ self.dem_solution.DEMFEMProcedures.PrintGraph(self.dem_solution.time)
204
+ self.dem_solution.DEMFEMProcedures.PrintBallsGraph(self.dem_solution.time)
205
+
206
+ self.dem_solution.DEMEnergyCalculator.CalculateEnergyAndPlot(self.dem_solution.time)
207
+
208
+ self.dem_solution.BeforePrintingOperations(self.dem_solution.time)
209
+
210
+ #### GiD IO ##########################################
211
+ if self.dem_solution.IsTimeToPrintPostProcess():
212
+ self.dem_solution._GetSolver().PrepareElementsForPrinting()
213
+ if self.dem_solution.DEM_parameters["ContactMeshOption"].GetBool():
214
+ self.dem_solution._GetSolver().PrepareContactElementsForPrinting()
215
+ self.dem_solution.PrintResultsForGid(self.dem_solution.time)
216
+ self.dem_solution.demio.PrintMultifileLists(self.dem_solution.time, self.dem_solution.post_path)
217
+ self.dem_solution.time_old_print = self.dem_solution.time
218
+
219
+ DemFem.InterpolateStructuralSolutionForDEM().RestoreStructuralSolution(self.structural_mp)
220
+
221
+ def ReadDemModelParts(self,
222
+ starting_node_Id=0,
223
+ starting_elem_Id=0,
224
+ starting_cond_Id=0):
225
+ creator_destructor = self.dem_solution.creator_destructor
226
+ structures_model_part = self.structural_solution._GetSolver().GetComputingModelPart()
227
+ max_node_Id = creator_destructor.FindMaxNodeIdInModelPart(structures_model_part)
228
+ max_elem_Id = creator_destructor.FindMaxElementIdInModelPart(structures_model_part)
229
+ max_cond_Id = creator_destructor.FindMaxConditionIdInModelPart(structures_model_part)
230
+ self.dem_solution.BaseReadModelParts(max_node_Id, max_elem_Id, max_cond_Id)
231
+ self.dem_solution.all_model_parts.MaxNodeId = max_node_Id
232
+
233
+ def Finalize(self):
234
+ self.dem_solution.Finalize()
235
+ self.structural_solution.Finalize()
236
+
237
+ def yield_DEM_time(self, current_time, current_time_plus_increment, delta_time):
238
+
239
+ current_time += delta_time
240
+
241
+ tolerance = 0.0001
242
+ while current_time < (current_time_plus_increment - tolerance * delta_time):
243
+ yield current_time
244
+ current_time += delta_time
245
+
246
+ current_time = current_time_plus_increment
247
+ yield current_time
248
+
249
+
250
+ if __name__ == "__main__":
251
+ Algorithm().Run()
@@ -0,0 +1,10 @@
1
+ import sys
2
+ import KratosMultiphysics as Kratos
3
+ from Kratos import Logger
4
+ import KratosMultiphysics.DEMApplication as Dem
5
+ import KratosMultiphysics.StructuralMechanicsApplication as Structural
6
+ import KratosMultiphysics.DemStructuresCouplingApplication as DemFem
7
+
8
+ from KratosMultiphysics.DemStructuresCouplingApplication.dem_fem_coupling_algorithm import Algorithm
9
+
10
+ Algorithm().Run()
@@ -0,0 +1,29 @@
1
+ import os
2
+ import KratosMultiphysics as Kratos
3
+ import KratosMultiphysics.DEMApplication as Dem
4
+
5
+ from KratosMultiphysics.DEMApplication.DEM_analysis_stage import DEMAnalysisStage
6
+
7
+ class StructuresCoupledDEMAnalysisStage(DEMAnalysisStage):
8
+
9
+ def __init__(self, model,parameters):
10
+ super(StructuresCoupledDEMAnalysisStage,self).__init__(model, parameters)
11
+
12
+ def ReadModelParts(self, max_node_Id = 0, max_elem_Id = 0, max_cond_Id = 0):
13
+ self.coupling_analysis.ReadDemModelParts()
14
+
15
+ def BaseReadModelParts(self, max_node_Id = 0, max_elem_Id = 0, max_cond_Id = 0):
16
+ super(StructuresCoupledDEMAnalysisStage, self).ReadModelParts(max_node_Id, max_elem_Id, max_cond_Id)
17
+
18
+ def PrintResultsForGid(self, time):
19
+ self.coupling_analysis.gid_output.Writeresults(time)
20
+
21
+ if __name__ == "__main__":
22
+ parameter_file_name = "ProjectParametersDEM.json"
23
+
24
+ with open(parameter_file_name,'r') as parameter_file:
25
+ parameters = Kratos.Parameters(parameter_file.read())
26
+
27
+ model = Kratos.Model()
28
+ simulation = StructuresCoupledDEMAnalysisStage(model, parameters)
29
+ simulation.Run()