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] Remove swapping faces in condition process #12227

Merged
merged 24 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ec73f5e
Remoded face swapping for Triangle3D3, and 3D6, Fixed the existing te…
mnabideltares Feb 12, 2024
761d14a
Removed face swapping for Quadrilateral3D4, and Quadrilateral3D8, Add…
mnabideltares Feb 13, 2024
1d8d851
Merge remote-tracking branch 'origin/master' into geo/12026-remove-sw…
rfaasse Mar 26, 2024
3a6681c
Fix sign of the normal stresses for 3D cases
rfaasse Mar 27, 2024
545ef42
Refactored diff order condition calculation function
rfaasse Mar 27, 2024
646836e
Minor refactoring
rfaasse Mar 27, 2024
d5c51ad
Renamed test to reflect diff order character
rfaasse Mar 27, 2024
2b766af
Renamed test to mention diff order
rfaasse Mar 27, 2024
7adf82f
Renamed triangle test to mention diff order
rfaasse Mar 27, 2024
0fdb128
Some code and comment improvements
rfaasse Mar 27, 2024
de213c3
Added test for hexa_8n_normal_load test, which does not assert anythi…
rfaasse Mar 27, 2024
d1e38a1
Revert "Renamed test to reflect diff order character"
rfaasse Mar 27, 2024
04ced09
Revert "Renamed test to mention diff order"
rfaasse Mar 27, 2024
dbd786b
Revert "Renamed triangle test to mention diff order"
rfaasse Mar 27, 2024
b9f44c8
Added asserts in the normal load test for hexa element
rfaasse Mar 27, 2024
abc89b4
Renames
rfaasse Mar 27, 2024
a0efacc
Added clarifying comments for the new test
rfaasse Mar 28, 2024
7685203
Fixed absorbing boundary 3d tests
rfaasse Mar 28, 2024
a1445a8
Added README + schematic for the structure
rfaasse Mar 28, 2024
e1147dd
Minor fixes for the README.md
rfaasse Mar 28, 2024
4bde10c
Added new test case specifications to overall README.md
rfaasse Mar 28, 2024
ee4d1d9
Processing review comments
rfaasse Mar 28, 2024
989971e
Fixing the entire element to a zero water pressure, since it's irrele…
rfaasse Mar 28, 2024
5d0fb9f
Added new test to the test_GeoMechanicsApplication.py script
rfaasse Mar 28, 2024
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 @@ -98,7 +98,7 @@ void UPwNormalFaceLoadCondition<TDim, TNumNodes>::CalculateTractionVector(
const unsigned int& GPoint)
{
Vector NormalVector = ZeroVector(TDim);
const double NormalStress = MathUtils<>::Dot(row(NContainer, GPoint), Variables.NormalStressVector);
double NormalStress = MathUtils<>::Dot(row(NContainer, GPoint), Variables.NormalStressVector);

if constexpr (TDim == 2) {
const double TangentialStress = MathUtils<>::Dot(row(NContainer, GPoint), Variables.TangentialStressVector);
Expand All @@ -107,6 +107,10 @@ void UPwNormalFaceLoadCondition<TDim, TNumNodes>::CalculateTractionVector(
rTractionVector[1] = NormalStress * NormalVector[0] + TangentialStress * NormalVector[1];
}
else if constexpr (TDim == 3) {
// Since the normal vector is pointing outwards for the 3D conditions, the normal stress
// should switch sign, such that positive normal contact stress is defined inwards.
NormalStress *= -1;

MathUtils<double>::CrossProduct(NormalVector, column(Jacobian, 0), column(Jacobian, 1));
rTractionVector = NormalStress * NormalVector;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

// Project includes
#include "custom_conditions/surface_normal_load_3D_diff_order_condition.hpp"
#include "custom_utilities/math_utilities.hpp"

namespace Kratos
{
Expand All @@ -36,37 +37,29 @@ Condition::Pointer SurfaceNormalLoad3DDiffOrderCondition::Create(IndexType NewId
return Condition::Pointer(new SurfaceNormalLoad3DDiffOrderCondition(NewId, GetGeometry().Create(ThisNodes), pProperties));
}

//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
void SurfaceNormalLoad3DDiffOrderCondition::
CalculateConditionVector(ConditionVariables& rVariables, unsigned int PointNumber)
void SurfaceNormalLoad3DDiffOrderCondition::CalculateConditionVector(ConditionVariables& rVariables,
unsigned int PointNumber)
{
KRATOS_TRY

double NormalVector[3];

NormalVector[0] = rVariables.JContainer[PointNumber](1,0) * rVariables.JContainer[PointNumber](2,1) -
rVariables.JContainer[PointNumber](2,0) * rVariables.JContainer[PointNumber](1,1);

NormalVector[1] = rVariables.JContainer[PointNumber](2,0) * rVariables.JContainer[PointNumber](0,1) -
rVariables.JContainer[PointNumber](0,0) * rVariables.JContainer[PointNumber](2,1);
Vector normal_vector(3);
MathUtils<double>::CrossProduct(normal_vector, column(rVariables.JContainer[PointNumber], 0),
column(rVariables.JContainer[PointNumber], 1));
rfaasse marked this conversation as resolved.
Show resolved Hide resolved

NormalVector[2] = rVariables.JContainer[PointNumber](0,0) * rVariables.JContainer[PointNumber](1,1) -
rVariables.JContainer[PointNumber](1,0) * rVariables.JContainer[PointNumber](0,1);

const GeometryType& rGeom = GetGeometry();
const SizeType NumUNodes = rGeom.PointsNumber();
double NormalStress = 0.0;
rVariables.ConditionVector.resize(3,false);
const auto& r_geometry = GetGeometry();
const auto number_of_displacement_nodes = r_geometry.PointsNumber();

for ( SizeType i = 0; i < NumUNodes; ++i ) {
NormalStress += rVariables.Nu[i]*rGeom[i].FastGetSolutionStepValue(NORMAL_CONTACT_STRESS);
}
Vector normal_stresses(number_of_displacement_nodes);
avdg81 marked this conversation as resolved.
Show resolved Hide resolved
std::transform(r_geometry.begin(), r_geometry.end(), normal_stresses.begin(), [](const auto& r_node) {
return r_node.FastGetSolutionStepValue(NORMAL_CONTACT_STRESS);
});

rVariables.ConditionVector[0] = NormalStress * NormalVector[0];
rVariables.ConditionVector[1] = NormalStress * NormalVector[1];
rVariables.ConditionVector[2] = NormalStress * NormalVector[2];
// Since the normal vector is pointing outwards for the 3D conditions, the normal stress
// should switch sign, such that positive normal contact stress is defined inwards.
const double normal_stress = -1 * MathUtils<>::Dot(rVariables.Nu, normal_stresses);
rVariables.ConditionVector = normal_stress * normal_vector;

KRATOS_CATCH( "" )
KRATOS_CATCH("")
}

//----------------------------------------------------------------------------------------
Expand All @@ -92,7 +85,7 @@ void SurfaceNormalLoad3DDiffOrderCondition::

for ( SizeType i = 0; i < NumUNodes; ++i ) {
Index = i * 3;

rRightHandSideVector[Index] += rVariables.Nu[i] * rVariables.ConditionVector[0] * rVariables.IntegrationCoefficient;
rRightHandSideVector[Index+1] += rVariables.Nu[i] * rVariables.ConditionVector[1] * rVariables.IntegrationCoefficient;
rRightHandSideVector[Index+2] += rVariables.Nu[i] * rVariables.ConditionVector[2] * rVariables.IntegrationCoefficient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,6 @@ void FindNeighbourElementsOfConditionsProcess::Execute()
Ids[i] = rGeometry[i].Id();
}

if (rGeometry.GetGeometryType() == GeometryData::KratosGeometryType::Kratos_Triangle3D3) {
// reverse ordering to be consistent with face ordering
std::swap(Ids[1], Ids[2]);
}

if (rGeometry.GetGeometryType() == GeometryData::KratosGeometryType::Kratos_Triangle3D6) {
// reverse ordering to be consistent with face ordering
std::swap(Ids[1], Ids[2]);
std::swap(Ids[3], Ids[5]);
}

if (rGeometry.GetGeometryType() == GeometryData::KratosGeometryType::Kratos_Quadrilateral3D4) {
// reverse ordering to be consistent with face ordering
std::swap(Ids[0], Ids[3]);
std::swap(Ids[1], Ids[2]);
}

if (rGeometry.GetGeometryType() == GeometryData::KratosGeometryType::Kratos_Quadrilateral3D8) {
// reverse ordering to be consistent with face ordering
std::swap(Ids[0], Ids[3]);
std::swap(Ids[1], Ids[2]);
std::swap(Ids[4], Ids[6]);
}

// adds to the map
FacesMap.insert( hashmap::value_type(Ids, std::vector<Condition::Pointer>({*itCond.base()})) );

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"properties": [{
"model_part_name": "PorousDomain.Soil",
"properties_id": 1,
"Material": {
"constitutive_law": {
"name" : "LinearElastic3DLaw"
},
"Variables": {
"IGNORE_UNDRAINED" : true,
"YOUNG_MODULUS" : 3.0e7,
"POISSON_RATIO" : 0,
"DENSITY_SOLID" : 0,
"DENSITY_WATER" : 1.0e3,
avdg81 marked this conversation as resolved.
Show resolved Hide resolved
"POROSITY" : 0.3,
"BULK_MODULUS_SOLID" : 1.0e16,
"BULK_MODULUS_FLUID" : 2.0e-30,
"PERMEABILITY_XX" : 4.5e-30,
"PERMEABILITY_YY" : 4.5e-30,
"PERMEABILITY_ZZ" : 4.5e-30,
rfaasse marked this conversation as resolved.
Show resolved Hide resolved
"PERMEABILITY_XY" : 0.0,
"PERMEABILITY_YZ" : 0.0,
"PERMEABILITY_ZX" : 0.0,
"DYNAMIC_VISCOSITY" : 1.0e-3
},
"Tables": {}
}
}]
}
Loading
Loading