Skip to content

Commit

Permalink
[GeoMechanicsApplication] Use the pressure geometry where needed (#13126
Browse files Browse the repository at this point in the history
)

In two instances, the displacement geometry was used, where the pressure geometry was intended. No failures occurred due to limiting the number of nodes visited. It gave, however, rise to confusion. That has been addressed now.

Furthermore, a member function was made `const` and marked `[[nodiscard]]`.
  • Loading branch information
avdg81 authored Feb 14, 2025
1 parent f4911d3 commit 536e51c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1003,11 +1003,12 @@ void SmallStrainUPwDiffOrderElement::InitializeNodalVariables(ElementVariables&
rVariables.PressureVector.resize(num_p_nodes, false);
rVariables.PressureDtVector.resize(num_p_nodes, false);
rVariables.DeltaPressureVector.resize(num_p_nodes, false);
const auto& r_p_geometry = *mpPressureGeometry;
for (SizeType i = 0; i < num_p_nodes; ++i) {
rVariables.PressureVector[i] = r_geom[i].FastGetSolutionStepValue(WATER_PRESSURE);
rVariables.PressureDtVector[i] = r_geom[i].FastGetSolutionStepValue(DT_WATER_PRESSURE);
rVariables.DeltaPressureVector[i] = r_geom[i].FastGetSolutionStepValue(WATER_PRESSURE) -
r_geom[i].FastGetSolutionStepValue(WATER_PRESSURE, 1);
rVariables.PressureVector[i] = r_p_geometry[i].FastGetSolutionStepValue(WATER_PRESSURE);
rVariables.PressureDtVector[i] = r_p_geometry[i].FastGetSolutionStepValue(DT_WATER_PRESSURE);
rVariables.DeltaPressureVector[i] = r_p_geometry[i].FastGetSolutionStepValue(WATER_PRESSURE) -
r_p_geometry[i].FastGetSolutionStepValue(WATER_PRESSURE, 1);
}

KRATOS_CATCH("")
Expand Down Expand Up @@ -1430,11 +1431,10 @@ void SmallStrainUPwDiffOrderElement::SetUpPressureGeometryPointer()
}
}

Vector SmallStrainUPwDiffOrderElement::GetPressureSolutionVector()
Vector SmallStrainUPwDiffOrderElement::GetPressureSolutionVector() const
{
Vector result(mpPressureGeometry->PointsNumber());
std::transform(this->GetGeometry().begin(),
this->GetGeometry().begin() + mpPressureGeometry->PointsNumber(), result.begin(),
std::transform(mpPressureGeometry->begin(), mpPressureGeometry->end(), result.begin(),
[](const auto& node) { return node.FastGetSolutionStepValue(WATER_PRESSURE); });
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUPwDiffOrderElement : pub
std::vector<Vector>& rStressVectors,
std::vector<Matrix>& rConstitutiveMatrices);

Vector GetPressureSolutionVector();
[[nodiscard]] Vector GetPressureSolutionVector() const;

[[nodiscard]] std::vector<double> CalculateDegreesOfSaturation(const std::vector<double>& rFluidPressures);
[[nodiscard]] std::vector<double> CalculateDerivativesOfSaturation(const std::vector<double>& rFluidPressures);
Expand Down

0 comments on commit 536e51c

Please sign in to comment.