Skip to content
Open
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 @@ -183,18 +183,31 @@ void GeoExtrapolateIntegrationPointValuesToNodesProcess::CacheExtrapolationMatri

bool GeoExtrapolateIntegrationPointValuesToNodesProcess::ExtrapolationMatrixIsCachedFor(const Element& rElement) const
{
return mExtrapolationMatrixMap.contains(typeid(rElement).hash_code());
const auto key = GetCacheKey(rElement);
return mExtrapolationMatrixMap.contains(key);
}

void GeoExtrapolateIntegrationPointValuesToNodesProcess::CacheExtrapolationMatrixFor(const Element& rElement,
const Matrix& rExtrapolationMatrix)
{
mExtrapolationMatrixMap[typeid(rElement).hash_code()] = rExtrapolationMatrix;
mExtrapolationMatrixMap[GetCacheKey(rElement)] = rExtrapolationMatrix;
}

const Matrix& GeoExtrapolateIntegrationPointValuesToNodesProcess::GetCachedExtrapolationMatrixFor(const Element& rElement) const
{
return mExtrapolationMatrixMap.at(typeid(rElement).hash_code());
return mExtrapolationMatrixMap.at(GetCacheKey(rElement));
}

std::size_t GeoExtrapolateIntegrationPointValuesToNodesProcess::GetCacheKey(
const Element& rElement) const
{
// Combine geometry type and number of integration points for unique key
const auto& r_geometry = rElement.GetGeometry();
std::size_t key = static_cast<std::size_t>(r_geometry.GetGeometryType());
key ^= GeoElementUtilities::GetNumberOfIntegrationPointsOf(rElement) << 16;
key ^= r_geometry.size() << 16;

return key;
Comment on lines +204 to +210
}

