Skip to content

Commit

Permalink
Fixed a bug related to handling of conditions
Browse files Browse the repository at this point in the history
We have found that conditions were only added to the computational model
part, but never removed from it. In multi-stage analysis, that could
result in adding inactive loads from previous stages. That has been
corrected.

Other changes include:
- Added a simple regression test with two uniform line loads, where each
  one is active in its own stage.
- Added a static method to Python class `GiDOutputFileReader`, which
  returns a list of nodal result values at the given time. Optionally,
  it filters its result given a sequence of node IDs.
- Use `math.isclose` to test whether two given times are nearly equal
  rather than using `==`.
- Removed some duplicated conditions that had been created by GiD.
- Updated the expected results of the settlement work flow test.
- Added a few nodal results that can be written by class
  `GeoOutputWriter`: reaction forces, normal contact stresses, and
  tangential contact stresses.
- Files `write_output.{cpp,h}` have been renamed to
  `geo_output_writer.{cpp,h}`.
  • Loading branch information
avdg81 committed Nov 6, 2023
1 parent 44e5005 commit 633fe21
Show file tree
Hide file tree
Showing 16 changed files with 75,783 additions and 74,681 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "input_output/logger_output.h"
#include "input_output/logger_table_output.h"
#include "includes/model_part_io.h"
#include "write_output.h"
#include "geo_output_writer.h"
#include "custom_utilities/file_input_utility.h"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ void KratosGeoSettlement::PrepareModelPart(const Parameters& rSolverSettings)
}
GetComputationalModelPart().AddElements(std::vector<IndexedObject::IndexType>{element_id_set.begin(), element_id_set.end()});

GetComputationalModelPart().Conditions().clear();
const auto processes_sub_model_part_list = rSolverSettings["processes_sub_model_part_list"];
std::vector<std::string> domain_condition_names;
for (const auto& sub_model_part : processes_sub_model_part_list) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// Main authors: Anne van de Graaf
//

#include "write_output.h"
#include "geo_output_writer.h"
#include "includes/model_part.h"
#include "custom_utilities/element_utilities.hpp"

