Skip to content
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

[GeoMechanicsApplication] Fix for prescribed displacement combined with reset_displacement. #11933

Merged
merged 3 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ int KratosGeoSettlement::RunStage(const std::filesystem::path& rWorki
std::vector<std::shared_ptr<Process>> processes = GetProcesses(project_parameters);
std::vector<std::weak_ptr<Process>> process_observables(processes.begin(), processes.end());

if (mpTimeLoopExecutor) {
mpTimeLoopExecutor->SetCancelDelegate(rShouldCancel);
mpTimeLoopExecutor->SetProgressDelegate(rProgressDelegate);
mpTimeLoopExecutor->SetProcessObservables(process_observables);
mpTimeLoopExecutor->SetTimeIncrementor(MakeTimeIncrementor(project_parameters));
mpTimeLoopExecutor->SetSolverStrategyWrapper(MakeStrategyWrapper(project_parameters,
rWorkingDirectory));
}

for (const auto& process : processes) {
process->ExecuteInitialize();
}
Expand All @@ -200,14 +209,7 @@ int KratosGeoSettlement::RunStage(const std::filesystem::path& rWorki
process->ExecuteBeforeSolutionLoop();
}

if (mpTimeLoopExecutor)
{
mpTimeLoopExecutor->SetCancelDelegate(rShouldCancel);
mpTimeLoopExecutor->SetProgressDelegate(rProgressDelegate);
mpTimeLoopExecutor->SetProcessObservables(process_observables);
mpTimeLoopExecutor->SetTimeIncrementor(MakeTimeIncrementor(project_parameters));
mpTimeLoopExecutor->SetSolverStrategyWrapper(MakeStrategyWrapper(project_parameters,
rWorkingDirectory));
if (mpTimeLoopExecutor) {
// For now, pass a dummy state. THIS PROBABLY NEEDS TO BE REFINED AT SOME POINT!
TimeStepEndState start_of_loop_state;
start_of_loop_state.convergence_state = TimeStepEndState::ConvergenceState::converged;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,16 @@ def ResetIfHasNodalSolutionStepVariable(self, variable):
new_value = node.GetSolutionStepValue(variable, 0)
node.SetSolutionStepValue(variable, 1, new_value)


def Initialize(self):
def ModifyInitialGeometry(self):
# Overrides the base class. Necessary to let reset_displacements function correctly i.c.w. prescribed displacements/rotations.
# The reset needs to take place befor the Initialize of the processes, as these will set the Dirichlet condition.
self._GetSolver().main_model_part.ProcessInfo[KratosGeo.RESET_DISPLACEMENTS] = self.reset_displacements

super().Initialize()

if (self.reset_displacements):
if self.reset_displacements:
self.ResetIfHasNodalSolutionStepVariable(KratosMultiphysics.DISPLACEMENT)
self.ResetIfHasNodalSolutionStepVariable(KratosMultiphysics.ROTATION)

KratosMultiphysics.VariableUtils().UpdateCurrentToInitialConfiguration(self._GetSolver().GetComputingModelPart().Nodes)


def Finalize(self):
super().Finalize()

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"properties": [{
"model_part_name": "PorousDomain.bodemplaat",
"properties_id": 1,
"Material": {
"name": "Vloerbeton",
"constitutive_law": {
"name": "LinearElasticPlaneStress2DLaw"
},
"Variables": {
"YOUNG_MODULUS": 4.32e8,
"POISSON_RATIO": 0.0,
"THICKNESS": 1300,
"DENSITY": 3.6e2
},
"Tables": {}
}
}]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
{
"problem_data": {
"problem_name": "bodemplaat",
"start_time": 0.0,
"end_time": 1.0,
"echo_level": 1,
"parallel_type": "OpenMP",
"number_of_threads": 1
},
"solver_settings": {
"solver_type": "U_Pw",
"model_part_name": "PorousDomain",
"domain_size": 3,
"model_import_settings": {
"input_type": "mdpa",
"input_filename": "bodemplaat"
},
"material_import_settings": {
"materials_filename": "MaterialParameters.json"
},
"time_stepping": {
"time_step": 1.0,
"max_delta_time_factor": 1.0
},
"buffer_size": 2,
"echo_level": 1,
"clear_storage": false,
"compute_reactions": false,
"move_mesh_flag": false,
"reform_dofs_at_each_step": false,
"nodal_smoothing": false,
"block_builder": true,
"solution_type": "Quasi-Static",
"scheme_type": "Backward_Euler",
"reset_displacements": true,
"newmark_beta": 0.25,
"newmark_gamma": 0.5,
"newmark_theta": 0.5,
"rayleigh_m": 0.0,
"rayleigh_k": 0.0,
"strategy_type": "newton_raphson",
"convergence_criterion": "residual_criterion",
"displacement_relative_tolerance": 1.0E-4,
"displacement_absolute_tolerance": 1.0E-9,
"residual_relative_tolerance": 1.0E-4,
"residual_absolute_tolerance": 1.0E-9,
"water_pressure_relative_tolerance": 1.0E-4,
"water_pressure_absolute_tolerance": 1.0E-9,
"min_iterations": 6,
"max_iterations": 15,
"number_cycles": 1,
"reduction_factor": 1.0,
"increase_factor": 1.0,
"desired_iterations": 4,
"max_radius_factor": 10.0,
"min_radius_factor": 0.1,
"calculate_reactions": true,
"max_line_search_iterations": 5,
"first_alpha_value": 0.5,
"second_alpha_value": 1.0,
"min_alpha": 0.1,
"max_alpha": 2.0,
"line_search_tolerance": 0.5,
"rotation_dofs": true,
"linear_solver_settings": {
"solver_type": "bicgstab",
"tolerance": 1.0e-6,
"max_iteration": 1000,
"scaling": true,
"preconditioner_type": "ilu0"
},
"problem_domain_sub_model_part_list": ["bodemplaat"],
"processes_sub_model_part_list": ["XZsupport","YZsupport","ZsupportLoadPoint"],
"body_domain_sub_model_part_list": ["bodemplaat"]
},
"output_processes": {
"gid_output": [{
"python_module": "gid_output_process",
"kratos_module": "KratosMultiphysics",
"process_name": "GiDOutputProcess",
"Parameters": {
"model_part_name": "PorousDomain.porous_computational_model_part",
"output_name": "bodemplaat",
"postprocess_parameters": {
"result_file_configuration": {
"gidpost_flags": {
"WriteDeformedMeshFlag": "WriteUndeformed",
"WriteConditionsFlag": "WriteElementsOnly",
"GiDPostMode": "GiD_PostAscii",
"MultiFileFlag": "SingleFile"
},
"file_label": "step",
"output_control_type": "step",
"output_interval": 1,
"body_output": true,
"node_output": false,
"skin_output": false,
"plane_output": [],
"nodal_results": ["DISPLACEMENT","TOTAL_DISPLACEMENT","ROTATION"],
"gauss_point_results": ["GREEN_LAGRANGE_STRAIN_TENSOR","ENGINEERING_STRAIN_TENSOR","CAUCHY_STRESS_TENSOR"]
},
"point_data_configuration": []
}
}
}]
},
"processes": {
"constraints_process_list": [{
"python_module": "apply_vector_constraint_table_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name": "ApplyVectorConstraintTableProcess",
"Parameters": {
"model_part_name": "PorousDomain.XZsupport",
"variable_name": "DISPLACEMENT",
"active": [true,false,true],
"is_fixed": [true,false,true],
"value": [0.0,0.0,0.0],
"table": [0,0,0]
}
},{
"python_module": "apply_vector_constraint_table_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name": "ApplyVectorConstraintTableProcess",
"Parameters": {
"model_part_name": "PorousDomain.YZsupport",
"variable_name": "DISPLACEMENT",
"active": [false,true,true],
"is_fixed": [false,true,true],
"value": [0.0,0.0,0.0],
"table": [0,0,0]
}
},{
"python_module": "apply_vector_constraint_table_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name": "ApplyVectorConstraintTableProcess",
"Parameters": {
"model_part_name": "PorousDomain.XZsupport",
"variable_name": "ROTATION",
"active": [true,true,true],
"is_fixed": [false,true,false],
"value": [0.0,0.0,0.0],
"table": [0,0,0]
}
},{
"python_module": "apply_vector_constraint_table_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name": "ApplyVectorConstraintTableProcess",
"Parameters": {
"model_part_name": "PorousDomain.YZsupport",
"variable_name": "ROTATION",
"active": [true,true,true],
"is_fixed": [true,false,false],
"value": [0.0,0.0,0.0],
"table": [0,0,0]
}
},{
"python_module": "apply_vector_constraint_table_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name": "ApplyVectorConstraintTableProcess",
"Parameters": {
"model_part_name": "PorousDomain.ZsupportLoadPoint",
"variable_name": "DISPLACEMENT",
"active": [false,false,true],
"is_fixed": [false,false,true],
"value": [0.0,0.0,-20.0],
"table": [0,0,0]
}
}],
"loads_process_list": [],
"auxiliar_process_list": []
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@

Begin Properties 1
End Properties

Begin Nodes
1 0.0000000000 0.0000000000 0.0000000000
2 2000.0000000000 0.0000000000 0.0000000000
3 2000.0000000000 2000.0000000000 0.0000000000
4 0.0000000000 2000.0000000000 0.0000000000
End Nodes


Begin Elements ShellThinElementCorotational3D4N
1 1 1 2 3 4
End Elements

Begin SubModelPart bodemplaat
Begin SubModelPartTables
End SubModelPartTables
Begin SubModelPartNodes
1
2
3
4
End SubModelPartNodes
Begin SubModelPartElements
1
End SubModelPartElements
Begin SubModelPartConditions
End SubModelPartConditions
End SubModelPart

Begin SubModelPart XZsupport
Begin SubModelPartTables
End SubModelPartTables
Begin SubModelPartNodes
1
4
End SubModelPartNodes
Begin SubModelPartElements
End SubModelPartElements
Begin SubModelPartConditions
End SubModelPartConditions
End SubModelPart

Begin SubModelPart YZsupport
Begin SubModelPartTables
End SubModelPartTables
Begin SubModelPartNodes
1
2
End SubModelPartNodes
Begin SubModelPartElements
End SubModelPartElements
Begin SubModelPartConditions
End SubModelPartConditions
End SubModelPart

Begin SubModelPart ZsupportLoadPoint
Begin SubModelPartTables
End SubModelPartTables
Begin SubModelPartNodes
3
End SubModelPartNodes
Begin SubModelPartElements
End SubModelPartElements
Begin SubModelPartConditions
End SubModelPartConditions
End SubModelPart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_reset_displacement_truss(self):
"""

# calculate strain
F = -1e10 # [N]
F = -1e10 # [N]
E = 2069e8 # [N/m2]
A = 1 # [m2]

Expand Down Expand Up @@ -125,5 +125,17 @@ def test_reset_displacement_beam(self):
for idx, node in enumerate(nodal_coordinates_stages[stage_nr]):
self.assertAlmostEqual(displacement_stages[stage_nr][idx][0], -eps * node[0], places=5)

def test_reset_displacement_shell_Dirichlet(self):
"""
Tests reset displacement in a shell, loaded with prescribed Displacement
Verifies that the prescribed displacement is not erased by reset_displacement.
load is applied / reset displacement is true, prescribed Z displacement -20 on node 3
"""
test_name = 'shell_with_reset_displacement'
file_path = test_helper.get_file_path(os.path.join('.', test_name))
simulation = test_helper.run_kratos(file_path)
displacement = test_helper.get_displacement(simulation)
self.assertEqual(displacement[2][2], -20.0)

if __name__ == '__main__':
KratosUnittest.main()
Loading