void GeoExtrapolateIntegrationPointValuesToNodesProcess::CheckElement(Element& rElement,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoExtrapolateIntegrationPointValues
void CacheExtrapolationMatrixFor(const Element& rElement, const Matrix& rExtrapolationMatrix);
[[nodiscard]] bool ExtrapolationMatrixIsCachedFor(const Element& rElement) const;
[[nodiscard]] const Matrix& GetCachedExtrapolationMatrixFor(const Element& rElement) const;
std::size_t GetCacheKey(const Element& rElement) const;

void AddIntegrationPointContributionsForAllVariables(Element& rElement,
const Matrix& rExtrapolationMatrix,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,30 @@ def test_8_noded_quadrilateral(self):
for fluid_flux_component, expected in zip(fluid_flux_vector, expected_fluid_flux_vector):
self.assertAlmostEqual(fluid_flux_component, expected, places=4)

def test_mixed_elements(self):
directory = 'test_integration_node_extrapolation'
test_name = 'mixed_elements'
file_path = test_helper.get_file_path(os.path.join(directory, test_name))

reader = GiDOutputFileReader()

# two quadrilaterals
file_path_quads = os.path.join(file_path, "quads")
test_helper.run_kratos(file_path_quads)
simulation_output = reader.read_output_from(os.path.join(file_path_quads, test_name+'.post.res'))
heads_quads = GiDOutputFileReader.nodal_values_at_time(
"HYDRAULIC_HEAD", 1, simulation_output, node_ids=range(1,14))

# mixed elements
file_path_mixed = os.path.join(file_path, "mixed")
test_helper.run_kratos(file_path_mixed)
simulation_output = reader.read_output_from(os.path.join(file_path_mixed, test_name+'.post.res'))
heads_mixed = GiDOutputFileReader.nodal_values_at_time(
"HYDRAULIC_HEAD", 1, simulation_output, node_ids=range(1,14))


for head_quad, head_mixed in zip(heads_quads, heads_mixed):
self.assertAlmostEqual(head_mixed, head_quad, places=4)
Comment on lines +104 to +120

if __name__=="__main__":
KratosUnittest.main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"properties": [{
"model_part_name": "PorousDomain.soil",
"properties_id": 1,
"Material": {
"constitutive_law": {
"name" : "GeoLinearElasticPlaneStrain2DLaw"
},
"Variables": {
"GEO_DRAINAGE_TYPE" : "FULLY_COUPLED",
"YOUNG_MODULUS" : 10000,
"POISSON_RATIO" : 0.2,
"DENSITY_SOLID" : 2650,
"DENSITY_WATER" : 1000,
"POROSITY" : 0.35,
"BULK_MODULUS_SOLID" : 1.0e9,
"BULK_MODULUS_FLUID" : 2.0e6,
"PERMEABILITY_XX" : 1.157e-12,
"PERMEABILITY_YY" : 1.157e-12,
"PERMEABILITY_XY" : 0.0,
"DYNAMIC_VISCOSITY" : 1e-3,
"BIOT_COEFFICIENT" : 1.0,
"RETENTION_LAW" : "SaturatedLaw",
"SATURATED_SATURATION" : 1.0
}
}
}]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
{
"problem_data": {
"problem_name": "simple_mesh",
"start_time": 0.0,
"end_time": 1.0,
"echo_level": 1,
"parallel_type": "OpenMP",
"number_of_threads": 1
},
"solver_settings": {
"solver_type": "geomechanics_U_Pw_solver",
"model_part_name": "PorousDomain",
"domain_size": 2,
"model_import_settings": {
"input_type": "mdpa",
"input_filename": "simple_mesh"
},
"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": false,
"reform_dofs_at_each_step": false,
"block_builder": true,
"solution_type": "Quasi-static",
"scheme_type": "Backward_Euler",
"reset_totals": 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",
"residual_relative_tolerance": 1.0E-4,
"residual_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,
"first_alpha_value": 0.5,
"second_alpha_value": 1.0,
"min_alpha": 0.1,
"max_alpha": 2.0,
"rotation_dofs": false,
"linear_solver_settings": {
"solver_type": "cg",
"scaling": true
},
"problem_domain_sub_model_part_list": ["soil"],
"body_domain_sub_model_part_list": ["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": "mixed_elements",
"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": true,
"skin_output": false,
"plane_output": [],
"nodal_results": ["HYDRAULIC_HEAD", "CAUCHY_STRESS_TENSOR", "FLUID_FLUX_VECTOR", "WATER_PRESSURE"],
"gauss_point_results": ["HYDRAULIC_HEAD", "CAUCHY_STRESS_TENSOR", "FLUID_FLUX_VECTOR"]
},
"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.Base",
"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.soil",
"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_scalar_constraint_table_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name": "ApplyScalarConstraintTableProcess",
"Parameters": {
"model_part_name": "PorousDomain.Top",
"variable_name": "WATER_PRESSURE",
"is_fixed": true,
"fluid_pressure_type": "Uniform",
"value": 0,
"table": 1
}
},{
"python_module": "apply_scalar_constraint_table_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name": "ApplyScalarConstraintTableProcess",
"Parameters": {
"model_part_name": "PorousDomain.Base",
"variable_name": "WATER_PRESSURE",
"is_fixed": true,
"fluid_pressure_type": "Uniform",
"value": 0,
"table": 2
}
}],
"loads_process_list": [{
"python_module": "apply_vector_constraint_table_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name": "ApplyVectorConstraintTableProcess",
"Parameters": {
"model_part_name": "PorousDomain.Body_Acceleration-auto-1",
"variable_name": "VOLUME_ACCELERATION",
"active": [false,true,false],
"value": [0.0,-10,0.0],
"table": [0,0,0]
}
}],
"auxiliary_process_list": [
{
"python_module": "geo_extrapolate_integration_point_values_to_nodes_process",
"kratos_module": "KratosMultiphysics.GeoMechanicsApplication",
"process_name" : "GeoExtrapolateIntegrationPointValuesToNodesProcess",
"Parameters": {
"model_part_name": "PorousDomain.porous_computational_model_part",
"list_of_variables" : ["HYDRAULIC_HEAD", "CAUCHY_STRESS_TENSOR", "FLUID_FLUX_VECTOR"]
}
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
Begin Table 1 X WATER_PRESSURE
0.0000000000 -2500
1.0000000000 -2500
2.0000000000 -2500
End Table

Begin Table 2 X WATER_PRESSURE
0.0000000000 -40000
1.0000000000 -40000
2.0000000000 -40000
End Table

Begin Properties 1
End Properties

Begin Nodes
1 0.0000000000 -2.0000000000 0.0000000000
2 1.0000000000 -2.0000000000 0.0000000000
3 1.0000000000 0.0000000000 0.0000000000
4 0.0000000000 0.0000000000 0.0000000000
5 0.5000000000 -2.0000000000 0.0000000000
6 1.0000000000 -1.0000000000 0.0000000000
7 0.5000000000 0.0000000000 0.0000000000
8 0.0000000000 -1.0000000000 0.0000000000
9 2.0000000000 -2.0000000000 0.0000000000
10 2.0000000000 0.0000000000 0.0000000000
11 1.5000000000 -2.0000000000 0.0000000000
12 2.0000000000 -1.0000000000 0.0000000000
13 1.5000000000 0.0000000000 0.0000000000
14 1.5000000000 -1.0000000000 0.0000000000
End Nodes

Begin Elements SmallStrainUPwDiffOrderElement2D8N
1 1 1 2 3 4 5 6 7 8
End Elements

Begin Elements SmallStrainUPwDiffOrderElement2D6N
2 1 2 9 3 11 14 6
3 1 10 3 9 13 14 12
End Elements


Begin SubModelPart soil
Begin SubModelPartNodes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
End SubModelPartNodes
Begin SubModelPartElements
1
2
3
End SubModelPartElements
End SubModelPart

Begin SubModelPart Body_Acceleration-auto-1
Begin SubModelPartNodes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
End SubModelPartNodes
Begin SubModelPartElements
1
2
3
End SubModelPartElements
End SubModelPart

Begin SubModelPart Top
Begin SubModelPartTables
1
End SubModelPartTables
Begin SubModelPartNodes
3
4
7
10
13
End SubModelPartNodes
End SubModelPart

Begin SubModelPart Base
Begin SubModelPartTables
2
End SubModelPartTables
Begin SubModelPartNodes
1
2
5
9
11
End SubModelPartNodes
End SubModelPart



Loading
Loading