Expand Down Expand Up @@ -123,14 +123,17 @@ void GeoOutputWriter::WriteNodalOutput(const std::vector<std::string>& rOutputIt
const ModelPart& rModelPart)
{
const auto output_writer_map = std::map<std::string, NodalResultWriter, std::less<>>{
{"DISPLACEMENT", MakeNodalResultWriterFor(DISPLACEMENT)},
{"TOTAL_DISPLACEMENT", MakeNodalResultWriterFor(TOTAL_DISPLACEMENT)},
{"WATER_PRESSURE", MakeNodalResultWriterFor(WATER_PRESSURE)},
{"NORMAL_FLUID_FLUX", MakeNodalResultWriterFor(NORMAL_FLUID_FLUX)},
{"VOLUME_ACCELERATION", MakeNodalResultWriterFor(VOLUME_ACCELERATION)},
{"HYDRAULIC_DISCHARGE", MakeNodalResultWriterFor(HYDRAULIC_DISCHARGE)},
{"HYDRAULIC_HEAD", MakeNodalResultWriterFor(HYDRAULIC_HEAD)},
{"LINE_LOAD_Y", MakeNodalResultWriterFor(LINE_LOAD_Y)},
{"DISPLACEMENT", MakeNodalResultWriterFor(DISPLACEMENT)},
{"TOTAL_DISPLACEMENT", MakeNodalResultWriterFor(TOTAL_DISPLACEMENT)},
{"WATER_PRESSURE", MakeNodalResultWriterFor(WATER_PRESSURE)},
{"NORMAL_FLUID_FLUX", MakeNodalResultWriterFor(NORMAL_FLUID_FLUX)},
{"VOLUME_ACCELERATION", MakeNodalResultWriterFor(VOLUME_ACCELERATION)},
{"HYDRAULIC_DISCHARGE", MakeNodalResultWriterFor(HYDRAULIC_DISCHARGE)},
{"HYDRAULIC_HEAD", MakeNodalResultWriterFor(HYDRAULIC_HEAD)},
{"LINE_LOAD_Y", MakeNodalResultWriterFor(LINE_LOAD_Y)},
{"REACTION", MakeNodalResultWriterFor(REACTION)},
{"NORMAL_CONTACT_STRESS", MakeNodalResultWriterFor(NORMAL_CONTACT_STRESS)},
{"TANGENTIAL_CONTACT_STRESS", MakeNodalResultWriterFor(TANGENTIAL_CONTACT_STRESS)}
};

for (const auto& name : rOutputItemNames)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "geo_mechanics_application_variables.h"
#include "includes/variables.h"
#include "solving_strategies/strategies/solving_strategy.h"
#include "write_output.h"
#include "geo_output_writer.h"

namespace Kratos {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def Execute(self):
list_of_ids.add(elem.Id)
computing_model_part.AddElements(list(list_of_ids))
# Adding Conditions to Computing Model Part
computing_model_part.Conditions.clear()
domain_conditions = []
for i in range(self.processes_sub_model_part_list.size()):
domain_conditions.append(self.main_model_part.GetSubModelPart(self.processes_sub_model_part_list[i].GetString()))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"properties": [{
"model_part_name": "PorousDomain.Dummy_soil",
"properties_id": 1,
"Material": {
"constitutive_law": {
"name" : "GeoLinearElasticPlaneStrain2DLaw"
},
"Variables": {
"IGNORE_UNDRAINED" : false,
"YOUNG_MODULUS" : 10000,
"POISSON_RATIO" : 0.2,
"DENSITY_SOLID" : 0.0,
"DENSITY_WATER" : 0.0,
"POROSITY" : 0.3,
"BULK_MODULUS_SOLID" : 1.0e9,
"BULK_MODULUS_FLUID" : 2.0e6,
"PERMEABILITY_XX" : 4.5e-13,
"PERMEABILITY_YY" : 4.5e-13,
"PERMEABILITY_XY" : 0.0,
"DYNAMIC_VISCOSITY" : 8.90e-7,
"THICKNESS" : 1.0,
"BIOT_COEFFICIENT" : 1.0,
"RETENTION_LAW" : "SaturatedBelowPhreaticLevelLaw",
"SATURATED_SATURATION" : 1.0,
"RESIDUAL_SATURATION" : 1e-10,
"VAN_GENUCHTEN_AIR_ENTRY_PRESSURE" : 2.561,
"VAN_GENUCHTEN_GN" : 1.377,
"VAN_GENUCHTEN_GL" : 1.25,
"MINIMUM_RELATIVE_PERMEABILITY" : 0.0001
},
"Tables": {}
}
}]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
{
"problem_data": {
"problem_name": "test",
"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": 2,
"model_import_settings": {
"input_type": "mdpa",
"input_filename": "test"
},
"material_import_settings": {
"materials_filename": "MaterialParameters.json"
},
"time_stepping": {
"time_step": 1,
"max_delta_time_factor": 1000
},
"buffer_size": 2,
"echo_level": 1,
"clear_storage": false,
"compute_reactions": true,
"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": 100,
"reduction_factor": 0.5,
"increase_factor": 2.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": ["Dummy_soil"],
"processes_sub_model_part_list": ["Bottom_fixed","Side_sliders","Phreatic_line","First_line_load"],
"body_domain_sub_model_part_list": ["Dummy_soil"]
},
"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": "test_stage1",
"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": ["REACTION"],
"gauss_point_results": []
},
"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.Bottom_fixed",
"variable_name": "DISPLACEMENT",
"active": [true,true,true],
"is_fixed": [true,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.Side_sliders",
"variable_name": "DISPLACEMENT",
"active": [true,false,false],
"is_fixed": [true,false,false],
"value": [0.0,0.0,0.0],
"table": [0,0,0]
}
},{
"python_module": "apply_scalar_constraint_table_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name": "ApplyScalarConstraintTableProcess",
"Parameters": {
"model_part_name": "PorousDomain.Phreatic_line",
"variable_name": "WATER_PRESSURE",
"is_fixed": true,
"fluid_pressure_type": "Phreatic_Line",
"gravity_direction": 1,
"out_of_plane_direction": 2,
"first_reference_coordinate" : [0.0,0.0,0.0],
"second_reference_coordinate": [5.0,0.0,0.0],
"table": [0,0],
"pressure_tension_cut_off": 0.0,
"specific_weight": 0.0
}
}],
"loads_process_list": [{
"python_module": "apply_vector_constraint_table_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name": "ApplyVectorConstraintTableProcess",
"Parameters": {
"model_part_name": "PorousDomain.First_line_load",
"variable_name": "LINE_LOAD",
"active": [false,true,false],
"value": [0.0,-10.0,0.0],
"table": [0,0,0]
}
}],
"auxiliar_process_list": []
}
}
Loading

0 comments on commit 633fe21

Please sign in to comment.