Skip to content

Commit

Permalink
Review request on testing. Capital I to start sentence.
Browse files Browse the repository at this point in the history
  • Loading branch information
WPK4FEM committed Dec 4, 2024
1 parent 0888fdc commit 01c13ce
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ double ApplyCPhiReductionProcess::GetAndCheckPhi(const Element::PropertiesType&
<< "Missing required item INDEX_OF_UMAT_PHI_PARAMETER" << std::endl;

KRATOS_ERROR_IF(part_properties[INDEX_OF_UMAT_PHI_PARAMETER] < 1 ||
part_properties[INDEX_OF_UMAT_PHI_PARAMETER] > static_cast<int>(part_properties[UMAT_PARAMETERS].size()))
<< "invalid INDEX_OF_UMAT_PHI_PARAMETER: " << part_properties[INDEX_OF_UMAT_PHI_PARAMETER]
part_properties[INDEX_OF_UMAT_PHI_PARAMETER] >
static_cast<int>(part_properties[UMAT_PARAMETERS].size()))
<< "Invalid INDEX_OF_UMAT_PHI_PARAMETER: " << part_properties[INDEX_OF_UMAT_PHI_PARAMETER]
<< " (out-of-bounds index)" << std::endl;
const double phi = part_properties[UMAT_PARAMETERS][part_properties[INDEX_OF_UMAT_PHI_PARAMETER] - 1];
KRATOS_ERROR_IF(phi < 0. || phi > 90.) << "Friction angle Phi out of range: " << phi << std::endl;
Expand Down Expand Up @@ -106,7 +107,8 @@ double ApplyCPhiReductionProcess::GetAndCheckC(const Element::PropertiesType& rP
<< "Missing required item INDEX_OF_UMAT_C_PARAMETER" << std::endl;

KRATOS_ERROR_IF(part_properties[INDEX_OF_UMAT_C_PARAMETER] < 1 ||
part_properties[INDEX_OF_UMAT_C_PARAMETER] > static_cast<int>(part_properties[UMAT_PARAMETERS].size()))
part_properties[INDEX_OF_UMAT_C_PARAMETER] >
static_cast<int>(part_properties[UMAT_PARAMETERS].size()))
<< "invalid INDEX_OF_UMAT_C_PARAMETER: " << part_properties[INDEX_OF_UMAT_C_PARAMETER]
<< " (out-of-bounds index)" << std::endl;
const auto c = part_properties[UMAT_PARAMETERS][part_properties[INDEX_OF_UMAT_C_PARAMETER] - 1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void ApplyK0ProcedureProcess::CheckK0(const Properties& rProperties, IndexType E
void ApplyK0ProcedureProcess::CheckPhi(const Properties& rProperties, IndexType ElementId)
{
if (rProperties.Has(INDEX_OF_UMAT_PHI_PARAMETER) && rProperties.Has(UMAT_PARAMETERS)) {
const auto phi_index = rProperties[INDEX_OF_UMAT_PHI_PARAMETER];
const auto phi_index = rProperties[INDEX_OF_UMAT_PHI_PARAMETER];
const auto number_of_umat_parameters = static_cast<int>(rProperties[UMAT_PARAMETERS].size());

KRATOS_ERROR_IF(phi_index < 1 || phi_index > number_of_umat_parameters)
Expand Down Expand Up @@ -209,7 +209,7 @@ void ApplyK0ProcedureProcess::CalculateK0Stresses(Element& rElement) const
{
// Get K0 material parameters of this element ( probably there is something more efficient )
const Element::PropertiesType& rProp = rElement.GetProperties();
const auto k0_main_direction = rProp[K0_MAIN_DIRECTION];
const auto k0_main_direction = rProp[K0_MAIN_DIRECTION];

auto k0_vector = CreateK0Vector(rProp);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ KRATOS_TEST_CASE_IN_SUITE(CheckFailureUmatInputsApplyCPhiReductionProcess, Krato
r_model_part_properties.SetValue(INDEX_OF_UMAT_PHI_PARAMETER, 0);
KRATOS_EXPECT_EXCEPTION_IS_THROWN(
(ApplyCPhiReductionProcess{r_model_part, {}}.ExecuteInitializeSolutionStep()),
"invalid INDEX_OF_UMAT_PHI_PARAMETER: 0 (out-of-bounds index)")
"Invalid INDEX_OF_UMAT_PHI_PARAMETER: 0 (out-of-bounds index)")

r_model_part_properties.SetValue(INDEX_OF_UMAT_PHI_PARAMETER, 7);
KRATOS_EXPECT_EXCEPTION_IS_THROWN(
(ApplyCPhiReductionProcess{r_model_part, {}}.ExecuteInitializeSolutionStep()),
"invalid INDEX_OF_UMAT_PHI_PARAMETER: 7 (out-of-bounds index)")
"Invalid INDEX_OF_UMAT_PHI_PARAMETER: 7 (out-of-bounds index)")

r_model_part_properties.SetValue(INDEX_OF_UMAT_PHI_PARAMETER, 4);
umat_parameters(3) = -0.0001;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,15 @@ KRATOS_TEST_CASE_IN_SUITE(K0ProcedureChecksIfProcessHasCorrectMaterialData, Krat
p_element->GetProperties().Erase(K0_VALUE_YY);
p_element->GetProperties().Erase(K0_VALUE_ZZ);

p_element->GetProperties().SetValue(INDEX_OF_UMAT_PHI_PARAMETER, 1);
p_element->GetProperties().SetValue(INDEX_OF_UMAT_PHI_PARAMETER, 2);
Vector umat_parameters{1};
umat_parameters[0] = -30.0;
p_element->GetProperties().SetValue(UMAT_PARAMETERS, umat_parameters);
KRATOS_EXPECT_EXCEPTION_IS_THROWN(
process.Check(),
"INDEX_OF_UMAT_PHI_PARAMETER (2) is not in range 1, size of UMAT_PARAMETERS for element 1")
p_element->GetProperties().SetValue(INDEX_OF_UMAT_PHI_PARAMETER, 1);

KRATOS_EXPECT_EXCEPTION_IS_THROWN(process.Check(),
"Phi (-30) should be between 0 and 90 degrees for element 1.")

Expand Down

0 comments on commit 01c13ce

Please sign in to comment.