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

Geo/tests strain measures #11696

Merged
merged 6 commits into from
Oct 30, 2023
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 @@ -37,6 +37,7 @@
from test_k0_procedure_process import KratosGeoMechanicsK0ProcedureProcessTests
from test_geomechanics_solver import KratosGeoMechanicsSolverTests
from test_column_changing_waterlevel import KratosGeoMechanicsChangingWaterLevelTests
from test_strain_measures import KratosGeoMechanicsStrainMeasureTests

def AssembleTestSuites():
''' Populates the test suites to run.
Expand Down Expand Up @@ -72,7 +73,8 @@ def AssembleTestSuites():
KratosGeoMechanicsNormalLoad1DTests,
KratosGeoMechanicsK0ProcedureProcessTests,
KratosGeoMechanicsSolverTests,
KratosGeoMechanicsChangingWaterLevelTests
KratosGeoMechanicsChangingWaterLevelTests,
KratosGeoMechanicsStrainMeasureTests
]

# Create an array with the selected tests
Expand Down
129 changes: 129 additions & 0 deletions applications/GeoMechanicsApplication/tests/test_strain_measures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import os

import KratosMultiphysics.KratosUnittest as KratosUnittest
import test_helper

class KratosGeoMechanicsStrainMeasureTests(KratosUnittest.TestCase):
"""
This class contains tests which check the displacement result of a column with linear elastic and linear or Hencky ( = natural = logarithmic ) strains
WPK4FEM marked this conversation as resolved.
Show resolved Hide resolved
The analytical solution for these tests is:

For linear strain: ∆H = H0 * (q / E)
For logarithmic strain: ∆H = H0 * (exp (q / E) -1)
WPK4FEM marked this conversation as resolved.
Show resolved Hide resolved

∆H : top total displacement (m)
H_0 : Original height of column (m)
q : Compressive distributed load (N/m2)
E : Young's Modulus (N/m2)
"""

def test_same_order_elements_column_small_deformation_linear_strain(self):
"""
Test to check if correct deformation is found using UPwSmallStrainElement2D8N and linear strain
"""

test_name = os.path.join("test_strain_measures", "same_order_elements", "column_small_deformation_linear_strain")
file_path = test_helper.get_file_path(test_name)

# run simulation
simulation = test_helper.run_kratos(file_path)

# retrieve displacement top of column
displacements = test_helper.get_displacement(simulation)

# compare top displacement H0 q / E = 10 * -10000 / 20000 = -5 for node 3 direction 2 ( off by 1 )
top_vertical_displacement = displacements[2][1]
self.assertAlmostEqual( top_vertical_displacement, -5.0 )

def test_same_order_elements_column_small_deformation_logarithmic_strain(self):
"""
Test to check if correct deformation is found using UPwSmallStrainElement2D8N and Hencky (= natural = logarithmic) strain
"""

test_name = os.path.join("test_strain_measures", "same_order_elements", "column_small_deformation_logarithmic_strain")
file_path = test_helper.get_file_path(test_name)

# run simulation
simulation = test_helper.run_kratos(file_path)

# retrieve displacement top of column
displacements = test_helper.get_displacement(simulation)

# compare top displacement H0 (1 - exp(q / E)) = 10 *(1 - exp(-0.5)) = -3.935 for node 3 direction 2 ( off by 1 )
top_vertical_displacement = displacements[2][1]
self.assertAlmostEqual( top_vertical_displacement, -3.934693402874 )

def test_same_order_elements_column_large_deformation_logarithmic_strain(self):
"""
Test to check if correct deformation is found using UPwUpdatedLagrangianElement2D8N and Hencky (= natural = logarithmic) strain
"""

test_name = os.path.join("test_strain_measures", "same_order_elements", "column_large_deformation_logarithmic_strain")
file_path = test_helper.get_file_path(test_name)

# run simulation
simulation = test_helper.run_kratos(file_path)

# retrieve displacement top of column
displacements = test_helper.get_displacement(simulation)

# compare top displacement H0 (-1 + exp(q / E)) = 10 *(-1 + exp(-0.5)) = -3.935 for node 3 direction 2 ( off by 1 )
top_vertical_displacement = displacements[2][1]
self.assertAlmostEqual( top_vertical_displacement, -3.934693402874 )

def test_diff_order_elements_column_small_deformation_linear_strain(self):
"""
Test to check if correct deformation is found using SmallStrainUPwDiffOrderElement2D8N and linear strain
"""

test_name = os.path.join("test_strain_measures", "diff_order_elements", "column_small_deformation_linear_strain")
file_path = test_helper.get_file_path(test_name)

# run simulation
simulation = test_helper.run_kratos(file_path)

# retrieve displacement top of column
displacements = test_helper.get_displacement(simulation)

# compare top displacement H0 q / E = 10 * -10000 / 20000 = -5 for node 3 direction 2 ( off by 1 )
top_vertical_displacement = displacements[2][1]
self.assertAlmostEqual( top_vertical_displacement, -5.0 )

def test_diff_order_elements_column_small_deformation_logarithmic_strain(self):
"""
Test to check if correct deformation is found using SmallStrainUPwDiffOrderElement2D8N and Hencky (= natural = logarithmic) strain
"""

test_name = os.path.join("test_strain_measures", "diff_order_elements", "column_small_deformation_logarithmic_strain")
file_path = test_helper.get_file_path(test_name)

# run simulation
simulation = test_helper.run_kratos(file_path)

# retrieve displacement top of column
displacements = test_helper.get_displacement(simulation)

# compare top displacement H0 (1 - exp(q / E)) = 10 *(1 - exp(-0.5)) = -3.935 for node 3 direction 2 ( off by 1 )
top_vertical_displacement = displacements[2][1]
self.assertAlmostEqual( top_vertical_displacement, -3.934693402874 )

def test_diff_order_elements_column_large_deformation_logarithmic_strain(self):
"""
Test to check if correct deformation is found using UpdatedLagrangianUPwDiffOrderElement2D8N and Hencky (= natural = logarithmic) strain
"""

test_name = os.path.join("test_strain_measures", "diff_order_elements", "column_large_deformation_logarithmic_strain")
file_path = test_helper.get_file_path(test_name)

# run simulation
simulation = test_helper.run_kratos(file_path)

# retrieve displacement top of column
displacements = test_helper.get_displacement(simulation)

# compare top displacement H0 (-1 + exp(q / E)) = 10 *(-1 + exp(-0.5)) = -3.935 for node 3 direction 2 ( off by 1 )
top_vertical_displacement = displacements[2][1]
self.assertAlmostEqual( top_vertical_displacement, -3.934693402874 )

if __name__ == '__main__':
KratosUnittest.main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Test cases for strain measures

This folder contains the test cases:

- [same order element small deformation linear strain](/~https://github.com/KratosMultiphysics/Kratos/tree/master/applications/GeoMechanicsApplication/tests/test_strain_measures/same_order_elements/column_small_deformation_linear_strain/README.md)
- [same order element small deformation logarithmic strain](/~https://github.com/KratosMultiphysics/Kratos/tree/master/applications/GeoMechanicsApplication/tests/test_strain_measures/same_order_elements/column_small_deformation_logarithmic_strain/README.md)
- [same order element large deformation logarithmic strain](/~https://github.com/KratosMultiphysics/Kratos/tree/master/applications/GeoMechanicsApplication/tests/test_strain_measures/same_order_elements/column_large_deformation_logarithmic_strain/README.md)
- [diff order element small deformation linear strain](/~https://github.com/KratosMultiphysics/Kratos/tree/master/applications/GeoMechanicsApplication/tests/test_strain_measures/diff_order_elements/column_small_deformation_linear_strain/README.md)
- [diff order element small deformation logarithmic strain](/~https://github.com/KratosMultiphysics/Kratos/tree/master/applications/GeoMechanicsApplication/tests/test_strain_measures/diff_order_elements/column_small_deformation_logarithmic_strain/README.md)
- [diff order element large deformation logarithmic strain](/~https://github.com/KratosMultiphysics/Kratos/tree/master/applications/GeoMechanicsApplication/tests/test_strain_measures/diff_order_elements/column_large_deformation_logarithmic_strain/README.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"properties": [{
"model_part_name": "PorousDomain.Column",
"properties_id": 1,
"Material": {
"constitutive_law": {
"name" : "GeoLinearElasticPlaneStrain2DLaw"
},
"Variables": {
"USE_HENCKY_STRAIN" : true,
"IGNORE_UNDRAINED" : false,
"YOUNG_MODULUS" : 2000,
"POISSON_RATIO" : 0.0,
"DENSITY_SOLID" : 0,
"DENSITY_WATER" : 0,
"POROSITY" : 0,
"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,159 @@
{
"problem_data": {
"problem_name": "column_large_displacement_logarithmic_strain",
"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": "column_large_displacement_logarithmic_strain"
},
"material_import_settings": {
"materials_filename": "MaterialParameters.json"
},
"time_stepping": {
"time_step": 1.0,
"max_delta_time_factor": 1000
},
"buffer_size": 2,
"echo_level": 1,
"clear_storage": false,
"compute_reactions": false,
"move_mesh_flag": true,
"reform_dofs_at_each_step": false,
"nodal_smoothing": false,
"block_builder": true,
"solution_type": "Quasi-Static",
"scheme_type": "Newmark",
"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": "displacement_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": ["Column"],
"processes_sub_model_part_list": ["bottom_fixed","side_slide","zero_pressure","top_load"],
"body_domain_sub_model_part_list": ["Column"]
},
"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": "column_large_displacement_logarithmic_strain",
"postprocess_parameters": {
"result_file_configuration": {
"gidpost_flags": {
"WriteDeformedMeshFlag": "WriteUndeformed",
"WriteConditionsFlag": "WriteElementsOnly",
"GiDPostMode": "GiD_PostBinary",
"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","WATER_PRESSURE","VOLUME_ACCELERATION","REACTION","LINE_LOAD"],
"gauss_point_results": ["GREEN_LAGRANGE_STRAIN_TENSOR","ENGINEERING_STRAIN_TENSOR","CAUCHY_STRESS_TENSOR","TOTAL_STRESS_TENSOR","VON_MISES_STRESS","FLUID_FLUX_VECTOR","HYDRAULIC_HEAD"]
},
"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_slide",
"variable_name": "DISPLACEMENT",
"active": [true,true,true],
"is_fixed": [true,false,true],
"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.zero_pressure",
"variable_name": "WATER_PRESSURE",
"is_fixed": true,
"fluid_pressure_type": "Uniform",
"value": 0.0,
"table": 0
}
}],
"loads_process_list": [{
"python_module": "apply_vector_constraint_table_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name": "ApplyVectorConstraintTableProcess",
"Parameters": {
"model_part_name": "PorousDomain.top_load",
"variable_name": "LINE_LOAD",
"active": [false,true,false],
"value": [0.0,-1000.0,0.0],
"table": [0,0,0]
}
}],
"auxiliar_process_list": []
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Test loaded column large displacement elements with Hencky ( = natural = logarithmic ) strain

**Author:** [Wijtze Pieter Kikstra](/~https://github.com/WPK4FEM)

## Case Specification
A 10 m high column of dry soil is loaded with a distributed -1 kN/m vertical load. The column material is linear elastic. Expected displacement on the top of the column is: S = H_0 * (exp(q/E) - 1) = 10 * (exp(-1000 / 2000) - 1) = -3.934693402874
Loading
Loading