From c1053f0db30127c351c95331d1686aa351fbd3e7 Mon Sep 17 00:00:00 2001 From: rubenzorrilla Date: Mon, 12 May 2025 19:07:48 +0200 Subject: [PATCH 1/9] Use Gauss rule in solid shell element --- .../solid_shell_element_sprism_3D6N.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp index bebb964709a8..32c6714dd88c 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp +++ b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp @@ -1565,26 +1565,26 @@ void SolidShellElementSprism3D6N::Initialize(const ProcessInfo& rCurrentProcessI switch ( integration_order ) { case 1: - mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1; + mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_1; break; case 2: - mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2; + mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_2; break; case 3: - mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_3; + mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_3; break; case 4: - mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4; + mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_4; break; case 5: - mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5; + mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_5; break; default: KRATOS_WARNING("SolidShellElementSprism3D6N") << "Integration order " << integration_order << " is not available, using default integration order for the geometry" << std::endl; - mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1; + mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_1; } } else { - mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1; + mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_1; } const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); From d1cd3495cbf547f52811cdf142b5aec8990c3bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicente=20Mataix=20Ferr=C3=A1ndiz?= Date: Mon, 19 May 2025 20:38:09 +0200 Subject: [PATCH 2/9] Refactor SolidShellElementSprism3D6N: Replace typedefs with using declarations and enhance documentation - Replaced typedefs with using declarations for improved readability and modern C++ style. - Enhanced documentation for constructors, methods, and member variables to clarify functionality and usage. - Corrected typos in comments and improved descriptions for enums and methods. - Added static methods for integration points and shape functions to streamline calculations. --- .../solid_shell_element_sprism_3D6N.cpp | 1003 +++++++++++------ .../solid_shell_element_sprism_3D6N.h | 174 ++- 2 files changed, 768 insertions(+), 409 deletions(-) diff --git a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp index ae9dc86e124e..f8d43320e243 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp +++ b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp @@ -15,12 +15,13 @@ // Project includes #include "includes/checks.h" +#include "includes/global_pointer_variables.h" #include "input_output/logger.h" +#include "integration/prism_gauss_legendre_integration_points.h" #include "utilities/geometry_utilities.h" #include "custom_utilities/constitutive_law_utilities.h" -#include "solid_shell_element_sprism_3D6N.h" #include "custom_utilities/structural_mechanics_element_utilities.h" -#include "includes/global_pointer_variables.h" +#include "solid_shell_element_sprism_3D6N.h" namespace Kratos { @@ -139,19 +140,21 @@ Element::Pointer SolidShellElementSprism3D6N::Clone( const SizeType integration_point_number = mConstitutiveLawVector.size(); - if ( new_element.mConstitutiveLawVector.size() != integration_point_number) + if ( new_element.mConstitutiveLawVector.size() != integration_point_number) { new_element.mConstitutiveLawVector.resize(integration_point_number); + } - KRATOS_ERROR_IF( new_element.mConstitutiveLawVector.size() != new_element.GetGeometry().IntegrationPointsNumber() ) << "Constitutive law not has the correct size " << new_element.mConstitutiveLawVector.size() << std::endl; - - for(IndexType i = 0; i < integration_point_number; ++i) + for(IndexType i = 0; i < integration_point_number; ++i) { new_element.mConstitutiveLawVector[i] = mConstitutiveLawVector[i]->Clone(); + } - if ( new_element.mAuxContainer.size() != mAuxContainer.size() ) + if (new_element.mAuxContainer.size() != mAuxContainer.size()) { new_element.mAuxContainer.resize(mAuxContainer.size()); + } - for(IndexType i = 0; i < mAuxContainer.size(); ++i) + for(IndexType i = 0; i < mAuxContainer.size(); ++i) { new_element.mAuxContainer[i] = mAuxContainer[i]; + } return Kratos::make_intrusive(new_element); } @@ -166,29 +169,33 @@ void SolidShellElementSprism3D6N::EquationIdVector( { KRATOS_TRY; - const WeakPointerVectorNodesType& p_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + // Get geometry + const auto& r_geometry = GetGeometry(); - const IndexType number_of_nodes = GetGeometry().size() + NumberOfActiveNeighbours(p_neighbour_nodes); + // Get the neighbours + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + const IndexType number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); const IndexType dim = number_of_nodes * 3; - if (rResult.size() != dim) + if (rResult.size() != dim) { rResult.resize(dim, false); + } // Nodes of the central element IndexType index = 0; - for (IndexType i = 0; i < 6; ++i) { - rResult[index] = GetGeometry()[i].GetDof(DISPLACEMENT_X).EquationId(); - rResult[index + 1] = GetGeometry()[i].GetDof(DISPLACEMENT_Y).EquationId(); - rResult[index + 2] = GetGeometry()[i].GetDof(DISPLACEMENT_Z).EquationId(); + for (IndexType i = 0; i < r_geometry.size(); ++i) { + rResult[index] = r_geometry[i].GetDof(DISPLACEMENT_X).EquationId(); + rResult[index + 1] = r_geometry[i].GetDof(DISPLACEMENT_Y).EquationId(); + rResult[index + 2] = r_geometry[i].GetDof(DISPLACEMENT_Z).EquationId(); index += 3; } // Adding the ids of the neighbouring nodes - for (IndexType i = 0; i < 6; ++i) { - if (HasNeighbour(i, p_neighbour_nodes[i])) { - rResult[index] = p_neighbour_nodes[i].GetDof(DISPLACEMENT_X).EquationId(); - rResult[index + 1] = p_neighbour_nodes[i].GetDof(DISPLACEMENT_Y).EquationId(); - rResult[index + 2] = p_neighbour_nodes[i].GetDof(DISPLACEMENT_Z).EquationId(); + for (IndexType i = 0; i < r_geometry.size(); ++i) { + if (HasNeighbour(i, r_neighbour_nodes[i])) { + rResult[index] = r_neighbour_nodes[i].GetDof(DISPLACEMENT_X).EquationId(); + rResult[index + 1] = r_neighbour_nodes[i].GetDof(DISPLACEMENT_Y).EquationId(); + rResult[index + 2] = r_neighbour_nodes[i].GetDof(DISPLACEMENT_Z).EquationId(); index += 3; } } @@ -206,22 +213,27 @@ void SolidShellElementSprism3D6N::GetDofList( { KRATOS_TRY; - const WeakPointerVectorNodesType& p_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + // Get geometry + const auto& r_geometry = GetGeometry(); + const unsigned int number_of_nodes = r_geometry.size(); + + // Get the neighbours + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); rElementalDofList.resize(0); // Nodes of the central element - for (IndexType i = 0; i < GetGeometry().size(); ++i) { - rElementalDofList.push_back(GetGeometry()[i].pGetDof(DISPLACEMENT_X)); - rElementalDofList.push_back(GetGeometry()[i].pGetDof(DISPLACEMENT_Y)); - rElementalDofList.push_back(GetGeometry()[i].pGetDof(DISPLACEMENT_Z)); + for (IndexType i = 0; i < number_of_nodes; ++i) { + rElementalDofList.push_back(r_geometry[i].pGetDof(DISPLACEMENT_X)); + rElementalDofList.push_back(r_geometry[i].pGetDof(DISPLACEMENT_Y)); + rElementalDofList.push_back(r_geometry[i].pGetDof(DISPLACEMENT_Z)); } // Adding the dofs of the neighbouring nodes - for (IndexType i = 0; i < 6; ++i) { - if (HasNeighbour(i, p_neighbour_nodes[i])) { - rElementalDofList.push_back(p_neighbour_nodes[i].pGetDof(DISPLACEMENT_X)); - rElementalDofList.push_back(p_neighbour_nodes[i].pGetDof(DISPLACEMENT_Y)); - rElementalDofList.push_back(p_neighbour_nodes[i].pGetDof(DISPLACEMENT_Z)); + for (IndexType i = 0; i < number_of_nodes; ++i) { + if (HasNeighbour(i, r_neighbour_nodes[i])) { + rElementalDofList.push_back(r_neighbour_nodes[i].pGetDof(DISPLACEMENT_X)); + rElementalDofList.push_back(r_neighbour_nodes[i].pGetDof(DISPLACEMENT_Y)); + rElementalDofList.push_back(r_neighbour_nodes[i].pGetDof(DISPLACEMENT_Z)); } } @@ -236,8 +248,12 @@ void SolidShellElementSprism3D6N::GetValuesVector( int Step ) const { - const WeakPointerVectorNodesType& p_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - const SizeType number_of_nodes = GetGeometry().size() + NumberOfActiveNeighbours(p_neighbour_nodes); + // Get geometry + const auto& r_geometry = GetGeometry(); + + // Get the neighbours + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + const SizeType number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); const SizeType mat_size = number_of_nodes * 3; if (rValues.size() != mat_size) @@ -246,19 +262,21 @@ void SolidShellElementSprism3D6N::GetValuesVector( IndexType index = 0; // Nodes of the central element - for (IndexType i = 0; i < 6; ++i) { - const array_1d & disp = GetGeometry()[i].FastGetSolutionStepValue(DISPLACEMENT, Step); - for (IndexType j = 0; j < 3; ++j) - rValues[index + j] = disp[j]; + for (IndexType i = 0; i < r_geometry.size(); ++i) { + const array_1d& r_displacement = r_geometry[i].FastGetSolutionStepValue(DISPLACEMENT, Step); + for (IndexType j = 0; j < 3; ++j) { + rValues[index + j] = r_displacement[j]; + } index += 3; } // Neighbour nodes - for (int i = 0; i < 6; ++i) { - if (HasNeighbour(i, p_neighbour_nodes[i])) { - const array_1d & disp = p_neighbour_nodes[i].FastGetSolutionStepValue(DISPLACEMENT, Step); - for (IndexType j = 0; j < 3; ++j) - rValues[index + j] = disp[j]; + for (int i = 0; i < r_geometry.size(); ++i) { + if (HasNeighbour(i, r_neighbour_nodes[i])) { + const array_1d& r_displacement = r_neighbour_nodes[i].FastGetSolutionStepValue(DISPLACEMENT, Step); + for (IndexType j = 0; j < 3; ++j) { + rValues[index + j] = r_displacement[j]; + } index += 3; } } @@ -272,8 +290,12 @@ void SolidShellElementSprism3D6N::GetFirstDerivativesVector( int Step ) const { - const WeakPointerVectorNodesType& p_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - const SizeType number_of_nodes = GetGeometry().size() + NumberOfActiveNeighbours(p_neighbour_nodes); + // Get geometry + const auto& r_geometry = GetGeometry(); + + // Get the neighbours + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + const SizeType number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); const SizeType mat_size = number_of_nodes * 3; if (rValues.size() != mat_size) @@ -282,19 +304,21 @@ void SolidShellElementSprism3D6N::GetFirstDerivativesVector( IndexType index = 0; // Nodes of the central element - for (IndexType i = 0; i < 6; ++i) { - const array_1d & vel = GetGeometry()[i].FastGetSolutionStepValue(VELOCITY, Step); - for (IndexType j = 0; j < 3; ++j) - rValues[index + j] = vel[j]; + for (IndexType i = 0; i < r_geometry.size(); ++i) { + const array_1d& r_velocity = r_geometry[i].FastGetSolutionStepValue(VELOCITY, Step); + for (IndexType j = 0; j < 3; ++j) { + rValues[index + j] = r_velocity[j]; + } index += 3; } // Neighbour nodes - for (int i = 0; i < 6; ++i) { - if (HasNeighbour(i, p_neighbour_nodes[i])) { - const array_1d & vel = p_neighbour_nodes[i].FastGetSolutionStepValue(VELOCITY, Step); - for (IndexType j = 0; j < 3; ++j) - rValues[index + j] = vel[j]; + for (int i = 0; i < r_geometry.size(); ++i) { + if (HasNeighbour(i, r_neighbour_nodes[i])) { + const array_1d& r_velocity = r_neighbour_nodes[i].FastGetSolutionStepValue(VELOCITY, Step); + for (IndexType j = 0; j < 3; ++j) { + rValues[index + j] = r_velocity[j]; + } index += 3; } } @@ -308,29 +332,36 @@ void SolidShellElementSprism3D6N::GetSecondDerivativesVector( int Step ) const { - const WeakPointerVectorNodesType& p_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - const SizeType number_of_nodes = GetGeometry().size() + NumberOfActiveNeighbours(p_neighbour_nodes); + // Get geometry + const auto& r_geometry = GetGeometry(); + + // Get the neighbours + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + const SizeType number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); const SizeType mat_size = number_of_nodes * 3; - if (rValues.size() != mat_size) + if (rValues.size() != mat_size) { rValues.resize(mat_size, false); + } IndexType index = 0; // Nodes of the central element - for (IndexType i = 0; i < 6; ++i) { - const array_1d & acc = GetGeometry()[i].FastGetSolutionStepValue(ACCELERATION, Step); - for (IndexType j = 0; j < 3; ++j) - rValues[index + j] = acc[j]; + for (IndexType i = 0; i < r_geometry.size(); ++i) { + const array_1d& r_acceleration = r_geometry[i].FastGetSolutionStepValue(ACCELERATION, Step); + for (IndexType j = 0; j < 3; ++j) { + rValues[index + j] = r_acceleration[j]; + } index += 3; } // Neighbour nodes - for (int i = 0; i < 6; ++i) { - if (HasNeighbour(i, p_neighbour_nodes[i])) { - const array_1d & acc = p_neighbour_nodes[i].FastGetSolutionStepValue(ACCELERATION, Step); - for (IndexType j = 0; j < 3; ++j) - rValues[index + j] = acc[j]; + for (int i = 0; i < r_geometry.size(); ++i) { + if (HasNeighbour(i, r_neighbour_nodes[i])) { + const array_1d& r_acceleration = r_neighbour_nodes[i].FastGetSolutionStepValue(ACCELERATION, Step); + for (IndexType j = 0; j < 3; ++j) { + rValues[index + j] = r_acceleration[j]; + } index += 3; } } @@ -441,9 +472,12 @@ void SolidShellElementSprism3D6N::CalculateMassMatrix( { KRATOS_TRY; - const WeakPointerVectorNodesType& p_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + // Get geometry + const auto& r_geometry = GetGeometry(); + + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - const SizeType number_of_nodes = GetGeometry().size() + NumberOfActiveNeighbours(p_neighbour_nodes); + const SizeType number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); const SizeType mat_size = number_of_nodes * 3; if (rMassMatrix.size1() != mat_size) { @@ -453,7 +487,7 @@ void SolidShellElementSprism3D6N::CalculateMassMatrix( noalias(rMassMatrix) = ZeroMatrix(mat_size, mat_size); Matrix aux_matrix; - const SizeType aux_mat_size = GetGeometry().size() * 3; + const SizeType aux_mat_size = r_geometry.size() * 3; BaseType::CalculateMassMatrix(aux_matrix, rCurrentProcessInfo); noalias(subrange(rMassMatrix, 0, aux_mat_size, 0, aux_mat_size)) = aux_matrix; @@ -468,8 +502,8 @@ void SolidShellElementSprism3D6N::CalculateDampingMatrix( const ProcessInfo& rCurrentProcessInfo ) { - const WeakPointerVectorNodesType& p_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - const IndexType mat_size = ( GetGeometry().size() + NumberOfActiveNeighbours(p_neighbour_nodes) ) * 3; + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + const IndexType mat_size = ( GetGeometry().size() + NumberOfActiveNeighbours(r_neighbour_nodes) ) * 3; StructuralMechanicsElementUtilities::CalculateRayleighDampingMatrix( *this, @@ -490,10 +524,10 @@ void SolidShellElementSprism3D6N::CalculateDampingMatrix( { KRATOS_TRY; - const WeakPointerVectorNodesType& p_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); // 0.-Initialize the DampingMatrix: - const SizeType number_of_nodes = GetGeometry().size() + NumberOfActiveNeighbours(p_neighbour_nodes); + const SizeType number_of_nodes = GetGeometry().size() + NumberOfActiveNeighbours(r_neighbour_nodes); // Resizing as needed the LHS const SizeType mat_size = number_of_nodes * 3; @@ -538,7 +572,10 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( { KRATOS_TRY; - const IndexType integration_point_number = GetGeometry().IntegrationPointsNumber( this->GetIntegrationMethod() ); + // Get geometry + const auto& r_geometry = GetGeometry(); + + const IndexType integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); if ( rOutput.size() != integration_point_number ) rOutput.resize( integration_point_number ); @@ -555,16 +592,16 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); /* Create constitutive law parameters: */ - ConstitutiveLaw::Parameters Values(GetGeometry(),GetProperties(),rCurrentProcessInfo); + ConstitutiveLaw::Parameters Values(r_geometry, GetProperties(), rCurrentProcessInfo); /* Set constitutive law flags: */ - Flags &ConstitutiveLawOptions = Values.GetOptions(); + Flags& r_constitutive_law_options = Values.GetOptions(); - ConstitutiveLawOptions.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_STRESS); + r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS); /* Reading integration points */ - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); double& alpha_eas = this->GetValue(ALPHA_EAS); @@ -588,7 +625,7 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( if( mFinalizedStep ) this->GetHistoricalVariables(general_variables,point_number); - // Set general variables to constitutivelaw parameters + // Set general variables to constitutive law parameters this->SetGeneralVariables(general_variables,Values,point_number); bool aux_bool; @@ -607,9 +644,11 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( for (IndexType iii = 0; iii < 6; ++iii) { rOutput[iii] = false; - for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) - if (r_output_aux[i_gp]) + for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) { + if (r_output_aux[i_gp]) { rOutput[iii] = true; + } + } } } @@ -627,10 +666,14 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( { KRATOS_TRY; - const IndexType integration_point_number = GetGeometry().IntegrationPointsNumber( this->GetIntegrationMethod() ); + // Get geometry + const auto& r_geometry = GetGeometry(); - if ( rOutput.size() != integration_point_number ) + const IndexType integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); + + if ( rOutput.size() != integration_point_number ) { rOutput.resize( integration_point_number ); + } if (mConstitutiveLawVector[0]->Has( rVariable)) { GetValueOnConstitutiveLaw(rVariable, rOutput); @@ -648,8 +691,9 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( for (IndexType iii = 0; iii < 6; ++iii) { rOutput[iii] = 0; - for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) + for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) { rOutput[iii] += interpol(i_gp, iii) * r_output_aux[i_gp]; + } } } @@ -667,7 +711,10 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( { KRATOS_TRY; - const IndexType integration_point_number = GetGeometry().IntegrationPointsNumber( this->GetIntegrationMethod() ); + // Get geometry + const auto& r_geometry = GetGeometry(); + + const IndexType integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); if ( rOutput.size() != integration_point_number ) rOutput.resize( integration_point_number ); @@ -678,16 +725,16 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); /* Create constitutive law parameters: */ - ConstitutiveLaw::Parameters Values(GetGeometry(),GetProperties(),rCurrentProcessInfo); + ConstitutiveLaw::Parameters Values(r_geometry, GetProperties(), rCurrentProcessInfo); /* Set constitutive law flags: */ - Flags &ConstitutiveLawOptions = Values.GetOptions(); + Flags& r_constitutive_law_options = Values.GetOptions(); - ConstitutiveLawOptions.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_STRESS); + r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS); /* Reading integration points */ - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); double& alpha_eas = this->GetValue(ALPHA_EAS); @@ -711,7 +758,7 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( if( mFinalizedStep ) this->GetHistoricalVariables(general_variables,point_number); - // Set general variables to constitutivelaw parameters + // Set general variables to constitutive law parameters this->SetGeneralVariables(general_variables,Values,point_number); // Call the constitutive law to update material variables @@ -739,17 +786,17 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); // Create constitutive law parameters: - ConstitutiveLaw::Parameters Values(GetGeometry(),GetProperties(),rCurrentProcessInfo); + ConstitutiveLaw::Parameters Values(r_geometry, GetProperties(), rCurrentProcessInfo); // Set constitutive law flags: - Flags &ConstitutiveLawOptions=Values.GetOptions(); + Flags& r_constitutive_law_options=Values.GetOptions(); - ConstitutiveLawOptions.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_STRESS, true); - ConstitutiveLawOptions.Set(ConstitutiveLaw::ISOCHORIC_TENSOR_ONLY, true); + r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true); + r_constitutive_law_options.Set(ConstitutiveLaw::ISOCHORIC_TENSOR_ONLY, true); /* Reading integration points */ - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); double& alpha_eas = this->GetValue(ALPHA_EAS); @@ -773,7 +820,7 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( if( mFinalizedStep ) this->GetHistoricalVariables(general_variables,point_number); - // Set general variables to constitutivelaw parameters + // Set general variables to constitutive law parameters this->SetGeneralVariables(general_variables,Values,point_number); // Call the constitutive law to update material variables @@ -795,19 +842,19 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); // Create constitutive law parameters: - ConstitutiveLaw::Parameters Values(GetGeometry(),GetProperties(),rCurrentProcessInfo); + ConstitutiveLaw::Parameters Values(r_geometry, GetProperties(), rCurrentProcessInfo); // Set constitutive law flags: - Flags &ConstitutiveLawOptions=Values.GetOptions(); + Flags& r_constitutive_law_options=Values.GetOptions(); - ConstitutiveLawOptions.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_STRESS, true); - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_STRAIN_ENERGY, true); + r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRAIN_ENERGY, true); /* Reading integration points */ - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); - double& alpha_eas = this->GetValue(ALPHA_EAS); + double& r_alpha_eas = this->GetValue(ALPHA_EAS); /* Calculate the cartesian derivatives */ CartesianDerivatives this_cartesian_derivatives; @@ -823,22 +870,24 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( const double ZetaGauss = 2.0 * integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, alpha_eas, ZetaGauss); + this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, ZetaGauss); // To take in account previous step writing - if( mFinalizedStep ) + if( mFinalizedStep ) { this->GetHistoricalVariables(general_variables,point_number); + } - // Set general variables to constitutivelaw parameters + // Set general variables to constitutive law parameters this->SetGeneralVariables(general_variables,Values,point_number); double strain_energy = 0.0; // Compute stresses and constitutive parameters - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) + if (mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { mConstitutiveLawVector[point_number]->CalculateMaterialResponseKirchhoff(Values); - else + } else { mConstitutiveLawVector[point_number]->CalculateMaterialResponsePK2(Values); + } mConstitutiveLawVector[point_number]->GetValue(STRAIN_ENERGY, strain_energy); @@ -879,10 +928,12 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( { KRATOS_TRY; - const IndexType integration_point_number = GetGeometry().IntegrationPointsNumber( this->GetIntegrationMethod() ); + // Get the integration points + const IndexType integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); - if ( rOutput.size() != integration_point_number ) + if ( rOutput.size() != integration_point_number ) { rOutput.resize( integration_point_number ); + } if (mConstitutiveLawVector[0]->Has( rVariable)) { GetValueOnConstitutiveLaw(rVariable, rOutput); @@ -900,8 +951,9 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( for (IndexType iii = 0; iii < 6; ++iii) { rOutput[iii] = ZeroVector(3); - for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) + for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) { rOutput[iii] += interpol(i_gp, iii) * r_output_aux[i_gp]; + } } } @@ -919,10 +971,12 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( { KRATOS_TRY; - const IndexType integration_point_number = GetGeometry().IntegrationPointsNumber( this->GetIntegrationMethod() ); + // Get integration points + const IndexType integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); - if ( rOutput.size() != integration_point_number ) + if ( rOutput.size() != integration_point_number ) { rOutput.resize( integration_point_number ); + } if (mConstitutiveLawVector[0]->Has( rVariable)) { GetValueOnConstitutiveLaw(rVariable, rOutput); @@ -940,8 +994,9 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( for (IndexType iii = 0; iii < 6; ++iii) { rOutput[iii] = ZeroVector(6); - for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) + for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) { rOutput[iii] += interpol(i_gp, iii) * r_output_aux[i_gp]; + } } } @@ -959,7 +1014,10 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( { KRATOS_TRY; - const IndexType integration_point_number = GetGeometry().IntegrationPointsNumber( this->GetIntegrationMethod() ); + // Get geometry + const auto& r_geometry = GetGeometry(); + + const IndexType integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); if ( rOutput.size() != integration_point_number ) rOutput.resize( integration_point_number ); @@ -970,7 +1028,7 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); // Create constitutive law parameters: - ConstitutiveLaw::Parameters Values(GetGeometry(), GetProperties(), rCurrentProcessInfo); + ConstitutiveLaw::Parameters Values(r_geometry, GetProperties(), rCurrentProcessInfo); // Set constitutive law flags: Flags &constitutive_laws_options=Values.GetOptions(); @@ -979,9 +1037,9 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( constitutive_laws_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true); /* Reading integration points */ - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); - double& alpha_eas = this->GetValue(ALPHA_EAS); + double& r_alpha_eas = this->GetValue(ALPHA_EAS); /* Calculate the cartesian derivatives */ CartesianDerivatives this_cartesian_derivatives; @@ -997,13 +1055,13 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, zeta_gauss); // To take in account previous step writing if( mFinalizedStep ) this->GetHistoricalVariables(general_variables,point_number); - // Set general variables to constitutivelaw parameters + // Set general variables to constitutive law parameters this->SetGeneralVariables(general_variables, Values, point_number); // Call the constitutive law to update material variables @@ -1024,21 +1082,21 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); /* Create constitutive law parameters: */ - ConstitutiveLaw::Parameters values(GetGeometry(),GetProperties(),rCurrentProcessInfo); + ConstitutiveLaw::Parameters values(r_geometry, GetProperties(), rCurrentProcessInfo); /* Set constitutive law flags: */ - Flags &ConstitutiveLawOptions=values.GetOptions(); + Flags& r_constitutive_law_options=values.GetOptions(); - ConstitutiveLawOptions.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_STRESS, false); - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false); + r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS, false); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false); values.SetStrainVector(general_variables.StrainVector); /* Reading integration points */ - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); - double& alpha_eas = this->GetValue(ALPHA_EAS); + double& r_alpha_eas = this->GetValue(ALPHA_EAS); /* Calculate the cartesian derivatives */ CartesianDerivatives this_cartesian_derivatives; @@ -1054,13 +1112,13 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, zeta_gauss); // To take in account previous step writing if( mFinalizedStep ) this->GetHistoricalVariables(general_variables,point_number); - // Set general variables to constitutivelaw parameters + // Set general variables to constitutive law parameters this->SetGeneralVariables(general_variables, values, point_number); // Compute Green-Lagrange Strain @@ -1112,44 +1170,51 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( { KRATOS_TRY; - const IndexType integration_point_number = GetGeometry().IntegrationPointsNumber( this->GetIntegrationMethod() ); + const IndexType integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); - if ( rOutput.size() != integration_point_number ) + if ( rOutput.size() != integration_point_number ) { rOutput.resize( integration_point_number ); + } if ( rVariable == CAUCHY_STRESS_TENSOR || rVariable == PK2_STRESS_TENSOR ) { std::vector stress_vector; - if( rVariable == CAUCHY_STRESS_TENSOR ) + if( rVariable == CAUCHY_STRESS_TENSOR ) { this->CalculateOnIntegrationPoints( CAUCHY_STRESS_VECTOR, stress_vector, rCurrentProcessInfo ); - else + } else { this->CalculateOnIntegrationPoints( PK2_STRESS_VECTOR, stress_vector, rCurrentProcessInfo ); + } // Loop integration points - if ( rOutput.size() != stress_vector.size() ) + if ( rOutput.size() != stress_vector.size() ) { rOutput.resize( stress_vector.size() ); + } for ( IndexType point_number = 0; point_number < rOutput.size(); ++point_number ) { - if (rOutput[point_number].size2() != 3) + if (rOutput[point_number].size2() != 3) { rOutput[point_number].resize(3, 3, false); + } rOutput[point_number] = MathUtils::StressVectorToTensor(stress_vector[point_number]); } } else if ( rVariable == GREEN_LAGRANGE_STRAIN_TENSOR || rVariable == ALMANSI_STRAIN_TENSOR || rVariable == HENCKY_STRAIN_TENSOR) { std::vector StrainVector; - if( rVariable == GREEN_LAGRANGE_STRAIN_TENSOR ) + if( rVariable == GREEN_LAGRANGE_STRAIN_TENSOR ) { CalculateOnIntegrationPoints( GREEN_LAGRANGE_STRAIN_VECTOR, StrainVector, rCurrentProcessInfo ); - else if ( rVariable == ALMANSI_STRAIN_TENSOR ) + } else if ( rVariable == ALMANSI_STRAIN_TENSOR ) { CalculateOnIntegrationPoints( ALMANSI_STRAIN_VECTOR, StrainVector, rCurrentProcessInfo ); - else if ( rVariable == HENCKY_STRAIN_TENSOR ) + } else if ( rVariable == HENCKY_STRAIN_TENSOR ) { CalculateOnIntegrationPoints( HENCKY_STRAIN_VECTOR, StrainVector, rCurrentProcessInfo ); + } // Loop integration points - if ( rOutput.size() != StrainVector.size() ) + if ( rOutput.size() != StrainVector.size() ) { rOutput.resize( StrainVector.size() ); + } for ( IndexType point_number = 0; point_number < rOutput.size(); ++point_number ) { - if (rOutput[point_number].size2() != 3) + if (rOutput[point_number].size2() != 3) { rOutput[point_number].resize(3, 3, false); + } rOutput[point_number] = MathUtils::StrainVectorToTensor(StrainVector[point_number]); } @@ -1159,16 +1224,16 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); // Create constitutive law parameters: - ConstitutiveLaw::Parameters Values(GetGeometry(),GetProperties(),rCurrentProcessInfo); + ConstitutiveLaw::Parameters Values(GetGeometry(), GetProperties(), rCurrentProcessInfo); // Set constitutive law flags: Flags &constitutive_laws_options=Values.GetOptions(); constitutive_laws_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, true); /* Reading integration points */ - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); - double& alpha_eas = this->GetValue(ALPHA_EAS); + double& r_alpha_eas = this->GetValue(ALPHA_EAS); /* Calculate the cartesian derivatives */ CartesianDerivatives this_cartesian_derivatives; @@ -1184,9 +1249,9 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, zeta_gauss); - // Set general variables to constitutivelaw parameters + // Set general variables to constitutive law parameters this->SetGeneralVariables(general_variables,Values,point_number); // Call the constitutive law to update material variables @@ -1203,9 +1268,9 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); /* Reading integration points */ - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); - double& alpha_eas = this->GetValue(ALPHA_EAS); + double& r_alpha_eas = this->GetValue(ALPHA_EAS); /* Calculate the cartesian derivatives */ CartesianDerivatives this_cartesian_derivatives; @@ -1221,7 +1286,7 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, zeta_gauss); if( rOutput[point_number].size2() != general_variables.F.size2() ) rOutput[point_number].resize( general_variables.F.size1() , general_variables.F.size2() , false ); @@ -1243,8 +1308,9 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( for (IndexType iii = 0; iii < 6; ++iii) { rOutput[iii] = ZeroMatrix(rOutput[0].size1(), rOutput[0].size2()); - for (IndexType Gauss_Point = 0; Gauss_Point < integration_point_number; Gauss_Point++) - rOutput[iii] += interpol(Gauss_Point, iii) * rOutput_aux[Gauss_Point]; + for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) { + rOutput[iii] += interpol(i_gp, iii) * rOutput_aux[i_gp]; + } } } @@ -1312,8 +1378,8 @@ int SolidShellElementSprism3D6N::Check(const ProcessInfo& rCurrentProcessInfo) c // Neighbour nodes KRATOS_ERROR_IF_NOT(this->Has(NEIGHBOUR_NODES)) << "The neighbour nodes are not calculated" << std::endl; if (this->Has(NEIGHBOUR_NODES)) { - const WeakPointerVectorNodesType& p_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - KRATOS_ERROR_IF(p_neighbour_nodes.size() == 0) << "The neighbour nodes calculated are empty" << std::endl; + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + KRATOS_ERROR_IF(r_neighbour_nodes.size() == 0) << "The neighbour nodes calculated are empty" << std::endl; } const int check = BaseType::Check(rCurrentProcessInfo); @@ -1343,24 +1409,27 @@ int SolidShellElementSprism3D6N::Check(const ProcessInfo& rCurrentProcessInfo) c void SolidShellElementSprism3D6N::InitializeSolutionStep(const ProcessInfo& rCurrentProcessInfo) { + // Get geometry + const auto& r_geometry = GetGeometry(); + /* Create and initialize element variables: */ GeneralVariables general_variables; this->InitializeGeneralVariables(general_variables); /* Create constitutive law parameters: */ - ConstitutiveLaw::Parameters Values(GetGeometry(),GetProperties(),rCurrentProcessInfo); + ConstitutiveLaw::Parameters Values(r_geometry, GetProperties(), rCurrentProcessInfo); /* Set constitutive law flags: */ - Flags &ConstitutiveLawOptions = Values.GetOptions(); + Flags& r_constitutive_law_options = Values.GetOptions(); - ConstitutiveLawOptions.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_STRESS); - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false); + r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false); /* Reading integration points */ - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); - double& alpha_eas = this->GetValue(ALPHA_EAS); + double& r_alpha_eas = this->GetValue(ALPHA_EAS); /* Calculate the cartesian derivatives */ CartesianDerivatives this_cartesian_derivatives; @@ -1372,20 +1441,19 @@ void SolidShellElementSprism3D6N::InitializeSolutionStep(const ProcessInfo& rCur this->CalculateCommonComponents(common_components, this_cartesian_derivatives); // Reading integration points - const GeometryType& r_geometry = GetGeometry(); const Properties& r_properties = GetProperties(); - const auto& N_values = r_geometry.ShapeFunctionsValues(mThisIntegrationMethod); + const auto& N_values = msGeometryData.ShapeFunctionsValues(this->GetIntegrationMethod()); for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, zeta_gauss); // To take in account previous step writing if( mFinalizedStep ) this->GetHistoricalVariables(general_variables,point_number); - // Set general variables to constitutivelaw parameters + // Set general variables to constitutive law parameters this->SetGeneralVariables(general_variables,Values,point_number); // Call the constitutive law to update material variables @@ -1405,22 +1473,25 @@ void SolidShellElementSprism3D6N::FinalizeSolutionStep(const ProcessInfo& rCurre { KRATOS_TRY; + // Get geometry + const auto& r_geometry = GetGeometry(); + // Create and initialize element variables: GeneralVariables general_variables; this->InitializeGeneralVariables(general_variables); // Create constitutive law parameters: - ConstitutiveLaw::Parameters Values(GetGeometry(),GetProperties(),rCurrentProcessInfo); + ConstitutiveLaw::Parameters Values(r_geometry, GetProperties(), rCurrentProcessInfo); // Get constitutive law flags: - Flags &ConstitutiveLawOptions=Values.GetOptions(); + Flags& r_constitutive_law_options=Values.GetOptions(); - ConstitutiveLawOptions.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_STRESS, true); + r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true); - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); - double& alpha_eas = this->GetValue(ALPHA_EAS); + double& r_alpha_eas = this->GetValue(ALPHA_EAS); /* Calculate the cartesian derivatives */ CartesianDerivatives this_cartesian_derivatives; @@ -1432,16 +1503,15 @@ void SolidShellElementSprism3D6N::FinalizeSolutionStep(const ProcessInfo& rCurre this->CalculateCommonComponents(common_components, this_cartesian_derivatives); // Reading integration points - const GeometryType& r_geometry = GetGeometry(); const Properties& r_properties = GetProperties(); - const auto& N_values = r_geometry.ShapeFunctionsValues(mThisIntegrationMethod); + const auto& N_values = msGeometryData.ShapeFunctionsValues(mThisIntegrationMethod); for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components,integration_points, point_number, alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components,integration_points, point_number, r_alpha_eas, zeta_gauss); - // Set general variables to constitutivelaw parameters + // Set general variables to constitutive law parameters this->SetGeneralVariables(general_variables,Values,point_number); // Call the constitutive law to update material variables @@ -1472,6 +1542,10 @@ void SolidShellElementSprism3D6N::InitializeNonLinearIteration( const ProcessInf void SolidShellElementSprism3D6N::FinalizeNonLinearIteration( const ProcessInfo& rCurrentProcessInfo ) { + // Get geometry + const auto& r_geometry = GetGeometry(); + + // Call base class BaseType::FinalizeNonLinearIteration(rCurrentProcessInfo); /* Create and initialize element variables: */ @@ -1479,24 +1553,24 @@ void SolidShellElementSprism3D6N::FinalizeNonLinearIteration( const ProcessInfo& this->InitializeGeneralVariables(general_variables); /* Create constitutive law parameters: */ - ConstitutiveLaw::Parameters values(GetGeometry(),GetProperties(),rCurrentProcessInfo); + ConstitutiveLaw::Parameters values(r_geometry, GetProperties(), rCurrentProcessInfo); /* Set constitutive law flags: */ - Flags &ConstitutiveLawOptions=values.GetOptions(); + Flags& r_constitutive_law_options=values.GetOptions(); - ConstitutiveLawOptions.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_STRESS, true); - if ( mELementalFlags.IsNot(SolidShellElementSprism3D6N::EXPLICIT_RHS_COMPUTATION) ) { // Implicit calculation of the RHS - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, true); + r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true); + if (mELementalFlags.IsNot(SolidShellElementSprism3D6N::EXPLICIT_RHS_COMPUTATION) ) { // Implicit calculation of the RHS + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, true); } else { - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false); } /* Reading integration points */ - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); /* Getting the alpha parameter of the EAS improvement */ - double& alpha_eas = this->GetValue(ALPHA_EAS); + double& r_alpha_eas = this->GetValue(ALPHA_EAS); /* Calculate the cartesian derivatives */ CartesianDerivatives this_cartesian_derivatives; @@ -1516,12 +1590,12 @@ void SolidShellElementSprism3D6N::FinalizeNonLinearIteration( const ProcessInfo& const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; /* Assemble B */ - this->CalculateDeformationMatrix(general_variables.B, common_components, zeta_gauss, alpha_eas); + this->CalculateDeformationMatrix(general_variables.B, common_components, zeta_gauss, r_alpha_eas); // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, zeta_gauss); - // Set general variables to constitutivelaw parameters + // Set general variables to constitutive law parameters this->SetGeneralVariables(general_variables, values, point_number); // Compute stresses and constitutive parameters @@ -1541,8 +1615,9 @@ void SolidShellElementSprism3D6N::FinalizeNonLinearIteration( const ProcessInfo& delta_disp = GetVectorCurrentPosition() - GetVectorPreviousPosition(); // Calculates the increase of displacements /* Update alpha EAS */ - if (EAS.mStiffAlpha > std::numeric_limits::epsilon()) // Avoid division by zero - alpha_eas -= prod(EAS.mHEAS, delta_disp)(0, 0) / EAS.mStiffAlpha; + if (EAS.mStiffAlpha > std::numeric_limits::epsilon()) { // Avoid division by zero + r_alpha_eas -= prod(EAS.mHEAS, delta_disp)(0, 0) / EAS.mStiffAlpha; + } } /***********************************************************************************/ @@ -1587,49 +1662,55 @@ void SolidShellElementSprism3D6N::Initialize(const ProcessInfo& rCurrentProcessI mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_1; } - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); /* Constitutive Law initialisation */ - if ( mConstitutiveLawVector.size() != integration_points.size() ) + if ( mConstitutiveLawVector.size() != integration_points.size() ) { mConstitutiveLawVector.resize( integration_points.size() ); + } /* Implicit or explicit EAS update */ - if( r_properties.Has(CONSIDER_IMPLICIT_EAS_SPRISM_ELEMENT) ) + if(r_properties.Has(CONSIDER_IMPLICIT_EAS_SPRISM_ELEMENT)) { mELementalFlags.Set(SolidShellElementSprism3D6N::EAS_IMPLICIT_EXPLICIT, r_properties.GetValue(CONSIDER_IMPLICIT_EAS_SPRISM_ELEMENT)); - else + } else { mELementalFlags.Set(SolidShellElementSprism3D6N::EAS_IMPLICIT_EXPLICIT, true); + } /* Total or updated lagrangian */ - if( r_properties.Has(CONSIDER_TOTAL_LAGRANGIAN_SPRISM_ELEMENT) ) + if(r_properties.Has(CONSIDER_TOTAL_LAGRANGIAN_SPRISM_ELEMENT)) { mELementalFlags.Set(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN, r_properties.GetValue(CONSIDER_TOTAL_LAGRANGIAN_SPRISM_ELEMENT)); - else + } else { mELementalFlags.Set(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN, true); + } /* Quadratic or linear element */ - if( r_properties.Has(CONSIDER_QUADRATIC_SPRISM_ELEMENT) ) + if(r_properties.Has(CONSIDER_QUADRATIC_SPRISM_ELEMENT)) { mELementalFlags.Set(SolidShellElementSprism3D6N::QUADRATIC_ELEMENT, r_properties.GetValue(CONSIDER_QUADRATIC_SPRISM_ELEMENT)); - else + } else { mELementalFlags.Set(SolidShellElementSprism3D6N::QUADRATIC_ELEMENT, true); + } /* Explicit RHS computation */ - if( r_properties.Has(PURE_EXPLICIT_RHS_COMPUTATION) ) + if(r_properties.Has(PURE_EXPLICIT_RHS_COMPUTATION)) { mELementalFlags.Set(SolidShellElementSprism3D6N::EXPLICIT_RHS_COMPUTATION, r_properties.GetValue(PURE_EXPLICIT_RHS_COMPUTATION)); - else + } else { mELementalFlags.Set(SolidShellElementSprism3D6N::EXPLICIT_RHS_COMPUTATION, false); + } // Resizing the containers mAuxContainer.resize( integration_points.size() ); - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { // Jacobian inverses - // Compute jacobian inverses and set the domain initial size: - GeometryType::JacobiansType J0; - J0 = GetGeometry().Jacobian(J0, this->GetIntegrationMethod()); + if (mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { // Jacobian inverses + // Compute jacobian inverses and set the domain initial size + const auto& r_geometry = this->GetGeometry(); /* Calculating the inverse J0 */ + Matrix J0(3, 3); for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { // Calculating and storing inverse of the jacobian and the parameters needed double aux_detJ; - MathUtils::InvertMatrix( J0[point_number], mAuxContainer[point_number], aux_detJ ); + r_geometry.Jacobian(J0, integration_points[point_number]); + MathUtils::InvertMatrix( J0, mAuxContainer[point_number], aux_detJ ); } } else { // Historic deformation gradient for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { @@ -1657,31 +1738,34 @@ void SolidShellElementSprism3D6N::CalculateElementalSystem( { KRATOS_TRY; + // Get geometries + const auto& r_geometry = this->GetGeometry(); + /* Create and initialize element variables: */ GeneralVariables general_variables; this->InitializeGeneralVariables(general_variables); /* Create constitutive law parameters: */ - ConstitutiveLaw::Parameters values(GetGeometry(),GetProperties(),rCurrentProcessInfo); + ConstitutiveLaw::Parameters values(r_geometry, GetProperties(), rCurrentProcessInfo); /* Set constitutive law flags: */ - Flags &ConstitutiveLawOptions=values.GetOptions(); + Flags& r_constitutive_law_options = values.GetOptions(); - ConstitutiveLawOptions.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_STRESS, true); + r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true); if ( rLocalSystem.CalculationFlags.IsNot(SolidShellElementSprism3D6N::COMPUTE_LHS_MATRIX) && mELementalFlags.Is(SolidShellElementSprism3D6N::EXPLICIT_RHS_COMPUTATION) ) { // Explicit calculation of the RHS and calculation of the matrix is required - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false); } else { - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, true); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, true); } /* Reading integration points */ - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); /* Getting the alpha parameter of the EAS improvement */ - double& alpha_eas = this->GetValue(ALPHA_EAS); + double& r_alpha_eas = this->GetValue(ALPHA_EAS); /* Calculate the cartesian derivatives */ CartesianDerivatives this_cartesian_derivatives; @@ -1708,12 +1792,12 @@ void SolidShellElementSprism3D6N::CalculateElementalSystem( const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; /* Assemble B */ - this->CalculateDeformationMatrix(general_variables.B, common_components, zeta_gauss, alpha_eas); + this->CalculateDeformationMatrix(general_variables.B, common_components, zeta_gauss, r_alpha_eas); // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, zeta_gauss); - // Set general variables to constitutivelaw parameters + // Set general variables to constitutive law parameters this->SetGeneralVariables(general_variables, values, point_number); // Compute stresses and constitutive parameters @@ -1724,7 +1808,7 @@ void SolidShellElementSprism3D6N::CalculateElementalSystem( /* Integrate in Zeta */ // Stresses - IntegrateStressesInZeta(general_variables, rIntegratedStress, alpha_eas, zeta_gauss, integration_weight); + IntegrateStressesInZeta(general_variables, rIntegratedStress, r_alpha_eas, zeta_gauss, integration_weight); // EAS components IntegrateEASInZeta(general_variables, EAS, zeta_gauss, integration_weight); @@ -1737,12 +1821,12 @@ void SolidShellElementSprism3D6N::CalculateElementalSystem( /* Calculate the RHS */ if ( rLocalSystem.CalculationFlags.Is(SolidShellElementSprism3D6N::COMPUTE_RHS_VECTOR) ) { // Calculation of the vector is required /* Contribution to external and internal forces */ - this->CalculateAndAddRHS ( rLocalSystem, general_variables, volume_force, rIntegratedStress, common_components, EAS, alpha_eas ); + this->CalculateAndAddRHS ( rLocalSystem, general_variables, volume_force, rIntegratedStress, common_components, EAS, r_alpha_eas ); } if ( rLocalSystem.CalculationFlags.Is(SolidShellElementSprism3D6N::COMPUTE_LHS_MATRIX) ) { // Calculation of the matrix is required /* Contribution to the tangent stiffness matrix */ - this->CalculateAndAddLHS( rLocalSystem, general_variables, values, rIntegratedStress, common_components, this_cartesian_derivatives, EAS, alpha_eas ); + this->CalculateAndAddLHS( rLocalSystem, general_variables, values, rIntegratedStress, common_components, this_cartesian_derivatives, EAS, r_alpha_eas ); } KRATOS_CATCH(""); @@ -1760,53 +1844,56 @@ void SolidShellElementSprism3D6N::PrintElementCalculation( KRATOS_INFO("SolidShellElementSprism3D6N") << " Element: " << this->Id() << std::endl; - const WeakPointerVectorNodesType& NeighbourNodes = this->GetValue(NEIGHBOUR_NODES); - const IndexType number_of_neighbours = NumberOfActiveNeighbours(NeighbourNodes); + // Get geometries and neighbour nodes + const auto& r_geometry = this->GetGeometry(); + const unsigned int number_of_nodes = r_geometry.size(); + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + const IndexType number_of_neighbours = NumberOfActiveNeighbours(r_neighbour_nodes); - for ( IndexType i = 0; i < 6; ++i ) { - const array_1d ¤t_position = GetGeometry()[i].Coordinates(); - const array_1d & current_displacement = GetGeometry()[i].FastGetSolutionStepValue(DISPLACEMENT); - const array_1d & previous_displacement = GetGeometry()[i].FastGetSolutionStepValue(DISPLACEMENT,1); - const array_1d previous_position = current_position - (current_displacement-previous_displacement); - KRATOS_INFO("SolidShellElementSprism3D6N") << " Previous Position node[" << GetGeometry()[i].Id() << "]: "<& r_current_position = r_geometry[i].Coordinates(); + const array_1d& r_current_displacement = r_geometry[i].FastGetSolutionStepValue(DISPLACEMENT); + const array_1d& r_previous_displacement = r_geometry[i].FastGetSolutionStepValue(DISPLACEMENT, 1); + const array_1d previous_position = r_current_position - (r_current_displacement - r_previous_displacement); + KRATOS_INFO("SolidShellElementSprism3D6N") << " Previous Position node[" << r_geometry[i].Id() << "]: " << previous_position << std::endl; } for ( IndexType i = 0; i < number_of_neighbours; ++i ) { - const array_1d ¤t_position = NeighbourNodes[i].Coordinates(); - const array_1d & current_displacement = NeighbourNodes[i].FastGetSolutionStepValue(DISPLACEMENT); - const array_1d & previous_displacement = NeighbourNodes[i].FastGetSolutionStepValue(DISPLACEMENT,1); - const array_1d previous_position = current_position - (current_displacement-previous_displacement); - KRATOS_INFO("SolidShellElementSprism3D6N") << " Previous Position neighbour node[" << NeighbourNodes[i].Id() << "]: "<& r_current_position = r_neighbour_nodes[i].Coordinates(); + const array_1d& r_current_displacement = r_neighbour_nodes[i].FastGetSolutionStepValue(DISPLACEMENT); + const array_1d& r_previous_displacement = r_neighbour_nodes[i].FastGetSolutionStepValue(DISPLACEMENT, 1); + const array_1d previous_position = r_current_position - (r_current_displacement - r_previous_displacement); + KRATOS_INFO("SolidShellElementSprism3D6N") << " Previous Position neighbour node[" << r_neighbour_nodes[i].Id() << "]: "< & current_position = GetGeometry()[i].Coordinates(); - KRATOS_INFO("SolidShellElementSprism3D6N") << " Current Position node[" << GetGeometry()[i].Id()<<"]: " << current_position << std::endl; + for ( IndexType i = 0; i < number_of_nodes; ++i ) { + const array_1d& r_current_position = r_geometry[i].Coordinates(); + KRATOS_INFO("SolidShellElementSprism3D6N") << " Current Position node[" << r_geometry[i].Id()<<"]: " << r_current_position << std::endl; } for ( IndexType i = 0; i < number_of_neighbours; ++i ) { - const array_1d & current_position = NeighbourNodes[i].Coordinates(); - KRATOS_INFO("SolidShellElementSprism3D6N") << " Current Position neighbour node[" << NeighbourNodes[i].Id()<<"]: " << current_position << std::endl; + const array_1d& r_current_position = r_neighbour_nodes[i].Coordinates(); + KRATOS_INFO("SolidShellElementSprism3D6N") << " Current Position neighbour node[" << r_neighbour_nodes[i].Id() <<"]: " << r_current_position << std::endl; } - for ( IndexType i = 0; i < 6; ++i ) { - const array_1d & previous_displacement = GetGeometry()[i].FastGetSolutionStepValue(DISPLACEMENT,1); - KRATOS_INFO("SolidShellElementSprism3D6N") << " Previous Displacement node[" << GetGeometry()[i].Id() << "]: " << previous_displacement << std::endl; + for ( IndexType i = 0; i < number_of_nodes; ++i ) { + const array_1d& r_previous_displacement = r_geometry[i].FastGetSolutionStepValue(DISPLACEMENT,1); + KRATOS_INFO("SolidShellElementSprism3D6N") << " Previous Displacement node[" << r_geometry[i].Id() << "]: " << r_previous_displacement << std::endl; } for ( IndexType i = 0; i < number_of_neighbours; ++i ) { - const array_1d & previous_displacement = NeighbourNodes[i].FastGetSolutionStepValue(DISPLACEMENT,1); - KRATOS_INFO("SolidShellElementSprism3D6N") << " Previous Displacement neighbour node[" << NeighbourNodes[i].Id() << "]: " << previous_displacement << std::endl; + const array_1d& r_previous_displacement = r_neighbour_nodes[i].FastGetSolutionStepValue(DISPLACEMENT,1); + KRATOS_INFO("SolidShellElementSprism3D6N") << " Previous Displacement neighbour node[" << r_neighbour_nodes[i].Id() << "]: " << r_previous_displacement << std::endl; } - for ( IndexType i = 0; i < 6; ++i ) { - const array_1d & current_displacement = GetGeometry()[i].FastGetSolutionStepValue(DISPLACEMENT); - KRATOS_INFO("SolidShellElementSprism3D6N") << " Current Displacement node[" << GetGeometry()[i].Id() << "]: " << current_displacement << std::endl; + for ( IndexType i = 0; i < number_of_nodes; ++i ) { + const array_1d& r_current_displacement = r_geometry[i].FastGetSolutionStepValue(DISPLACEMENT); + KRATOS_INFO("SolidShellElementSprism3D6N") << " Current Displacement node[" << r_geometry[i].Id() << "]: " << r_current_displacement << std::endl; } for ( IndexType i = 0; i < number_of_neighbours; ++i ) { - const array_1d & current_displacement = NeighbourNodes[i].FastGetSolutionStepValue(DISPLACEMENT); - KRATOS_INFO("SolidShellElementSprism3D6N") << " Current Displacement node[" << NeighbourNodes[i].Id() << "]: " << current_displacement << std::endl; + const array_1d& r_current_displacement = r_neighbour_nodes[i].FastGetSolutionStepValue(DISPLACEMENT); + KRATOS_INFO("SolidShellElementSprism3D6N") << " Current Displacement node[" << r_neighbour_nodes[i].Id() << "]: " << r_current_displacement << std::endl; } KRATOS_INFO("SolidShellElementSprism3D6N") << " Stress " << rVariables.StressVector << std::endl; @@ -1824,16 +1911,17 @@ void SolidShellElementSprism3D6N::PrintElementCalculation( bool SolidShellElementSprism3D6N::HasNeighbour( const IndexType Index, - const NodeType& NeighbourNode + const Node& NeighbourNode ) const { if (NeighbourNode.Id() == GetGeometry()[Index].Id()) { return false; } else { - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::QUADRATIC_ELEMENT)) + if (mELementalFlags.Is(SolidShellElementSprism3D6N::QUADRATIC_ELEMENT)) { return true; - else + } else { return false; + } } } @@ -1855,34 +1943,38 @@ std::size_t SolidShellElementSprism3D6N::NumberOfActiveNeighbours(const WeakPoin void SolidShellElementSprism3D6N::GetNodalCoordinates( BoundedMatrix & NodesCoord, - const WeakPointerVectorNodesType& NeighbourNodes, + const WeakPointerVectorNodesType& rNeighbourNodes, const Configuration ThisConfiguration ) const { - NodesCoord = ZeroMatrix(12, 3); - const IndexType number_of_neighbours = NumberOfActiveNeighbours(NeighbourNodes); + // Get geometry + const auto& r_geometry = GetGeometry(); + + // Get the number of neighbours + NodesCoord = ZeroMatrix(12, 3); + const IndexType number_of_neighbours = NumberOfActiveNeighbours(rNeighbourNodes); if (ThisConfiguration == Configuration::INITIAL) { /* Fill the aux matrix of coordinates */ for (IndexType i = 0; i < 6; ++i) { - const array_1d &initial_position = GetGeometry()[i].GetInitialPosition().Coordinates(); + const array_1d& r_initial_position = r_geometry[i].GetInitialPosition().Coordinates(); for (IndexType j = 0; j < 3; ++j) - NodesCoord(i, j) = initial_position[j]; + NodesCoord(i, j) = r_initial_position[j]; } if (number_of_neighbours == 6) { // All the possible neighbours for (IndexType i = 0; i < 6; ++i) { - const array_1d &initial_position = NeighbourNodes[i].GetInitialPosition().Coordinates(); + const array_1d& r_initial_position = rNeighbourNodes[i].GetInitialPosition().Coordinates(); for (IndexType j = 0; j < 3; ++j) - NodesCoord(i + 6, j) = initial_position[j]; + NodesCoord(i + 6, j) = r_initial_position[j]; } } else { for (IndexType i = 0; i < 6; ++i) { - if (HasNeighbour(i, NeighbourNodes[i])) { - const array_1d &initial_position = NeighbourNodes[i].GetInitialPosition().Coordinates(); + if (HasNeighbour(i, rNeighbourNodes[i])) { + const array_1d& r_initial_position = rNeighbourNodes[i].GetInitialPosition().Coordinates(); for (IndexType j = 0; j < 3; ++j) - NodesCoord(i + 6, j) = initial_position[j]; + NodesCoord(i + 6, j) = r_initial_position[j]; } else { for (IndexType j = 0; j < 3; ++j) @@ -1893,23 +1985,23 @@ void SolidShellElementSprism3D6N::GetNodalCoordinates( } else if (ThisConfiguration == Configuration::CURRENT) { /* Fill the aux matrix of coordinates */ for (IndexType i = 0; i < 6; ++i) { - const array_1d& current_position = GetGeometry()[i].Coordinates(); + const array_1d& r_current_position = r_geometry[i].Coordinates(); for (IndexType j = 0; j < 3; ++j) - NodesCoord(i, j) = current_position[j]; + NodesCoord(i, j) = r_current_position[j]; } if (number_of_neighbours == 6) { // All the possible neighours for (IndexType i = 0; i < 6; ++i) { - const array_1d& current_position = NeighbourNodes[i].Coordinates(); + const array_1d& r_current_position = rNeighbourNodes[i].Coordinates(); for (IndexType j = 0; j < 3; ++j) - NodesCoord(i + 6, j) = current_position[j]; + NodesCoord(i + 6, j) = r_current_position[j]; } } else { for (IndexType i = 0; i < 6; ++i) { - if (HasNeighbour(i, NeighbourNodes[i])) { - const array_1d& current_position = NeighbourNodes[i].Coordinates(); + if (HasNeighbour(i, rNeighbourNodes[i])) { + const array_1d& r_current_position = rNeighbourNodes[i].Coordinates(); for (IndexType j = 0; j < 3; ++j) - NodesCoord(i + 6, j) = current_position[j]; + NodesCoord(i + 6, j) = r_current_position[j]; } else { for (IndexType j = 0; j < 3; ++j) NodesCoord(i + 6, j) = 0.0; @@ -1929,7 +2021,7 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerivatives(CartesianDerivat { BoundedMatrix nodes_coord; // Coordinates of the nodes const WeakPointerVectorNodesType& neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { + if (mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { this->GetNodalCoordinates(nodes_coord, neighbour_nodes, Configuration::INITIAL); } else { this->GetNodalCoordinates(nodes_coord, neighbour_nodes, Configuration::CURRENT); @@ -2000,8 +2092,8 @@ void SolidShellElementSprism3D6N::CalculateCommonComponents( KRATOS_TRY; BoundedMatrix NodesCoord; // Coordinates of the nodes - const WeakPointerVectorNodesType& NeighbourNodes = this->GetValue(NEIGHBOUR_NODES); - this->GetNodalCoordinates(NodesCoord, NeighbourNodes, Configuration::CURRENT); + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + this->GetNodalCoordinates(NodesCoord, r_neighbour_nodes, Configuration::CURRENT); /* Declare deformation Gradient F components */ // In plane components @@ -2087,25 +2179,28 @@ void SolidShellElementSprism3D6N::CalculateLocalCoordinateSystem( { KRATOS_TRY; + // Get the geometry of the element + const auto& r_geometry = GetGeometry(); + /* Mid-surface vectors */ double norm; // TODO: Use the geometry normal when available array_1d vxe, vye; - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { - vxe[0] = 0.5 * ((GetGeometry()[2].X0() + GetGeometry()[5].X0()) - (GetGeometry()[1].X0() + GetGeometry()[4].X0())); - vxe[1] = 0.5 * ((GetGeometry()[2].Y0() + GetGeometry()[5].Y0()) - (GetGeometry()[1].Y0() + GetGeometry()[4].Y0())); - vxe[2] = 0.5 * ((GetGeometry()[2].Z0() + GetGeometry()[5].Z0()) - (GetGeometry()[1].Z0() + GetGeometry()[4].Z0())); - - vye[0] = 0.5 * ((GetGeometry()[0].X0() + GetGeometry()[3].X0()) - (GetGeometry()[2].X0() + GetGeometry()[5].X0())); - vye[1] = 0.5 * ((GetGeometry()[0].Y0() + GetGeometry()[3].Y0()) - (GetGeometry()[2].Y0() + GetGeometry()[5].Y0())); - vye[2] = 0.5 * ((GetGeometry()[0].Z0() + GetGeometry()[3].Z0()) - (GetGeometry()[2].Z0() + GetGeometry()[5].Z0())); + if (mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { + vxe[0] = 0.5 * ((r_geometry[2].X0() + r_geometry[5].X0()) - (r_geometry[1].X0() + r_geometry[4].X0())); + vxe[1] = 0.5 * ((r_geometry[2].Y0() + r_geometry[5].Y0()) - (r_geometry[1].Y0() + r_geometry[4].Y0())); + vxe[2] = 0.5 * ((r_geometry[2].Z0() + r_geometry[5].Z0()) - (r_geometry[1].Z0() + r_geometry[4].Z0())); + + vye[0] = 0.5 * ((r_geometry[0].X0() + r_geometry[3].X0()) - (r_geometry[2].X0() + r_geometry[5].X0())); + vye[1] = 0.5 * ((r_geometry[0].Y0() + r_geometry[3].Y0()) - (r_geometry[2].Y0() + r_geometry[5].Y0())); + vye[2] = 0.5 * ((r_geometry[0].Z0() + r_geometry[3].Z0()) - (r_geometry[2].Z0() + r_geometry[5].Z0())); } else { - vxe[0] = 0.5 * ((GetGeometry()[2].X() + GetGeometry()[5].X()) - (GetGeometry()[1].X() + GetGeometry()[4].X())); - vxe[1] = 0.5 * ((GetGeometry()[2].Y() + GetGeometry()[5].Y()) - (GetGeometry()[1].Y() + GetGeometry()[4].Y())); - vxe[2] = 0.5 * ((GetGeometry()[2].Z() + GetGeometry()[5].Z()) - (GetGeometry()[1].Z() + GetGeometry()[4].Z())); + vxe[0] = 0.5 * ((r_geometry[2].X() + r_geometry[5].X()) - (r_geometry[1].X() + r_geometry[4].X())); + vxe[1] = 0.5 * ((r_geometry[2].Y() + r_geometry[5].Y()) - (r_geometry[1].Y() + r_geometry[4].Y())); + vxe[2] = 0.5 * ((r_geometry[2].Z() + r_geometry[5].Z()) - (r_geometry[1].Z() + r_geometry[4].Z())); - vye[0] = 0.5 * ((GetGeometry()[0].X() + GetGeometry()[3].X()) - (GetGeometry()[2].X() + GetGeometry()[5].X())); - vye[1] = 0.5 * ((GetGeometry()[0].Y() + GetGeometry()[3].Y()) - (GetGeometry()[2].Y() + GetGeometry()[5].Y())); - vye[2] = 0.5 * ((GetGeometry()[0].Z() + GetGeometry()[3].Z()) - (GetGeometry()[2].Z() + GetGeometry()[5].Z())); + vye[0] = 0.5 * ((r_geometry[0].X() + r_geometry[3].X()) - (r_geometry[2].X() + r_geometry[5].X())); + vye[1] = 0.5 * ((r_geometry[0].Y() + r_geometry[3].Y()) - (r_geometry[2].Y() + r_geometry[5].Y())); + vye[2] = 0.5 * ((r_geometry[0].Z() + r_geometry[3].Z()) - (r_geometry[2].Z() + r_geometry[5].Z())); } MathUtils::CrossProduct(ThisOrthogonalBase.Vzeta, vxe, vye); @@ -2225,12 +2320,12 @@ void SolidShellElementSprism3D6N::CalculateIdVector(array_1d& rI { KRATOS_TRY; - const WeakPointerVectorNodesType& p_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); /* Compute ID vector */ // TODO: Optimize this IndexType index = 18; for (IndexType i = 0; i < 6; ++i) { - if (HasNeighbour(i, p_neighbour_nodes[i])) { + if (HasNeighbour(i, r_neighbour_nodes[i])) { for (IndexType j = 0; j < 3; ++j) { rIdVector[i * 3 + j] = index; ++index; @@ -2349,11 +2444,12 @@ void SolidShellElementSprism3D6N::CalculateJacobianCenterGauss( ) { /* Fill the aux matrix of coordinates */ + const auto& r_geometry = GetGeometry(); BoundedMatrix nodes_coord; for (IndexType i = 0; i < 6; ++i) { - const array_1d ¤t_position = GetGeometry()[i].Coordinates(); + const array_1d& r_current_position = r_geometry[i].Coordinates(); for (IndexType j = 0; j < 3; ++j) - nodes_coord(j, i) = current_position[j]; + nodes_coord(j, i) = r_current_position[j]; } array_1d local_coordinates; @@ -2453,26 +2549,37 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerivativesOnCenterPlane( const GeometricLevel Part ) { + // Get geometry + const auto& r_geometry = GetGeometry(); + + // Get the index of the nodes + // 0- Lower face + // 1- Upper face + // 2- Lower face + // 3- Upper face + // 4- Lower face + // 5- Upper face + // 6- Lower face const IndexType index = Part == GeometricLevel::UPPER ? 3 : 0; double norm0, norm; array_1d vxe, vye; - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { - vxe[0] = GetGeometry()[2 + index].X0() - GetGeometry()[1 + index].X0(); - vxe[1] = GetGeometry()[2 + index].Y0() - GetGeometry()[1 + index].Y0(); - vxe[2] = GetGeometry()[2 + index].Z0() - GetGeometry()[1 + index].Z0(); - - vye[0] = GetGeometry()[0 + index].X0() - GetGeometry()[2 + index].X0(); - vye[1] = GetGeometry()[0 + index].Y0() - GetGeometry()[2 + index].Y0(); - vye[2] = GetGeometry()[0 + index].Z0() - GetGeometry()[2 + index].Z0(); + if (mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { + vxe[0] = r_geometry[2 + index].X0() - r_geometry[1 + index].X0(); + vxe[1] = r_geometry[2 + index].Y0() - r_geometry[1 + index].Y0(); + vxe[2] = r_geometry[2 + index].Z0() - r_geometry[1 + index].Z0(); + + vye[0] = r_geometry[0 + index].X0() - r_geometry[2 + index].X0(); + vye[1] = r_geometry[0 + index].Y0() - r_geometry[2 + index].Y0(); + vye[2] = r_geometry[0 + index].Z0() - r_geometry[2 + index].Z0(); } else { - vxe[0] = GetGeometry()[2 + index].X() - GetGeometry()[1 + index].X(); - vxe[1] = GetGeometry()[2 + index].Y() - GetGeometry()[1 + index].Y(); - vxe[2] = GetGeometry()[2 + index].Z() - GetGeometry()[1 + index].Z(); + vxe[0] = r_geometry[2 + index].X() - r_geometry[1 + index].X(); + vxe[1] = r_geometry[2 + index].Y() - r_geometry[1 + index].Y(); + vxe[2] = r_geometry[2 + index].Z() - r_geometry[1 + index].Z(); - vye[0] = GetGeometry()[0 + index].X() - GetGeometry()[2 + index].X(); - vye[1] = GetGeometry()[0 + index].Y() - GetGeometry()[2 + index].Y(); - vye[2] = GetGeometry()[0 + index].Z() - GetGeometry()[2 + index].Z(); + vye[0] = r_geometry[0 + index].X() - r_geometry[2 + index].X(); + vye[1] = r_geometry[0 + index].Y() - r_geometry[2 + index].Y(); + vye[2] = r_geometry[0 + index].Z() - r_geometry[2 + index].Z(); } array_1d t1g, t2g, t3g; @@ -2702,8 +2809,8 @@ void SolidShellElementSprism3D6N::CalculateInPlaneGradientFGauss( noalias(InPlaneGradientFGauss) = prod(nodes_coord_aux, in_plane_cartesian_derivatives_gauss_aux); - const WeakPointerVectorNodesType& p_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - if (HasNeighbour(NodeGauss, p_neighbour_nodes[NodeGauss])) { + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + if (HasNeighbour(NodeGauss, r_neighbour_nodes[NodeGauss])) { for (IndexType j = 0; j < 3 ; ++j) { InPlaneGradientFGauss(j, 0) += NodesCoord(NodeGauss + 6 + index, j) * InPlaneCartesianDerivativesGauss(0, 3); InPlaneGradientFGauss(j, 1) += NodesCoord(NodeGauss + 6 + index, j) * InPlaneCartesianDerivativesGauss(1, 3); @@ -3087,30 +3194,34 @@ BoundedMatrix SolidShellElementSprism3D6N::GetVectorCurrentPosit BoundedMatrix vector_current_position; - const WeakPointerVectorNodesType& p_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + + // Get geometry + const auto& r_geometry = GetGeometry(); + const unsigned int number_of_nodes = r_geometry.size(); /* Element nodes */ - for (IndexType index = 0; index < 6; ++index) { - const array_1d& current_position = GetGeometry()[index].Coordinates(); + for (IndexType index = 0; index < number_of_nodes; ++index) { + const array_1d& r_current_position = r_geometry[index].Coordinates(); for (IndexType j = 0; j < 3; ++j) - vector_current_position(index * 3 + j, 0) = current_position[j]; + vector_current_position(index * 3 + j, 0) = r_current_position[j]; } /* Neighbour nodes */ - const SizeType number_of_neighbours = NumberOfActiveNeighbours(p_neighbour_nodes); + const SizeType number_of_neighbours = NumberOfActiveNeighbours(r_neighbour_nodes); if (number_of_neighbours == 6) { // All the possible neighbours - for (IndexType index = 0; index < 6; ++index) { - const array_1d& current_position = p_neighbour_nodes[index].Coordinates(); + for (IndexType index = 0; index < number_of_nodes; ++index) { + const array_1d& r_current_position = r_neighbour_nodes[index].Coordinates(); for (IndexType j = 0; j < 3; ++j) - vector_current_position(18 + index * 3 + j, 0) = current_position[j]; + vector_current_position(18 + index * 3 + j, 0) = r_current_position[j]; } } else { - for (IndexType index = 0; index < 6; ++index) { - if (HasNeighbour(index, p_neighbour_nodes[index])) { - const array_1d& current_position = p_neighbour_nodes[index].Coordinates(); + for (IndexType index = 0; index < number_of_nodes; ++index) { + if (HasNeighbour(index, r_neighbour_nodes[index])) { + const array_1d& r_current_position = r_neighbour_nodes[index].Coordinates(); for (IndexType j = 0; j < 3; ++j) - vector_current_position(18 + index * 3 + j, 0) = current_position[j]; + vector_current_position(18 + index * 3 + j, 0) = r_current_position[j]; } else { for (IndexType j = 0; j < 3; ++j) vector_current_position(18 + index * 3 + j, 0) = 0.0; @@ -3132,34 +3243,37 @@ BoundedMatrix SolidShellElementSprism3D6N::GetVectorPreviousPosi BoundedMatrix vector_current_position; - const WeakPointerVectorNodesType& p_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + + // Get geometry + const auto& r_geometry = GetGeometry(); /* Element nodes */ for (IndexType index = 0; index < 6; ++index) { - const array_1d& previous_position = GetGeometry()[index].GetInitialPosition().Coordinates() - + GetGeometry()[index].FastGetSolutionStepValue(DISPLACEMENT, 1); + const array_1d& r_previous_position = r_geometry[index].GetInitialPosition().Coordinates() + + r_geometry[index].FastGetSolutionStepValue(DISPLACEMENT, 1); for (IndexType j = 0; j < 3; ++j) - vector_current_position(index * 3 + j, 0) = previous_position[j]; + vector_current_position(index * 3 + j, 0) = r_previous_position[j]; } /* Neighbour nodes */ - const SizeType number_of_neighbours = NumberOfActiveNeighbours(p_neighbour_nodes); + const SizeType number_of_neighbours = NumberOfActiveNeighbours(r_neighbour_nodes); if (number_of_neighbours == 6) { // All the possible neighbours for (IndexType index = 0; index < 6; ++index) { - const array_1d& previous_position = p_neighbour_nodes[index].GetInitialPosition().Coordinates() - + p_neighbour_nodes[index].FastGetSolutionStepValue(DISPLACEMENT, 1); + const array_1d& r_previous_position = r_neighbour_nodes[index].GetInitialPosition().Coordinates() + + r_neighbour_nodes[index].FastGetSolutionStepValue(DISPLACEMENT, 1); for (IndexType j = 0; j < 3; ++j) - vector_current_position(18 + index * 3 + j, 0) = previous_position[j]; + vector_current_position(18 + index * 3 + j, 0) = r_previous_position[j]; } } else { for (IndexType index = 0; index < 6; ++index) { - if (HasNeighbour(index, p_neighbour_nodes[index])) { - const array_1d& previous_position = p_neighbour_nodes[index].GetInitialPosition().Coordinates() - + p_neighbour_nodes[index].FastGetSolutionStepValue(DISPLACEMENT, 1); + if (HasNeighbour(index, r_neighbour_nodes[index])) { + const array_1d& r_previous_position = r_neighbour_nodes[index].GetInitialPosition().Coordinates() + + r_neighbour_nodes[index].FastGetSolutionStepValue(DISPLACEMENT, 1); for (IndexType j = 0; j < 3; ++j) - vector_current_position(18 + index * 3 + j, 0) = previous_position[j]; + vector_current_position(18 + index * 3 + j, 0) = r_previous_position[j]; } else { for (IndexType j = 0; j < 3; ++j) vector_current_position(18 + index * 3 + j, 0) = 0.0; @@ -3236,7 +3350,7 @@ void SolidShellElementSprism3D6N::IntegrateEASInZeta( BoundedMatrix B3; BoundedMatrix D3; - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::EXPLICIT_RHS_COMPUTATION) ) { // Explicit calculation of the RHS + if (mELementalFlags.Is(SolidShellElementSprism3D6N::EXPLICIT_RHS_COMPUTATION) ) { // Explicit calculation of the RHS // Kirchoff PK2 tangent tensor const Properties& r_properties = GetProperties(); const double young_modulus = r_properties[YOUNG_MODULUS]; @@ -3299,7 +3413,7 @@ void SolidShellElementSprism3D6N::CalculateAndAddLHS( /* Calculate the Material Stiffness Matrix */ if( rLeftHandSideVariables[i] == MATERIAL_STIFFNESS_MATRIX ) { /* Reading integration points */ - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; @@ -3310,7 +3424,7 @@ void SolidShellElementSprism3D6N::CalculateAndAddLHS( // Compute element kinematics C, F ... this->CalculateKinematics(rVariables, rCommonComponents, integration_points, point_number, AlphaEAS, zeta_gauss); - // Set general variables to constitutivelaw parameters + // Set general variables to constitutive law parameters this->SetGeneralVariables(rVariables, rValues, point_number); // Compute stresses and constitutive parameters @@ -3333,7 +3447,7 @@ void SolidShellElementSprism3D6N::CalculateAndAddLHS( } /* Implicit or explicit EAS update*/ - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::EAS_IMPLICIT_EXPLICIT)) { + if (mELementalFlags.Is(SolidShellElementSprism3D6N::EAS_IMPLICIT_EXPLICIT)) { /* Apply EAS stabilization */ ApplyEASLHS(rLeftHandSideMatrices[i], rEAS); } @@ -3344,7 +3458,7 @@ void SolidShellElementSprism3D6N::CalculateAndAddLHS( MatrixType& LeftHandSideMatrix = rLocalSystem.GetLeftHandSideMatrix(); /* Reading integration points */ - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); /* Calculate the Material Stiffness Matrix */ for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { @@ -3356,7 +3470,7 @@ void SolidShellElementSprism3D6N::CalculateAndAddLHS( // Compute element kinematics C, F ... this->CalculateKinematics(rVariables, rCommonComponents, integration_points, point_number, AlphaEAS, zeta_gauss); - // Set general variables to constitutivelaw parameters + // Set general variables to constitutive law parameters this->SetGeneralVariables(rVariables, rValues, point_number); // Compute stresses and constitutive parameters @@ -3374,7 +3488,7 @@ void SolidShellElementSprism3D6N::CalculateAndAddLHS( this->CalculateAndAddKuug( LeftHandSideMatrix, rIntegratedStress, rCartesianDerivatives ); /* Implicit or explicit EAS update*/ - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::EAS_IMPLICIT_EXPLICIT)) { + if (mELementalFlags.Is(SolidShellElementSprism3D6N::EAS_IMPLICIT_EXPLICIT)) { /* Apply EAS stabilization */ ApplyEASLHS(LeftHandSideMatrix, rEAS); } @@ -3556,7 +3670,7 @@ void SolidShellElementSprism3D6N::ApplyEASLHS( void SolidShellElementSprism3D6N::ApplyEASRHS( BoundedMatrix& rRHSFull, const EASComponents& rEAS, - double& AlphaEAS + double& rAlphaEAS ) { KRATOS_TRY; @@ -3565,7 +3679,7 @@ void SolidShellElementSprism3D6N::ApplyEASRHS( noalias(rRHSFull) -= trans(rEAS.mHEAS) * rEAS.mRHSAlpha / rEAS.mStiffAlpha; /* Update ALPHA_EAS */ - AlphaEAS -= rEAS.mRHSAlpha / rEAS.mStiffAlpha; + rAlphaEAS -= rEAS.mRHSAlpha / rEAS.mStiffAlpha; KRATOS_CATCH( "" ); } @@ -3581,6 +3695,7 @@ void SolidShellElementSprism3D6N::CalculateAndAddExternalForces( { KRATOS_TRY; + // Number of nodes const IndexType number_of_nodes = GetGeometry().PointsNumber(); IndexType index; @@ -3690,8 +3805,8 @@ void SolidShellElementSprism3D6N::InitializeSystemMatrices( ) { // Resizing as needed the LHS - const WeakPointerVectorNodesType& p_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - const IndexType number_of_nodes = GetGeometry().size() + NumberOfActiveNeighbours(p_neighbour_nodes); + const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + const IndexType number_of_nodes = GetGeometry().size() + NumberOfActiveNeighbours(r_neighbour_nodes); const IndexType mat_size = number_of_nodes * 3; if ( rCalculationFlags.Is(SolidShellElementSprism3D6N::COMPUTE_LHS_MATRIX) ) {// Calculation of the matrix is required @@ -3716,7 +3831,7 @@ void SolidShellElementSprism3D6N::InitializeSystemMatrices( void SolidShellElementSprism3D6N::CalculateKinematics( GeneralVariables& rVariables, const CommonComponents& rCommonComponents, - const GeometryType::IntegrationPointsArrayType& rIntegrationPoints, + const IntegrationPointsArrayType& rIntegrationPoints, const IndexType rPointNumber, const double AlphaEAS, const double ZetaGauss @@ -3746,13 +3861,14 @@ void SolidShellElementSprism3D6N::CalculateKinematics( rVariables.detF = std::sqrt(rVariables.detF); - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { + if (mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { // PK2 stress measure rVariables.StressMeasure = ConstitutiveLaw::StressMeasure_PK2; // Jacobian Determinant for the isoparametric and numerical integration Matrix J0; - GeometryUtils::JacobianOnInitialConfiguration(GetGeometry(), rIntegrationPoints[rPointNumber], J0); + auto& r_geometry = GetGeometry(); + GeometryUtils::JacobianOnInitialConfiguration(r_geometry, rIntegrationPoints[rPointNumber], J0); rVariables.detJ = MathUtils::Det(J0); } else { // Cauchy stress measure @@ -3781,12 +3897,18 @@ void SolidShellElementSprism3D6N::CalculateDeltaPosition(Matrix & rDeltaPosition { KRATOS_TRY; - for ( IndexType i = 0; i < 6; ++i ) { - const array_1d & current_displacement = GetGeometry()[i].FastGetSolutionStepValue(DISPLACEMENT); - const array_1d & previous_displacement = GetGeometry()[i].FastGetSolutionStepValue(DISPLACEMENT, 1); + // Get geometry + const auto& r_geometry = GetGeometry(); - for ( IndexType j = 0; j < 3; ++j ) - rDeltaPosition(i,j) = current_displacement[j] - previous_displacement[j]; + // Iterate over the nodes to calculate the delta position + const IndexType number_of_nodes = r_geometry.size(); + for ( IndexType i = 0; i < number_of_nodes; ++i ) { + const array_1d& r_current_displacement = r_geometry[i].FastGetSolutionStepValue(DISPLACEMENT); + const array_1d& r_previous_displacement = r_geometry[i].FastGetSolutionStepValue(DISPLACEMENT, 1); + + for ( IndexType j = 0; j < 3; ++j ) { + rDeltaPosition(i,j) = r_current_displacement[j] - r_previous_displacement[j]; + } } KRATOS_CATCH( "" ); @@ -3814,7 +3936,7 @@ void SolidShellElementSprism3D6N::CbartoFbar( /* Decompose F */ Matrix F = ZeroMatrix(3, 3); - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { + if (mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { // Deformation Gradient F [dx_n+1/dx_n] noalias(F) = prod( rVariables.j[rPointNumber], mAuxContainer[rPointNumber] ); } else { @@ -3898,10 +4020,14 @@ void SolidShellElementSprism3D6N::InitializeGeneralVariables(GeneralVariables& r // StressMeasure_Cauchy //stress related to current configuration // StressMeasure - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) + if (mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { rVariables.StressMeasure = ConstitutiveLaw::StressMeasure_PK2; - else + } else { rVariables.StressMeasure = ConstitutiveLaw::StressMeasure_Cauchy; + } + + // Get geometry + const GeometryType& r_geometry = GetGeometry(); // Doubles rVariables.detF = 1.0; @@ -3925,34 +4051,41 @@ void SolidShellElementSprism3D6N::InitializeGeneralVariables(GeneralVariables& r rVariables.ConstitutiveMatrix = ZeroMatrix(6, 6); // Reading shape functions - rVariables.SetShapeFunctions(GetGeometry().ShapeFunctionsValues( this->GetIntegrationMethod() )); + rVariables.SetShapeFunctions(msGeometryData.ShapeFunctionsValues( this->GetIntegrationMethod() )); // Jacobians - rVariables.J.resize(1, false); - rVariables.j.resize(1, false); - rVariables.J[0] = ZeroMatrix(1, 1); - rVariables.j[0] = ZeroMatrix(1, 1); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); + const IndexType integration_point_number = integration_points.size(); + rVariables.j.resize(integration_point_number, false); // Calculating the current jacobian from cartesian coordinates to parent coordinates for all integration points [dx_n+1/d£] - rVariables.j = GetGeometry().Jacobian( rVariables.j, this->GetIntegrationMethod() ); + for (IndexType point_number = 0; point_number < integration_points.size(); ++point_number) { + r_geometry.Jacobian(rVariables.j[point_number], integration_points[point_number]); + } - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN) == false ) { + if (mELementalFlags.IsNot(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { //Calculate Delta Position - Matrix delta_position( 6 , 3); + rVariables.J.resize(integration_point_number, false); + Matrix delta_position(6, 3); this->CalculateDeltaPosition(delta_position); - rVariables.J = GetGeometry().Jacobian( rVariables.J, this->GetIntegrationMethod(), delta_position); + for (IndexType point_number = 0; point_number < integration_points.size(); ++point_number) { + r_geometry.Jacobian(rVariables.J[point_number], integration_points[point_number], delta_position); + } + } else { + rVariables.J.resize(1, false); } // Computing gradient - const IndexType integration_point_number = GetGeometry().IntegrationPointsNumber( this->GetIntegrationMethod() ); GeometryType::ShapeFunctionsGradientsType DN_DX(integration_point_number, ZeroMatrix(6, 3)); - const GeometryType::ShapeFunctionsGradientsType& DN_De = GetGeometry().ShapeFunctionsLocalGradients(this->GetIntegrationMethod()); + const GeometryType::ShapeFunctionsGradientsType& DN_De = msGeometryData.ShapeFunctionsLocalGradients(this->GetIntegrationMethod()); double detJ; Matrix inv_j; for (IndexType i_point = 0; i_point < integration_point_number; ++i_point) { MathUtils::InvertMatrix( rVariables.j[i_point], inv_j, detJ ); noalias(DN_DX[i_point]) = prod(DN_De[i_point], inv_j); } + + // Setting shape functions gradients rVariables.SetShapeFunctionsGradients(DN_DX); } @@ -3964,7 +4097,7 @@ void SolidShellElementSprism3D6N::FinalizeStepVariables( const IndexType rPointNumber ) { - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN) == false ) { + if (mELementalFlags.IsNot(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { // Update internal (historical) variables mAuxContainer[rPointNumber] = prod(rVariables.F, rVariables.F0); } @@ -3992,10 +4125,11 @@ void SolidShellElementSprism3D6N::CalculateVolumeChange( double& rVolumeChange, { KRATOS_TRY; - if ( mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN) == true ) + if (mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { rVolumeChange = 1.0; - else + } else { rVolumeChange = 1.0 / (rVariables.detF * rVariables.detF0); + } KRATOS_CATCH( "" ); } @@ -4011,19 +4145,24 @@ void SolidShellElementSprism3D6N::CalculateVolumeForce( { KRATOS_TRY; + // Ge the properties and geometry + const auto& r_properties = GetProperties(); + const auto& r_geometry = GetGeometry(); + array_1d volume_acceleration = ZeroVector(3); - if (GetProperties().Has( VOLUME_ACCELERATION )) - volume_acceleration = GetProperties()[VOLUME_ACCELERATION]; - else if( GetGeometry()[0].SolutionStepsDataHas(VOLUME_ACCELERATION) ) { - for (unsigned int i_node = 0; i_node < this->GetGeometry().size(); ++i_node) - volume_acceleration += rVariables.N[i_node] * GetGeometry()[i_node].FastGetSolutionStepValue(VOLUME_ACCELERATION); + if (r_properties.Has( VOLUME_ACCELERATION )) { + volume_acceleration = r_properties[VOLUME_ACCELERATION]; + } else if( r_geometry[0].SolutionStepsDataHas(VOLUME_ACCELERATION) ) { + for (unsigned int i_node = 0; i_node < r_geometry.size(); ++i_node) { + volume_acceleration += rVariables.N[i_node] * r_geometry[i_node].FastGetSolutionStepValue(VOLUME_ACCELERATION); + } } // Compute volume change double volume_change; this->CalculateVolumeChange( volume_change, rVariables ); - rVolumeForce += volume_acceleration * IntegrationWeight * volume_change * GetProperties()[DENSITY]; + rVolumeForce += volume_acceleration * IntegrationWeight * volume_change * r_properties[DENSITY]; KRATOS_CATCH( "" ); } @@ -4031,6 +4170,134 @@ void SolidShellElementSprism3D6N::CalculateVolumeForce( /***********************************************************************************/ /***********************************************************************************/ +const SolidShellElementSprism3D6N::IntegrationPointsContainerType SolidShellElementSprism3D6N::AllIntegrationPoints() +{ + IntegrationPointsContainerType integration_points = + { + { + Quadrature>::GenerateIntegrationPoints(), + Quadrature>::GenerateIntegrationPoints(), + Quadrature>::GenerateIntegrationPoints(), + Quadrature>::GenerateIntegrationPoints(), + Quadrature>::GenerateIntegrationPoints() + } + }; + return integration_points; +} + +/***********************************************************************************/ +/***********************************************************************************/ + +Matrix SolidShellElementSprism3D6N::CalculateShapeFunctionsIntegrationPointsValues(const IntegrationMethod ThisMethod) +{ + IntegrationPointsContainerType all_integration_points = AllIntegrationPoints(); + IntegrationPointsArrayType integration_points = all_integration_points[static_cast(ThisMethod)]; + // Number of integration points + const int integration_points_number = integration_points.size(); + // Number of nodes in current geometry + const int points_number = 6; + // Setting up return matrix + Matrix shape_function_values( integration_points_number, points_number ); + + // Loop over all integration points + for ( int pnt = 0; pnt < integration_points_number; pnt++ ) { + shape_function_values( pnt, 0 ) = ( 1.0 + - integration_points[pnt].X() + - integration_points[pnt].Y() + - integration_points[pnt].Z() + + ( integration_points[pnt].X() * integration_points[pnt].Z() ) + + ( integration_points[pnt].Y() * integration_points[pnt].Z() ) ); + shape_function_values( pnt, 1 ) = integration_points[pnt].X() + - ( integration_points[pnt].X() * integration_points[pnt].Z() ); + shape_function_values( pnt, 2 ) = integration_points[pnt].Y() + - ( integration_points[pnt].Y() * integration_points[pnt].Z() ); + shape_function_values( pnt, 3 ) = integration_points[pnt].Z() + - ( integration_points[pnt].X() * integration_points[pnt].Z() ) + - ( integration_points[pnt].Y() * integration_points[pnt].Z() ); + shape_function_values( pnt, 4 ) = ( integration_points[pnt].X() * integration_points[pnt].Z() ); + shape_function_values( pnt, 5 ) = ( integration_points[pnt].Y() * integration_points[pnt].Z() ); + } + + return shape_function_values; +} + +/***********************************************************************************/ +/***********************************************************************************/ + +const SolidShellElementSprism3D6N::ShapeFunctionsValuesContainerType SolidShellElementSprism3D6N::AllShapeFunctionsValues() +{ + ShapeFunctionsValuesContainerType shape_functions_values = + { + { + CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_1 ), + CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_2 ), + CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_3 ), + CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_4 ), + CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_5 ) + } + }; + return shape_functions_values; +} + +/***********************************************************************************/ +/***********************************************************************************/ + +SolidShellElementSprism3D6N::ShapeFunctionsGradientsType SolidShellElementSprism3D6N::CalculateShapeFunctionsIntegrationPointsLocalGradients(const IntegrationMethod ThisMethod ) +{ + IntegrationPointsContainerType all_integration_points = AllIntegrationPoints(); + IntegrationPointsArrayType integration_points = all_integration_points[static_cast(ThisMethod)]; + // Number of integration points + const int integration_points_number = integration_points.size(); + ShapeFunctionsGradientsType d_shape_f_values( integration_points_number ); + // Initialising container + // Loop over all integration points + Matrix result( 6, 3 ); + for (unsigned int pnt = 0; pnt < integration_points_number; pnt++ ) { + result( 0, 0 ) = -1.0 + integration_points[pnt].Z(); + result( 0, 1 ) = -1.0 + integration_points[pnt].Z(); + result( 0, 2 ) = -1.0 + integration_points[pnt].X() + integration_points[pnt].Y(); + result( 1, 0 ) = 1.0 - integration_points[pnt].Z(); + result( 1, 1 ) = 0.0; + result( 1, 2 ) = -integration_points[pnt].X(); + result( 2, 0 ) = 0.0; + result( 2, 1 ) = 1.0 - integration_points[pnt].Z(); + result( 2, 2 ) = -integration_points[pnt].Y(); + result( 3, 0 ) = -integration_points[pnt].Z(); + result( 3, 1 ) = -integration_points[pnt].Z(); + result( 3, 2 ) = 1.0 - integration_points[pnt].X() - integration_points[pnt].Y(); + result( 4, 0 ) = integration_points[pnt].Z(); + result( 4, 1 ) = 0.0; + result( 4, 2 ) = integration_points[pnt].X(); + result( 5, 0 ) = 0.0; + result( 5, 1 ) = integration_points[pnt].Z(); + result( 5, 2 ) = integration_points[pnt].Y(); + d_shape_f_values[pnt] = result; + } + + return d_shape_f_values; +} + +/***********************************************************************************/ +/***********************************************************************************/ + +const SolidShellElementSprism3D6N::ShapeFunctionsLocalGradientsContainerType SolidShellElementSprism3D6N::AllShapeFunctionsLocalGradients() +{ + ShapeFunctionsLocalGradientsContainerType shape_functions_local_gradients = + { + { + CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_1 ), + CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_2 ), + CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_3 ), + CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_4 ), + CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_5 ) + } + }; + return shape_functions_local_gradients; +} + +/***********************************************************************************/ +/***********************************************************************************/ + void SolidShellElementSprism3D6N::save( Serializer& rSerializer ) const { KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, BaseSolidElement); diff --git a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h index c16812a18e5e..eefc2df2c493 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h +++ b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h @@ -74,31 +74,52 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N KRATOS_DEFINE_LOCAL_FLAG( EXPLICIT_RHS_COMPUTATION ); // True means elastic behaviour for stabilization ///Reference type definition for constitutive laws - typedef ConstitutiveLaw ConstitutiveLawType; + using ConstitutiveLawType = ConstitutiveLaw; ///Pointer type for constitutive laws - typedef ConstitutiveLawType::Pointer ConstitutiveLawPointerType; + using ConstitutiveLawPointerType = ConstitutiveLawType::Pointer; ///StressMeasure from constitutive laws - typedef ConstitutiveLawType::StressMeasure StressMeasureType; + using StressMeasureType = ConstitutiveLawType::StressMeasure; ///Type definition for integration methods - typedef GeometryData::IntegrationMethod IntegrationMethod; - - /// This is the definition of the node. - typedef Node NodeType; + using IntegrationMethod = GeometryData::IntegrationMethod; /// The base element type - typedef BaseSolidElement BaseType; + using BaseType = BaseSolidElement; /// The definition of the index type - typedef std::size_t IndexType; + using IndexType = std::size_t; /// The definition of the sizetype - typedef std::size_t SizeType; + using SizeType = std::size_t; + + /// The definition of the geometry type + using GeometryType = Geometry; + + /// The definition of the coordinates array type + using CoordinatesArrayType = GeometryType::CoordinatesArrayType; + + /// The vector containing the weak pointers to the nodes + using WeakPointerVectorNodesType = GlobalPointersVector; + + /// Integration methods implemented in geometry. + using IntegrationMethod = GeometryType::IntegrationMethod; + + /// The definition of the integration points array type + using IntegrationPointsArrayType = GeometryType::IntegrationPointsArrayType; + + /// The integration points array type + using IntegrationPointsContainerType = GeometryType::IntegrationPointsContainerType; - // The vector containing the weak pointers to the nodes - typedef GlobalPointersVector WeakPointerVectorNodesType; + /// A third order tensor used as shape functions' values container. + using ShapeFunctionsValuesContainerType = GeometryType::ShapeFunctionsValuesContainerType; + + /// A third order tensor to hold shape functions' gradients. ShapefunctionsGradients function return this type as its result. + using ShapeFunctionsGradientsType = GeometryType::ShapeFunctionsGradientsType; + + /// A fourth order tensor used as shape functions' local gradients container in geometry. + using ShapeFunctionsLocalGradientsContainerType = GeometryType::ShapeFunctionsLocalGradientsContainerType; /// Counted pointer of SolidShellElementSprism3D6N KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(SolidShellElementSprism3D6N); @@ -108,21 +129,21 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N ///@{ /** - * @brief This enum is defined in oder to difereniate between initial (TL) and current (UL) configuration + * @brief This enum is defined in oder to differentiate between initial (TL) and current (UL) configuration */ enum class Configuration {INITIAL = 0, CURRENT = 1}; /** - * @brief To differtiate between center, lower part and upper part + * @brief To differentiate between center, lower part and upper part */ enum class GeometricLevel {LOWER = 0, CENTER = 5, UPPER = 9}; /** - * @brief To differtiate between the different possible orthogonal bases + * @brief To differentiate between the different possible orthogonal bases * @details Then: - * - 0- If X is the prefered normal vector - * - 1- If Y is the prefered normal vector - * - 2- If Z is the prefered normal vector + * - 0- If X is the preferred normal vector + * - 1- If Y is the preferred normal vector + * - 2- If Z is the preferred normal vector */ enum class OrthogonalBaseApproach {X = 0, Y = 1, Z = 2}; @@ -130,26 +151,35 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N ///@name Life Cycle ///@{ - /* A private default constructor necessary for serialization */ + //// A private default constructor necessary for serialization SolidShellElementSprism3D6N(); - /* Constructor using an array of nodes */ + /** + * @brief Constructor using an array of nodes + * @param NewId The Id of the new created element + * @param pGeometry The pointer to the geometry of the element + */ SolidShellElementSprism3D6N(IndexType NewId, GeometryType::Pointer pGeometry); - /* Constructor using an array of nodes with properties */ + /** + * @brief Constructor using an array of nodes with properties + * @param NewId The Id of the new created element + * @param pGeometry The pointer to the geometry of the element + * @param pProperties The pointer to the properties of the element + */ SolidShellElementSprism3D6N(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties); - /* Copy constructor */ + /// Copy constructor SolidShellElementSprism3D6N(SolidShellElementSprism3D6N const& rOther); - /* Destructor */ + /// Destructor ~SolidShellElementSprism3D6N() override; ///@} ///@name Operators ///@{ - /// - /* Assignment operator */ + + /// Assignment operator SolidShellElementSprism3D6N& operator=(SolidShellElementSprism3D6N const& rOther); ///@} @@ -744,12 +774,11 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N }; /** - * This struct is used in the component wise calculation only + * @brief This struct is used in the component wise calculation only * is defined here and is used to declare a member variable in the component wise elements * private pointers can only be accessed by means of set and get functions * this allows to set and not copy the local system variables */ - struct LocalSystemComponents { private: @@ -795,7 +824,6 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N }; ///@{ - ///@name Protected static Member Variables ///@{ @@ -849,7 +877,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N */ bool HasNeighbour( const IndexType Index, - const NodeType& NeighbourNode + const Node& NeighbourNode ) const ; /** @@ -857,14 +885,14 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N * @param pNeighbourNodes The neighbours nodes * @return An integer with the number of neighbours of the node */ - std::size_t NumberOfActiveNeighbours(const GlobalPointersVector< NodeType >& pNeighbourNodes) const; + std::size_t NumberOfActiveNeighbours(const GlobalPointersVector< Node >& pNeighbourNodes) const; /** * @brief It gets the nodal coordinates, according to the configutaion */ void GetNodalCoordinates( BoundedMatrix& NodesCoord, - const GlobalPointersVector< NodeType >& pNeighbourNodes, + const GlobalPointersVector< Node >& pNeighbourNodes, const Configuration ThisConfiguration ) const; @@ -1271,12 +1299,12 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N * @brief Update the RHS of the system with the EAS and the internal variable alpha * @param rRHSFull The full internal forces vector * @param rEAS The components of the EAS stabilization - * @param AlphaEAS The internal variable for the EAS + * @param rAlphaEAS The internal variable for the EAS */ void ApplyEASRHS( BoundedMatrix& rRHSFull, const EASComponents& rEAS, - double& AlphaEAS + double& rAlphaEAS ); /** @@ -1345,7 +1373,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N void CalculateKinematics( GeneralVariables& rVariables, const CommonComponents& rCommonComponents, - const GeometryType::IntegrationPointsArrayType& rIntegrationPoints, + const IntegrationPointsArrayType& rIntegrationPoints, const IndexType rPointNumber, const double AlphaEAS, const double ZetaGauss @@ -1423,27 +1451,89 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N const double IntegrationWeight ); + /** + * @brief Retrieves all integration points associated with the solid shell element. + * @details This static function constructs and returns a container holding the integration points used in the solid shell element's numerical integration process. The integration points are intended to be generated via specific quadrature rules tailored to prism elements. + * @return IntegrationPointsContainerType A container with all the integration points required for this element. + */ + static const IntegrationPointsContainerType AllIntegrationPoints(); + + /** + * @brief Calculates the values of all shape function in all integration points. + * @details Integration points are expected to be given in local coordinates + * @param ThisMethod the current integration method + * @return the matrix of values of every shape function in each integration point + */ + static Matrix CalculateShapeFunctionsIntegrationPointsValues(const IntegrationMethod ThisMethod); + + /** + * @brief Generates a container with precomputed shape functions values. + * @details This function evaluates and collects the shape function values at integration points + * for various Gauss integration methods. It calls the function + * CalculateShapeFunctionsIntegrationPointsValues() for each of the following methods: + * - GI_GAUSS_1 + * - GI_GAUSS_2 + * - GI_GAUSS_3 + * - GI_GAUSS_4 + * - GI_GAUSS_5 + * The results are stored in a ShapeFunctionsValuesContainerType, with each element + * corresponding to the shape function values for a specific Gauss integration method. + * @return ShapeFunctionsValuesContainerType containing the shape functions values + * evaluated at the respective integration points. + */ + static const ShapeFunctionsValuesContainerType AllShapeFunctionsValues(); + + /** + * @brief Calculates the local gradients of all shape functions in all integration points. + * @details Integration points are expected to be given in local coordinates + * @param ThisMethod the current integration method + * @return The vector of the gradients of all shape functions in each integration point + */ + static ShapeFunctionsGradientsType + CalculateShapeFunctionsIntegrationPointsLocalGradients(const IntegrationMethod ThisMethod); + + /** + * @brief Computes and returns a container with local gradients for shape functions. + * @details This function calculates the local gradients of the shape functions used by the element at various integration points determined by different Gauss integration methods. It generates the local gradients for each of the predefined integration methods (GI_GAUSS_1 to GI_GAUSS_5) and stores them in a container. + * @return ShapeFunctionsLocalGradientsContainerType A container holding the local gradients for each + * integration point corresponding to the different Gauss integration methods. + */ + static const ShapeFunctionsLocalGradientsContainerType AllShapeFunctionsLocalGradients(); + ///@} ///@name Protected Access ///@{ + ///@} ///@name Protected Inquiry ///@{ + ///@} ///@name Protected LifeCycle ///@{ - ///@} + ///@} private: - ///@name Static Member Variables ///@{ + + inline static const GeometryDimension msGeometryDimension = GeometryDimension(3, 3); /// Dimension of the geometry + inline static const GeometryData msGeometryData = GeometryData( + &msGeometryDimension, + GeometryData::IntegrationMethod::GI_GAUSS_1, + AllIntegrationPoints(), + AllShapeFunctionsValues(), + AllShapeFunctionsLocalGradients() + ); /// Geometry data + ///@} ///@name Member Variables ///@{ + ///@} ///@name Private Operators ///@{ + ///@} ///@name Private Operations ///@{ @@ -1461,7 +1551,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N std::vector& rOutput ) { - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); for ( IndexType point_number = 0; point_number GetValue( rVariable,rOutput[point_number]); @@ -1497,7 +1587,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_STRESS); /* Reading integration points */ - const GeometryType::IntegrationPointsArrayType& integration_points = GetGeometry().IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); double& alpha_eas = this->GetValue(ALPHA_EAS); @@ -1531,10 +1621,11 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N ///@} ///@name Private Access ///@{ - ///@} + ///@} ///@name Serialization ///@{ + friend class Serializer; /** @@ -1544,16 +1635,17 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N void load(Serializer& rSerializer) override; - // Constructor + ///@} }; // class SolidShellElementSprism3D6N. ///@} ///@name Type Definitions ///@{ + ///@} ///@name Input and output ///@{ -///@} +///@} } // namespace Kratos. From dbf71f96ddf7a157987cbe6c17765279b664c30c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicente=20Mataix=20Ferr=C3=A1ndiz?= Date: Tue, 20 May 2025 00:25:43 +0200 Subject: [PATCH 3/9] Fix --- .../solid_shell_element_sprism_3D6N.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h index eefc2df2c493..c019a633c31e 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h +++ b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h @@ -73,17 +73,17 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N KRATOS_DEFINE_LOCAL_FLAG( QUADRATIC_ELEMENT ); // True means quadratic in-plane behaviour KRATOS_DEFINE_LOCAL_FLAG( EXPLICIT_RHS_COMPUTATION ); // True means elastic behaviour for stabilization - ///Reference type definition for constitutive laws + /// Reference type definition for constitutive laws using ConstitutiveLawType = ConstitutiveLaw; - ///Pointer type for constitutive laws + /// Pointer type for constitutive laws using ConstitutiveLawPointerType = ConstitutiveLawType::Pointer; - ///StressMeasure from constitutive laws + /// StressMeasure from constitutive laws using StressMeasureType = ConstitutiveLawType::StressMeasure; - ///Type definition for integration methods - using IntegrationMethod = GeometryData::IntegrationMethod; + /// Integration methods implemented in geometry. + using IntegrationMethod = GeometryType::IntegrationMethod; /// The base element type using BaseType = BaseSolidElement; @@ -103,9 +103,6 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N /// The vector containing the weak pointers to the nodes using WeakPointerVectorNodesType = GlobalPointersVector; - /// Integration methods implemented in geometry. - using IntegrationMethod = GeometryType::IntegrationMethod; - /// The definition of the integration points array type using IntegrationPointsArrayType = GeometryType::IntegrationPointsArrayType; From 0c817daffb6c13b96fca53b7feba7518ca17e711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicente=20Mataix=20Ferr=C3=A1ndiz?= Date: Tue, 20 May 2025 11:44:02 +0200 Subject: [PATCH 4/9] Fix variable types in SolidShellElementSprism3D6N for consistency and clarity --- .../solid_shell_element_sprism_3D6N.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp index f8d43320e243..3dbc58424869 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp +++ b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp @@ -271,7 +271,7 @@ void SolidShellElementSprism3D6N::GetValuesVector( } // Neighbour nodes - for (int i = 0; i < r_geometry.size(); ++i) { + for (unsigned int i = 0; i < r_geometry.size(); ++i) { if (HasNeighbour(i, r_neighbour_nodes[i])) { const array_1d& r_displacement = r_neighbour_nodes[i].FastGetSolutionStepValue(DISPLACEMENT, Step); for (IndexType j = 0; j < 3; ++j) { @@ -313,7 +313,7 @@ void SolidShellElementSprism3D6N::GetFirstDerivativesVector( } // Neighbour nodes - for (int i = 0; i < r_geometry.size(); ++i) { + for (unsigned int i = 0; i < r_geometry.size(); ++i) { if (HasNeighbour(i, r_neighbour_nodes[i])) { const array_1d& r_velocity = r_neighbour_nodes[i].FastGetSolutionStepValue(VELOCITY, Step); for (IndexType j = 0; j < 3; ++j) { @@ -356,7 +356,7 @@ void SolidShellElementSprism3D6N::GetSecondDerivativesVector( } // Neighbour nodes - for (int i = 0; i < r_geometry.size(); ++i) { + for (unsigned int i = 0; i < r_geometry.size(); ++i) { if (HasNeighbour(i, r_neighbour_nodes[i])) { const array_1d& r_acceleration = r_neighbour_nodes[i].FastGetSolutionStepValue(ACCELERATION, Step); for (IndexType j = 0; j < 3; ++j) { @@ -666,9 +666,7 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( { KRATOS_TRY; - // Get geometry - const auto& r_geometry = GetGeometry(); - + // Get the integration points number const IndexType integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); if ( rOutput.size() != integration_point_number ) { @@ -4252,7 +4250,7 @@ SolidShellElementSprism3D6N::ShapeFunctionsGradientsType SolidShellElementSprism // Initialising container // Loop over all integration points Matrix result( 6, 3 ); - for (unsigned int pnt = 0; pnt < integration_points_number; pnt++ ) { + for (int pnt = 0; pnt < integration_points_number; pnt++ ) { result( 0, 0 ) = -1.0 + integration_points[pnt].Z(); result( 0, 1 ) = -1.0 + integration_points[pnt].Z(); result( 0, 2 ) = -1.0 + integration_points[pnt].X() + integration_points[pnt].Y(); From 45ccb1b7032a1b5c5c908c5516c6f306578f4694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicente=20Mataix=20Ferr=C3=A1ndiz?= Date: Tue, 20 May 2025 11:50:37 +0200 Subject: [PATCH 5/9] Make it private --- .../solid_shell_element_sprism_3D6N.h | 124 +++++++++--------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h index c019a633c31e..7f4af7351e74 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h +++ b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h @@ -1448,55 +1448,6 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N const double IntegrationWeight ); - /** - * @brief Retrieves all integration points associated with the solid shell element. - * @details This static function constructs and returns a container holding the integration points used in the solid shell element's numerical integration process. The integration points are intended to be generated via specific quadrature rules tailored to prism elements. - * @return IntegrationPointsContainerType A container with all the integration points required for this element. - */ - static const IntegrationPointsContainerType AllIntegrationPoints(); - - /** - * @brief Calculates the values of all shape function in all integration points. - * @details Integration points are expected to be given in local coordinates - * @param ThisMethod the current integration method - * @return the matrix of values of every shape function in each integration point - */ - static Matrix CalculateShapeFunctionsIntegrationPointsValues(const IntegrationMethod ThisMethod); - - /** - * @brief Generates a container with precomputed shape functions values. - * @details This function evaluates and collects the shape function values at integration points - * for various Gauss integration methods. It calls the function - * CalculateShapeFunctionsIntegrationPointsValues() for each of the following methods: - * - GI_GAUSS_1 - * - GI_GAUSS_2 - * - GI_GAUSS_3 - * - GI_GAUSS_4 - * - GI_GAUSS_5 - * The results are stored in a ShapeFunctionsValuesContainerType, with each element - * corresponding to the shape function values for a specific Gauss integration method. - * @return ShapeFunctionsValuesContainerType containing the shape functions values - * evaluated at the respective integration points. - */ - static const ShapeFunctionsValuesContainerType AllShapeFunctionsValues(); - - /** - * @brief Calculates the local gradients of all shape functions in all integration points. - * @details Integration points are expected to be given in local coordinates - * @param ThisMethod the current integration method - * @return The vector of the gradients of all shape functions in each integration point - */ - static ShapeFunctionsGradientsType - CalculateShapeFunctionsIntegrationPointsLocalGradients(const IntegrationMethod ThisMethod); - - /** - * @brief Computes and returns a container with local gradients for shape functions. - * @details This function calculates the local gradients of the shape functions used by the element at various integration points determined by different Gauss integration methods. It generates the local gradients for each of the predefined integration methods (GI_GAUSS_1 to GI_GAUSS_5) and stores them in a container. - * @return ShapeFunctionsLocalGradientsContainerType A container holding the local gradients for each - * integration point corresponding to the different Gauss integration methods. - */ - static const ShapeFunctionsLocalGradientsContainerType AllShapeFunctionsLocalGradients(); - ///@} ///@name Protected Access ///@{ @@ -1511,19 +1462,6 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N ///@} private: - ///@name Static Member Variables - ///@{ - - inline static const GeometryDimension msGeometryDimension = GeometryDimension(3, 3); /// Dimension of the geometry - inline static const GeometryData msGeometryData = GeometryData( - &msGeometryDimension, - GeometryData::IntegrationMethod::GI_GAUSS_1, - AllIntegrationPoints(), - AllShapeFunctionsValues(), - AllShapeFunctionsLocalGradients() - ); /// Geometry data - - ///@} ///@name Member Variables ///@{ @@ -1615,6 +1553,68 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N } } + /** + * @brief Retrieves all integration points associated with the solid shell element. + * @details This static function constructs and returns a container holding the integration points used in the solid shell element's numerical integration process. The integration points are intended to be generated via specific quadrature rules tailored to prism elements. + * @return IntegrationPointsContainerType A container with all the integration points required for this element. + */ + static const IntegrationPointsContainerType AllIntegrationPoints(); + + /** + * @brief Calculates the values of all shape function in all integration points. + * @details Integration points are expected to be given in local coordinates + * @param ThisMethod the current integration method + * @return the matrix of values of every shape function in each integration point + */ + static Matrix CalculateShapeFunctionsIntegrationPointsValues(const IntegrationMethod ThisMethod); + + /** + * @brief Generates a container with precomputed shape functions values. + * @details This function evaluates and collects the shape function values at integration points + * for various Gauss integration methods. It calls the function + * CalculateShapeFunctionsIntegrationPointsValues() for each of the following methods: + * - GI_GAUSS_1 + * - GI_GAUSS_2 + * - GI_GAUSS_3 + * - GI_GAUSS_4 + * - GI_GAUSS_5 + * The results are stored in a ShapeFunctionsValuesContainerType, with each element + * corresponding to the shape function values for a specific Gauss integration method. + * @return ShapeFunctionsValuesContainerType containing the shape functions values + * evaluated at the respective integration points. + */ + static const ShapeFunctionsValuesContainerType AllShapeFunctionsValues(); + + /** + * @brief Calculates the local gradients of all shape functions in all integration points. + * @details Integration points are expected to be given in local coordinates + * @param ThisMethod the current integration method + * @return The vector of the gradients of all shape functions in each integration point + */ + static ShapeFunctionsGradientsType + CalculateShapeFunctionsIntegrationPointsLocalGradients(const IntegrationMethod ThisMethod); + + /** + * @brief Computes and returns a container with local gradients for shape functions. + * @details This function calculates the local gradients of the shape functions used by the element at various integration points determined by different Gauss integration methods. It generates the local gradients for each of the predefined integration methods (GI_GAUSS_1 to GI_GAUSS_5) and stores them in a container. + * @return ShapeFunctionsLocalGradientsContainerType A container holding the local gradients for each + * integration point corresponding to the different Gauss integration methods. + */ + static const ShapeFunctionsLocalGradientsContainerType AllShapeFunctionsLocalGradients(); + + ///@} + ///@name Static Member Variables + ///@{ + + inline static const GeometryDimension msGeometryDimension = GeometryDimension(3, 3); /// Dimension of the geometry + inline static const GeometryData msGeometryData = GeometryData( + &msGeometryDimension, + GeometryData::IntegrationMethod::GI_GAUSS_1, + AllIntegrationPoints(), + AllShapeFunctionsValues(), + AllShapeFunctionsLocalGradients() + ); /// Geometry data + ///@} ///@name Private Access ///@{ From b46c0f5f3270112620c37530f3b058b5d484490a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicente=20Mataix=20Ferr=C3=A1ndiz?= Date: Tue, 20 May 2025 12:34:47 +0200 Subject: [PATCH 6/9] More hardcoded --- .../solid_shell_element_sprism_3D6N.cpp | 94 +++++++++- .../solid_shell_element_sprism_3D6N.h | 163 ++++++++++++++++++ 2 files changed, 251 insertions(+), 6 deletions(-) diff --git a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp index 3dbc58424869..4c073a193669 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp +++ b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp @@ -17,7 +17,6 @@ #include "includes/checks.h" #include "includes/global_pointer_variables.h" #include "input_output/logger.h" -#include "integration/prism_gauss_legendre_integration_points.h" #include "utilities/geometry_utilities.h" #include "custom_utilities/constitutive_law_utilities.h" #include "custom_utilities/structural_mechanics_element_utilities.h" @@ -4173,11 +4172,11 @@ const SolidShellElementSprism3D6N::IntegrationPointsContainerType SolidShellElem IntegrationPointsContainerType integration_points = { { - Quadrature>::GenerateIntegrationPoints(), - Quadrature>::GenerateIntegrationPoints(), - Quadrature>::GenerateIntegrationPoints(), - Quadrature>::GenerateIntegrationPoints(), - Quadrature>::GenerateIntegrationPoints() + Quadrature>::GenerateIntegrationPoints(), + Quadrature>::GenerateIntegrationPoints(), + Quadrature>::GenerateIntegrationPoints(), + Quadrature>::GenerateIntegrationPoints(), + Quadrature>::GenerateIntegrationPoints() } }; return integration_points; @@ -4313,4 +4312,87 @@ void SolidShellElementSprism3D6N::load( Serializer& rSerializer ) rSerializer.load("HistoricalF0",mAuxContainer); } +/***********************************************************************************/ +/***********************************************************************************/ + +const PrismGaussLegendreIntegrationPointsInAxis1::IntegrationPointsArrayType& PrismGaussLegendreIntegrationPointsInAxis1::IntegrationPoints() +{ + static constexpr double one_third = 1.0 / 3.0; + static const IntegrationPointsArrayType s_integration_points{{ + IntegrationPointType( one_third , one_third, 0.2113248654051871177454 , 0.25 ), + IntegrationPointType( one_third , one_third, 0.7886751345948128822546 , 0.25 ) + }}; + return s_integration_points; +} + +/***********************************************************************************/ +/***********************************************************************************/ + +const PrismGaussLegendreIntegrationPointsInAxis2::IntegrationPointsArrayType& PrismGaussLegendreIntegrationPointsInAxis2::IntegrationPoints() +{ + static constexpr double one_third = 1.0 / 3.0; + static const IntegrationPointsArrayType s_integration_points{{ + IntegrationPointType( one_third , one_third, 0.1127016653792583114821 , 0.1388888888888888889 ), + IntegrationPointType( one_third , one_third, 0.5 , 0.2222222222222222222 ), + IntegrationPointType( one_third , one_third, 0.8872983346207416885180 , 0.1388888888888888889 ) + }}; + return s_integration_points; +} + +/***********************************************************************************/ +/***********************************************************************************/ + +const PrismGaussLegendreIntegrationPointsInAxis3::IntegrationPointsArrayType& PrismGaussLegendreIntegrationPointsInAxis3::IntegrationPoints() +{ + static constexpr double one_third = 1.0 / 3.0; + static const IntegrationPointsArrayType s_integration_points{{ + IntegrationPointType( one_third , one_third, 0.0469100770306680036012 , 0.0592317212640472718 ), + IntegrationPointType( one_third , one_third, 0.2307653449471584544819 , 0.1196571676248416170 ), + IntegrationPointType( one_third , one_third, 0.5 , 0.1422222222222222222 ), + IntegrationPointType( one_third , one_third, 0.7692346550528415455182 , 0.1196571676248416170 ), + IntegrationPointType( one_third , one_third, 0.9530899229693319963988 , 0.0592317212640472718 ) + }}; + return s_integration_points; +} + +/***********************************************************************************/ +/***********************************************************************************/ + +const PrismGaussLegendreIntegrationPointsInAxis4::IntegrationPointsArrayType& PrismGaussLegendreIntegrationPointsInAxis4::IntegrationPoints() +{ + static constexpr double one_third = 1.0 / 3.0; + static const IntegrationPointsArrayType s_integration_points{{ + IntegrationPointType( one_third , one_third, 0.0254460438286207377369 , 0.0261224489795918367347 ), + IntegrationPointType( one_third , one_third, 0.1292344072003027800681 , 0.069926347872319166975 ), + IntegrationPointType( one_third , one_third, 0.2970774243113014165467 , 0.09545751262627973624 ), + IntegrationPointType( one_third , one_third, 0.5 , 0.1044897959183673469388 ), + IntegrationPointType( one_third , one_third, 0.7029225756886985834533 , 0.09545751262627973624 ), + IntegrationPointType( one_third , one_third, 0.8707655927996972199320 , 0.069926347872319166975 ), + IntegrationPointType( one_third , one_third, 0.9745539561713792622631 , 0.0261224489795918367347 ) + }}; + return s_integration_points; +} + +/***********************************************************************************/ +/***********************************************************************************/ + +const PrismGaussLegendreIntegrationPointsInAxis5::IntegrationPointsArrayType& PrismGaussLegendreIntegrationPointsInAxis5::IntegrationPoints() +{ + static constexpr double one_third = 1.0 / 3.0; + static const IntegrationPointsArrayType s_integration_points{{ + IntegrationPointType( one_third , one_third, 0.0108856709269715035981 , 0.0139171417790434166207 ), + IntegrationPointType( one_third , one_third, 0.0564687001159523504624 , 0.031395092366226156159 ), + IntegrationPointType( one_third , one_third, 0.1349239972129753379533 , 0.0465725527319335628565 ), + IntegrationPointType( one_third , one_third, 0.2404519353965940920372 , 0.058298441147997619980 ), + IntegrationPointType( one_third , one_third, 0.3652284220238275138343 , 0.065701136127561665545 ), + IntegrationPointType( one_third , one_third, 0.5 , 0.0682312716944751576786 ), + IntegrationPointType( one_third , one_third, 0.6347715779761724861657 , 0.065701136127561665545 ), + IntegrationPointType( one_third , one_third, 0.7595480646034059079628 , 0.058298441147997619980 ), + IntegrationPointType( one_third , one_third, 0.8650760027870246620467 , 0.0465725527319335628565 ), + IntegrationPointType( one_third , one_third, 0.9435312998840476495376 , 0.031395092366226156159 ), + IntegrationPointType( one_third , one_third, 0.9891143290730284964020 , 0.0139171417790434166207 ) + }}; + return s_integration_points; +} + } // Namespace Kratos. diff --git a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h index 7f4af7351e74..bf1199d33513 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h +++ b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h @@ -16,6 +16,7 @@ // External includes // Project includes +#include "integration/quadrature.h" #include "base_solid_element.h" #include "structural_mechanics_application_variables.h" #include "custom_utilities/structural_mechanics_math_utilities.hpp" @@ -1636,6 +1637,168 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N }; // class SolidShellElementSprism3D6N. +/* For the formulation SPRISM we just consider one integration point in the plane */ + +class PrismGaussLegendreIntegrationPointsInAxis1 +{ +public: + KRATOS_CLASS_POINTER_DEFINITION(PrismGaussLegendreIntegrationPointsInAxis1); + + using SizeType = std::size_t; + + static const unsigned int Dimension = 3; + + using IntegrationPointType = IntegrationPoint<3>; + + using IntegrationPointsArrayType = std::array; + + using PointType = IntegrationPointType::PointType; + + static SizeType IntegrationPointsNumber() + { + return 2; + } + + static const IntegrationPointsArrayType& IntegrationPoints(); + + std::string Info() const + { + std::stringstream buffer; + buffer << "Prism Gauss-Legendre quadrature 2, 1 point in plane"; + return buffer.str(); + } + + +}; // Class PrismGaussLegendreIntegrationPointsInAxis1 + +class PrismGaussLegendreIntegrationPointsInAxis2 +{ +public: + KRATOS_CLASS_POINTER_DEFINITION(PrismGaussLegendreIntegrationPointsInAxis2); + + using SizeType = std::size_t; + + static const unsigned int Dimension = 3; + + using IntegrationPointType = IntegrationPoint<3>; + + using IntegrationPointsArrayType = std::array; + + using PointType = IntegrationPointType::PointType; + + static SizeType IntegrationPointsNumber() + { + return 3; + } + + static const IntegrationPointsArrayType& IntegrationPoints(); + + std::string Info() const + { + std::stringstream buffer; + buffer << "Prism Gauss-Legendre quadrature 3, 1 point in plane"; + return buffer.str(); + } + + +}; // Class PrismGaussLegendreIntegrationPointsInAxis2 + +class PrismGaussLegendreIntegrationPointsInAxis3 +{ +public: + KRATOS_CLASS_POINTER_DEFINITION(PrismGaussLegendreIntegrationPointsInAxis3); + + using SizeType = std::size_t; + + static const unsigned int Dimension = 3; + + using IntegrationPointType = IntegrationPoint<3>; + + using IntegrationPointsArrayType = std::array; + + using PointType = IntegrationPointType::PointType; + + static SizeType IntegrationPointsNumber() + { + return 5; + } + + static const IntegrationPointsArrayType& IntegrationPoints(); + + std::string Info() const + { + std::stringstream buffer; + buffer << "Prism Gauss-Legendre quadrature 5, 1 point in plane"; + return buffer.str(); + } + + +}; // Class PrismGaussLegendreIntegrationPointsInAxis3 + +class PrismGaussLegendreIntegrationPointsInAxis4 +{ +public: + KRATOS_CLASS_POINTER_DEFINITION(PrismGaussLegendreIntegrationPointsInAxis4); + + using SizeType = std::size_t; + + static const unsigned int Dimension = 3; + + using IntegrationPointType = IntegrationPoint<3>; + + using IntegrationPointsArrayType = std::array; + + using PointType = IntegrationPointType::PointType; + + static SizeType IntegrationPointsNumber() + { + return 7; + } + + static const IntegrationPointsArrayType& IntegrationPoints(); + + std::string Info() const + { + std::stringstream buffer; + buffer << "Prism Gauss-Legendre quadrature 7, 1 point in plane"; + return buffer.str(); + } + + +}; // Class PrismGaussLegendreIntegrationPointsInAxis4 + +class PrismGaussLegendreIntegrationPointsInAxis5 +{ +public: + KRATOS_CLASS_POINTER_DEFINITION(PrismGaussLegendreIntegrationPointsInAxis5); + + using SizeType = std::size_t; + + static const unsigned int Dimension = 3; + + using IntegrationPointType = IntegrationPoint<3>; + + using IntegrationPointsArrayType = std::array; + + using PointType = IntegrationPointType::PointType; + + static SizeType IntegrationPointsNumber() + { + return 11; + } + + static const IntegrationPointsArrayType& IntegrationPoints(); + + std::string Info() const + { + std::stringstream buffer; + buffer << "Prism Gauss-Legendre quadrature 11, 1 point in plane"; + return buffer.str(); + } + + +}; // Class PrismGaussLegendreIntegrationPointsInAxis5 + ///@} ///@name Type Definitions ///@{ From bb36aff6f5c83884ee57bdb9216f5f86dc5d252c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicente=20Mataix=20Ferr=C3=A1ndiz?= Date: Tue, 20 May 2025 12:35:05 +0200 Subject: [PATCH 7/9] Remove extended prism quadratures --- kratos/geometries/prism_3d_15.h | 36 +-- kratos/geometries/prism_3d_6.h | 37 +-- .../prism_gauss_legendre_integration_points.h | 225 +----------------- 3 files changed, 11 insertions(+), 287 deletions(-) diff --git a/kratos/geometries/prism_3d_15.h b/kratos/geometries/prism_3d_15.h index b17b3b277ae8..cb50561f62ef 100644 --- a/kratos/geometries/prism_3d_15.h +++ b/kratos/geometries/prism_3d_15.h @@ -1016,17 +1016,7 @@ class Prism3D15 Quadrature < PrismGaussLegendreIntegrationPoints4, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), Quadrature < PrismGaussLegendreIntegrationPoints5, - 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < PrismGaussLegendreIntegrationPointsExt1, - 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < PrismGaussLegendreIntegrationPointsExt2, - 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < PrismGaussLegendreIntegrationPointsExt3, - 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < PrismGaussLegendreIntegrationPointsExt4, - 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < PrismGaussLegendreIntegrationPointsExt5, - 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), + 3, IntegrationPoint<3> >::GenerateIntegrationPoints() } }; return integration_points; @@ -1046,17 +1036,7 @@ class Prism3D15 Prism3D15::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_4 ), Prism3D15::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_GAUSS_5 ), - Prism3D15::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1 ), - Prism3D15::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 ), - Prism3D15::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_3 ), - Prism3D15::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ), - Prism3D15::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ) + GeometryData::IntegrationMethod::GI_GAUSS_5 ) } }; return shape_functions_values; @@ -1076,17 +1056,7 @@ class Prism3D15 Prism3D15::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_4 ), Prism3D15::CalculateShapeFunctionsIntegrationPointsLocalGradients( - GeometryData::IntegrationMethod::GI_GAUSS_5 ), - Prism3D15::CalculateShapeFunctionsIntegrationPointsLocalGradients( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1 ), - Prism3D15::CalculateShapeFunctionsIntegrationPointsLocalGradients( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 ), - Prism3D15::CalculateShapeFunctionsIntegrationPointsLocalGradients( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_3 ), - Prism3D15::CalculateShapeFunctionsIntegrationPointsLocalGradients( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ), - Prism3D15::CalculateShapeFunctionsIntegrationPointsLocalGradients( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ) + GeometryData::IntegrationMethod::GI_GAUSS_5 ) } }; return shape_functions_local_gradients; diff --git a/kratos/geometries/prism_3d_6.h b/kratos/geometries/prism_3d_6.h index f3707b2f36b0..d3da1b668b89 100644 --- a/kratos/geometries/prism_3d_6.h +++ b/kratos/geometries/prism_3d_6.h @@ -1018,17 +1018,8 @@ template class Prism3D6 : public Geometry Quadrature < PrismGaussLegendreIntegrationPoints4, 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), Quadrature < PrismGaussLegendreIntegrationPoints5, - 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < PrismGaussLegendreIntegrationPointsExt1, - 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < PrismGaussLegendreIntegrationPointsExt2, - 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < PrismGaussLegendreIntegrationPointsExt3, - 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < PrismGaussLegendreIntegrationPointsExt4, - 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), - Quadrature < PrismGaussLegendreIntegrationPointsExt5, - 3, IntegrationPoint<3> >::GenerateIntegrationPoints(), + 3, IntegrationPoint<3> >::GenerateIntegrationPoints() + } }; return integration_points; @@ -1048,17 +1039,7 @@ template class Prism3D6 : public Geometry Prism3D6::CalculateShapeFunctionsIntegrationPointsValues( GeometryData::IntegrationMethod::GI_GAUSS_4 ), Prism3D6::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_GAUSS_5 ), - Prism3D6::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1 ), - Prism3D6::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 ), - Prism3D6::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_3 ), - Prism3D6::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ), - Prism3D6::CalculateShapeFunctionsIntegrationPointsValues( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ) + GeometryData::IntegrationMethod::GI_GAUSS_5 ) } }; return shape_functions_values; @@ -1082,17 +1063,7 @@ template class Prism3D6 : public Geometry Prism3D6::CalculateShapeFunctionsIntegrationPointsLocalGradients( GeometryData::IntegrationMethod::GI_GAUSS_4 ), Prism3D6::CalculateShapeFunctionsIntegrationPointsLocalGradients( - GeometryData::IntegrationMethod::GI_GAUSS_5 ), - Prism3D6::CalculateShapeFunctionsIntegrationPointsLocalGradients( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_1 ), - Prism3D6::CalculateShapeFunctionsIntegrationPointsLocalGradients( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_2 ), - Prism3D6::CalculateShapeFunctionsIntegrationPointsLocalGradients( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_3 ), - Prism3D6::CalculateShapeFunctionsIntegrationPointsLocalGradients( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_4 ), - Prism3D6::CalculateShapeFunctionsIntegrationPointsLocalGradients( - GeometryData::IntegrationMethod::GI_EXTENDED_GAUSS_5 ) + GeometryData::IntegrationMethod::GI_GAUSS_5 ) } }; return shape_functions_local_gradients; diff --git a/kratos/integration/prism_gauss_legendre_integration_points.h b/kratos/integration/prism_gauss_legendre_integration_points.h index 07d05b57ca4f..19d22f311072 100644 --- a/kratos/integration/prism_gauss_legendre_integration_points.h +++ b/kratos/integration/prism_gauss_legendre_integration_points.h @@ -4,16 +4,15 @@ // _|\_\_| \__,_|\__|\___/ ____/ // Multi-Physics // -// License: BSD License -// Kratos default license: kratos/license.txt +// License: BSD License +// Kratos default license: kratos/license.txt // // Main authors: Josep Maria Carbonell // Vicente Mataix Ferrandiz // // -#if !defined(KRATOS_PRISM_GAUSS_LEGENDRE_INTEGRATION_POINTS_H_INCLUDED ) -#define KRATOS_PRISM_GAUSS_LEGENDRE_INTEGRATION_POINTS_H_INCLUDED +#pragma once // System includes @@ -250,230 +249,14 @@ class PrismGaussLegendreIntegrationPoints5 }; // Class PrismGaussLegendreIntegrationPoints5 -/* For the formulation SPRISM we just consider one integration point in the plane */ - -class PrismGaussLegendreIntegrationPointsExt1 -{ -public: - KRATOS_CLASS_POINTER_DEFINITION(PrismGaussLegendreIntegrationPointsExt1); - typedef std::size_t SizeType; - - static const unsigned int Dimension = 3; - - typedef IntegrationPoint<3> IntegrationPointType; - - typedef std::array IntegrationPointsArrayType; - - typedef IntegrationPointType::PointType PointType; - - static SizeType IntegrationPointsNumber() - { - return 2; - } - - static const IntegrationPointsArrayType& IntegrationPoints() - { - static const IntegrationPointsArrayType s_integration_points{{ - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.2113248654051871177454 , 0.25000000000000000000000 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.7886751345948128822546 , 0.25000000000000000000000 ) - }}; - return s_integration_points; - } - - std::string Info() const - { - std::stringstream buffer; - buffer << "Prism Gauss-Legendre quadrature 2, 1 point in plane"; - return buffer.str(); - } - - -}; // Class PrismGaussLegendreIntegrationPointsExt1 - -class PrismGaussLegendreIntegrationPointsExt2 -{ -public: - KRATOS_CLASS_POINTER_DEFINITION(PrismGaussLegendreIntegrationPointsExt2); - typedef std::size_t SizeType; - - static const unsigned int Dimension = 3; - - typedef IntegrationPoint<3> IntegrationPointType; - - typedef std::array IntegrationPointsArrayType; - - typedef IntegrationPointType::PointType PointType; - - static SizeType IntegrationPointsNumber() - { - return 3; - } - - static const IntegrationPointsArrayType& IntegrationPoints() - { - static const IntegrationPointsArrayType s_integration_points{{ - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.1127016653792583114821 , 0.1388888888888888889 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.5000000000000000000000 , 0.2222222222222222222 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.8872983346207416885180 , 0.1388888888888888889 ) - }}; - return s_integration_points; - } - - std::string Info() const - { - std::stringstream buffer; - buffer << "Prism Gauss-Legendre quadrature 3, 1 point in plane"; - return buffer.str(); - } - - -}; // Class PrismGaussLegendreIntegrationPointsExt2 - -class PrismGaussLegendreIntegrationPointsExt3 -{ -public: - KRATOS_CLASS_POINTER_DEFINITION(PrismGaussLegendreIntegrationPointsExt3); - typedef std::size_t SizeType; - - static const unsigned int Dimension = 3; - - typedef IntegrationPoint<3> IntegrationPointType; - - typedef std::array IntegrationPointsArrayType; - - typedef IntegrationPointType::PointType PointType; - - static SizeType IntegrationPointsNumber() - { - return 5; - } - - static const IntegrationPointsArrayType& IntegrationPoints() - { - static const IntegrationPointsArrayType s_integration_points{{ - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.0469100770306680036012 , 0.0592317212640472718 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.2307653449471584544819 , 0.1196571676248416170 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.5000000000000000000000 , 0.1422222222222222222 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.7692346550528415455182 , 0.1196571676248416170 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.9530899229693319963988 , 0.0592317212640472718 ) - }}; - return s_integration_points; - } - - std::string Info() const - { - std::stringstream buffer; - buffer << "Prism Gauss-Legendre quadrature 5, 1 point in plane"; - return buffer.str(); - } - - -}; // Class PrismGaussLegendreIntegrationPointsExt3 - -class PrismGaussLegendreIntegrationPointsExt4 -{ -public: - KRATOS_CLASS_POINTER_DEFINITION(PrismGaussLegendreIntegrationPointsExt4); - typedef std::size_t SizeType; - - static const unsigned int Dimension = 3; - - typedef IntegrationPoint<3> IntegrationPointType; - - typedef std::array IntegrationPointsArrayType; - - typedef IntegrationPointType::PointType PointType; - - static SizeType IntegrationPointsNumber() - { - return 7; - } - - static const IntegrationPointsArrayType& IntegrationPoints() - { - static const IntegrationPointsArrayType s_integration_points{{ - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.0254460438286207377369 , 0.0261224489795918367347 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.1292344072003027800681 , 0.069926347872319166975 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.2970774243113014165467 , 0.09545751262627973624 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.5000000000000000000000 , 0.1044897959183673469388 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.7029225756886985834533 , 0.09545751262627973624 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.8707655927996972199320 , 0.069926347872319166975 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.9745539561713792622631 , 0.0261224489795918367347 ) - }}; - return s_integration_points; - } - - std::string Info() const - { - std::stringstream buffer; - buffer << "Prism Gauss-Legendre quadrature 4, 1 point in plane"; - return buffer.str(); - } - - -}; // Class PrismGaussLegendreIntegrationPointsExt4 - -class PrismGaussLegendreIntegrationPointsExt5 -{ -public: - KRATOS_CLASS_POINTER_DEFINITION(PrismGaussLegendreIntegrationPointsExt5); - typedef std::size_t SizeType; - - static const unsigned int Dimension = 3; - - typedef IntegrationPoint<3> IntegrationPointType; - - typedef std::array IntegrationPointsArrayType; - - typedef IntegrationPointType::PointType PointType; - - static SizeType IntegrationPointsNumber() - { - return 11; - } - - static const IntegrationPointsArrayType& IntegrationPoints() - { - static const IntegrationPointsArrayType s_integration_points{{ - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.0108856709269715035981 , 0.0139171417790434166207 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.0564687001159523504624 , 0.031395092366226156159 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.1349239972129753379533 , 0.0465725527319335628565 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.2404519353965940920372 , 0.058298441147997619980 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.3652284220238275138343 , 0.065701136127561665545 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.5000000000000000000000 , 0.0682312716944751576786 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.6347715779761724861657 , 0.065701136127561665545 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.7595480646034059079628 , 0.058298441147997619980 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.8650760027870246620467 , 0.0465725527319335628565 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.9435312998840476495376 , 0.031395092366226156159 ), - IntegrationPointType( 0.33333333333333333333 , 0.33333333333333333333 , 0.9891143290730284964020 , 0.0139171417790434166207 ) - }}; - return s_integration_points; - } - - std::string Info() const - { - std::stringstream buffer; - buffer << "Prism Gauss-Legendre quadrature 4, 1 point in plane"; - return buffer.str(); - } - - -}; // Class PrismGaussLegendreIntegrationPointsExt5 - +///@} ///@name Type Definitions ///@{ - ///@} ///@name Input and output ///@{ - ///@} - } // namespace Kratos. - -#endif // KRATOS_PRISM_GAUSS_LEGENDRE_INTEGRATION_POINTS_H_INCLUDED defined - - From c317568eb2621d60c28678aef098dd102baca87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicente=20Mataix=20Ferr=C3=A1ndiz?= Date: Tue, 20 May 2025 21:08:50 +0200 Subject: [PATCH 8/9] Refactor SolidShellElementSprism3D6N: Improve code readability and consistency - Removed unused IntegrationMethod type alias. - Reformatted constructor signatures for better readability. - Updated parameter names for consistency (e.g., `ThisNodes` to `rNodes`). - Added a new method to return the integration method used. - Improved documentation comments for clarity. - Corrected typos in comments and variable names. - Enhanced code structure by grouping related methods and variables. --- .../solid_shell_element_sprism_3D6N.cpp | 1656 +++++++++-------- .../solid_shell_element_sprism_3D6N.h | 431 ++--- 2 files changed, 1067 insertions(+), 1020 deletions(-) diff --git a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp index 4c073a193669..0371105894c2 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp +++ b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp @@ -91,14 +91,14 @@ SolidShellElementSprism3D6N& SolidShellElementSprism3D6N::operator=(SolidShellE { BaseType::operator=(rOther); - mThisIntegrationMethod = rOther.mThisIntegrationMethod; + mIntegrationOrder = rOther.mIntegrationOrder; mAuxContainer.clear(); - mAuxContainer.resize( rOther.mAuxContainer.size()); + mAuxContainer.resize(rOther.mAuxContainer.size()); - for(IndexType i = 0; i < mConstitutiveLawVector.size(); ++i) { + for (unsigned int i = 0; i < mConstitutiveLawVector.size(); ++i) { mConstitutiveLawVector[i] = rOther.mConstitutiveLawVector[i]; - mAuxContainer[i]=rOther.mAuxContainer[i]; + mAuxContainer[i] = rOther.mAuxContainer[i]; } return *this; @@ -135,15 +135,15 @@ Element::Pointer SolidShellElementSprism3D6N::Clone( { SolidShellElementSprism3D6N new_element( NewId, GetGeometry().Create( rThisNodes ), pGetProperties() ); - new_element.mThisIntegrationMethod = this->GetIntegrationMethod(); + new_element.mIntegrationOrder = mIntegrationOrder; - const SizeType integration_point_number = mConstitutiveLawVector.size(); + const unsigned int integration_point_number = mConstitutiveLawVector.size(); if ( new_element.mConstitutiveLawVector.size() != integration_point_number) { new_element.mConstitutiveLawVector.resize(integration_point_number); } - for(IndexType i = 0; i < integration_point_number; ++i) { + for(unsigned int i = 0; i < integration_point_number; ++i) { new_element.mConstitutiveLawVector[i] = mConstitutiveLawVector[i]->Clone(); } @@ -151,7 +151,7 @@ Element::Pointer SolidShellElementSprism3D6N::Clone( new_element.mAuxContainer.resize(mAuxContainer.size()); } - for(IndexType i = 0; i < mAuxContainer.size(); ++i) { + for(unsigned int i = 0; i < mAuxContainer.size(); ++i) { new_element.mAuxContainer[i] = mAuxContainer[i]; } @@ -173,16 +173,16 @@ void SolidShellElementSprism3D6N::EquationIdVector( // Get the neighbours const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - const IndexType number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); - const IndexType dim = number_of_nodes * 3; + const unsigned int number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); + const unsigned int dim = number_of_nodes * 3; if (rResult.size() != dim) { rResult.resize(dim, false); } // Nodes of the central element - IndexType index = 0; - for (IndexType i = 0; i < r_geometry.size(); ++i) { + unsigned int index = 0; + for (unsigned int i = 0; i < r_geometry.size(); ++i) { rResult[index] = r_geometry[i].GetDof(DISPLACEMENT_X).EquationId(); rResult[index + 1] = r_geometry[i].GetDof(DISPLACEMENT_Y).EquationId(); rResult[index + 2] = r_geometry[i].GetDof(DISPLACEMENT_Z).EquationId(); @@ -190,7 +190,7 @@ void SolidShellElementSprism3D6N::EquationIdVector( } // Adding the ids of the neighbouring nodes - for (IndexType i = 0; i < r_geometry.size(); ++i) { + for (unsigned int i = 0; i < r_geometry.size(); ++i) { if (HasNeighbour(i, r_neighbour_nodes[i])) { rResult[index] = r_neighbour_nodes[i].GetDof(DISPLACEMENT_X).EquationId(); rResult[index + 1] = r_neighbour_nodes[i].GetDof(DISPLACEMENT_Y).EquationId(); @@ -221,14 +221,14 @@ void SolidShellElementSprism3D6N::GetDofList( rElementalDofList.resize(0); // Nodes of the central element - for (IndexType i = 0; i < number_of_nodes; ++i) { + for (unsigned int i = 0; i < number_of_nodes; ++i) { rElementalDofList.push_back(r_geometry[i].pGetDof(DISPLACEMENT_X)); rElementalDofList.push_back(r_geometry[i].pGetDof(DISPLACEMENT_Y)); rElementalDofList.push_back(r_geometry[i].pGetDof(DISPLACEMENT_Z)); } // Adding the dofs of the neighbouring nodes - for (IndexType i = 0; i < number_of_nodes; ++i) { + for (unsigned int i = 0; i < number_of_nodes; ++i) { if (HasNeighbour(i, r_neighbour_nodes[i])) { rElementalDofList.push_back(r_neighbour_nodes[i].pGetDof(DISPLACEMENT_X)); rElementalDofList.push_back(r_neighbour_nodes[i].pGetDof(DISPLACEMENT_Y)); @@ -252,18 +252,19 @@ void SolidShellElementSprism3D6N::GetValuesVector( // Get the neighbours const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - const SizeType number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); + const unsigned int number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); - const SizeType mat_size = number_of_nodes * 3; - if (rValues.size() != mat_size) + const unsigned int mat_size = number_of_nodes * 3; + if (rValues.size() != mat_size) { rValues.resize(mat_size, false); + } - IndexType index = 0; + unsigned int index = 0; // Nodes of the central element - for (IndexType i = 0; i < r_geometry.size(); ++i) { + for (unsigned int i = 0; i < r_geometry.size(); ++i) { const array_1d& r_displacement = r_geometry[i].FastGetSolutionStepValue(DISPLACEMENT, Step); - for (IndexType j = 0; j < 3; ++j) { + for (unsigned int j = 0; j < 3; ++j) { rValues[index + j] = r_displacement[j]; } index += 3; @@ -273,7 +274,7 @@ void SolidShellElementSprism3D6N::GetValuesVector( for (unsigned int i = 0; i < r_geometry.size(); ++i) { if (HasNeighbour(i, r_neighbour_nodes[i])) { const array_1d& r_displacement = r_neighbour_nodes[i].FastGetSolutionStepValue(DISPLACEMENT, Step); - for (IndexType j = 0; j < 3; ++j) { + for (unsigned int j = 0; j < 3; ++j) { rValues[index + j] = r_displacement[j]; } index += 3; @@ -294,18 +295,19 @@ void SolidShellElementSprism3D6N::GetFirstDerivativesVector( // Get the neighbours const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - const SizeType number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); + const unsigned int number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); - const SizeType mat_size = number_of_nodes * 3; - if (rValues.size() != mat_size) + const unsigned int mat_size = number_of_nodes * 3; + if (rValues.size() != mat_size) { rValues.resize(mat_size, false); + } - IndexType index = 0; + unsigned int index = 0; // Nodes of the central element - for (IndexType i = 0; i < r_geometry.size(); ++i) { + for (unsigned int i = 0; i < r_geometry.size(); ++i) { const array_1d& r_velocity = r_geometry[i].FastGetSolutionStepValue(VELOCITY, Step); - for (IndexType j = 0; j < 3; ++j) { + for (unsigned int j = 0; j < 3; ++j) { rValues[index + j] = r_velocity[j]; } index += 3; @@ -315,7 +317,7 @@ void SolidShellElementSprism3D6N::GetFirstDerivativesVector( for (unsigned int i = 0; i < r_geometry.size(); ++i) { if (HasNeighbour(i, r_neighbour_nodes[i])) { const array_1d& r_velocity = r_neighbour_nodes[i].FastGetSolutionStepValue(VELOCITY, Step); - for (IndexType j = 0; j < 3; ++j) { + for (unsigned int j = 0; j < 3; ++j) { rValues[index + j] = r_velocity[j]; } index += 3; @@ -336,19 +338,19 @@ void SolidShellElementSprism3D6N::GetSecondDerivativesVector( // Get the neighbours const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - const SizeType number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); + const unsigned int number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); - const SizeType mat_size = number_of_nodes * 3; + const unsigned int mat_size = number_of_nodes * 3; if (rValues.size() != mat_size) { rValues.resize(mat_size, false); } - IndexType index = 0; + unsigned int index = 0; // Nodes of the central element - for (IndexType i = 0; i < r_geometry.size(); ++i) { + for (unsigned int i = 0; i < r_geometry.size(); ++i) { const array_1d& r_acceleration = r_geometry[i].FastGetSolutionStepValue(ACCELERATION, Step); - for (IndexType j = 0; j < 3; ++j) { + for (unsigned int j = 0; j < 3; ++j) { rValues[index + j] = r_acceleration[j]; } index += 3; @@ -358,7 +360,7 @@ void SolidShellElementSprism3D6N::GetSecondDerivativesVector( for (unsigned int i = 0; i < r_geometry.size(); ++i) { if (HasNeighbour(i, r_neighbour_nodes[i])) { const array_1d& r_acceleration = r_neighbour_nodes[i].FastGetSolutionStepValue(ACCELERATION, Step); - for (IndexType j = 0; j < 3; ++j) { + for (unsigned int j = 0; j < 3; ++j) { rValues[index + j] = r_acceleration[j]; } index += 3; @@ -386,7 +388,7 @@ void SolidShellElementSprism3D6N::CalculateRightHandSide( MatrixType left_hand_side_matrix = Matrix(); //Initialize sizes for the system components: - this->InitializeSystemMatrices( left_hand_side_matrix, rRightHandSideVector, local_system.CalculationFlags ); + this->InitializeSystemMatrices(left_hand_side_matrix, rRightHandSideVector, local_system.CalculationFlags); //Set general_variables to Local system components local_system.SetLeftHandSideMatrix(left_hand_side_matrix); @@ -476,8 +478,8 @@ void SolidShellElementSprism3D6N::CalculateMassMatrix( const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - const SizeType number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); - const SizeType mat_size = number_of_nodes * 3; + const unsigned int number_of_nodes = r_geometry.size() + NumberOfActiveNeighbours(r_neighbour_nodes); + const unsigned int mat_size = number_of_nodes * 3; if (rMassMatrix.size1() != mat_size) { rMassMatrix.resize(mat_size, mat_size, false); @@ -486,7 +488,7 @@ void SolidShellElementSprism3D6N::CalculateMassMatrix( noalias(rMassMatrix) = ZeroMatrix(mat_size, mat_size); Matrix aux_matrix; - const SizeType aux_mat_size = r_geometry.size() * 3; + const unsigned int aux_mat_size = r_geometry.size() * 3; BaseType::CalculateMassMatrix(aux_matrix, rCurrentProcessInfo); noalias(subrange(rMassMatrix, 0, aux_mat_size, 0, aux_mat_size)) = aux_matrix; @@ -502,7 +504,7 @@ void SolidShellElementSprism3D6N::CalculateDampingMatrix( ) { const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - const IndexType mat_size = ( GetGeometry().size() + NumberOfActiveNeighbours(r_neighbour_nodes) ) * 3; + const unsigned int mat_size = ( GetGeometry().size() + NumberOfActiveNeighbours(r_neighbour_nodes) ) * 3; StructuralMechanicsElementUtilities::CalculateRayleighDampingMatrix( *this, @@ -526,13 +528,14 @@ void SolidShellElementSprism3D6N::CalculateDampingMatrix( const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); // 0.-Initialize the DampingMatrix: - const SizeType number_of_nodes = GetGeometry().size() + NumberOfActiveNeighbours(r_neighbour_nodes); + const unsigned int number_of_nodes = GetGeometry().size() + NumberOfActiveNeighbours(r_neighbour_nodes); // Resizing as needed the LHS - const SizeType mat_size = number_of_nodes * 3; + const unsigned int mat_size = number_of_nodes * 3; - if ( rDampingMatrix.size1() != mat_size ) + if ( rDampingMatrix.size1() != mat_size ) { rDampingMatrix.resize( mat_size, mat_size, false ); + } noalias( rDampingMatrix ) = ZeroMatrix( mat_size, mat_size ); @@ -574,13 +577,14 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( // Get geometry const auto& r_geometry = GetGeometry(); - const IndexType integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); + const unsigned int integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); - if ( rOutput.size() != integration_point_number ) + if ( rOutput.size() != integration_point_number ) { rOutput.resize( integration_point_number ); + } if (mConstitutiveLawVector[0]->Has( rVariable)) { - for ( IndexType ii = 0; ii < integration_point_number; ++ii ) { + for (unsigned int ii = 0; ii < integration_point_number; ++ii ) { bool aux_bool; aux_bool = mConstitutiveLawVector[ii]->GetValue( rVariable, aux_bool); rOutput[ii] = aux_bool; @@ -591,16 +595,15 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); /* Create constitutive law parameters: */ - ConstitutiveLaw::Parameters Values(r_geometry, GetProperties(), rCurrentProcessInfo); + ConstitutiveLaw::Parameters cl_values(r_geometry, GetProperties(), rCurrentProcessInfo); /* Set constitutive law flags: */ - Flags& r_constitutive_law_options = Values.GetOptions(); - + Flags& r_constitutive_law_options = cl_values.GetOptions(); r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS); /* Reading integration points */ - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); double& alpha_eas = this->GetValue(ALPHA_EAS); @@ -614,21 +617,22 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->CalculateCommonComponents(common_components, this_cartesian_derivatives); // Reading integration points - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number ) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, r_integration_points, point_number, alpha_eas, zeta_gauss); // To take in account previous step writing - if( mFinalizedStep ) + if (mFinalizedStep) { this->GetHistoricalVariables(general_variables,point_number); + } // Set general variables to constitutive law parameters - this->SetGeneralVariables(general_variables,Values,point_number); + this->SetGeneralVariables(general_variables, cl_values, point_number); bool aux_bool; - aux_bool = mConstitutiveLawVector[point_number]->CalculateValue( Values, rVariable, aux_bool ); + aux_bool = mConstitutiveLawVector[point_number]->CalculateValue( cl_values, rVariable, aux_bool ); rOutput[point_number] = aux_bool; } } @@ -640,10 +644,10 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( rOutput.resize( 6 ); Matrix interpol = StructuralMechanicsMathUtilities::InterpolPrismGiD(integration_point_number); - for (IndexType iii = 0; iii < 6; ++iii) { + for (unsigned int iii = 0; iii < 6; ++iii) { rOutput[iii] = false; - for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) { + for (unsigned int i_gp = 0; i_gp < integration_point_number; i_gp++) { if (r_output_aux[i_gp]) { rOutput[iii] = true; } @@ -666,7 +670,7 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( KRATOS_TRY; // Get the integration points number - const IndexType integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); + const unsigned int integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); if ( rOutput.size() != integration_point_number ) { rOutput.resize( integration_point_number ); @@ -685,10 +689,10 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( rOutput.resize( 6 ); Matrix interpol = StructuralMechanicsMathUtilities::InterpolPrismGiD(integration_point_number); - for (IndexType iii = 0; iii < 6; ++iii) { + for (unsigned int iii = 0; iii < 6; ++iii) { rOutput[iii] = 0; - for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) { + for (unsigned int i_gp = 0; i_gp < integration_point_number; i_gp++) { rOutput[iii] += interpol(i_gp, iii) * r_output_aux[i_gp]; } } @@ -711,7 +715,8 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( // Get geometry const auto& r_geometry = GetGeometry(); - const IndexType integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); + // Get the integration points number + const unsigned int integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); if ( rOutput.size() != integration_point_number ) rOutput.resize( integration_point_number ); @@ -722,16 +727,15 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); /* Create constitutive law parameters: */ - ConstitutiveLaw::Parameters Values(r_geometry, GetProperties(), rCurrentProcessInfo); + ConstitutiveLaw::Parameters cl_values(r_geometry, GetProperties(), rCurrentProcessInfo); /* Set constitutive law flags: */ - Flags& r_constitutive_law_options = Values.GetOptions(); - + Flags& r_constitutive_law_options = cl_values.GetOptions(); r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS); /* Reading integration points */ - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); double& alpha_eas = this->GetValue(ALPHA_EAS); @@ -745,23 +749,24 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->CalculateCommonComponents(common_components, this_cartesian_derivatives); // Reading integration points - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number ) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, r_integration_points, point_number, alpha_eas, zeta_gauss); // To take in account previous step writing - if( mFinalizedStep ) + if (mFinalizedStep) { this->GetHistoricalVariables(general_variables,point_number); + } // Set general variables to constitutive law parameters - this->SetGeneralVariables(general_variables,Values,point_number); + this->SetGeneralVariables(general_variables, cl_values, point_number); // Call the constitutive law to update material variables - mConstitutiveLawVector[point_number]->CalculateMaterialResponseCauchy (Values); + mConstitutiveLawVector[point_number]->CalculateMaterialResponseCauchy (cl_values); - const Matrix& stress_tensor = MathUtils::StressVectorToTensor(general_variables.StressVector); //reduced dimension stress tensor + const Matrix stress_tensor = MathUtils::StressVectorToTensor(general_variables.StressVector); //reduced dimension stress tensor // In general coordinates: @@ -770,8 +775,9 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( (stress_tensor(2,2)-stress_tensor(0,0))*((stress_tensor(2,2)-stress_tensor(0,0)))+ 6*(stress_tensor(0,1)*stress_tensor(1,0)+stress_tensor(1,2)*stress_tensor(2,1)+stress_tensor(2,0)*stress_tensor(0,2))); - if( sigma_equivalent < 0 ) + if (sigma_equivalent < 0) { sigma_equivalent = 0; + } sigma_equivalent = std::sqrt(sigma_equivalent); @@ -783,17 +789,16 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); // Create constitutive law parameters: - ConstitutiveLaw::Parameters Values(r_geometry, GetProperties(), rCurrentProcessInfo); + ConstitutiveLaw::Parameters cl_values(r_geometry, GetProperties(), rCurrentProcessInfo); // Set constitutive law flags: - Flags& r_constitutive_law_options=Values.GetOptions(); - + Flags& r_constitutive_law_options = cl_values.GetOptions(); r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true); r_constitutive_law_options.Set(ConstitutiveLaw::ISOCHORIC_TENSOR_ONLY, true); /* Reading integration points */ - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); double& alpha_eas = this->GetValue(ALPHA_EAS); @@ -807,23 +812,24 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->CalculateCommonComponents(common_components, this_cartesian_derivatives); // Reading integration points - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number ) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points,point_number, alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, r_integration_points,point_number, alpha_eas, zeta_gauss); // To take in account previous step writing - if( mFinalizedStep ) + if (mFinalizedStep) { this->GetHistoricalVariables(general_variables,point_number); + } // Set general variables to constitutive law parameters - this->SetGeneralVariables(general_variables,Values,point_number); + this->SetGeneralVariables(general_variables, cl_values, point_number); // Call the constitutive law to update material variables - mConstitutiveLawVector[point_number]->CalculateMaterialResponseCauchy (Values); + mConstitutiveLawVector[point_number]->CalculateMaterialResponseCauchy (cl_values); - const Matrix& stress_tensor = MathUtils::StressVectorToTensor(general_variables.StressVector); //reduced dimension stress tensor + const Matrix stress_tensor = MathUtils::StressVectorToTensor(general_variables.StressVector); //reduced dimension stress tensor double stress_norm = ((stress_tensor(0,0)*stress_tensor(0,0))+(stress_tensor(1,1)*stress_tensor(1,1))+(stress_tensor(2,2)*stress_tensor(2,2))+ (stress_tensor(0,1)*stress_tensor(0,1))+(stress_tensor(0,2)*stress_tensor(0,2))+(stress_tensor(1,2)*stress_tensor(1,2))+ @@ -839,17 +845,16 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); // Create constitutive law parameters: - ConstitutiveLaw::Parameters Values(r_geometry, GetProperties(), rCurrentProcessInfo); + ConstitutiveLaw::Parameters cl_values(r_geometry, GetProperties(), rCurrentProcessInfo); // Set constitutive law flags: - Flags& r_constitutive_law_options=Values.GetOptions(); - + Flags& r_constitutive_law_options = cl_values.GetOptions(); r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true); r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRAIN_ENERGY, true); /* Reading integration points */ - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); double& r_alpha_eas = this->GetValue(ALPHA_EAS); @@ -863,32 +868,32 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->CalculateCommonComponents(common_components, this_cartesian_derivatives); // Reading integration points - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double ZetaGauss = 2.0 * integration_points[point_number].Z() - 1.0; + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number ) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, ZetaGauss); + this->CalculateKinematics(general_variables, common_components, r_integration_points, point_number, r_alpha_eas, zeta_gauss); // To take in account previous step writing - if( mFinalizedStep ) { - this->GetHistoricalVariables(general_variables,point_number); + if (mFinalizedStep) { + this->GetHistoricalVariables(general_variables, point_number); } // Set general variables to constitutive law parameters - this->SetGeneralVariables(general_variables,Values,point_number); + this->SetGeneralVariables(general_variables, cl_values, point_number); double strain_energy = 0.0; // Compute stresses and constitutive parameters if (mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { - mConstitutiveLawVector[point_number]->CalculateMaterialResponseKirchhoff(Values); + mConstitutiveLawVector[point_number]->CalculateMaterialResponseKirchhoff(cl_values); } else { - mConstitutiveLawVector[point_number]->CalculateMaterialResponsePK2(Values); + mConstitutiveLawVector[point_number]->CalculateMaterialResponsePK2(cl_values); } mConstitutiveLawVector[point_number]->GetValue(STRAIN_ENERGY, strain_energy); - rOutput[point_number] = general_variables.detJ * integration_points[point_number].Weight() * strain_energy; // 1/2 * sigma * epsilon + rOutput[point_number] = general_variables.detJ * r_integration_points[point_number].Weight() * strain_energy; // 1/2 * sigma * epsilon } } else if (mConstitutiveLawVector[0]->Has( rVariable)) { GetValueOnConstitutiveLaw(rVariable, rOutput); @@ -903,11 +908,12 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( rOutput.resize( 6 ); Matrix interpol = StructuralMechanicsMathUtilities::InterpolPrismGiD(integration_point_number); - for (IndexType iii = 0; iii < 6; ++iii) { + for (unsigned int iii = 0; iii < 6; ++iii) { rOutput[iii] = 0.0; - for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) + for (unsigned int i_gp = 0; i_gp < integration_point_number; i_gp++) { rOutput[iii] += interpol(i_gp, iii) * r_output_aux[i_gp]; + } } } @@ -926,7 +932,7 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( KRATOS_TRY; // Get the integration points - const IndexType integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); + const unsigned int integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); if ( rOutput.size() != integration_point_number ) { rOutput.resize( integration_point_number ); @@ -945,10 +951,10 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( rOutput.resize( 6 ); Matrix interpol = StructuralMechanicsMathUtilities::InterpolPrismGiD(integration_point_number); - for (IndexType iii = 0; iii < 6; ++iii) { + for (unsigned int iii = 0; iii < 6; ++iii) { rOutput[iii] = ZeroVector(3); - for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) { + for (unsigned int i_gp = 0; i_gp < integration_point_number; i_gp++) { rOutput[iii] += interpol(i_gp, iii) * r_output_aux[i_gp]; } } @@ -969,9 +975,9 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( KRATOS_TRY; // Get integration points - const IndexType integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); + const unsigned int integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); - if ( rOutput.size() != integration_point_number ) { + if (rOutput.size() != integration_point_number ) { rOutput.resize( integration_point_number ); } @@ -988,10 +994,10 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( rOutput.resize( 6 ); Matrix interpol = StructuralMechanicsMathUtilities::InterpolPrismGiD(integration_point_number); - for (IndexType iii = 0; iii < 6; ++iii) { + for (unsigned int iii = 0; iii < 6; ++iii) { rOutput[iii] = ZeroVector(6); - for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) { + for (unsigned int i_gp = 0; i_gp < integration_point_number; i_gp++) { rOutput[iii] += interpol(i_gp, iii) * r_output_aux[i_gp]; } } @@ -1016,8 +1022,9 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( const IndexType integration_point_number = msGeometryData.IntegrationPointsNumber( this->GetIntegrationMethod() ); - if ( rOutput.size() != integration_point_number ) + if ( rOutput.size() != integration_point_number ) { rOutput.resize( integration_point_number ); + } if ( rVariable == CAUCHY_STRESS_VECTOR || rVariable == PK2_STRESS_VECTOR ) { // Create and initialize element variables: @@ -1025,16 +1032,15 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); // Create constitutive law parameters: - ConstitutiveLaw::Parameters Values(r_geometry, GetProperties(), rCurrentProcessInfo); + ConstitutiveLaw::Parameters cl_values(r_geometry, GetProperties(), rCurrentProcessInfo); // Set constitutive law flags: - Flags &constitutive_laws_options=Values.GetOptions(); - - constitutive_laws_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); - constitutive_laws_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true); + Flags& r_constitutive_laws_options = cl_values.GetOptions(); + r_constitutive_laws_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); + r_constitutive_laws_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true); /* Reading integration points */ - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); double& r_alpha_eas = this->GetValue(ALPHA_EAS); @@ -1048,18 +1054,19 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->CalculateCommonComponents(common_components, this_cartesian_derivatives); // Reading integration points - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number ) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, r_integration_points, point_number, r_alpha_eas, zeta_gauss); // To take in account previous step writing - if( mFinalizedStep ) + if (mFinalizedStep) { this->GetHistoricalVariables(general_variables,point_number); + } // Set general variables to constitutive law parameters - this->SetGeneralVariables(general_variables, Values, point_number); + this->SetGeneralVariables(general_variables, cl_values, point_number); // Call the constitutive law to update material variables if( rVariable == CAUCHY_STRESS_VECTOR) @@ -1067,10 +1074,11 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( else general_variables.StressMeasure = ConstitutiveLaw::StressMeasure_PK2; - mConstitutiveLawVector[point_number]->CalculateMaterialResponse(Values, general_variables.StressMeasure); + mConstitutiveLawVector[point_number]->CalculateMaterialResponse(cl_values, general_variables.StressMeasure); - if (rOutput[point_number].size() != general_variables.StressVector.size()) + if (rOutput[point_number].size() != general_variables.StressVector.size()) { rOutput[point_number].resize( general_variables.StressVector.size(), false); + } rOutput[point_number] = general_variables.StressVector; } } else if( rVariable == GREEN_LAGRANGE_STRAIN_VECTOR || rVariable == ALMANSI_STRAIN_VECTOR || rVariable == HENCKY_STRAIN_VECTOR) { @@ -1079,19 +1087,19 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); /* Create constitutive law parameters: */ - ConstitutiveLaw::Parameters values(r_geometry, GetProperties(), rCurrentProcessInfo); + ConstitutiveLaw::Parameters cl_values(r_geometry, GetProperties(), rCurrentProcessInfo); /* Set constitutive law flags: */ - Flags& r_constitutive_law_options=values.GetOptions(); - + Flags& r_constitutive_law_options=cl_values.GetOptions(); r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS, false); r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false); - values.SetStrainVector(general_variables.StrainVector); + // Set the strain vector + cl_values.SetStrainVector(general_variables.StrainVector); /* Reading integration points */ - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); double& r_alpha_eas = this->GetValue(ALPHA_EAS); @@ -1105,30 +1113,32 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->CalculateCommonComponents(common_components, this_cartesian_derivatives); // Reading integration points - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number ) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, r_integration_points, point_number, r_alpha_eas, zeta_gauss); // To take in account previous step writing - if( mFinalizedStep ) + if (mFinalizedStep) { this->GetHistoricalVariables(general_variables,point_number); + } // Set general variables to constitutive law parameters - this->SetGeneralVariables(general_variables, values, point_number); + this->SetGeneralVariables(general_variables, cl_values, point_number); // Compute Green-Lagrange Strain - if( rVariable == GREEN_LAGRANGE_STRAIN_VECTOR ) { - mConstitutiveLawVector[point_number]->CalculateMaterialResponse(values, ConstitutiveLaw::StressMeasure_PK2); - } else if( rVariable == ALMANSI_STRAIN_VECTOR ) { - mConstitutiveLawVector[point_number]->CalculateMaterialResponse(values, ConstitutiveLaw::StressMeasure_Cauchy); - } else if( rVariable == HENCKY_STRAIN_VECTOR ) { - mConstitutiveLawVector[point_number]->CalculateValue(values, HENCKY_STRAIN_VECTOR, general_variables.StrainVector); + if (rVariable == GREEN_LAGRANGE_STRAIN_VECTOR) { + mConstitutiveLawVector[point_number]->CalculateMaterialResponse(cl_values, ConstitutiveLaw::StressMeasure_PK2); + } else if (rVariable == ALMANSI_STRAIN_VECTOR) { + mConstitutiveLawVector[point_number]->CalculateMaterialResponse(cl_values, ConstitutiveLaw::StressMeasure_Cauchy); + } else if (rVariable == HENCKY_STRAIN_VECTOR) { + mConstitutiveLawVector[point_number]->CalculateValue(cl_values, HENCKY_STRAIN_VECTOR, general_variables.StrainVector); } - if (rOutput[point_number].size() != general_variables.StrainVector.size()) + if (rOutput[point_number].size() != general_variables.StrainVector.size()) { rOutput[point_number].resize( general_variables.StrainVector.size(), false ); + } rOutput[point_number] = general_variables.StrainVector; } @@ -1145,11 +1155,12 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( rOutput.resize( 6 ); Matrix interpol = StructuralMechanicsMathUtilities::InterpolPrismGiD(integration_point_number); - for (IndexType iii = 0; iii < 6; ++iii) { + for (unsigned int iii = 0; iii < 6; ++iii) { rOutput[iii] = ZeroVector(rOutput[0].size()); - for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) + for (unsigned int i_gp = 0; i_gp < integration_point_number; i_gp++) { rOutput[iii] += interpol(i_gp, iii) * rOutput_aux[i_gp]; + } } } @@ -1186,7 +1197,7 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( rOutput.resize( stress_vector.size() ); } - for ( IndexType point_number = 0; point_number < rOutput.size(); ++point_number ) { + for (unsigned int point_number = 0; point_number < rOutput.size(); ++point_number ) { if (rOutput[point_number].size2() != 3) { rOutput[point_number].resize(3, 3, false); } @@ -1208,7 +1219,7 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( rOutput.resize( StrainVector.size() ); } - for ( IndexType point_number = 0; point_number < rOutput.size(); ++point_number ) { + for (unsigned int point_number = 0; point_number < rOutput.size(); ++point_number ) { if (rOutput[point_number].size2() != 3) { rOutput[point_number].resize(3, 3, false); } @@ -1221,14 +1232,14 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); // Create constitutive law parameters: - ConstitutiveLaw::Parameters Values(GetGeometry(), GetProperties(), rCurrentProcessInfo); + ConstitutiveLaw::Parameters cl_values(GetGeometry(), GetProperties(), rCurrentProcessInfo); // Set constitutive law flags: - Flags &constitutive_laws_options=Values.GetOptions(); - constitutive_laws_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, true); + Flags& r_constitutive_laws_options = cl_values.GetOptions(); + r_constitutive_laws_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, true); /* Reading integration points */ - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); double& r_alpha_eas = this->GetValue(ALPHA_EAS); @@ -1242,17 +1253,17 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->CalculateCommonComponents(common_components, this_cartesian_derivatives); // Reading integration points - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number ) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, r_integration_points, point_number, r_alpha_eas, zeta_gauss); // Set general variables to constitutive law parameters - this->SetGeneralVariables(general_variables,Values,point_number); + this->SetGeneralVariables(general_variables, cl_values, point_number); // Call the constitutive law to update material variables - mConstitutiveLawVector[point_number]->CalculateMaterialResponseCauchy(Values); + mConstitutiveLawVector[point_number]->CalculateMaterialResponseCauchy(cl_values); if( rOutput[point_number].size2() != general_variables.ConstitutiveMatrix.size2() ) { rOutput[point_number].resize( general_variables.ConstitutiveMatrix.size1() , general_variables.ConstitutiveMatrix.size2() , false ); @@ -1265,7 +1276,7 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->InitializeGeneralVariables(general_variables); /* Reading integration points */ - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); double& r_alpha_eas = this->GetValue(ALPHA_EAS); @@ -1279,14 +1290,15 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( this->CalculateCommonComponents(common_components, this_cartesian_derivatives); // Reading integration points - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number ) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, r_integration_points, point_number, r_alpha_eas, zeta_gauss); - if( rOutput[point_number].size2() != general_variables.F.size2() ) + if(rOutput[point_number].size2() != general_variables.F.size2() ) { rOutput[point_number].resize( general_variables.F.size1() , general_variables.F.size2() , false ); + } rOutput[point_number] = general_variables.F; } } else if (mConstitutiveLawVector[0]->Has( rVariable)) { @@ -1302,10 +1314,10 @@ void SolidShellElementSprism3D6N::CalculateOnIntegrationPoints( rOutput.resize( 6 ); Matrix interpol = StructuralMechanicsMathUtilities::InterpolPrismGiD(integration_point_number); - for (IndexType iii = 0; iii < 6; ++iii) { + for (unsigned int iii = 0; iii < 6; ++iii) { rOutput[iii] = ZeroMatrix(rOutput[0].size1(), rOutput[0].size2()); - for (IndexType i_gp = 0; i_gp < integration_point_number; i_gp++) { + for (unsigned int i_gp = 0; i_gp < integration_point_number; i_gp++) { rOutput[iii] += interpol(i_gp, iii) * rOutput_aux[i_gp]; } } @@ -1387,11 +1399,12 @@ int SolidShellElementSprism3D6N::Check(const ProcessInfo& rCurrentProcessInfo) c // Check strain measure bool correct_strain_measure = false; - for(IndexType i = 0; i < law_features.mStrainMeasures.size(); ++i) + for (unsigned int i = 0; i < law_features.mStrainMeasures.size(); ++i) { if (law_features.mStrainMeasures[i] == ConstitutiveLaw::StrainMeasure_Deformation_Gradient || law_features.mStrainMeasures[i] == ConstitutiveLaw::StrainMeasure_Infinitesimal) { correct_strain_measure = true; } + } KRATOS_ERROR_IF_NOT(correct_strain_measure) << "Constitutive law is not compatible with the element type SolidShellElementSprism3D6N" << std::endl; @@ -1414,17 +1427,16 @@ void SolidShellElementSprism3D6N::InitializeSolutionStep(const ProcessInfo& rCur this->InitializeGeneralVariables(general_variables); /* Create constitutive law parameters: */ - ConstitutiveLaw::Parameters Values(r_geometry, GetProperties(), rCurrentProcessInfo); + ConstitutiveLaw::Parameters cl_values(r_geometry, GetProperties(), rCurrentProcessInfo); /* Set constitutive law flags: */ - Flags& r_constitutive_law_options = Values.GetOptions(); - + Flags& r_constitutive_law_options = cl_values.GetOptions(); r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS); r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false); /* Reading integration points */ - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); double& r_alpha_eas = this->GetValue(ALPHA_EAS); @@ -1439,25 +1451,26 @@ void SolidShellElementSprism3D6N::InitializeSolutionStep(const ProcessInfo& rCur // Reading integration points const Properties& r_properties = GetProperties(); - const auto& N_values = msGeometryData.ShapeFunctionsValues(this->GetIntegrationMethod()); - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; + const auto& r_N_values = msGeometryData.ShapeFunctionsValues(this->GetIntegrationMethod()); + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number ) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, r_integration_points, point_number, r_alpha_eas, zeta_gauss); // To take in account previous step writing - if( mFinalizedStep ) - this->GetHistoricalVariables(general_variables,point_number); + if (mFinalizedStep) { + this->GetHistoricalVariables(general_variables, point_number); + } // Set general variables to constitutive law parameters - this->SetGeneralVariables(general_variables,Values,point_number); + this->SetGeneralVariables(general_variables, cl_values, point_number); // Call the constitutive law to update material variables - mConstitutiveLawVector[point_number]->InitializeMaterialResponse(Values, GetStressMeasure()); + mConstitutiveLawVector[point_number]->InitializeMaterialResponse(cl_values, GetStressMeasure()); // TODO: Deprecated, remove this - mConstitutiveLawVector[point_number]->InitializeSolutionStep( r_properties, r_geometry, row( N_values, point_number ), rCurrentProcessInfo); + mConstitutiveLawVector[point_number]->InitializeSolutionStep( r_properties, r_geometry, row( r_N_values, point_number ), rCurrentProcessInfo); } mFinalizedStep = false; @@ -1478,15 +1491,14 @@ void SolidShellElementSprism3D6N::FinalizeSolutionStep(const ProcessInfo& rCurre this->InitializeGeneralVariables(general_variables); // Create constitutive law parameters: - ConstitutiveLaw::Parameters Values(r_geometry, GetProperties(), rCurrentProcessInfo); + ConstitutiveLaw::Parameters cl_values(r_geometry, GetProperties(), rCurrentProcessInfo); // Get constitutive law flags: - Flags& r_constitutive_law_options=Values.GetOptions(); - + Flags& r_constitutive_law_options = cl_values.GetOptions(); r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true); - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); double& r_alpha_eas = this->GetValue(ALPHA_EAS); @@ -1501,21 +1513,21 @@ void SolidShellElementSprism3D6N::FinalizeSolutionStep(const ProcessInfo& rCurre // Reading integration points const Properties& r_properties = GetProperties(); - const auto& N_values = msGeometryData.ShapeFunctionsValues(mThisIntegrationMethod); - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; + const auto& r_N_values = msGeometryData.ShapeFunctionsValues(this->GetIntegrationMethod()); + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number ) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components,integration_points, point_number, r_alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components,r_integration_points, point_number, r_alpha_eas, zeta_gauss); // Set general variables to constitutive law parameters - this->SetGeneralVariables(general_variables,Values,point_number); + this->SetGeneralVariables(general_variables, cl_values, point_number); // Call the constitutive law to update material variables - mConstitutiveLawVector[point_number]->FinalizeMaterialResponse(Values, general_variables.StressMeasure); + mConstitutiveLawVector[point_number]->FinalizeMaterialResponse(cl_values, general_variables.StressMeasure); // Call the constitutive law to finalize the solution step - mConstitutiveLawVector[point_number]->FinalizeSolutionStep( r_properties, r_geometry, row( N_values, point_number ), rCurrentProcessInfo); + mConstitutiveLawVector[point_number]->FinalizeSolutionStep( r_properties, r_geometry, row( r_N_values, point_number ), rCurrentProcessInfo); // Call the element internal variables update this->FinalizeStepVariables(general_variables, point_number); @@ -1550,11 +1562,10 @@ void SolidShellElementSprism3D6N::FinalizeNonLinearIteration( const ProcessInfo& this->InitializeGeneralVariables(general_variables); /* Create constitutive law parameters: */ - ConstitutiveLaw::Parameters values(r_geometry, GetProperties(), rCurrentProcessInfo); + ConstitutiveLaw::Parameters cl_values(r_geometry, GetProperties(), rCurrentProcessInfo); /* Set constitutive law flags: */ - Flags& r_constitutive_law_options=values.GetOptions(); - + Flags& r_constitutive_law_options = cl_values.GetOptions(); r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true); if (mELementalFlags.IsNot(SolidShellElementSprism3D6N::EXPLICIT_RHS_COMPUTATION) ) { // Implicit calculation of the RHS @@ -1564,7 +1575,7 @@ void SolidShellElementSprism3D6N::FinalizeNonLinearIteration( const ProcessInfo& } /* Reading integration points */ - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); /* Getting the alpha parameter of the EAS improvement */ double& r_alpha_eas = this->GetValue(ALPHA_EAS); @@ -1583,23 +1594,23 @@ void SolidShellElementSprism3D6N::FinalizeNonLinearIteration( const ProcessInfo& EAS.clear(); // Reading integration points - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number ) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; /* Assemble B */ this->CalculateDeformationMatrix(general_variables.B, common_components, zeta_gauss, r_alpha_eas); // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, r_integration_points, point_number, r_alpha_eas, zeta_gauss); // Set general variables to constitutive law parameters - this->SetGeneralVariables(general_variables, values, point_number); + this->SetGeneralVariables(general_variables, cl_values, point_number); // Compute stresses and constitutive parameters - mConstitutiveLawVector[point_number]->CalculateMaterialResponse(values, general_variables.StressMeasure); + mConstitutiveLawVector[point_number]->CalculateMaterialResponse(cl_values, general_variables.StressMeasure); // Calculating weights for integration on the "reference configuration" - const double integration_weight = integration_points[point_number].Weight() * general_variables.detJ; + const double integration_weight = r_integration_points[point_number].Weight() * general_variables.detJ; /* Integrate in Zeta */ // EAS components @@ -1607,9 +1618,12 @@ void SolidShellElementSprism3D6N::FinalizeNonLinearIteration( const ProcessInfo& } /* Getting the increase of displacements */ - BoundedMatrix delta_disp; + BoundedMatrix delta_disp, current_disp, previous_disp; + GetVectorCurrentPosition(current_disp); + GetVectorPreviousPosition(previous_disp); - delta_disp = GetVectorCurrentPosition() - GetVectorPreviousPosition(); // Calculates the increase of displacements + // Calculates the increase of displacements + noalias(delta_disp) = current_disp - previous_disp; /* Update alpha EAS */ if (EAS.mStiffAlpha > std::numeric_limits::epsilon()) { // Avoid division by zero @@ -1633,37 +1647,17 @@ void SolidShellElementSprism3D6N::Initialize(const ProcessInfo& rCurrentProcessI // Checking integration order if( r_properties.Has(INTEGRATION_ORDER) ) { - const SizeType integration_order = r_properties.GetValue(INTEGRATION_ORDER); - switch ( integration_order ) - { - case 1: - mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_1; - break; - case 2: - mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_2; - break; - case 3: - mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_3; - break; - case 4: - mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_4; - break; - case 5: - mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_5; - break; - default: - KRATOS_WARNING("SolidShellElementSprism3D6N") << "Integration order " << integration_order << " is not available, using default integration order for the geometry" << std::endl; - mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_1; + mIntegrationOrder = r_properties.GetValue(INTEGRATION_ORDER); + if (mIntegrationOrder < 0 || mIntegrationOrder > 5) { + KRATOS_WARNING("SolidShellElementSprism3D6N") << "Integration order " << mIntegrationOrder << " is not available, using default integration order for the geometry" << std::endl; + mIntegrationOrder = 0; } - } else { - mThisIntegrationMethod = GeometryData::IntegrationMethod::GI_GAUSS_1; } - - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); /* Constitutive Law initialisation */ - if ( mConstitutiveLawVector.size() != integration_points.size() ) { - mConstitutiveLawVector.resize( integration_points.size() ); + if ( mConstitutiveLawVector.size() != r_integration_points.size() ) { + mConstitutiveLawVector.resize( r_integration_points.size() ); } /* Implicit or explicit EAS update */ @@ -1695,7 +1689,7 @@ void SolidShellElementSprism3D6N::Initialize(const ProcessInfo& rCurrentProcessI } // Resizing the containers - mAuxContainer.resize( integration_points.size() ); + mAuxContainer.resize( r_integration_points.size() ); if (mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { // Jacobian inverses // Compute jacobian inverses and set the domain initial size @@ -1703,14 +1697,14 @@ void SolidShellElementSprism3D6N::Initialize(const ProcessInfo& rCurrentProcessI /* Calculating the inverse J0 */ Matrix J0(3, 3); - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number ) { // Calculating and storing inverse of the jacobian and the parameters needed double aux_detJ; - r_geometry.Jacobian(J0, integration_points[point_number]); + r_geometry.Jacobian(J0, r_integration_points[point_number]); MathUtils::InvertMatrix( J0, mAuxContainer[point_number], aux_detJ ); } } else { // Historic deformation gradient - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number ) { mAuxContainer[point_number] = IdentityMatrix(3); } } @@ -1743,14 +1737,12 @@ void SolidShellElementSprism3D6N::CalculateElementalSystem( this->InitializeGeneralVariables(general_variables); /* Create constitutive law parameters: */ - ConstitutiveLaw::Parameters values(r_geometry, GetProperties(), rCurrentProcessInfo); + ConstitutiveLaw::Parameters cl_values(r_geometry, GetProperties(), rCurrentProcessInfo); /* Set constitutive law flags: */ - Flags& r_constitutive_law_options = values.GetOptions(); - + Flags& r_constitutive_law_options = cl_values.GetOptions(); r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS, true); - if ( rLocalSystem.CalculationFlags.IsNot(SolidShellElementSprism3D6N::COMPUTE_LHS_MATRIX) && mELementalFlags.Is(SolidShellElementSprism3D6N::EXPLICIT_RHS_COMPUTATION) ) { // Explicit calculation of the RHS and calculation of the matrix is required r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_CONSTITUTIVE_TENSOR, false); @@ -1759,7 +1751,7 @@ void SolidShellElementSprism3D6N::CalculateElementalSystem( } /* Reading integration points */ - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); /* Getting the alpha parameter of the EAS improvement */ double& r_alpha_eas = this->GetValue(ALPHA_EAS); @@ -1785,23 +1777,23 @@ void SolidShellElementSprism3D6N::CalculateElementalSystem( Vector volume_force = ZeroVector(3); // Reading integration points - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number ) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; /* Assemble B */ this->CalculateDeformationMatrix(general_variables.B, common_components, zeta_gauss, r_alpha_eas); // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, r_alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, r_integration_points, point_number, r_alpha_eas, zeta_gauss); // Set general variables to constitutive law parameters - this->SetGeneralVariables(general_variables, values, point_number); + this->SetGeneralVariables(general_variables, cl_values, point_number); // Compute stresses and constitutive parameters - mConstitutiveLawVector[point_number]->CalculateMaterialResponse(values, general_variables.StressMeasure); + mConstitutiveLawVector[point_number]->CalculateMaterialResponse(cl_values, general_variables.StressMeasure); // Calculating weights for integration on the "reference configuration" - const double integration_weight = integration_points[point_number].Weight() * general_variables.detJ; + const double integration_weight = r_integration_points[point_number].Weight() * general_variables.detJ; /* Integrate in Zeta */ // Stresses @@ -1823,7 +1815,7 @@ void SolidShellElementSprism3D6N::CalculateElementalSystem( if ( rLocalSystem.CalculationFlags.Is(SolidShellElementSprism3D6N::COMPUTE_LHS_MATRIX) ) { // Calculation of the matrix is required /* Contribution to the tangent stiffness matrix */ - this->CalculateAndAddLHS( rLocalSystem, general_variables, values, rIntegratedStress, common_components, this_cartesian_derivatives, EAS, r_alpha_eas ); + this->CalculateAndAddLHS( rLocalSystem, general_variables, cl_values, rIntegratedStress, common_components, this_cartesian_derivatives, EAS, r_alpha_eas ); } KRATOS_CATCH(""); @@ -1847,7 +1839,7 @@ void SolidShellElementSprism3D6N::PrintElementCalculation( const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); const IndexType number_of_neighbours = NumberOfActiveNeighbours(r_neighbour_nodes); - for ( IndexType i = 0; i < number_of_nodes; ++i ) { + for (unsigned int i = 0; i < number_of_nodes; ++i ) { const array_1d& r_current_position = r_geometry[i].Coordinates(); const array_1d& r_current_displacement = r_geometry[i].FastGetSolutionStepValue(DISPLACEMENT); const array_1d& r_previous_displacement = r_geometry[i].FastGetSolutionStepValue(DISPLACEMENT, 1); @@ -1855,7 +1847,7 @@ void SolidShellElementSprism3D6N::PrintElementCalculation( KRATOS_INFO("SolidShellElementSprism3D6N") << " Previous Position node[" << r_geometry[i].Id() << "]: " << previous_position << std::endl; } - for ( IndexType i = 0; i < number_of_neighbours; ++i ) { + for (unsigned int i = 0; i < number_of_neighbours; ++i ) { const array_1d& r_current_position = r_neighbour_nodes[i].Coordinates(); const array_1d& r_current_displacement = r_neighbour_nodes[i].FastGetSolutionStepValue(DISPLACEMENT); const array_1d& r_previous_displacement = r_neighbour_nodes[i].FastGetSolutionStepValue(DISPLACEMENT, 1); @@ -1863,32 +1855,32 @@ void SolidShellElementSprism3D6N::PrintElementCalculation( KRATOS_INFO("SolidShellElementSprism3D6N") << " Previous Position neighbour node[" << r_neighbour_nodes[i].Id() << "]: "<& r_current_position = r_geometry[i].Coordinates(); KRATOS_INFO("SolidShellElementSprism3D6N") << " Current Position node[" << r_geometry[i].Id()<<"]: " << r_current_position << std::endl; } - for ( IndexType i = 0; i < number_of_neighbours; ++i ) { + for (unsigned int i = 0; i < number_of_neighbours; ++i ) { const array_1d& r_current_position = r_neighbour_nodes[i].Coordinates(); KRATOS_INFO("SolidShellElementSprism3D6N") << " Current Position neighbour node[" << r_neighbour_nodes[i].Id() <<"]: " << r_current_position << std::endl; } - for ( IndexType i = 0; i < number_of_nodes; ++i ) { + for (unsigned int i = 0; i < number_of_nodes; ++i ) { const array_1d& r_previous_displacement = r_geometry[i].FastGetSolutionStepValue(DISPLACEMENT,1); KRATOS_INFO("SolidShellElementSprism3D6N") << " Previous Displacement node[" << r_geometry[i].Id() << "]: " << r_previous_displacement << std::endl; } - for ( IndexType i = 0; i < number_of_neighbours; ++i ) { + for (unsigned int i = 0; i < number_of_neighbours; ++i ) { const array_1d& r_previous_displacement = r_neighbour_nodes[i].FastGetSolutionStepValue(DISPLACEMENT,1); KRATOS_INFO("SolidShellElementSprism3D6N") << " Previous Displacement neighbour node[" << r_neighbour_nodes[i].Id() << "]: " << r_previous_displacement << std::endl; } - for ( IndexType i = 0; i < number_of_nodes; ++i ) { + for (unsigned int i = 0; i < number_of_nodes; ++i ) { const array_1d& r_current_displacement = r_geometry[i].FastGetSolutionStepValue(DISPLACEMENT); KRATOS_INFO("SolidShellElementSprism3D6N") << " Current Displacement node[" << r_geometry[i].Id() << "]: " << r_current_displacement << std::endl; } - for ( IndexType i = 0; i < number_of_neighbours; ++i ) { + for (unsigned int i = 0; i < number_of_neighbours; ++i ) { const array_1d& r_current_displacement = r_neighbour_nodes[i].FastGetSolutionStepValue(DISPLACEMENT); KRATOS_INFO("SolidShellElementSprism3D6N") << " Current Displacement node[" << r_neighbour_nodes[i].Id() << "]: " << r_current_displacement << std::endl; } @@ -1928,9 +1920,10 @@ bool SolidShellElementSprism3D6N::HasNeighbour( std::size_t SolidShellElementSprism3D6N::NumberOfActiveNeighbours(const WeakPointerVectorNodesType& pNeighbourNodes) const { std::size_t active_neighbours = 0; - for (IndexType i = 0; i < pNeighbourNodes.size(); ++i) { - if (HasNeighbour(i, pNeighbourNodes[i])) + for (unsigned int i = 0; i < pNeighbourNodes.size(); ++i) { + if (HasNeighbour(i, pNeighbourNodes[i])) { ++active_neighbours; + } } return active_neighbours; } @@ -1939,69 +1932,77 @@ std::size_t SolidShellElementSprism3D6N::NumberOfActiveNeighbours(const WeakPoin /***********************************************************************************/ void SolidShellElementSprism3D6N::GetNodalCoordinates( - BoundedMatrix & NodesCoord, + BoundedMatrix& rNodesCoordinates, const WeakPointerVectorNodesType& rNeighbourNodes, const Configuration ThisConfiguration ) const { // Get geometry const auto& r_geometry = GetGeometry(); + const unsigned int number_of_nodes = r_geometry.size(); // Get the number of neighbours - NodesCoord = ZeroMatrix(12, 3); - const IndexType number_of_neighbours = NumberOfActiveNeighbours(rNeighbourNodes); + rNodesCoordinates = ZeroMatrix(12, 3); + const unsigned int number_of_neighbours = NumberOfActiveNeighbours(rNeighbourNodes); if (ThisConfiguration == Configuration::INITIAL) { /* Fill the aux matrix of coordinates */ - for (IndexType i = 0; i < 6; ++i) { + for (unsigned int i = 0; i < number_of_nodes; ++i) { const array_1d& r_initial_position = r_geometry[i].GetInitialPosition().Coordinates(); - for (IndexType j = 0; j < 3; ++j) - NodesCoord(i, j) = r_initial_position[j]; + for (unsigned int j = 0; j < 3; ++j) { + rNodesCoordinates(i, j) = r_initial_position[j]; + } } - if (number_of_neighbours == 6) { // All the possible neighbours - for (IndexType i = 0; i < 6; ++i) { + if (number_of_neighbours == number_of_nodes) { // All the possible neighbours + for (unsigned int i = 0; i < number_of_nodes; ++i) { const array_1d& r_initial_position = rNeighbourNodes[i].GetInitialPosition().Coordinates(); - for (IndexType j = 0; j < 3; ++j) - NodesCoord(i + 6, j) = r_initial_position[j]; + for (unsigned int j = 0; j < 3; ++j) { + rNodesCoordinates(i + number_of_nodes, j) = r_initial_position[j]; + } } } else { - for (IndexType i = 0; i < 6; ++i) { + for (unsigned int i = 0; i < number_of_nodes; ++i) { if (HasNeighbour(i, rNeighbourNodes[i])) { const array_1d& r_initial_position = rNeighbourNodes[i].GetInitialPosition().Coordinates(); - for (IndexType j = 0; j < 3; ++j) - NodesCoord(i + 6, j) = r_initial_position[j]; - + for (unsigned int j = 0; j < 3; ++j) { + rNodesCoordinates(i + number_of_nodes, j) = r_initial_position[j]; + } } else { - for (IndexType j = 0; j < 3; ++j) - NodesCoord(i + 6, j) = 0.0; + for (unsigned int j = 0; j < 3; ++j) { + rNodesCoordinates(i + number_of_nodes, j) = 0.0; + } } } } } else if (ThisConfiguration == Configuration::CURRENT) { /* Fill the aux matrix of coordinates */ - for (IndexType i = 0; i < 6; ++i) { + for (unsigned int i = 0; i < number_of_nodes; ++i) { const array_1d& r_current_position = r_geometry[i].Coordinates(); - for (IndexType j = 0; j < 3; ++j) - NodesCoord(i, j) = r_current_position[j]; + for (unsigned int j = 0; j < 3; ++j) { + rNodesCoordinates(i, j) = r_current_position[j]; + } } - if (number_of_neighbours == 6) { // All the possible neighours - for (IndexType i = 0; i < 6; ++i) { + if (number_of_neighbours == number_of_nodes) { // All the possible neighours + for (unsigned int i = 0; i < number_of_nodes; ++i) { const array_1d& r_current_position = rNeighbourNodes[i].Coordinates(); - for (IndexType j = 0; j < 3; ++j) - NodesCoord(i + 6, j) = r_current_position[j]; + for (unsigned int j = 0; j < 3; ++j) { + rNodesCoordinates(i + number_of_nodes, j) = r_current_position[j]; + } } } else { - for (IndexType i = 0; i < 6; ++i) { + for (unsigned int i = 0; i < number_of_nodes; ++i) { if (HasNeighbour(i, rNeighbourNodes[i])) { const array_1d& r_current_position = rNeighbourNodes[i].Coordinates(); - for (IndexType j = 0; j < 3; ++j) - NodesCoord(i + 6, j) = r_current_position[j]; + for (unsigned int j = 0; j < 3; ++j) { + rNodesCoordinates(i + number_of_nodes, j) = r_current_position[j]; + } } else { - for (IndexType j = 0; j < 3; ++j) - NodesCoord(i + 6, j) = 0.0; + for (unsigned int j = 0; j < 3; ++j) { + rNodesCoordinates(i + number_of_nodes, j) = 0.0; + } } } } @@ -2016,12 +2017,12 @@ void SolidShellElementSprism3D6N::GetNodalCoordinates( void SolidShellElementSprism3D6N::CalculateCartesianDerivatives(CartesianDerivatives& rCartesianDerivatives) { - BoundedMatrix nodes_coord; // Coordinates of the nodes + BoundedMatrix nodes_coordinates; // Coordinates of the nodes const WeakPointerVectorNodesType& neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); if (mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { - this->GetNodalCoordinates(nodes_coord, neighbour_nodes, Configuration::INITIAL); + this->GetNodalCoordinates(nodes_coordinates, neighbour_nodes, Configuration::INITIAL); } else { - this->GetNodalCoordinates(nodes_coord, neighbour_nodes, Configuration::CURRENT); + this->GetNodalCoordinates(nodes_coordinates, neighbour_nodes, Configuration::CURRENT); } /* Calculate local system of coordinates of the element */ @@ -2039,9 +2040,9 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerivatives(CartesianDerivat CalculateCartesianDerivativesOnCenterPlane(cartesian_derivatives_center_upper, this_orthogonal_base, GeometricLevel::UPPER ); /* Transversal derivative */ - CalculateCartesianDerOnCenterTrans(rCartesianDerivatives, nodes_coord, this_orthogonal_base, GeometricLevel::CENTER); // Center - CalculateCartesianDerOnCenterTrans(rCartesianDerivatives, nodes_coord, this_orthogonal_base, GeometricLevel::LOWER); // Lower part - CalculateCartesianDerOnCenterTrans(rCartesianDerivatives, nodes_coord, this_orthogonal_base, GeometricLevel::UPPER); // Upper part + CalculateCartesianDerOnCenterTrans(rCartesianDerivatives, nodes_coordinates, this_orthogonal_base, GeometricLevel::CENTER); // Center + CalculateCartesianDerOnCenterTrans(rCartesianDerivatives, nodes_coordinates, this_orthogonal_base, GeometricLevel::LOWER); // Lower part + CalculateCartesianDerOnCenterTrans(rCartesianDerivatives, nodes_coordinates, this_orthogonal_base, GeometricLevel::UPPER); // Upper part //******************************** GAUSS POINTS ******************************* @@ -2051,26 +2052,26 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerivatives(CartesianDerivat local_coordinates[2] = -1.0; /* Transversal derivatives */ - CalculateCartesianDerOnGaussTrans(rCartesianDerivatives.TransversalCartesianDerivativesGauss[0], nodes_coord, this_orthogonal_base, local_coordinates); + CalculateCartesianDerOnGaussTrans(rCartesianDerivatives.TransversalCartesianDerivativesGauss[0], nodes_coordinates, this_orthogonal_base, local_coordinates); local_coordinates[2] = 1.0; - CalculateCartesianDerOnGaussTrans(rCartesianDerivatives.TransversalCartesianDerivativesGauss[3], nodes_coord, this_orthogonal_base, local_coordinates); + CalculateCartesianDerOnGaussTrans(rCartesianDerivatives.TransversalCartesianDerivativesGauss[3], nodes_coordinates, this_orthogonal_base, local_coordinates); local_coordinates[0] = 0.0; local_coordinates[2] = -1.0; - CalculateCartesianDerOnGaussTrans(rCartesianDerivatives.TransversalCartesianDerivativesGauss[1], nodes_coord, this_orthogonal_base, local_coordinates); + CalculateCartesianDerOnGaussTrans(rCartesianDerivatives.TransversalCartesianDerivativesGauss[1], nodes_coordinates, this_orthogonal_base, local_coordinates); local_coordinates[2] = 1.0; - CalculateCartesianDerOnGaussTrans(rCartesianDerivatives.TransversalCartesianDerivativesGauss[4], nodes_coord, this_orthogonal_base, local_coordinates); + CalculateCartesianDerOnGaussTrans(rCartesianDerivatives.TransversalCartesianDerivativesGauss[4], nodes_coordinates, this_orthogonal_base, local_coordinates); local_coordinates[0] = 0.5; local_coordinates[1] = 0.0; local_coordinates[2] = -1.0; - CalculateCartesianDerOnGaussTrans(rCartesianDerivatives.TransversalCartesianDerivativesGauss[2], nodes_coord, this_orthogonal_base, local_coordinates); + CalculateCartesianDerOnGaussTrans(rCartesianDerivatives.TransversalCartesianDerivativesGauss[2], nodes_coordinates, this_orthogonal_base, local_coordinates); local_coordinates[2] = 1.0; - CalculateCartesianDerOnGaussTrans(rCartesianDerivatives.TransversalCartesianDerivativesGauss[5], nodes_coord, this_orthogonal_base, local_coordinates); + CalculateCartesianDerOnGaussTrans(rCartesianDerivatives.TransversalCartesianDerivativesGauss[5], nodes_coordinates, this_orthogonal_base, local_coordinates); /* In-plane derivative */ - for (IndexType i = 0; i < 3 ;++i) { + for (unsigned int i = 0; i < 3 ;++i) { if (HasNeighbour(i, neighbour_nodes[i])) { // Assuming that if the upper element has neighbours the lower has too - CalculateCartesianDerOnGaussPlane(rCartesianDerivatives.InPlaneCartesianDerivativesGauss[i ], nodes_coord, this_orthogonal_base, i, GeometricLevel::LOWER); - CalculateCartesianDerOnGaussPlane(rCartesianDerivatives.InPlaneCartesianDerivativesGauss[i + 3], nodes_coord, this_orthogonal_base, i, GeometricLevel::UPPER); + CalculateCartesianDerOnGaussPlane(rCartesianDerivatives.InPlaneCartesianDerivativesGauss[i ], nodes_coordinates, this_orthogonal_base, i, GeometricLevel::LOWER); + CalculateCartesianDerOnGaussPlane(rCartesianDerivatives.InPlaneCartesianDerivativesGauss[i + 3], nodes_coordinates, this_orthogonal_base, i, GeometricLevel::UPPER); } else { noalias(rCartesianDerivatives.InPlaneCartesianDerivativesGauss[i ]) = cartesian_derivatives_center_lower; noalias(rCartesianDerivatives.InPlaneCartesianDerivativesGauss[i + 3]) = cartesian_derivatives_center_upper; @@ -2088,9 +2089,9 @@ void SolidShellElementSprism3D6N::CalculateCommonComponents( { KRATOS_TRY; - BoundedMatrix NodesCoord; // Coordinates of the nodes + BoundedMatrix nodes_coordinates; // Coordinates of the nodes const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - this->GetNodalCoordinates(NodesCoord, r_neighbour_nodes, Configuration::CURRENT); + this->GetNodalCoordinates(nodes_coordinates, r_neighbour_nodes, Configuration::CURRENT); /* Declare deformation Gradient F components */ // In plane components @@ -2105,8 +2106,8 @@ void SolidShellElementSprism3D6N::CalculateCommonComponents( /* MEMBRANE CONTRIBUTION */ /* Calculating the membrane strain-displacement matrix */ // Lower face - for (IndexType i = 0; i < 3; ++i) { - CalculateInPlaneGradientFGauss(in_plane_gradient_F_gauss, rCartesianDerivatives.InPlaneCartesianDerivativesGauss[i], NodesCoord, i, GeometricLevel::LOWER); + for (unsigned int i = 0; i < 3; ++i) { + CalculateInPlaneGradientFGauss(in_plane_gradient_F_gauss, rCartesianDerivatives.InPlaneCartesianDerivativesGauss[i], nodes_coordinates, i, GeometricLevel::LOWER); CalculateAndAddBMembrane(rCommonComponents.BMembraneLower, rCommonComponents.CMembraneLower, rCartesianDerivatives.InPlaneCartesianDerivativesGauss[i], in_plane_gradient_F_gauss, i); } @@ -2114,8 +2115,8 @@ void SolidShellElementSprism3D6N::CalculateCommonComponents( rCommonComponents.CMembraneLower *= 1.0/3.0; // Upper face - for (IndexType i = 0; i < 3; ++i) { - CalculateInPlaneGradientFGauss(in_plane_gradient_F_gauss, rCartesianDerivatives.InPlaneCartesianDerivativesGauss[i + 3], NodesCoord, i, GeometricLevel::UPPER); + for (unsigned int i = 0; i < 3; ++i) { + CalculateInPlaneGradientFGauss(in_plane_gradient_F_gauss, rCartesianDerivatives.InPlaneCartesianDerivativesGauss[i + 3], nodes_coordinates, i, GeometricLevel::UPPER); CalculateAndAddBMembrane(rCommonComponents.BMembraneUpper, rCommonComponents.CMembraneUpper, rCartesianDerivatives.InPlaneCartesianDerivativesGauss[i + 3], in_plane_gradient_F_gauss, i); } @@ -2131,12 +2132,12 @@ void SolidShellElementSprism3D6N::CalculateCommonComponents( // Lower face /* Calculate f components in the face */ - CalculateTransverseGradientFinP(transverse_gradient_isoparametric, NodesCoord, GeometricLevel::LOWER); + CalculateTransverseGradientFinP(transverse_gradient_isoparametric, nodes_coordinates, GeometricLevel::LOWER); /* Calculate f transverse components */ - CalculateTransverseGradientF(transverse_gradient.F0, rCartesianDerivatives.TransversalCartesianDerivativesGauss[0], NodesCoord); - CalculateTransverseGradientF(transverse_gradient.F1, rCartesianDerivatives.TransversalCartesianDerivativesGauss[1], NodesCoord); - CalculateTransverseGradientF(transverse_gradient.F2, rCartesianDerivatives.TransversalCartesianDerivativesGauss[2], NodesCoord); + CalculateTransverseGradientF(transverse_gradient.F0, rCartesianDerivatives.TransversalCartesianDerivativesGauss[0], nodes_coordinates); + CalculateTransverseGradientF(transverse_gradient.F1, rCartesianDerivatives.TransversalCartesianDerivativesGauss[1], nodes_coordinates); + CalculateTransverseGradientF(transverse_gradient.F2, rCartesianDerivatives.TransversalCartesianDerivativesGauss[2], nodes_coordinates); /* Shear contribution to the deformation matrix */ CalculateAndAddBShear(rCommonComponents.BShearLower, rCommonComponents.CShearLower, rCartesianDerivatives, transverse_gradient, transverse_gradient_isoparametric, GeometricLevel::LOWER); @@ -2144,12 +2145,12 @@ void SolidShellElementSprism3D6N::CalculateCommonComponents( // Upper face /* Calculate f components in the face */ - CalculateTransverseGradientFinP(transverse_gradient_isoparametric, NodesCoord, GeometricLevel::UPPER); + CalculateTransverseGradientFinP(transverse_gradient_isoparametric, nodes_coordinates, GeometricLevel::UPPER); /* Calculate f transverse components */ - CalculateTransverseGradientF(transverse_gradient.F0, rCartesianDerivatives.TransversalCartesianDerivativesGauss[3], NodesCoord); - CalculateTransverseGradientF(transverse_gradient.F1, rCartesianDerivatives.TransversalCartesianDerivativesGauss[4], NodesCoord); - CalculateTransverseGradientF(transverse_gradient.F2, rCartesianDerivatives.TransversalCartesianDerivativesGauss[5], NodesCoord); + CalculateTransverseGradientF(transverse_gradient.F0, rCartesianDerivatives.TransversalCartesianDerivativesGauss[3], nodes_coordinates); + CalculateTransverseGradientF(transverse_gradient.F1, rCartesianDerivatives.TransversalCartesianDerivativesGauss[4], nodes_coordinates); + CalculateTransverseGradientF(transverse_gradient.F2, rCartesianDerivatives.TransversalCartesianDerivativesGauss[5], nodes_coordinates); /* Shear contribution to the deformation matrix */ CalculateAndAddBShear(rCommonComponents.BShearUpper, rCommonComponents.CShearUpper, rCartesianDerivatives, transverse_gradient, transverse_gradient_isoparametric, GeometricLevel::UPPER); @@ -2157,7 +2158,7 @@ void SolidShellElementSprism3D6N::CalculateCommonComponents( /* NORMAL TRANSVERSE */ /* Calculate f normal components */ array_1d F3; - CalculateTransverseGradientF(F3, rCartesianDerivatives.TransversalCartesianDerivativesCenter, NodesCoord); + CalculateTransverseGradientF(F3, rCartesianDerivatives.TransversalCartesianDerivativesCenter, nodes_coordinates); /* Calculating the normal transverse strain-displacement matrix */ CalculateAndAddBNormal(rCommonComponents.BNormal, rCommonComponents.CNormal, rCartesianDerivatives.TransversalCartesianDerivativesCenter, F3); @@ -2169,7 +2170,7 @@ void SolidShellElementSprism3D6N::CalculateCommonComponents( /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateLocalCoordinateSystem( - OrthogonalBase& ThisOrthogonalBase, + OrthogonalBase& rOrthogonalBase, const OrthogonalBaseApproach ThisOrthogonalBaseApproach, const double ThisAngle ) @@ -2200,9 +2201,9 @@ void SolidShellElementSprism3D6N::CalculateLocalCoordinateSystem( vye[2] = 0.5 * ((r_geometry[0].Z() + r_geometry[3].Z()) - (r_geometry[2].Z() + r_geometry[5].Z())); } - MathUtils::CrossProduct(ThisOrthogonalBase.Vzeta, vxe, vye); - norm = norm_2(ThisOrthogonalBase.Vzeta); - ThisOrthogonalBase.Vzeta /= norm; + MathUtils::CrossProduct(rOrthogonalBase.Vzeta, vxe, vye); + norm = norm_2(rOrthogonalBase.Vzeta); + rOrthogonalBase.Vzeta /= norm; const double threshold = std::numeric_limits::epsilon(); double ortho_comp; @@ -2213,98 +2214,98 @@ void SolidShellElementSprism3D6N::CalculateLocalCoordinateSystem( // 2- If Z is the prefered normal vector if (ThisOrthogonalBaseApproach == OrthogonalBaseApproach::X) { - ortho_comp = ThisOrthogonalBase.Vzeta[1] * ThisOrthogonalBase.Vzeta[1] + ThisOrthogonalBase.Vzeta[2] * ThisOrthogonalBase.Vzeta[2]; // Component in th Y-Z plane - if (ortho_comp < threshold) { // If ThisOrthogonalBase.Vzeta is almost orthogonal to Y-Z plane - ThisOrthogonalBase.Veta[0] = - ThisOrthogonalBase.Vzeta[2]; // Choose ThisOrthogonalBase.Vxi orthogonal to global Y direction - ThisOrthogonalBase.Veta[1] = 0.0; - ThisOrthogonalBase.Veta[2] = ThisOrthogonalBase.Vzeta[0]; - - norm = norm_2(ThisOrthogonalBase.Vxi); - ThisOrthogonalBase.Vxi /= norm; - MathUtils::CrossProduct(ThisOrthogonalBase.Vxi, ThisOrthogonalBase.Veta, ThisOrthogonalBase.Vzeta); - } else { // SELECT local y=ThisOrthogonalBase.Vxi in the global YZ plane - ThisOrthogonalBase.Vxi[0] = 0.0; - ThisOrthogonalBase.Vxi[1] = ThisOrthogonalBase.Vzeta[2]; - ThisOrthogonalBase.Vxi[2] = - ThisOrthogonalBase.Vzeta[1]; - - norm = norm_2(ThisOrthogonalBase.Vxi); - ThisOrthogonalBase.Vxi /= norm; - - ThisOrthogonalBase.Veta[0] = ortho_comp; // Choose ThisOrthogonalBase.Vxi orthogonal to global X direction - ThisOrthogonalBase.Veta[1] = - ThisOrthogonalBase.Vzeta[0] * ThisOrthogonalBase.Vzeta[1]; - ThisOrthogonalBase.Veta[2] = - ThisOrthogonalBase.Vzeta[0] * ThisOrthogonalBase.Vzeta[2]; - - norm = norm_2(ThisOrthogonalBase.Veta); - ThisOrthogonalBase.Veta /= norm; + ortho_comp = rOrthogonalBase.Vzeta[1] * rOrthogonalBase.Vzeta[1] + rOrthogonalBase.Vzeta[2] * rOrthogonalBase.Vzeta[2]; // Component in th Y-Z plane + if (ortho_comp < threshold) { // If rOrthogonalBase.Vzeta is almost orthogonal to Y-Z plane + rOrthogonalBase.Veta[0] = - rOrthogonalBase.Vzeta[2]; // Choose rOrthogonalBase.Vxi orthogonal to global Y direction + rOrthogonalBase.Veta[1] = 0.0; + rOrthogonalBase.Veta[2] = rOrthogonalBase.Vzeta[0]; + + norm = norm_2(rOrthogonalBase.Vxi); + rOrthogonalBase.Vxi /= norm; + MathUtils::CrossProduct(rOrthogonalBase.Vxi, rOrthogonalBase.Veta, rOrthogonalBase.Vzeta); + } else { // SELECT local y=rOrthogonalBase.Vxi in the global YZ plane + rOrthogonalBase.Vxi[0] = 0.0; + rOrthogonalBase.Vxi[1] = rOrthogonalBase.Vzeta[2]; + rOrthogonalBase.Vxi[2] = - rOrthogonalBase.Vzeta[1]; + + norm = norm_2(rOrthogonalBase.Vxi); + rOrthogonalBase.Vxi /= norm; + + rOrthogonalBase.Veta[0] = ortho_comp; // Choose rOrthogonalBase.Vxi orthogonal to global X direction + rOrthogonalBase.Veta[1] = - rOrthogonalBase.Vzeta[0] * rOrthogonalBase.Vzeta[1]; + rOrthogonalBase.Veta[2] = - rOrthogonalBase.Vzeta[0] * rOrthogonalBase.Vzeta[2]; + + norm = norm_2(rOrthogonalBase.Veta); + rOrthogonalBase.Veta /= norm; } } else if (ThisOrthogonalBaseApproach == OrthogonalBaseApproach::Y) { - ortho_comp = ThisOrthogonalBase.Vzeta[0] * ThisOrthogonalBase.Vzeta[0] + ThisOrthogonalBase.Vzeta[2] * ThisOrthogonalBase.Vzeta[2]; // Component in th Z-X plane + ortho_comp = rOrthogonalBase.Vzeta[0] * rOrthogonalBase.Vzeta[0] + rOrthogonalBase.Vzeta[2] * rOrthogonalBase.Vzeta[2]; // Component in th Z-X plane if (ortho_comp < threshold) { // If vze is almost orthogonal to Z-X plane - ThisOrthogonalBase.Veta[0] = 0.0; // Choose ThisOrthogonalBase.Vxi orthogonal to global X direction - ThisOrthogonalBase.Veta[1] = ThisOrthogonalBase.Vzeta[2]; - ThisOrthogonalBase.Veta[2] = - ThisOrthogonalBase.Vzeta[1]; - - norm = norm_2(ThisOrthogonalBase.Veta); - ThisOrthogonalBase.Veta /= norm; - MathUtils::CrossProduct(ThisOrthogonalBase.Vxi, ThisOrthogonalBase.Veta, ThisOrthogonalBase.Vzeta); - } else { // SELECT local z=ThisOrthogonalBase.Vxi in the global ZX plane - ThisOrthogonalBase.Vxi[0] = - ThisOrthogonalBase.Vzeta[2]; // Choose ThisOrthogonalBase.Vxi orthogonal to global Y direction - ThisOrthogonalBase.Vxi[1] = 0.0; - ThisOrthogonalBase.Vxi[2] = - ThisOrthogonalBase.Vzeta[0]; - - norm = norm_2(ThisOrthogonalBase.Vxi); - ThisOrthogonalBase.Vxi /= norm; - - ThisOrthogonalBase.Veta[0] = - ThisOrthogonalBase.Vzeta[0] * ThisOrthogonalBase.Vzeta[1]; - ThisOrthogonalBase.Veta[1] = ortho_comp; - ThisOrthogonalBase.Veta[2] = - ThisOrthogonalBase.Vzeta[2] * ThisOrthogonalBase.Vzeta[1]; - - norm = norm_2(ThisOrthogonalBase.Veta); - ThisOrthogonalBase.Veta /= norm; + rOrthogonalBase.Veta[0] = 0.0; // Choose rOrthogonalBase.Vxi orthogonal to global X direction + rOrthogonalBase.Veta[1] = rOrthogonalBase.Vzeta[2]; + rOrthogonalBase.Veta[2] = - rOrthogonalBase.Vzeta[1]; + + norm = norm_2(rOrthogonalBase.Veta); + rOrthogonalBase.Veta /= norm; + MathUtils::CrossProduct(rOrthogonalBase.Vxi, rOrthogonalBase.Veta, rOrthogonalBase.Vzeta); + } else { // SELECT local z=rOrthogonalBase.Vxi in the global ZX plane + rOrthogonalBase.Vxi[0] = - rOrthogonalBase.Vzeta[2]; // Choose rOrthogonalBase.Vxi orthogonal to global Y direction + rOrthogonalBase.Vxi[1] = 0.0; + rOrthogonalBase.Vxi[2] = - rOrthogonalBase.Vzeta[0]; + + norm = norm_2(rOrthogonalBase.Vxi); + rOrthogonalBase.Vxi /= norm; + + rOrthogonalBase.Veta[0] = - rOrthogonalBase.Vzeta[0] * rOrthogonalBase.Vzeta[1]; + rOrthogonalBase.Veta[1] = ortho_comp; + rOrthogonalBase.Veta[2] = - rOrthogonalBase.Vzeta[2] * rOrthogonalBase.Vzeta[1]; + + norm = norm_2(rOrthogonalBase.Veta); + rOrthogonalBase.Veta /= norm; } } else if (ThisOrthogonalBaseApproach == OrthogonalBaseApproach::Z) { - ortho_comp = ThisOrthogonalBase.Vzeta[0] * ThisOrthogonalBase.Vzeta[0] + ThisOrthogonalBase.Vzeta[1] * ThisOrthogonalBase.Vzeta[1]; // Component in th X-Y plane + ortho_comp = rOrthogonalBase.Vzeta[0] * rOrthogonalBase.Vzeta[0] + rOrthogonalBase.Vzeta[1] * rOrthogonalBase.Vzeta[1]; // Component in th X-Y plane if (ortho_comp < threshold) { // If vze is almost orthogonal to X-Y plane - ThisOrthogonalBase.Veta[0] = 0.0; // Choose ThisOrthogonalBase.Vxi orthogonal to global X direction - ThisOrthogonalBase.Veta[1] = ThisOrthogonalBase.Vzeta[2]; - ThisOrthogonalBase.Veta[2] = - ThisOrthogonalBase.Vzeta[1]; - - norm = norm_2(ThisOrthogonalBase.Veta); - ThisOrthogonalBase.Veta /= norm; - MathUtils::CrossProduct(ThisOrthogonalBase.Vxi, ThisOrthogonalBase.Veta, ThisOrthogonalBase.Vzeta); - } else { // SELECT local x=ThisOrthogonalBase.Vxi in the global XY plane - ThisOrthogonalBase.Vxi[0] = - ThisOrthogonalBase.Vzeta[1]; - ThisOrthogonalBase.Vxi[1] = ThisOrthogonalBase.Vzeta[0]; - ThisOrthogonalBase.Vxi[2] = 0.0; - - norm = norm_2(ThisOrthogonalBase.Vxi); - ThisOrthogonalBase.Vxi /= norm; - - ThisOrthogonalBase.Veta[0] = - ThisOrthogonalBase.Vzeta[0] * ThisOrthogonalBase.Vzeta[2]; // Choose ThisOrthogonalBase.Vxi orthogonal to global Z direction - ThisOrthogonalBase.Veta[1] = - ThisOrthogonalBase.Vzeta[1] * ThisOrthogonalBase.Vzeta[2]; - ThisOrthogonalBase.Veta[2] = ortho_comp; - - norm = norm_2(ThisOrthogonalBase.Veta); - ThisOrthogonalBase.Veta /= norm; + rOrthogonalBase.Veta[0] = 0.0; // Choose rOrthogonalBase.Vxi orthogonal to global X direction + rOrthogonalBase.Veta[1] = rOrthogonalBase.Vzeta[2]; + rOrthogonalBase.Veta[2] = - rOrthogonalBase.Vzeta[1]; + + norm = norm_2(rOrthogonalBase.Veta); + rOrthogonalBase.Veta /= norm; + MathUtils::CrossProduct(rOrthogonalBase.Vxi, rOrthogonalBase.Veta, rOrthogonalBase.Vzeta); + } else { // SELECT local x=rOrthogonalBase.Vxi in the global XY plane + rOrthogonalBase.Vxi[0] = - rOrthogonalBase.Vzeta[1]; + rOrthogonalBase.Vxi[1] = rOrthogonalBase.Vzeta[0]; + rOrthogonalBase.Vxi[2] = 0.0; + + norm = norm_2(rOrthogonalBase.Vxi); + rOrthogonalBase.Vxi /= norm; + + rOrthogonalBase.Veta[0] = - rOrthogonalBase.Vzeta[0] * rOrthogonalBase.Vzeta[2]; // Choose rOrthogonalBase.Vxi orthogonal to global Z direction + rOrthogonalBase.Veta[1] = - rOrthogonalBase.Vzeta[1] * rOrthogonalBase.Vzeta[2]; + rOrthogonalBase.Veta[2] = ortho_comp; + + norm = norm_2(rOrthogonalBase.Veta); + rOrthogonalBase.Veta /= norm; } } else { - ThisOrthogonalBase.Vxi[0] = 1.0; - ThisOrthogonalBase.Vxi[1] = 0.0; - ThisOrthogonalBase.Vxi[2] = 0.0; + rOrthogonalBase.Vxi[0] = 1.0; + rOrthogonalBase.Vxi[1] = 0.0; + rOrthogonalBase.Vxi[2] = 0.0; - ThisOrthogonalBase.Veta[0] = 0.0; - ThisOrthogonalBase.Veta[1] = 1.0; - ThisOrthogonalBase.Veta[2] = 0.0; + rOrthogonalBase.Veta[0] = 0.0; + rOrthogonalBase.Veta[1] = 1.0; + rOrthogonalBase.Veta[2] = 0.0; } if (ThisAngle != 0.0) { - // Compute angle between local system ThisOrthogonalBase.Vxi-ThisOrthogonalBase.Veta and L1 + // Compute angle between local system rOrthogonalBase.Vxi-rOrthogonalBase.Veta and L1 const double cosa = std::cos(ThisAngle); const double sina = std::sin(ThisAngle); - // Rotate local system ThisOrthogonalBase.Vxi-ThisOrthogonalBase.Veta to best fit L1-L2 - ThisOrthogonalBase.Vzeta = ThisOrthogonalBase.Vxi; // Reusing as auxiliary value - ThisOrthogonalBase.Vxi = cosa * ThisOrthogonalBase.Vxi + sina * ThisOrthogonalBase.Veta; - ThisOrthogonalBase.Veta = - sina * ThisOrthogonalBase.Vzeta + cosa * ThisOrthogonalBase.Veta; + // Rotate local system rOrthogonalBase.Vxi-rOrthogonalBase.Veta to best fit L1-L2 + rOrthogonalBase.Vzeta = rOrthogonalBase.Vxi; // Reusing as auxiliary value + rOrthogonalBase.Vxi = cosa * rOrthogonalBase.Vxi + sina * rOrthogonalBase.Veta; + rOrthogonalBase.Veta = - sina * rOrthogonalBase.Vzeta + cosa * rOrthogonalBase.Veta; } KRATOS_CATCH(""); @@ -2313,22 +2314,27 @@ void SolidShellElementSprism3D6N::CalculateLocalCoordinateSystem( /***********************************************************************************/ /***********************************************************************************/ -void SolidShellElementSprism3D6N::CalculateIdVector(array_1d& rIdVector) +void SolidShellElementSprism3D6N::CalculateIdVector(array_1d& rIdVector) { KRATOS_TRY; + // Get the number of nodes + const auto& r_geometry = GetGeometry(); + const unsigned int number_of_nodes = r_geometry.size(); + + // Get the list of neighbour nodes const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); /* Compute ID vector */ // TODO: Optimize this - IndexType index = 18; - for (IndexType i = 0; i < 6; ++i) { + unsigned int index = 18; + for (unsigned int i = 0; i < number_of_nodes; ++i) { if (HasNeighbour(i, r_neighbour_nodes[i])) { - for (IndexType j = 0; j < 3; ++j) { + for (unsigned int j = 0; j < 3; ++j) { rIdVector[i * 3 + j] = index; ++index; } } else { - for (IndexType j = 0; j < 3; ++j) { + for (unsigned int j = 0; j < 3; ++j) { rIdVector[i * 3 + j] = 36; } } @@ -2341,7 +2347,7 @@ void SolidShellElementSprism3D6N::CalculateIdVector(array_1d& rI /***********************************************************************************/ void SolidShellElementSprism3D6N::ComputeLocalDerivatives( - BoundedMatrix & LocalDerivativePatch, + BoundedMatrix& rLocalDerivativePatch, const array_1d& rLocalCoordinates ) { @@ -2351,38 +2357,38 @@ void SolidShellElementSprism3D6N::ComputeLocalDerivatives( /* Derivative in direction nu and xi */ // Lower face - LocalDerivativePatch(0, 0) = - L_1; - LocalDerivativePatch(1, 0) = L_1; - LocalDerivativePatch(2, 0) = 0.0; + rLocalDerivativePatch(0, 0) = - L_1; + rLocalDerivativePatch(1, 0) = L_1; + rLocalDerivativePatch(2, 0) = 0.0; - LocalDerivativePatch(0, 1) = - L_1; - LocalDerivativePatch(1, 1) = 0.0; - LocalDerivativePatch(2, 1) = L_1; + rLocalDerivativePatch(0, 1) = - L_1; + rLocalDerivativePatch(1, 1) = 0.0; + rLocalDerivativePatch(2, 1) = L_1; // Upper face - LocalDerivativePatch(3, 0) = - L_2; - LocalDerivativePatch(4, 0) = L_2; - LocalDerivativePatch(5, 0) = 0.0; + rLocalDerivativePatch(3, 0) = - L_2; + rLocalDerivativePatch(4, 0) = L_2; + rLocalDerivativePatch(5, 0) = 0.0; - LocalDerivativePatch(3, 1) = - L_2; - LocalDerivativePatch(4, 1) = 0.0; - LocalDerivativePatch(5, 1) = L_2; + rLocalDerivativePatch(3, 1) = - L_2; + rLocalDerivativePatch(4, 1) = 0.0; + rLocalDerivativePatch(5, 1) = L_2; // /* Derivative in direction zeta */ -// LocalDerivativePatch(0, 2) = - zzeta/2.0; -// LocalDerivativePatch(1, 2) = - rLocalCoordinates[0]/2.0; -// LocalDerivativePatch(2, 2) = - rLocalCoordinates[1]/2.0; -// LocalDerivativePatch(3, 2) = zzeta/2.0; -// LocalDerivativePatch(4, 2) = rLocalCoordinates[0]/2.0; -// LocalDerivativePatch(5, 2) = rLocalCoordinates[1]/2.0; +// rLocalDerivativePatch(0, 2) = - zzeta/2.0; +// rLocalDerivativePatch(1, 2) = - rLocalCoordinates[0]/2.0; +// rLocalDerivativePatch(2, 2) = - rLocalCoordinates[1]/2.0; +// rLocalDerivativePatch(3, 2) = zzeta/2.0; +// rLocalDerivativePatch(4, 2) = rLocalCoordinates[0]/2.0; +// rLocalDerivativePatch(5, 2) = rLocalCoordinates[1]/2.0; /* Derivative in direction zeta */ - LocalDerivativePatch(0, 2) = - 1.0 + rLocalCoordinates[1] + rLocalCoordinates[0]; - LocalDerivativePatch(1, 2) = - rLocalCoordinates[0]; - LocalDerivativePatch(2, 2) = - rLocalCoordinates[1]; - LocalDerivativePatch(3, 2) = 1.0 - rLocalCoordinates[1] - rLocalCoordinates[0]; - LocalDerivativePatch(4, 2) = rLocalCoordinates[0]; - LocalDerivativePatch(5, 2) = rLocalCoordinates[1]; + rLocalDerivativePatch(0, 2) = - 1.0 + rLocalCoordinates[1] + rLocalCoordinates[0]; + rLocalDerivativePatch(1, 2) = - rLocalCoordinates[0]; + rLocalDerivativePatch(2, 2) = - rLocalCoordinates[1]; + rLocalDerivativePatch(3, 2) = 1.0 - rLocalCoordinates[1] - rLocalCoordinates[0]; + rLocalDerivativePatch(4, 2) = rLocalCoordinates[0]; + rLocalDerivativePatch(5, 2) = rLocalCoordinates[1]; } /***********************************************************************************/ @@ -2390,7 +2396,7 @@ void SolidShellElementSprism3D6N::ComputeLocalDerivatives( void SolidShellElementSprism3D6N::ComputeLocalDerivativesQuadratic( BoundedMatrix& rLocalDerivativePatch, - const IndexType NodeGauss + const unsigned int NodeGauss ) { /* Local coordinates */ @@ -2433,20 +2439,22 @@ void SolidShellElementSprism3D6N::ComputeLocalDerivativesQuadratic( /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateJacobianCenterGauss( - GeometryType::JacobiansType& J, - std::vector< Matrix >& Jinv, - Vector& detJ, - const IndexType rPointNumber, + GeometryType::JacobiansType& rJ, + std::vector< Matrix >& rJinv, + Vector& rDetJ, + const unsigned int PointNumber, const double ZetaGauss ) { /* Fill the aux matrix of coordinates */ const auto& r_geometry = GetGeometry(); - BoundedMatrix nodes_coord; - for (IndexType i = 0; i < 6; ++i) { + const unsigned int number_of_nodes = r_geometry.size(); + BoundedMatrix nodes_coordinates; + for (unsigned int i = 0; i < number_of_nodes; ++i) { const array_1d& r_current_position = r_geometry[i].Coordinates(); - for (IndexType j = 0; j < 3; ++j) - nodes_coord(j, i) = r_current_position[j]; + for (unsigned int j = 0; j < 3; ++j) { + nodes_coordinates(j, i) = r_current_position[j]; + } } array_1d local_coordinates; @@ -2455,94 +2463,100 @@ void SolidShellElementSprism3D6N::CalculateJacobianCenterGauss( local_coordinates[2] = ZetaGauss; /* Local derivatives patch */ - BoundedMatrix LocalDerivativePatch; - ComputeLocalDerivatives(LocalDerivativePatch, local_coordinates); + BoundedMatrix rLocalDerivativePatch; + ComputeLocalDerivatives(rLocalDerivativePatch, local_coordinates); /* Compute Jacobian */ - noalias(J[rPointNumber]) = prod(nodes_coord, LocalDerivativePatch); + noalias(rJ[PointNumber]) = prod(nodes_coordinates, rLocalDerivativePatch); /* Compute inverse of the Jaccobian */ - MathUtils::InvertMatrix( J[rPointNumber], Jinv[rPointNumber], detJ[rPointNumber] ); + MathUtils::InvertMatrix(rJ[PointNumber], rJinv[PointNumber], rDetJ[PointNumber]); } /***********************************************************************************/ /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateJacobian( - double & detJ, - BoundedMatrix & J, - BoundedMatrix & LocalDerivativePatch, - const BoundedMatrix & NodesCoord, + double& rDetJ, + BoundedMatrix& rJ, + BoundedMatrix& rLocalDerivativePatch, + const BoundedMatrix& rNodesCoordinates, const array_1d& rLocalCoordinates ) { + // Get the number of nodes + const auto& r_geometry = GetGeometry(); + const unsigned int number_of_nodes = r_geometry.size(); + /* Auxiliary coordinates of the nodes */ - BoundedMatrix nodes_coord_aux; + BoundedMatrix nodes_coord_aux; - for (IndexType i = 0; i < 6; ++i) - for (IndexType j = 0; j < 3; ++j) - nodes_coord_aux(j, i) = NodesCoord(i, j); + for (unsigned int i = 0; i < number_of_nodes; ++i) { + for (unsigned int j = 0; j < 3; ++j) { + nodes_coord_aux(j, i) = rNodesCoordinates(i, j); + } + } /* Local derivatives patch */ - ComputeLocalDerivatives(LocalDerivativePatch, rLocalCoordinates); + ComputeLocalDerivatives(rLocalDerivativePatch, rLocalCoordinates); /* Compute Jacobian */ - noalias(J) = prod(nodes_coord_aux, LocalDerivativePatch); + noalias(rJ) = prod(nodes_coord_aux, rLocalDerivativePatch); /* Compute determinant */ - detJ = MathUtils::Det3(J); + rDetJ = MathUtils::Det3(rJ); } /***********************************************************************************/ /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateJacobianAndInv( - BoundedMatrix& J, - BoundedMatrix& Jinv, - BoundedMatrix& LocalDerivativePatch, - const BoundedMatrix& NodesCoord, + BoundedMatrix& rJ, + BoundedMatrix& rJinv, + BoundedMatrix& rLocalDerivativePatch, + const BoundedMatrix& rNodesCoordinates, const array_1d& rLocalCoordinates ) { /* Local derivatives patch */ - ComputeLocalDerivatives(LocalDerivativePatch, rLocalCoordinates); + ComputeLocalDerivatives(rLocalDerivativePatch, rLocalCoordinates); /* Compute Jacobian */ - noalias(J) = prod(NodesCoord, LocalDerivativePatch); + noalias(rJ) = prod(rNodesCoordinates, rLocalDerivativePatch); /* Compute inverse of the Jaccobian */ double detJ; - MathUtils::InvertMatrix(J, Jinv, detJ); + MathUtils::InvertMatrix(rJ, rJinv, detJ); } /***********************************************************************************/ /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateJacobianAndInv( - BoundedMatrix & J, - BoundedMatrix & Jinv, - const BoundedMatrix & NodesCoord, + BoundedMatrix& rJ, + BoundedMatrix& rJinv, + const BoundedMatrix& rNodesCoordinates, const array_1d& rLocalCoordinates ) { /* Local derivatives patch */ - BoundedMatrix local_derivative_patch; + BoundedMatrix local_derivative_patch; ComputeLocalDerivatives(local_derivative_patch, rLocalCoordinates); /* Compute Jacobian */ - noalias(J) = prod(NodesCoord, local_derivative_patch); + noalias(rJ) = prod(rNodesCoordinates, local_derivative_patch); /* Compute inverse of the Jaccobian */ double detJ; - MathUtils::InvertMatrix(J, Jinv, detJ); + MathUtils::InvertMatrix(rJ, rJinv, detJ); } /***********************************************************************************/ /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateCartesianDerivativesOnCenterPlane( - BoundedMatrix& CartesianDerivativesCenter, - const OrthogonalBase& ThisOrthogonalBase, + BoundedMatrix& rCartesianDerivativesCenter, + const OrthogonalBase& rOrthogonalBase, const GeometricLevel Part ) { @@ -2557,7 +2571,7 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerivativesOnCenterPlane( // 4- Lower face // 5- Upper face // 6- Lower face - const IndexType index = Part == GeometricLevel::UPPER ? 3 : 0; + const unsigned int index = Part == GeometricLevel::UPPER ? 3 : 0; double norm0, norm; array_1d vxe, vye; @@ -2584,7 +2598,7 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerivativesOnCenterPlane( norm0 = norm_2(t3g); t3g /= norm0; - MathUtils::CrossProduct(t2g, t3g, ThisOrthogonalBase.Vxi); + MathUtils::CrossProduct(t2g, t3g, rOrthogonalBase.Vxi); norm = norm_2(t2g); t2g /= norm; @@ -2601,10 +2615,10 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerivativesOnCenterPlane( b[1] = inner_prod(vye, t2g)/norm0; b[2] = -(b[0] + b[1]); - CartesianDerivativesCenter = ZeroMatrix(2, 4); - for (IndexType i = 0; i < 3; ++i) { - CartesianDerivativesCenter(0, i) = - b[i]; - CartesianDerivativesCenter(1, i) = a[i]; + rCartesianDerivativesCenter = ZeroMatrix(2, 4); + for (unsigned int i = 0; i < 3; ++i) { + rCartesianDerivativesCenter(0, i) = - b[i]; + rCartesianDerivativesCenter(1, i) = a[i]; } } @@ -2612,14 +2626,14 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerivativesOnCenterPlane( /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateCartesianDerOnGaussPlane( - BoundedMatrix & InPlaneCartesianDerivativesGauss, - const BoundedMatrix & NodesCoord, - const OrthogonalBase& ThisOrthogonalBase, - const IndexType NodeGauss, + BoundedMatrix& rInPlaneCartesianDerivativesGauss, + const BoundedMatrix& rNodesCoordinates, + const OrthogonalBase& rOrthogonalBase, + const unsigned int NodeGauss, const GeometricLevel Part ) { - const IndexType index = Part == GeometricLevel::UPPER ? 3 : 0; + const unsigned int index = Part == GeometricLevel::UPPER ? 3 : 0; /* Local derivatives patch */ BoundedMatrix local_derivative_patch; @@ -2628,17 +2642,18 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerOnGaussPlane( /* Auxiliary coordinates of the nodes */ BoundedMatrix nodes_coord_aux; - for (IndexType i = 0; i < 3; ++i) { - for (IndexType j = 0; j < 3; ++j) { - nodes_coord_aux(j, i) = NodesCoord(i + index, j); + for (unsigned int i = 0; i < 3; ++i) { + for (unsigned int j = 0; j < 3; ++j) { + nodes_coord_aux(j, i) = rNodesCoordinates(i + index, j); } } - for (IndexType j = 0; j < 3; ++j) - nodes_coord_aux(j, 3) = NodesCoord(NodeGauss + 6 + index, j); + for (unsigned int j = 0; j < 3; ++j) { + nodes_coord_aux(j, 3) = rNodesCoordinates(NodeGauss + 6 + index, j); + } /* Compute local derivatives */ - const BoundedMatrix Xd = prod(nodes_coord_aux, local_derivative_patch); + const BoundedMatrix Xd = prod(nodes_coord_aux, local_derivative_patch); /* Split local derivatives */ array_1d Xdxi, Xdeta; @@ -2651,7 +2666,7 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerOnGaussPlane( /* Compute orthonormal vectors */ array_1d t1g, t2g, t3g; - StructuralMechanicsMathUtilities::Comp_Orthonor_Base(t1g, t2g, t3g, ThisOrthogonalBase.Vxi, Xdxi, Xdeta); + StructuralMechanicsMathUtilities::Comp_Orthonor_Base(t1g, t2g, t3g, rOrthogonalBase.Vxi, Xdxi, Xdeta); /* Compute Jacobian */ BoundedMatrix jac; @@ -2666,16 +2681,16 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerOnGaussPlane( MathUtils::InvertMatrix(jac, JinvPlane, aux_det); /* Compute the Cartesian derivatives */ - noalias(InPlaneCartesianDerivativesGauss) = prod(JinvPlane, trans(local_derivative_patch)); + noalias(rInPlaneCartesianDerivativesGauss) = prod(JinvPlane, trans(local_derivative_patch)); } /***********************************************************************************/ /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateCartesianDerOnGaussTrans( - BoundedMatrix & TransversalCartesianDerivativesGauss, - const BoundedMatrix & NodesCoord, - const OrthogonalBase& ThisOrthogonalBase, + BoundedMatrix& rTransversalCartesianDerivativesGauss, + const BoundedMatrix& rNodesCoordinates, + const OrthogonalBase& rOrthogonalBase, const array_1d& rLocalCoordinates ) { @@ -2683,7 +2698,7 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerOnGaussTrans( double det; BoundedMatrix Xd; BoundedMatrix local_derivatives_patch; - CalculateJacobian(det, Xd, local_derivatives_patch, NodesCoord, rLocalCoordinates); + CalculateJacobian(det, Xd, local_derivatives_patch, rNodesCoordinates, rLocalCoordinates); /* Split local derivatives */ array_1d Xdxi, Xdeta; @@ -2696,7 +2711,7 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerOnGaussTrans( /* Compute orthonormal vectors */ BoundedMatrix t; - StructuralMechanicsMathUtilities::Comp_Orthonor_Base(t, ThisOrthogonalBase.Vxi, Xdxi, Xdeta); + StructuralMechanicsMathUtilities::Comp_Orthonor_Base(t, rOrthogonalBase.Vxi, Xdxi, Xdeta); /* Compute Jacobian */ const BoundedMatrix jac = prod(t, Xd); @@ -2708,7 +2723,7 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerOnGaussTrans( JinvTrans(2, 0) = (jac(0, 0) * jac(1, 1) - jac(1, 0) * jac(0, 1)) / det; /* Compute Cartesian derivatives */ - noalias(TransversalCartesianDerivativesGauss) = prod(local_derivatives_patch, JinvTrans); + noalias(rTransversalCartesianDerivativesGauss) = prod(local_derivatives_patch, JinvTrans); } /***********************************************************************************/ @@ -2716,8 +2731,8 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerOnGaussTrans( void SolidShellElementSprism3D6N::CalculateCartesianDerOnCenterTrans( CartesianDerivatives& rCartesianDerivatives, - const BoundedMatrix& NodesCoord, - const OrthogonalBase& ThisOrthogonalBase, + const BoundedMatrix& rNodesCoordinates, + const OrthogonalBase& rOrthogonalBase, const GeometricLevel Part ) { @@ -2725,18 +2740,21 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerOnCenterTrans( local_coordinates[0] = 1.0/3.0; local_coordinates[1] = 1.0/3.0; - if (Part == GeometricLevel::CENTER) + if (Part == GeometricLevel::CENTER) { local_coordinates[2] = 0.0; - else if (Part == GeometricLevel::LOWER) + } else if (Part == GeometricLevel::LOWER) { local_coordinates[2] = - 1.0; - else if (Part == GeometricLevel::UPPER) + } else if (Part == GeometricLevel::UPPER) { local_coordinates[2] = 1.0; + } /* Auxiliary coordinates of the nodes */ BoundedMatrix nodes_coord_aux; - for (IndexType i = 0; i < 6; ++i) - for (IndexType j = 0; j < 3; ++j) - nodes_coord_aux(j, i) = NodesCoord(i, j); + for (unsigned int i = 0; i < 6; ++i) { + for (unsigned int j = 0; j < 3; ++j) { + nodes_coord_aux(j, i) = rNodesCoordinates(i, j); + } + } /* Auxiliary components to calculate the Jacobian and his inverse */ BoundedMatrix J, Jinv; @@ -2750,9 +2768,10 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerOnCenterTrans( /* Compute Cartesian derivatives */ const BoundedMatrix transverse_cartesian_derivatives_gauss_aux = prod(local_derivatives_patch, Jinv); - for (IndexType i = 0; i < 6 ; ++i) - rCartesianDerivatives.TransversalCartesianDerivativesCenter(i, 0) = inner_prod(ThisOrthogonalBase.Vzeta, row(transverse_cartesian_derivatives_gauss_aux, i)); - } else { + for (unsigned int i = 0; i < 6 ; ++i) { + rCartesianDerivatives.TransversalCartesianDerivativesCenter(i, 0) = inner_prod(rOrthogonalBase.Vzeta, row(transverse_cartesian_derivatives_gauss_aux, i)); + } + } else { /* Calculate the Jacobian and his inverse */ CalculateJacobianAndInv(J, Jinv, nodes_coord_aux, local_coordinates); @@ -2767,15 +2786,15 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerOnCenterTrans( /* Compute inverse of the Jaccobian (just in plane components)*/ if (Part == GeometricLevel::LOWER) { - rCartesianDerivatives.JInvPlaneLower(0, 0) = inner_prod(Xdxi, ThisOrthogonalBase.Vxi); - rCartesianDerivatives.JInvPlaneLower(0, 1) = inner_prod(Xdeta, ThisOrthogonalBase.Vxi); - rCartesianDerivatives.JInvPlaneLower(1, 0) = inner_prod(Xdxi, ThisOrthogonalBase.Veta); - rCartesianDerivatives.JInvPlaneLower(1, 1) = inner_prod(Xdeta, ThisOrthogonalBase.Veta); + rCartesianDerivatives.JInvPlaneLower(0, 0) = inner_prod(Xdxi, rOrthogonalBase.Vxi); + rCartesianDerivatives.JInvPlaneLower(0, 1) = inner_prod(Xdeta, rOrthogonalBase.Vxi); + rCartesianDerivatives.JInvPlaneLower(1, 0) = inner_prod(Xdxi, rOrthogonalBase.Veta); + rCartesianDerivatives.JInvPlaneLower(1, 1) = inner_prod(Xdeta, rOrthogonalBase.Veta); } else if (Part == GeometricLevel::UPPER) { - rCartesianDerivatives.JInvPlaneUpper(0, 0) = inner_prod(Xdxi, ThisOrthogonalBase.Vxi); - rCartesianDerivatives.JInvPlaneUpper(0, 1) = inner_prod(Xdeta, ThisOrthogonalBase.Vxi); - rCartesianDerivatives.JInvPlaneUpper(1, 0) = inner_prod(Xdxi, ThisOrthogonalBase.Veta); - rCartesianDerivatives.JInvPlaneUpper(1, 1) = inner_prod(Xdeta, ThisOrthogonalBase.Veta); + rCartesianDerivatives.JInvPlaneUpper(0, 0) = inner_prod(Xdxi, rOrthogonalBase.Vxi); + rCartesianDerivatives.JInvPlaneUpper(0, 1) = inner_prod(Xdeta, rOrthogonalBase.Vxi); + rCartesianDerivatives.JInvPlaneUpper(1, 0) = inner_prod(Xdxi, rOrthogonalBase.Veta); + rCartesianDerivatives.JInvPlaneUpper(1, 1) = inner_prod(Xdeta, rOrthogonalBase.Veta); } } } @@ -2784,33 +2803,34 @@ void SolidShellElementSprism3D6N::CalculateCartesianDerOnCenterTrans( /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateInPlaneGradientFGauss( - BoundedMatrix& InPlaneGradientFGauss, - const BoundedMatrix& InPlaneCartesianDerivativesGauss, - const BoundedMatrix& NodesCoord, - const IndexType NodeGauss, + BoundedMatrix& rInPlaneGradientFGauss, + const BoundedMatrix& rInPlaneCartesianDerivativesGauss, + const BoundedMatrix& rNodesCoordinates, + const unsigned int NodeGauss, const GeometricLevel Part ) { /* Auxiliary operators */ const IndexType index = Part == GeometricLevel::UPPER ? 3 : 0; - BoundedMatrix nodes_coord_aux; - BoundedMatrix in_plane_cartesian_derivatives_gauss_aux; + BoundedMatrix nodes_coord_aux; + BoundedMatrix in_plane_cartesian_derivatives_gauss_aux; - for (IndexType i = 0; i < 3; ++i) { - for (IndexType j = 0; j < 3; ++j) - nodes_coord_aux(j, i) = NodesCoord(i + index, j); + for (unsigned int i = 0; i < 3; ++i) { + for (unsigned int j = 0; j < 3; ++j) { + nodes_coord_aux(j, i) = rNodesCoordinates(i + index, j); + } - in_plane_cartesian_derivatives_gauss_aux(i, 0) = InPlaneCartesianDerivativesGauss(0, i); - in_plane_cartesian_derivatives_gauss_aux(i, 1) = InPlaneCartesianDerivativesGauss(1, i); + in_plane_cartesian_derivatives_gauss_aux(i, 0) = rInPlaneCartesianDerivativesGauss(0, i); + in_plane_cartesian_derivatives_gauss_aux(i, 1) = rInPlaneCartesianDerivativesGauss(1, i); } - noalias(InPlaneGradientFGauss) = prod(nodes_coord_aux, in_plane_cartesian_derivatives_gauss_aux); + noalias(rInPlaneGradientFGauss) = prod(nodes_coord_aux, in_plane_cartesian_derivatives_gauss_aux); const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); if (HasNeighbour(NodeGauss, r_neighbour_nodes[NodeGauss])) { - for (IndexType j = 0; j < 3 ; ++j) { - InPlaneGradientFGauss(j, 0) += NodesCoord(NodeGauss + 6 + index, j) * InPlaneCartesianDerivativesGauss(0, 3); - InPlaneGradientFGauss(j, 1) += NodesCoord(NodeGauss + 6 + index, j) * InPlaneCartesianDerivativesGauss(1, 3); + for (unsigned int j = 0; j < 3 ; ++j) { + rInPlaneGradientFGauss(j, 0) += rNodesCoordinates(NodeGauss + 6 + index, j) * rInPlaneCartesianDerivativesGauss(0, 3); + rInPlaneGradientFGauss(j, 1) += rNodesCoordinates(NodeGauss + 6 + index, j) * rInPlaneCartesianDerivativesGauss(1, 3); } } } @@ -2819,18 +2839,22 @@ void SolidShellElementSprism3D6N::CalculateInPlaneGradientFGauss( /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateTransverseGradientF( - array_1d& TransverseGradientF, - const BoundedMatrix& TransversalCartesianDerivativesGauss, - const BoundedMatrix& NodesCoord + array_1d& rTransverseGradientF, + const BoundedMatrix& rTransversalCartesianDerivativesGauss, + const BoundedMatrix& rNodesCoordinates ) { - for (IndexType j = 0; j < 3; ++j) { - TransverseGradientF[j] = 0.0; + for (unsigned int j = 0; j < 3; ++j) { + rTransverseGradientF[j] = 0.0; } - for (IndexType i = 0; i < 6; ++i) { - for (IndexType j = 0; j < 3; ++j) { - TransverseGradientF[j] += TransversalCartesianDerivativesGauss(i, 0) * NodesCoord(i, j); + // Get number of nodes + const auto& r_geometry = GetGeometry(); + const unsigned int number_of_nodes = r_geometry.size(); + + for (unsigned int i = 0; i < number_of_nodes; ++i) { + for (unsigned int j = 0; j < 3; ++j) { + rTransverseGradientF[j] += rTransversalCartesianDerivativesGauss(i, 0) * rNodesCoordinates(i, j); } } } @@ -2839,17 +2863,17 @@ void SolidShellElementSprism3D6N::CalculateTransverseGradientF( /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateTransverseGradientFinP( - TransverseGradientIsoParametric& TransverseGradientIsoParametric, - const BoundedMatrix & NodesCoord, + TransverseGradientIsoParametric& rTransverseGradientIsoParametric, + const BoundedMatrix& rNodesCoordinates, const GeometricLevel Part ) { - const IndexType index = Part == GeometricLevel::UPPER ? 3 : 0; + const unsigned int index = Part == GeometricLevel::UPPER ? 3 : 0; - for (IndexType i = 0; i < 3; ++i) { - TransverseGradientIsoParametric.Ft[i] = NodesCoord(2 + index, i) - NodesCoord(1 + index, i); - TransverseGradientIsoParametric.Fxi[i] = NodesCoord(0 + index, i) - NodesCoord(2 + index, i); - TransverseGradientIsoParametric.Feta[i] = NodesCoord(1 + index, i) - NodesCoord(0 + index, i); + for (unsigned int i = 0; i < 3; ++i) { + rTransverseGradientIsoParametric.Ft[i] = rNodesCoordinates(2 + index, i) - rNodesCoordinates(1 + index, i); + rTransverseGradientIsoParametric.Fxi[i] = rNodesCoordinates(0 + index, i) - rNodesCoordinates(2 + index, i); + rTransverseGradientIsoParametric.Feta[i] = rNodesCoordinates(1 + index, i) - rNodesCoordinates(0 + index, i); } } @@ -2857,23 +2881,23 @@ void SolidShellElementSprism3D6N::CalculateTransverseGradientFinP( /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateAndAddBMembrane( - BoundedMatrix& BMembrane, - BoundedMatrix& CMembrane, - const BoundedMatrix& InPlaneCartesianDerivativesGauss, - const BoundedMatrix& InPlaneGradientFGauss, - const IndexType NodeGauss + BoundedMatrix& rBMembrane, + BoundedMatrix& rCMembrane, + const BoundedMatrix& rInPlaneCartesianDerivativesGauss, + const BoundedMatrix& rInPlaneGradientFGauss, + const unsigned int NodeGauss ) { - for (IndexType i = 0; i < 4; ++i) { - IndexType base = i * 3; + for (unsigned int i = 0; i < 4; ++i) { + unsigned int base = i * 3; if (i == 3) { base += NodeGauss * 3; } - for (IndexType j = 0; j < 3; ++j) { - BMembrane(0, base + j) += InPlaneCartesianDerivativesGauss(0, i) * InPlaneGradientFGauss(j, 0); - BMembrane(1, base + j) += InPlaneCartesianDerivativesGauss(1, i) * InPlaneGradientFGauss(j, 1); - BMembrane(2, base + j) += InPlaneCartesianDerivativesGauss(1, i) * InPlaneGradientFGauss(j, 0) - + InPlaneCartesianDerivativesGauss(0, i) * InPlaneGradientFGauss(j, 1); + for (unsigned int j = 0; j < 3; ++j) { + rBMembrane(0, base + j) += rInPlaneCartesianDerivativesGauss(0, i) * rInPlaneGradientFGauss(j, 0); + rBMembrane(1, base + j) += rInPlaneCartesianDerivativesGauss(1, i) * rInPlaneGradientFGauss(j, 1); + rBMembrane(2, base + j) += rInPlaneCartesianDerivativesGauss(1, i) * rInPlaneGradientFGauss(j, 0) + + rInPlaneCartesianDerivativesGauss(0, i) * rInPlaneGradientFGauss(j, 1); } } @@ -2881,74 +2905,74 @@ void SolidShellElementSprism3D6N::CalculateAndAddBMembrane( // In plane auxiliary components array_1d aux_deformation_gradient_F1, aux_deformation_gradient_F2; - for (IndexType i = 0; i < 3; ++i) { - aux_deformation_gradient_F1[i] = InPlaneGradientFGauss(i, 0); - aux_deformation_gradient_F2[i] = InPlaneGradientFGauss(i, 1); + for (unsigned int i = 0; i < 3; ++i) { + aux_deformation_gradient_F1[i] = rInPlaneGradientFGauss(i, 0); + aux_deformation_gradient_F2[i] = rInPlaneGradientFGauss(i, 1); } - CMembrane(0, 0) += inner_prod(aux_deformation_gradient_F1, aux_deformation_gradient_F1); - CMembrane(1, 0) += inner_prod(aux_deformation_gradient_F2, aux_deformation_gradient_F2); - CMembrane(2, 0) += inner_prod(aux_deformation_gradient_F1, aux_deformation_gradient_F2); + rCMembrane(0, 0) += inner_prod(aux_deformation_gradient_F1, aux_deformation_gradient_F1); + rCMembrane(1, 0) += inner_prod(aux_deformation_gradient_F2, aux_deformation_gradient_F2); + rCMembrane(2, 0) += inner_prod(aux_deformation_gradient_F1, aux_deformation_gradient_F2); } /***********************************************************************************/ /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateAndAddMembraneKgeometric( - BoundedMatrix & Kgeometricmembrane, + BoundedMatrix& rKgeometricmembrane, const CartesianDerivatives& rCartesianDerivatives, - const array_1d & SMembrane, + const array_1d& rSMembrane, const GeometricLevel Part ) { - const IndexType index = static_cast(Part); - const IndexType auxiliary_index = Part == GeometricLevel::UPPER ? 3 : 0; + const unsigned int index = static_cast(Part); + const unsigned int auxiliary_index = Part == GeometricLevel::UPPER ? 3 : 0; - BoundedMatrix H = ZeroMatrix(6, 6); + BoundedMatrix H = ZeroMatrix(6, 6); - IndexType ii, jj; - for (IndexType i = 0; i < 4; ++i) { - for (IndexType j = 0; j < 4; ++j) { + unsigned int ii, jj; + for (unsigned int i = 0; i < 4; ++i) { + for (unsigned int j = 0; j < 4; ++j) { // Gauss 1 ii = i; jj = j; - H(ii, jj) += SMembrane[0] * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](0, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](0, j) - + SMembrane[1] * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](1, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](1, j) - + SMembrane[2] * (rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](0, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](1, j) - + rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](1, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](0, j)); + H(ii, jj) += rSMembrane[0] * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](0, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](0, j) + + rSMembrane[1] * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](1, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](1, j) + + rSMembrane[2] * (rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](0, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](1, j) + + rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](1, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 0](0, j)); // Gauss 2 ii = (i == 3) ? 4 : i; jj = (j == 3) ? 4 : j; - H(ii, jj) += SMembrane[0] * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](0, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](0, j) - + SMembrane[1] * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](1, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](1, j) - + SMembrane[2] * (rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](0, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](1, j) - + rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](1, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](0, j)); + H(ii, jj) += rSMembrane[0] * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](0, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](0, j) + + rSMembrane[1] * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](1, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](1, j) + + rSMembrane[2] * (rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](0, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](1, j) + + rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](1, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 1](0, j)); // Gauss 3 ii = (i == 3) ? 5 : i; jj = (j == 3) ? 5 : j; - H(ii, jj) += SMembrane[0] * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](0, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](0, j) - + SMembrane[1] * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](1, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](1, j) - + SMembrane[2] * (rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](0, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](1, j) - + rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](1, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](0, j)); + H(ii, jj) += rSMembrane[0] * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](0, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](0, j) + + rSMembrane[1] * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](1, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](1, j) + + rSMembrane[2] * (rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](0, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](1, j) + + rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](1, i) * rCartesianDerivatives.InPlaneCartesianDerivativesGauss[auxiliary_index + 2](0, j)); } } H *= 1.0/3.0; // Assembling in Kgeometricmembrane - IndexType rowindex, colindex; - for (IndexType i = 0; i < 6; ++i) { + unsigned int rowindex, colindex; + for (unsigned int i = 0; i < 6; ++i) { rowindex = (i < 3) ? i * 3 + index : i * 3 + index + 9; - for (IndexType j = i; j < 6; ++j) { + for (unsigned int j = i; j < 6; ++j) { colindex = (j < 3) ? j * 3 + index : j * 3 + index + 9; - for(IndexType ii = 0; ii < 3; ++ii) { - Kgeometricmembrane(rowindex + ii,colindex + ii) += H (i, j); + for(unsigned int ii = 0; ii < 3; ++ii) { + rKgeometricmembrane(rowindex + ii,colindex + ii) += H (i, j); if (rowindex != colindex) { // Skip diagonal - Kgeometricmembrane(colindex + ii, rowindex + ii) += H (i, j); // Symmetric part + rKgeometricmembrane(colindex + ii, rowindex + ii) += H (i, j); // Symmetric part } } } @@ -2959,16 +2983,16 @@ void SolidShellElementSprism3D6N::CalculateAndAddMembraneKgeometric( /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateAndAddBShear( - BoundedMatrix& BShear, - BoundedMatrix& CShear, + BoundedMatrix& rBShear, + BoundedMatrix& rCShear, const CartesianDerivatives& rCartesianDerivatives, const TransverseGradient& rTransverseGradient, const TransverseGradientIsoParametric& rTransverseGradientIsoParametric, const GeometricLevel Part ) { - const IndexType index = static_cast(Part); - const IndexType auxiliary_index = Part == GeometricLevel::UPPER ? 3 : 0; + const unsigned int index = static_cast(Part); + const unsigned int auxiliary_index = Part == GeometricLevel::UPPER ? 3 : 0; const BoundedMatrix& JInvPlane = Part == GeometricLevel::UPPER ? rCartesianDerivatives.JInvPlaneUpper : rCartesianDerivatives.JInvPlaneLower; @@ -2983,12 +3007,14 @@ void SolidShellElementSprism3D6N::CalculateAndAddBShear( Pa(1, 1) = eta_p - 1.0; Pa(1, 2) = eta_p; - BoundedMatrix aux_b_shear = ZeroMatrix(3, 18); + BoundedMatrix aux_b_shear = ZeroMatrix(3, 18); /* First contribution*/ - for (IndexType i = 0; i < 6; ++i) { - IndexType base = i * 3; - for (IndexType j = 0; j < 3; ++j) { + const auto& r_geometry = GetGeometry(); + const unsigned int number_of_nodes = r_geometry.size(); + for (unsigned int i = 0; i < number_of_nodes; ++i) { + unsigned int base = i * 3; + for (unsigned int j = 0; j < 3; ++j) { aux_b_shear(0, base + j) += rCartesianDerivatives.TransversalCartesianDerivativesGauss[auxiliary_index + 0](i, 0) * rTransverseGradientIsoParametric.Ft[j]; aux_b_shear(1, base + j) += rCartesianDerivatives.TransversalCartesianDerivativesGauss[auxiliary_index + 1](i, 0) * rTransverseGradientIsoParametric.Fxi[j]; aux_b_shear(2, base + j) += rCartesianDerivatives.TransversalCartesianDerivativesGauss[auxiliary_index + 2](i, 0) * rTransverseGradientIsoParametric.Feta[j]; @@ -2996,7 +3022,7 @@ void SolidShellElementSprism3D6N::CalculateAndAddBShear( } /* Second contibution */ - for (IndexType i = 0; i < 3; ++i) { + for (unsigned int i = 0; i < 3; ++i) { /* First row */ aux_b_shear(0, i + index + 3) -= rTransverseGradient.F0[i]; aux_b_shear(0, i + index + 6) += rTransverseGradient.F0[i]; @@ -3011,7 +3037,7 @@ void SolidShellElementSprism3D6N::CalculateAndAddBShear( } const BoundedMatrix aux_prod = prod(JInvPlane, Pa); - noalias(BShear) = prod(aux_prod, aux_b_shear); + noalias(rBShear) = prod(aux_prod, aux_b_shear); // Calculating the components of C BoundedMatrix aux_c_shear; @@ -3019,16 +3045,16 @@ void SolidShellElementSprism3D6N::CalculateAndAddBShear( aux_c_shear(1, 0) = inner_prod(rTransverseGradientIsoParametric.Fxi , rTransverseGradient.F1); aux_c_shear(2, 0) = inner_prod(rTransverseGradientIsoParametric.Feta, rTransverseGradient.F2); - noalias(CShear) = prod(aux_prod, aux_c_shear); + noalias(rCShear) = prod(aux_prod, aux_c_shear); } /***********************************************************************************/ /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateAndAddShearKgeometric( - BoundedMatrix & Kgeometricshear, + BoundedMatrix& rKgeometricshear, const CartesianDerivatives& rCartesianDerivatives, - const array_1d & SShear, + const array_1d& rSShear, const GeometricLevel Part ) { @@ -3037,8 +3063,8 @@ void SolidShellElementSprism3D6N::CalculateAndAddShearKgeometric( const BoundedMatrix& JInvPlane = Part == GeometricLevel::UPPER ? rCartesianDerivatives.JInvPlaneUpper : rCartesianDerivatives.JInvPlaneLower; - const double Q1 = 1.0/3.0 * (SShear[0] * JInvPlane(0, 0) + SShear[1] * JInvPlane(0, 1)); - const double Q2 = 1.0/3.0 * (SShear[0] * JInvPlane(1, 0) + SShear[1] * JInvPlane(1, 1)); + const double Q1 = 1.0/3.0 * (rSShear[0] * JInvPlane(0, 0) + rSShear[1] * JInvPlane(0, 1)); + const double Q2 = 1.0/3.0 * (rSShear[0] * JInvPlane(1, 0) + rSShear[1] * JInvPlane(1, 1)); // array_1d q; // q[0] = -Q1 + Q2; @@ -3051,7 +3077,7 @@ void SolidShellElementSprism3D6N::CalculateAndAddShearKgeometric( // else // delta = 0; -// for (IndexType i = 0; i < 3; ++i) { // For each DOF +// for (unsigned int i = 0; i < 3; ++i) { // For each DOF // /* First assembling */ // Kgeometricshear(i + index + 3, i + index + 3) -= q[0] * rCartesianDerivatives.TransversalCartesianDerivativesGauss[0 + auxiliary_index](1 + delta, 0); // Kgeometricshear(i + index + 6, i + index + 6) += q[0] * rCartesianDerivatives.TransversalCartesianDerivativesGauss[0 + auxiliary_index](2 + delta, 0); @@ -3105,24 +3131,25 @@ void SolidShellElementSprism3D6N::CalculateAndAddShearKgeometric( } double value = 0.0; - for (IndexType k = 0; k < 3; k++) { + for (unsigned int k = 0; k < 3; k++) { IndexType l = 0; // Initializes DOF associated to N_3 - for (IndexType i = 0; i < 6; ++i) { // For each node - if (k == 0) + for (unsigned int i = 0; i < 6; ++i) { // For each node + if (k == 0) { value = (-Q1 + Q2) * rCartesianDerivatives.TransversalCartesianDerivativesGauss[0 + auxiliary_index](i, 0); - else if (k == 1) + } else if (k == 1) { value = -(Q1 + 2.0 * Q2) * rCartesianDerivatives.TransversalCartesianDerivativesGauss[1 + auxiliary_index](i, 0); - else if (k == 2) + } else if (k == 2) { value = (2.0 * Q1 + Q2) * rCartesianDerivatives.TransversalCartesianDerivativesGauss[2 + auxiliary_index](i, 0); + } - for (IndexType j = 0; j < 3; ++j) { // For each DOF (diagonal only) - Kgeometricshear(n1[k] + j, l + j) += value; - Kgeometricshear(l + j, n1[k] + j) += value; + for (unsigned int j = 0; j < 3; ++j) { // For each DOF (diagonal only) + rKgeometricshear(n1[k] + j, l + j) += value; + rKgeometricshear(l + j, n1[k] + j) += value; } - for (IndexType j = 0; j < 3; ++j) { // For each DOF (diagonal only) - Kgeometricshear(n2[k] + j, l + j) -= value; - Kgeometricshear(l + j, n2[k] + j) -= value; + for (unsigned int j = 0; j < 3; ++j) { // For each DOF (diagonal only) + rKgeometricshear(n2[k] + j, l + j) -= value; + rKgeometricshear(l + j, n2[k] + j) -= value; } l += 3; // Increment DOF position I @@ -3134,49 +3161,49 @@ void SolidShellElementSprism3D6N::CalculateAndAddShearKgeometric( /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateAndAddBNormal( - BoundedMatrix& BNormal, - double& CNormal, - const BoundedMatrix& TransversalCartesianDerivativesCenter, - const array_1d& TransversalDeformationGradientF + BoundedMatrix& rBNormal, + double& rCNormal, + const BoundedMatrix& rTransversalCartesianDerivativesCenter, + const array_1d& rTransversalDeformationGradientF ) { - IndexType base; - for (IndexType i = 0; i < 6; ++i) { + unsigned int base; + for (unsigned int i = 0; i < 6; ++i) { base = i * 3; - for (IndexType j = 0; j < 3; ++j) { - BNormal(0, base + j) = TransversalCartesianDerivativesCenter(i, 0) * TransversalDeformationGradientF[j]; + for (unsigned int j = 0; j < 3; ++j) { + rBNormal(0, base + j) = rTransversalCartesianDerivativesCenter(i, 0) * rTransversalDeformationGradientF[j]; } } - CNormal = inner_prod(TransversalDeformationGradientF, TransversalDeformationGradientF); + rCNormal = inner_prod(rTransversalDeformationGradientF, rTransversalDeformationGradientF); } /***********************************************************************************/ /***********************************************************************************/ void SolidShellElementSprism3D6N::CalculateAndAddNormalKgeometric( - BoundedMatrix& Kgeometricnormal, - const BoundedMatrix& TransversalCartesianDerivativesCenter, + BoundedMatrix& rKgeometricnormal, + const BoundedMatrix& rTransversalCartesianDerivativesCenter, const double SNormal ) { BoundedMatrix H = ZeroMatrix(6, 6); - for (IndexType i = 0; i < 6; ++i) { - const double aux = SNormal * TransversalCartesianDerivativesCenter(i, 0); - for (IndexType j = 0; j < 6; ++j) { - H(i, j) = aux * TransversalCartesianDerivativesCenter(j, 0); + for (unsigned int i = 0; i < 6; ++i) { + const double aux = SNormal * rTransversalCartesianDerivativesCenter(i, 0); + for (unsigned int j = 0; j < 6; ++j) { + H(i, j) = aux * rTransversalCartesianDerivativesCenter(j, 0); } } - noalias(H) = SNormal * prod(TransversalCartesianDerivativesCenter, trans(TransversalCartesianDerivativesCenter)); + noalias(H) = SNormal * prod(rTransversalCartesianDerivativesCenter, trans(rTransversalCartesianDerivativesCenter)); - IndexType rowindex, colindex; - for (IndexType i = 0; i < 6; ++i) { + unsigned int rowindex, colindex; + for (unsigned int i = 0; i < 6; ++i) { rowindex = i * 3; - for (IndexType j = 0; j < 6; ++j) { + for (unsigned int j = 0; j < 6; ++j) { colindex = j * 3; - for(IndexType ii = 0; ii < 3; ++ii) { - Kgeometricnormal(rowindex + ii,colindex + ii) += H(i, j); + for (unsigned int ii = 0; ii < 3; ++ii) { + rKgeometricnormal(rowindex + ii, colindex + ii) += H(i, j); } } } @@ -3185,12 +3212,11 @@ void SolidShellElementSprism3D6N::CalculateAndAddNormalKgeometric( /***********************************************************************************/ /***********************************************************************************/ -BoundedMatrix SolidShellElementSprism3D6N::GetVectorCurrentPosition() +void SolidShellElementSprism3D6N::GetVectorCurrentPosition(BoundedMatrix& rVectorCurrentPosition) { KRATOS_TRY; - BoundedMatrix vector_current_position; - + // Get neighbour nodes const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); // Get geometry @@ -3198,88 +3224,92 @@ BoundedMatrix SolidShellElementSprism3D6N::GetVectorCurrentPosit const unsigned int number_of_nodes = r_geometry.size(); /* Element nodes */ - for (IndexType index = 0; index < number_of_nodes; ++index) { + for (unsigned int index = 0; index < number_of_nodes; ++index) { const array_1d& r_current_position = r_geometry[index].Coordinates(); - for (IndexType j = 0; j < 3; ++j) - vector_current_position(index * 3 + j, 0) = r_current_position[j]; + for (unsigned int j = 0; j < 3; ++j) { + rVectorCurrentPosition(index * 3 + j, 0) = r_current_position[j]; + } } /* Neighbour nodes */ const SizeType number_of_neighbours = NumberOfActiveNeighbours(r_neighbour_nodes); if (number_of_neighbours == 6) { // All the possible neighbours - for (IndexType index = 0; index < number_of_nodes; ++index) { + for (unsigned int index = 0; index < number_of_nodes; ++index) { const array_1d& r_current_position = r_neighbour_nodes[index].Coordinates(); - for (IndexType j = 0; j < 3; ++j) - vector_current_position(18 + index * 3 + j, 0) = r_current_position[j]; + for (unsigned int j = 0; j < 3; ++j) { + rVectorCurrentPosition(18 + index * 3 + j, 0) = r_current_position[j]; + } } } else { - for (IndexType index = 0; index < number_of_nodes; ++index) { + for (unsigned int index = 0; index < number_of_nodes; ++index) { if (HasNeighbour(index, r_neighbour_nodes[index])) { const array_1d& r_current_position = r_neighbour_nodes[index].Coordinates(); - for (IndexType j = 0; j < 3; ++j) - vector_current_position(18 + index * 3 + j, 0) = r_current_position[j]; + for (unsigned int j = 0; j < 3; ++j) { + rVectorCurrentPosition(18 + index * 3 + j, 0) = r_current_position[j]; + } } else { - for (IndexType j = 0; j < 3; ++j) - vector_current_position(18 + index * 3 + j, 0) = 0.0; + for (unsigned int j = 0; j < 3; ++j) { + rVectorCurrentPosition(18 + index * 3 + j, 0) = 0.0; + } } } } - return vector_current_position; - KRATOS_CATCH( "" ); } /***********************************************************************************/ /***********************************************************************************/ -BoundedMatrix SolidShellElementSprism3D6N::GetVectorPreviousPosition() +void SolidShellElementSprism3D6N::GetVectorPreviousPosition(BoundedMatrix& rVectorPreviousPosition) { KRATOS_TRY; - BoundedMatrix vector_current_position; - + // Get neighbour nodes const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); // Get geometry const auto& r_geometry = GetGeometry(); + const unsigned int number_of_nodes = r_geometry.size(); /* Element nodes */ - for (IndexType index = 0; index < 6; ++index) { + for (unsigned int index = 0; index < number_of_nodes; ++index) { const array_1d& r_previous_position = r_geometry[index].GetInitialPosition().Coordinates() + r_geometry[index].FastGetSolutionStepValue(DISPLACEMENT, 1); - for (IndexType j = 0; j < 3; ++j) - vector_current_position(index * 3 + j, 0) = r_previous_position[j]; + for (unsigned int j = 0; j < 3; ++j) { + rVectorPreviousPosition(index * 3 + j, 0) = r_previous_position[j]; + } } /* Neighbour nodes */ const SizeType number_of_neighbours = NumberOfActiveNeighbours(r_neighbour_nodes); if (number_of_neighbours == 6) { // All the possible neighbours - for (IndexType index = 0; index < 6; ++index) { - const array_1d& r_previous_position = r_neighbour_nodes[index].GetInitialPosition().Coordinates() - + r_neighbour_nodes[index].FastGetSolutionStepValue(DISPLACEMENT, 1); + for (unsigned int index = 0; index < number_of_nodes; ++index) { + const array_1d& r_previous_position = r_neighbour_nodes[index].GetInitialPosition().Coordinates() + + r_neighbour_nodes[index].FastGetSolutionStepValue(DISPLACEMENT, 1); - for (IndexType j = 0; j < 3; ++j) - vector_current_position(18 + index * 3 + j, 0) = r_previous_position[j]; + for (unsigned int j = 0; j < 3; ++j) { + rVectorPreviousPosition(18 + index * 3 + j, 0) = r_previous_position[j]; + } } } else { - for (IndexType index = 0; index < 6; ++index) { + for (unsigned int index = 0; index < number_of_nodes; ++index) { if (HasNeighbour(index, r_neighbour_nodes[index])) { - const array_1d& r_previous_position = r_neighbour_nodes[index].GetInitialPosition().Coordinates() + const array_1d& r_previous_position = r_neighbour_nodes[index].GetInitialPosition().Coordinates() + r_neighbour_nodes[index].FastGetSolutionStepValue(DISPLACEMENT, 1); - for (IndexType j = 0; j < 3; ++j) - vector_current_position(18 + index * 3 + j, 0) = r_previous_position[j]; + for (unsigned int j = 0; j < 3; ++j) { + rVectorPreviousPosition(18 + index * 3 + j, 0) = r_previous_position[j]; + } } else { - for (IndexType j = 0; j < 3; ++j) - vector_current_position(18 + index * 3 + j, 0) = 0.0; + for (unsigned int j = 0; j < 3; ++j) { + rVectorPreviousPosition(18 + index * 3 + j, 0) = 0.0; + } } } } - return vector_current_position; - KRATOS_CATCH( "" ); } @@ -3372,11 +3402,11 @@ void SolidShellElementSprism3D6N::IntegrateEASInZeta( rEAS.mStiffAlpha += IntegrationWeight * ZetaGauss * ZetaGauss * rVariables.C[2] * (rVariables.ConstitutiveMatrix(2, 2) * rVariables.C[2] + 2.0 * rVariables.StressVector[2]); // Assign D3 - for (IndexType i = 0; i < 6; ++i) { + for (unsigned int i = 0; i < 6; ++i) { D3(0, i) = rVariables.ConstitutiveMatrix(2, i); } } - for (IndexType i = 0; i < 36; ++i) { + for (unsigned int i = 0; i < 36; ++i) { B3(0, i) = rVariables.B(2, i); } @@ -3392,43 +3422,43 @@ void SolidShellElementSprism3D6N::IntegrateEASInZeta( void SolidShellElementSprism3D6N::CalculateAndAddLHS( LocalSystemComponents& rLocalSystem, GeneralVariables& rVariables, - ConstitutiveLaw::Parameters& rValues, + ConstitutiveLaw::Parameters& rConstitutiveValues, const StressIntegratedComponents& rIntegratedStress, const CommonComponents& rCommonComponents, const CartesianDerivatives& rCartesianDerivatives, const EASComponents& rEAS, - double& AlphaEAS + double& rAlphaEAS ) { /* Contributions of the stiffness matrix calculated on the reference configuration */ - if( rLocalSystem.CalculationFlags.Is( SolidShellElementSprism3D6N::COMPUTE_LHS_MATRIX_WITH_COMPONENTS ) ) { + if (rLocalSystem.CalculationFlags.Is( SolidShellElementSprism3D6N::COMPUTE_LHS_MATRIX_WITH_COMPONENTS )) { std::vector& rLeftHandSideMatrices = rLocalSystem.GetLeftHandSideMatrices(); const std::vector< Variable< MatrixType > >& rLeftHandSideVariables = rLocalSystem.GetLeftHandSideVariables(); - for( IndexType i = 0; i < rLeftHandSideVariables.size(); ++i ) { + for (unsigned int i = 0; i < rLeftHandSideVariables.size(); ++i) { bool calculated = false; /* Calculate the Material Stiffness Matrix */ if( rLeftHandSideVariables[i] == MATERIAL_STIFFNESS_MATRIX ) { /* Reading integration points */ - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; /* Assemble B */ - this->CalculateDeformationMatrix(rVariables.B, rCommonComponents, zeta_gauss, AlphaEAS); + this->CalculateDeformationMatrix(rVariables.B, rCommonComponents, zeta_gauss, rAlphaEAS); // Compute element kinematics C, F ... - this->CalculateKinematics(rVariables, rCommonComponents, integration_points, point_number, AlphaEAS, zeta_gauss); + this->CalculateKinematics(rVariables, rCommonComponents, r_integration_points, point_number, rAlphaEAS, zeta_gauss); // Set general variables to constitutive law parameters - this->SetGeneralVariables(rVariables, rValues, point_number); + this->SetGeneralVariables(rVariables, rConstitutiveValues, point_number); // Compute stresses and constitutive parameters - mConstitutiveLawVector[point_number]->CalculateMaterialResponse(rValues, rVariables.StressMeasure); + mConstitutiveLawVector[point_number]->CalculateMaterialResponse(rConstitutiveValues, rVariables.StressMeasure); // Calculating weights for integration on the "reference configuration" - const double integration_weight = integration_points[point_number].Weight() * rVariables.detJ; + const double integration_weight = r_integration_points[point_number].Weight() * rVariables.detJ; /* Operation performed: add Km to the LefsHandSideMatrix */ this->CalculateAndAddKuum( rLeftHandSideMatrices[i], rVariables, integration_weight); @@ -3455,26 +3485,26 @@ void SolidShellElementSprism3D6N::CalculateAndAddLHS( MatrixType& LeftHandSideMatrix = rLocalSystem.GetLeftHandSideMatrix(); /* Reading integration points */ - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); /* Calculate the Material Stiffness Matrix */ - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; /* Assemble B */ - this->CalculateDeformationMatrix(rVariables.B, rCommonComponents, zeta_gauss, AlphaEAS); + this->CalculateDeformationMatrix(rVariables.B, rCommonComponents, zeta_gauss, rAlphaEAS); // Compute element kinematics C, F ... - this->CalculateKinematics(rVariables, rCommonComponents, integration_points, point_number, AlphaEAS, zeta_gauss); + this->CalculateKinematics(rVariables, rCommonComponents, r_integration_points, point_number, rAlphaEAS, zeta_gauss); // Set general variables to constitutive law parameters - this->SetGeneralVariables(rVariables, rValues, point_number); + this->SetGeneralVariables(rVariables, rConstitutiveValues, point_number); // Compute stresses and constitutive parameters - mConstitutiveLawVector[point_number]->CalculateMaterialResponse(rValues, rVariables.StressMeasure); + mConstitutiveLawVector[point_number]->CalculateMaterialResponse(rConstitutiveValues, rVariables.StressMeasure); // Calculating weights for integration on the "reference configuration" - const double integration_weight = integration_points[point_number].Weight() * rVariables.detJ; + const double integration_weight = r_integration_points[point_number].Weight() * rVariables.detJ; /* Operation performed: add Km to the LefsHandSideMatrix */ this->CalculateAndAddKuum( LeftHandSideMatrix, rVariables, integration_weight); @@ -3502,14 +3532,14 @@ void SolidShellElementSprism3D6N::CalculateAndAddRHS( const StressIntegratedComponents& rIntegratedStress, const CommonComponents& rCommonComponents, const EASComponents& rEAS, - double& AlphaEAS + double& rAlphaEAS ) { /* Contribution of the internal and external forces */ - if( rLocalSystem.CalculationFlags.Is( SolidShellElementSprism3D6N::COMPUTE_RHS_VECTOR_WITH_COMPONENTS ) ) { + if (rLocalSystem.CalculationFlags.Is( SolidShellElementSprism3D6N::COMPUTE_RHS_VECTOR_WITH_COMPONENTS )) { std::vector& RightHandSideVectors = rLocalSystem.GetRightHandSideVectors(); const std::vector< Variable< VectorType > >& rRightHandSideVariables = rLocalSystem.GetRightHandSideVariables(); - for( IndexType i = 0; i < rRightHandSideVariables.size(); ++i ) { + for (unsigned int i = 0; i < rRightHandSideVariables.size(); ++i) { bool calculated = false; if( rRightHandSideVariables[i] == EXTERNAL_FORCES_VECTOR ) { /* Operation performed: RightHandSideVector += ExtForce */ @@ -3519,7 +3549,7 @@ void SolidShellElementSprism3D6N::CalculateAndAddRHS( if( rRightHandSideVariables[i] == INTERNAL_FORCES_VECTOR ) { /* Operation performed: RightHandSideVector -= IntForce */ - this->CalculateAndAddInternalForces( RightHandSideVectors[i], rIntegratedStress, rCommonComponents, rEAS, AlphaEAS ); + this->CalculateAndAddInternalForces( RightHandSideVectors[i], rIntegratedStress, rCommonComponents, rEAS, rAlphaEAS ); calculated = true; } @@ -3532,7 +3562,7 @@ void SolidShellElementSprism3D6N::CalculateAndAddRHS( this->CalculateAndAddExternalForces( RightHandSideVector, rVariables, rVolumeForce ); /* Operation performed: RightHandSideVector -= IntForce */ - this->CalculateAndAddInternalForces( RightHandSideVector, rIntegratedStress, rCommonComponents, rEAS, AlphaEAS ); + this->CalculateAndAddInternalForces( RightHandSideVector, rIntegratedStress, rCommonComponents, rEAS, rAlphaEAS ); } } @@ -3555,12 +3585,11 @@ void SolidShellElementSprism3D6N::CalculateAndAddKuum( array_1d id_vector; CalculateIdVector(id_vector); - IndexType index_i, index_j; - - for (IndexType i = 0; i < 36; ++i) { + unsigned int index_i, index_j; + for (unsigned int i = 0; i < 36; ++i) { index_i = i < 18 ? i : id_vector[i - 18]; if (index_i < 36) { - for (IndexType j = 0; j < 36; ++j) { + for (unsigned int j = 0; j < 36; ++j) { index_j = j < 18 ? j : id_vector[j - 18]; if (index_j < 36) { rLeftHandSideMatrix(index_i, index_j) += K(i, j); @@ -3612,11 +3641,11 @@ void SolidShellElementSprism3D6N::CalculateAndAddKuug( array_1d id_vector; CalculateIdVector(id_vector); - IndexType index_i, index_j; - for (IndexType i = 0; i < 36; ++i) { + unsigned int index_i, index_j; + for (unsigned int i = 0; i < 36; ++i) { index_i = i < 18 ? i : id_vector[i - 18]; if (index_i < 36) { - for (IndexType j = 0; j < 36; ++j) { + for (unsigned int j = 0; j < 36; ++j) { index_j = j < 18 ? j : id_vector[j - 18]; if (index_j < 36) { rLeftHandSideMatrix(index_i, index_j) += K(i, j); @@ -3645,11 +3674,11 @@ void SolidShellElementSprism3D6N::ApplyEASLHS( CalculateIdVector(id_vector); // Note: IntegrationWeight already considered in the integration - IndexType index_i, index_j; - for (IndexType i = 0; i < 36; ++i) { + unsigned int index_i, index_j; + for (unsigned int i = 0; i < 36; ++i) { index_i = i < 18 ? i : id_vector[i - 18]; if (index_i < 36) { - for (IndexType j = 0; j < 36; ++j) { + for (unsigned int j = 0; j < 36; ++j) { index_j = j < 18 ? j : id_vector[j - 18]; if (index_j < 36) { rLeftHandSideMatrix(index_i, index_j) += lhs_aux(i, j); @@ -3693,12 +3722,12 @@ void SolidShellElementSprism3D6N::CalculateAndAddExternalForces( KRATOS_TRY; // Number of nodes - const IndexType number_of_nodes = GetGeometry().PointsNumber(); + const unsigned int number_of_nodes = GetGeometry().PointsNumber(); - IndexType index; - for ( IndexType i = 0; i < number_of_nodes; ++i ) { + unsigned int index; + for (unsigned int i = 0; i < number_of_nodes; ++i) { index = 3 * i; - for ( IndexType j = 0; j < 3; ++j ) { + for (unsigned int j = 0; j < 3; ++j) { rRightHandSideVector[index + j] += rVolumeForce[j]/static_cast(number_of_nodes); } } @@ -3714,15 +3743,15 @@ void SolidShellElementSprism3D6N::CalculateAndAddInternalForces( const StressIntegratedComponents& rIntegratedStress, const CommonComponents& rCommonComponents, const EASComponents& rEAS, - double& AlphaEAS + double& rAlphaEAS ) { KRATOS_TRY; BoundedMatrix rhs_full = ZeroMatrix(36, 1); - IndexType aux_index = 0; - for (IndexType i = 0; i < 18; ++i) { + unsigned int aux_index = 0; + for (unsigned int i = 0; i < 18; ++i) { if (i == 9) aux_index += 9; /* Calculate residual forces */ @@ -3749,14 +3778,14 @@ void SolidShellElementSprism3D6N::CalculateAndAddInternalForces( } /* Apply EAS stabilization */ - ApplyEASRHS(rhs_full, rEAS, AlphaEAS); + ApplyEASRHS(rhs_full, rEAS, rAlphaEAS); // Compute vector of IDs array_1d id_vector; CalculateIdVector(id_vector); - IndexType index_i; - for (IndexType i = 0; i < 36; ++i) { + unsigned int index_i; + for (unsigned int i = 0; i < 36; ++i) { index_i = i < 18 ? i : id_vector[i - 18]; if (index_i < 36) { rRightHandSideVector[index_i] -= rhs_full(i, 0); @@ -3771,8 +3800,8 @@ void SolidShellElementSprism3D6N::CalculateAndAddInternalForces( void SolidShellElementSprism3D6N::SetGeneralVariables( GeneralVariables& rVariables, - ConstitutiveLaw::Parameters& rValues, - const IndexType rPointNumber + ConstitutiveLaw::Parameters& rConstitutiveValues, + const unsigned int PointNumber ) { KRATOS_ERROR_IF(rVariables.detF < 0) << "SPRISM ELEMENT: " << this->Id() << "INVERTED: |F| < 0 detF = " << rVariables.detF << std::endl; @@ -3781,15 +3810,15 @@ void SolidShellElementSprism3D6N::SetGeneralVariables( rVariables.detFT = rVariables.detF * rVariables.detF0; rVariables.FT = prod( rVariables.F, rVariables.F0 ); - rValues.SetDeterminantF(rVariables.detFT); - rValues.SetDeformationGradientF(rVariables.FT); - rValues.SetStrainVector(rVariables.StrainVector); - rValues.SetStressVector(rVariables.StressVector); - rValues.SetConstitutiveMatrix(rVariables.ConstitutiveMatrix); + rConstitutiveValues.SetDeterminantF(rVariables.detFT); + rConstitutiveValues.SetDeformationGradientF(rVariables.FT); + rConstitutiveValues.SetStrainVector(rVariables.StrainVector); + rConstitutiveValues.SetStressVector(rVariables.StressVector); + rConstitutiveValues.SetConstitutiveMatrix(rVariables.ConstitutiveMatrix); // Adding the standard prism shape functions - rValues.SetShapeFunctionsValues(rVariables.N); - rValues.SetShapeFunctionsDerivatives(rVariables.DN_DX); + rConstitutiveValues.SetShapeFunctionsValues(rVariables.N); + rConstitutiveValues.SetShapeFunctionsDerivatives(rVariables.DN_DX); } /***********************************************************************************/ @@ -3803,22 +3832,24 @@ void SolidShellElementSprism3D6N::InitializeSystemMatrices( { // Resizing as needed the LHS const WeakPointerVectorNodesType& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); - const IndexType number_of_nodes = GetGeometry().size() + NumberOfActiveNeighbours(r_neighbour_nodes); - const IndexType mat_size = number_of_nodes * 3; + const unsigned int number_of_nodes = GetGeometry().size() + NumberOfActiveNeighbours(r_neighbour_nodes); + const unsigned int mat_size = number_of_nodes * 3; - if ( rCalculationFlags.Is(SolidShellElementSprism3D6N::COMPUTE_LHS_MATRIX) ) {// Calculation of the matrix is required - if ( rLeftHandSideMatrix.size1() != mat_size ) - rLeftHandSideMatrix.resize( mat_size, mat_size, false ); + if (rCalculationFlags.Is(SolidShellElementSprism3D6N::COMPUTE_LHS_MATRIX)) {// Calculation of the matrix is required + if (rLeftHandSideMatrix.size1() != mat_size) { + rLeftHandSideMatrix.resize(mat_size, mat_size, false); + } - noalias( rLeftHandSideMatrix ) = ZeroMatrix( mat_size, mat_size ); // Resetting LHS + noalias(rLeftHandSideMatrix) = ZeroMatrix(mat_size, mat_size); // Resetting LHS } // Resizing as needed the RHS - if ( rCalculationFlags.Is(SolidShellElementSprism3D6N::COMPUTE_RHS_VECTOR) ) { // Calculation of the matrix is required - if ( rRightHandSideVector.size() != mat_size ) - rRightHandSideVector.resize( mat_size, false ); + if (rCalculationFlags.Is(SolidShellElementSprism3D6N::COMPUTE_RHS_VECTOR)) { // Calculation of the matrix is required + if (rRightHandSideVector.size() != mat_size) { + rRightHandSideVector.resize(mat_size, false); + } - rRightHandSideVector = ZeroVector( mat_size ); // Resetting RHS + rRightHandSideVector = ZeroVector(mat_size); // Resetting RHS } } @@ -3829,7 +3860,7 @@ void SolidShellElementSprism3D6N::CalculateKinematics( GeneralVariables& rVariables, const CommonComponents& rCommonComponents, const IntegrationPointsArrayType& rIntegrationPoints, - const IndexType rPointNumber, + const unsigned int PointNumber, const double AlphaEAS, const double ZetaGauss ) @@ -3865,24 +3896,24 @@ void SolidShellElementSprism3D6N::CalculateKinematics( // Jacobian Determinant for the isoparametric and numerical integration Matrix J0; auto& r_geometry = GetGeometry(); - GeometryUtils::JacobianOnInitialConfiguration(r_geometry, rIntegrationPoints[rPointNumber], J0); + GeometryUtils::JacobianOnInitialConfiguration(r_geometry, rIntegrationPoints[PointNumber], J0); rVariables.detJ = MathUtils::Det(J0); } else { // Cauchy stress measure rVariables.StressMeasure = ConstitutiveLaw::StressMeasure_Cauchy; //Determinant of the Deformation Gradient F0 - rVariables.detF0 = MathUtils::Det3(mAuxContainer[rPointNumber]); - rVariables.F0 = mAuxContainer[rPointNumber]; + rVariables.detF0 = MathUtils::Det3(mAuxContainer[PointNumber]); + noalias(rVariables.F0) = mAuxContainer[PointNumber]; } - this->CbartoFbar(rVariables, rPointNumber); + this->CbartoFbar(rVariables, PointNumber); // Get the shape functions for the order of the integration method [N] - const Matrix& N_container = rVariables.GetShapeFunctions(); + const Matrix& r_N_container = rVariables.GetShapeFunctions(); // Set Shape Functions Values for this integration point - rVariables.N = row( N_container, rPointNumber); + noalias(rVariables.N) = row( r_N_container, PointNumber); KRATOS_CATCH( "" ); } @@ -3890,7 +3921,7 @@ void SolidShellElementSprism3D6N::CalculateKinematics( /***************************** COMPUTE DELTA POSITION ******************************/ /***********************************************************************************/ -void SolidShellElementSprism3D6N::CalculateDeltaPosition(Matrix & rDeltaPosition) +void SolidShellElementSprism3D6N::CalculateDeltaPosition(Matrix& rDeltaPosition) { KRATOS_TRY; @@ -3898,12 +3929,12 @@ void SolidShellElementSprism3D6N::CalculateDeltaPosition(Matrix & rDeltaPosition const auto& r_geometry = GetGeometry(); // Iterate over the nodes to calculate the delta position - const IndexType number_of_nodes = r_geometry.size(); - for ( IndexType i = 0; i < number_of_nodes; ++i ) { + const unsigned int number_of_nodes = r_geometry.size(); + for (unsigned int i = 0; i < number_of_nodes; ++i) { const array_1d& r_current_displacement = r_geometry[i].FastGetSolutionStepValue(DISPLACEMENT); const array_1d& r_previous_displacement = r_geometry[i].FastGetSolutionStepValue(DISPLACEMENT, 1); - for ( IndexType j = 0; j < 3; ++j ) { + for (unsigned int j = 0; j < 3; ++j) { rDeltaPosition(i,j) = r_current_displacement[j] - r_previous_displacement[j]; } } @@ -3917,7 +3948,7 @@ void SolidShellElementSprism3D6N::CalculateDeltaPosition(Matrix & rDeltaPosition void SolidShellElementSprism3D6N::CbartoFbar( GeneralVariables& rVariables, - const int rPointNumber + const unsigned int PointNumber ) { KRATOS_TRY; @@ -3935,14 +3966,14 @@ void SolidShellElementSprism3D6N::CbartoFbar( Matrix F = ZeroMatrix(3, 3); if (mELementalFlags.Is(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { // Deformation Gradient F [dx_n+1/dx_n] - noalias(F) = prod( rVariables.j[rPointNumber], mAuxContainer[rPointNumber] ); + noalias(F) = prod( rVariables.j[PointNumber], mAuxContainer[PointNumber] ); } else { // Calculating the inverse of the jacobian and the parameters needed [d£/dx_n] Matrix InvJ(3, 3); - MathUtils::InvertMatrix( rVariables.J[rPointNumber], InvJ, rVariables.detJ); + MathUtils::InvertMatrix( rVariables.J[PointNumber], InvJ, rVariables.detJ); // Deformation Gradient F [dx_n+1/dx_n] - noalias(F) = prod( rVariables.j[rPointNumber], InvJ ); + noalias(F) = prod( rVariables.j[PointNumber], InvJ ); } // Compute R @@ -3975,20 +4006,20 @@ void SolidShellElementSprism3D6N::CalculateDeformationMatrix( const double factor_eas = std::exp(2.0 * AlphaEAS * ZetaGauss); // EAS factor - for (IndexType index = 0; index < 9; ++index) { + for (unsigned int index = 0; index < 9; ++index) { /* Element nodes */ // Note: It's important to consider the Voigt notation order considered in Kratos // Lower face rB(0, index) = L1 * rCommonComponents.BMembraneLower(0, index); // xx rB(1, index) = L1 * rCommonComponents.BMembraneLower(1, index); // yy - rB(2, index) = factor_eas * rCommonComponents.BNormal(0, index); // zz + rB(2, index) = factor_eas * rCommonComponents.BNormal(0, index); // zz rB(3, index) = L1 * rCommonComponents.BMembraneLower(2, index); // xy rB(4, index) = L1 * rCommonComponents.BShearLower(1, index) + L2 * rCommonComponents.BShearUpper(1, index); // yz rB(5, index) = L1 * rCommonComponents.BShearLower(0, index) + L2 * rCommonComponents.BShearUpper(0, index); // xz // Upper face - rB(0, index + 9) = L2 * rCommonComponents.BMembraneUpper(0, index); // xx - rB(1, index + 9) = L2 * rCommonComponents.BMembraneUpper(1, index); // yy + rB(0, index + 9) = L2 * rCommonComponents.BMembraneUpper(0, index); // xx + rB(1, index + 9) = L2 * rCommonComponents.BMembraneUpper(1, index); // yy rB(2, index + 9) = factor_eas * rCommonComponents.BNormal(0, index + 9); // zz - rB(3, index + 9) = L2 * rCommonComponents.BMembraneUpper(2, index); // xy + rB(3, index + 9) = L2 * rCommonComponents.BMembraneUpper(2, index); // xy rB(4, index + 9) = L1 * rCommonComponents.BShearLower(1, index + 9) + L2 * rCommonComponents.BShearUpper(1, index + 9); // yz rB(5, index + 9) = L1 * rCommonComponents.BShearLower(0, index + 9) + L2 * rCommonComponents.BShearUpper(0, index + 9); // xz @@ -4051,13 +4082,13 @@ void SolidShellElementSprism3D6N::InitializeGeneralVariables(GeneralVariables& r rVariables.SetShapeFunctions(msGeometryData.ShapeFunctionsValues( this->GetIntegrationMethod() )); // Jacobians - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); - const IndexType integration_point_number = integration_points.size(); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); + const IndexType integration_point_number = r_integration_points.size(); rVariables.j.resize(integration_point_number, false); // Calculating the current jacobian from cartesian coordinates to parent coordinates for all integration points [dx_n+1/d£] - for (IndexType point_number = 0; point_number < integration_points.size(); ++point_number) { - r_geometry.Jacobian(rVariables.j[point_number], integration_points[point_number]); + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number) { + r_geometry.Jacobian(rVariables.j[point_number], r_integration_points[point_number]); } if (mELementalFlags.IsNot(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { @@ -4065,8 +4096,8 @@ void SolidShellElementSprism3D6N::InitializeGeneralVariables(GeneralVariables& r rVariables.J.resize(integration_point_number, false); Matrix delta_position(6, 3); this->CalculateDeltaPosition(delta_position); - for (IndexType point_number = 0; point_number < integration_points.size(); ++point_number) { - r_geometry.Jacobian(rVariables.J[point_number], integration_points[point_number], delta_position); + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number) { + r_geometry.Jacobian(rVariables.J[point_number], r_integration_points[point_number], delta_position); } } else { rVariables.J.resize(1, false); @@ -4077,7 +4108,7 @@ void SolidShellElementSprism3D6N::InitializeGeneralVariables(GeneralVariables& r const GeometryType::ShapeFunctionsGradientsType& DN_De = msGeometryData.ShapeFunctionsLocalGradients(this->GetIntegrationMethod()); double detJ; Matrix inv_j; - for (IndexType i_point = 0; i_point < integration_point_number; ++i_point) { + for (unsigned int i_point = 0; i_point < integration_point_number; ++i_point) { MathUtils::InvertMatrix( rVariables.j[i_point], inv_j, detJ ); noalias(DN_DX[i_point]) = prod(DN_De[i_point], inv_j); } @@ -4091,12 +4122,12 @@ void SolidShellElementSprism3D6N::InitializeGeneralVariables(GeneralVariables& r void SolidShellElementSprism3D6N::FinalizeStepVariables( GeneralVariables & rVariables, - const IndexType rPointNumber + const unsigned int PointNumber ) { if (mELementalFlags.IsNot(SolidShellElementSprism3D6N::TOTAL_UPDATED_LAGRANGIAN)) { // Update internal (historical) variables - mAuxContainer[rPointNumber] = prod(rVariables.F, rVariables.F0); + mAuxContainer[PointNumber] = prod(rVariables.F, rVariables.F0); } } @@ -4105,7 +4136,7 @@ void SolidShellElementSprism3D6N::FinalizeStepVariables( void SolidShellElementSprism3D6N::GetHistoricalVariables( GeneralVariables& rVariables, - const IndexType rPointNumber + const unsigned int PointNumber ) { /* Deformation Gradient F ( set to identity ) */ @@ -4169,7 +4200,7 @@ void SolidShellElementSprism3D6N::CalculateVolumeForce( const SolidShellElementSprism3D6N::IntegrationPointsContainerType SolidShellElementSprism3D6N::AllIntegrationPoints() { - IntegrationPointsContainerType integration_points = + IntegrationPointsContainerType r_integration_points = { { Quadrature>::GenerateIntegrationPoints(), @@ -4179,40 +4210,43 @@ const SolidShellElementSprism3D6N::IntegrationPointsContainerType SolidShellElem Quadrature>::GenerateIntegrationPoints() } }; - return integration_points; + return r_integration_points; } /***********************************************************************************/ /***********************************************************************************/ -Matrix SolidShellElementSprism3D6N::CalculateShapeFunctionsIntegrationPointsValues(const IntegrationMethod ThisMethod) +Matrix SolidShellElementSprism3D6N::CalculateShapeFunctionsIntegrationPointsValues(const int ThisMethod) { IntegrationPointsContainerType all_integration_points = AllIntegrationPoints(); - IntegrationPointsArrayType integration_points = all_integration_points[static_cast(ThisMethod)]; + IntegrationPointsArrayType r_integration_points = all_integration_points[ThisMethod]; + // Number of integration points - const int integration_points_number = integration_points.size(); + const unsigned int integration_points_number = r_integration_points.size(); + // Number of nodes in current geometry - const int points_number = 6; + const unsigned int points_number = 6; + // Setting up return matrix - Matrix shape_function_values( integration_points_number, points_number ); + Matrix shape_function_values(integration_points_number, points_number); // Loop over all integration points - for ( int pnt = 0; pnt < integration_points_number; pnt++ ) { - shape_function_values( pnt, 0 ) = ( 1.0 - - integration_points[pnt].X() - - integration_points[pnt].Y() - - integration_points[pnt].Z() - + ( integration_points[pnt].X() * integration_points[pnt].Z() ) - + ( integration_points[pnt].Y() * integration_points[pnt].Z() ) ); - shape_function_values( pnt, 1 ) = integration_points[pnt].X() - - ( integration_points[pnt].X() * integration_points[pnt].Z() ); - shape_function_values( pnt, 2 ) = integration_points[pnt].Y() - - ( integration_points[pnt].Y() * integration_points[pnt].Z() ); - shape_function_values( pnt, 3 ) = integration_points[pnt].Z() - - ( integration_points[pnt].X() * integration_points[pnt].Z() ) - - ( integration_points[pnt].Y() * integration_points[pnt].Z() ); - shape_function_values( pnt, 4 ) = ( integration_points[pnt].X() * integration_points[pnt].Z() ); - shape_function_values( pnt, 5 ) = ( integration_points[pnt].Y() * integration_points[pnt].Z() ); + for (unsigned int pnt = 0; pnt < integration_points_number; pnt++) { + shape_function_values(pnt, 0) = (1.0 + - r_integration_points[pnt].X() + - r_integration_points[pnt].Y() + - r_integration_points[pnt].Z() + + ( r_integration_points[pnt].X() * r_integration_points[pnt].Z()) + + ( r_integration_points[pnt].Y() * r_integration_points[pnt].Z())); + shape_function_values(pnt, 1) = r_integration_points[pnt].X() + - ( r_integration_points[pnt].X() * r_integration_points[pnt].Z()); + shape_function_values(pnt, 2) = r_integration_points[pnt].Y() + - ( r_integration_points[pnt].Y() * r_integration_points[pnt].Z()); + shape_function_values(pnt, 3) = r_integration_points[pnt].Z() + - ( r_integration_points[pnt].X() * r_integration_points[pnt].Z()) + - ( r_integration_points[pnt].Y() * r_integration_points[pnt].Z()); + shape_function_values(pnt, 4) = ( r_integration_points[pnt].X() * r_integration_points[pnt].Z()); + shape_function_values(pnt, 5) = ( r_integration_points[pnt].Y() * r_integration_points[pnt].Z()); } return shape_function_values; @@ -4226,11 +4260,11 @@ const SolidShellElementSprism3D6N::ShapeFunctionsValuesContainerType SolidShellE ShapeFunctionsValuesContainerType shape_functions_values = { { - CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_1 ), - CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_2 ), - CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_3 ), - CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_4 ), - CalculateShapeFunctionsIntegrationPointsValues(GeometryData::IntegrationMethod::GI_GAUSS_5 ) + CalculateShapeFunctionsIntegrationPointsValues(0), + CalculateShapeFunctionsIntegrationPointsValues(1), + CalculateShapeFunctionsIntegrationPointsValues(2), + CalculateShapeFunctionsIntegrationPointsValues(3), + CalculateShapeFunctionsIntegrationPointsValues(4) } }; return shape_functions_values; @@ -4239,35 +4273,37 @@ const SolidShellElementSprism3D6N::ShapeFunctionsValuesContainerType SolidShellE /***********************************************************************************/ /***********************************************************************************/ -SolidShellElementSprism3D6N::ShapeFunctionsGradientsType SolidShellElementSprism3D6N::CalculateShapeFunctionsIntegrationPointsLocalGradients(const IntegrationMethod ThisMethod ) +SolidShellElementSprism3D6N::ShapeFunctionsGradientsType SolidShellElementSprism3D6N::CalculateShapeFunctionsIntegrationPointsLocalGradients(const int ThisMethod ) { IntegrationPointsContainerType all_integration_points = AllIntegrationPoints(); - IntegrationPointsArrayType integration_points = all_integration_points[static_cast(ThisMethod)]; + IntegrationPointsArrayType r_integration_points = all_integration_points[ThisMethod]; + // Number of integration points - const int integration_points_number = integration_points.size(); + const unsigned int integration_points_number = r_integration_points.size(); ShapeFunctionsGradientsType d_shape_f_values( integration_points_number ); + // Initialising container // Loop over all integration points - Matrix result( 6, 3 ); - for (int pnt = 0; pnt < integration_points_number; pnt++ ) { - result( 0, 0 ) = -1.0 + integration_points[pnt].Z(); - result( 0, 1 ) = -1.0 + integration_points[pnt].Z(); - result( 0, 2 ) = -1.0 + integration_points[pnt].X() + integration_points[pnt].Y(); - result( 1, 0 ) = 1.0 - integration_points[pnt].Z(); - result( 1, 1 ) = 0.0; - result( 1, 2 ) = -integration_points[pnt].X(); - result( 2, 0 ) = 0.0; - result( 2, 1 ) = 1.0 - integration_points[pnt].Z(); - result( 2, 2 ) = -integration_points[pnt].Y(); - result( 3, 0 ) = -integration_points[pnt].Z(); - result( 3, 1 ) = -integration_points[pnt].Z(); - result( 3, 2 ) = 1.0 - integration_points[pnt].X() - integration_points[pnt].Y(); - result( 4, 0 ) = integration_points[pnt].Z(); - result( 4, 1 ) = 0.0; - result( 4, 2 ) = integration_points[pnt].X(); - result( 5, 0 ) = 0.0; - result( 5, 1 ) = integration_points[pnt].Z(); - result( 5, 2 ) = integration_points[pnt].Y(); + Matrix result(6, 3); + for (unsigned int pnt = 0; pnt < integration_points_number; pnt++ ) { + result(0, 0) = -1.0 + r_integration_points[pnt].Z(); + result(0, 1) = -1.0 + r_integration_points[pnt].Z(); + result(0, 2) = -1.0 + r_integration_points[pnt].X() + r_integration_points[pnt].Y(); + result(1, 0) = 1.0 - r_integration_points[pnt].Z(); + result(1, 1) = 0.0; + result(1, 2) = -r_integration_points[pnt].X(); + result(2, 0) = 0.0; + result(2, 1) = 1.0 - r_integration_points[pnt].Z(); + result(2, 2) = -r_integration_points[pnt].Y(); + result(3, 0) = -r_integration_points[pnt].Z(); + result(3, 1) = -r_integration_points[pnt].Z(); + result(3, 2) = 1.0 - r_integration_points[pnt].X() - r_integration_points[pnt].Y(); + result(4, 0) = r_integration_points[pnt].Z(); + result(4, 1) = 0.0; + result(4, 2) = r_integration_points[pnt].X(); + result(5, 0) = 0.0; + result(5, 1) = r_integration_points[pnt].Z(); + result(5, 2) = r_integration_points[pnt].Y(); d_shape_f_values[pnt] = result; } @@ -4282,11 +4318,11 @@ const SolidShellElementSprism3D6N::ShapeFunctionsLocalGradientsContainerType Sol ShapeFunctionsLocalGradientsContainerType shape_functions_local_gradients = { { - CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_1 ), - CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_2 ), - CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_3 ), - CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_4 ), - CalculateShapeFunctionsIntegrationPointsLocalGradients(GeometryData::IntegrationMethod::GI_GAUSS_5 ) + CalculateShapeFunctionsIntegrationPointsLocalGradients(0), + CalculateShapeFunctionsIntegrationPointsLocalGradients(1), + CalculateShapeFunctionsIntegrationPointsLocalGradients(2), + CalculateShapeFunctionsIntegrationPointsLocalGradients(3), + CalculateShapeFunctionsIntegrationPointsLocalGradients(4) } }; return shape_functions_local_gradients; diff --git a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h index bf1199d33513..ef7ecfd96058 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h +++ b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h @@ -83,9 +83,6 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N /// StressMeasure from constitutive laws using StressMeasureType = ConstitutiveLawType::StressMeasure; - /// Integration methods implemented in geometry. - using IntegrationMethod = GeometryType::IntegrationMethod; - /// The base element type using BaseType = BaseSolidElement; @@ -157,7 +154,10 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N * @param NewId The Id of the new created element * @param pGeometry The pointer to the geometry of the element */ - SolidShellElementSprism3D6N(IndexType NewId, GeometryType::Pointer pGeometry); + SolidShellElementSprism3D6N( + IndexType NewId, + GeometryType::Pointer pGeometry + ); /** * @brief Constructor using an array of nodes with properties @@ -165,7 +165,11 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N * @param pGeometry The pointer to the geometry of the element * @param pProperties The pointer to the properties of the element */ - SolidShellElementSprism3D6N(IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties); + SolidShellElementSprism3D6N( + IndexType NewId, + GeometryType::Pointer pGeometry, + PropertiesType::Pointer pProperties + ); /// Copy constructor SolidShellElementSprism3D6N(SolidShellElementSprism3D6N const& rOther); @@ -200,25 +204,25 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N /** * @brief Creates a new element * @param NewId The Id of the new created element - * @param ThisNodes The array containing nodes + * @param rNodes The array containing nodes * @param pProperties The pointer to property * @return The pointer to the created element */ Element::Pointer Create( IndexType NewId, - NodesArrayType const& ThisNodes, + NodesArrayType const& rNodes, PropertiesType::Pointer pProperties ) const override; /** * Clones the selected element variables, creating a new one * @param NewId the ID of the new element - * @param ThisNodes the nodes of the new element + * @param rNodes the nodes of the new element * @return a Pointer to the new element */ Element::Pointer Clone( IndexType NewId, - NodesArrayType const& ThisNodes + NodesArrayType const& rNodes ) const override; /** @@ -325,9 +329,9 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N * @param rCurrentProcessInfo the current process info instance */ void CalculateDampingMatrix( - MatrixType& rDampingMatrix, - const ProcessInfo& rCurrentProcessInfo - ) override; + MatrixType& rDampingMatrix, + const ProcessInfo& rCurrentProcessInfo + ) override; /** * @brief This is called during the assembling process in order @@ -444,7 +448,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N /** * @brief Set a double Value on the Element Constitutive Law * @param rVariable The internal variables in the element - * @param rValues Values of the ContstitutiveLaw + * @param rValues Values of the ConstitutiveLaw * @param rCurrentProcessInfo The current process info instance */ void SetValuesOnIntegrationPoints( @@ -456,7 +460,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N /** * @brief Set a Vector Value on the Element Constitutive Law * @param rVariable The internal variables in the element - * @param rValues Values of the ContstitutiveLaw + * @param rValues Values of the ConstitutiveLaw * @param rCurrentProcessInfo The current process info instance */ void SetValuesOnIntegrationPoints( @@ -468,7 +472,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N /** * @brief Set a Matrix Value on the Element Constitutive Law * @param rVariable The internal variables in the element - * @param rValues Values of the ContstitutiveLaw + * @param rValues Values of the ConstitutiveLaw * @param rCurrentProcessInfo The current process info instance */ void SetValuesOnIntegrationPoints( @@ -480,7 +484,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N /** * @brief Set a Constitutive Law Value * @param rVariable The internal variables in the element - * @param rValues Values of the ContstitutiveLaw + * @param rValues Values of the ConstitutiveLaw * @param rCurrentProcessInfo The current process info instance */ void SetValuesOnIntegrationPoints( @@ -489,6 +493,15 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N const ProcessInfo& rCurrentProcessInfo ) override; + /** + * @brief Returns the used integration method + * @return Integration method of the used Geometry + */ + GeometryData::IntegrationMethod GetIntegrationMethod() const override + { + return static_cast(mIntegrationOrder); + } + //****************** CHECK VALUES *****************// /** * @brief This function provides the place to perform checks on the completeness of the input. @@ -499,30 +512,6 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N */ int Check(const ProcessInfo& rCurrentProcessInfo) const override; - ///@} - ///@name Input and output - ///@{ - - // Turn back information as a string. - std::string Info() const override - { - std::stringstream buffer; - buffer << "SPRISM Element #" << Id(); - return buffer.str(); - } - - /// Print information about this object. - void PrintInfo(std::ostream& rOStream) const override - { - rOStream << "SPRISM Element #" << Id(); - } - - /// Print object's data. - void PrintData(std::ostream& rOStream) const override - { - GetGeometry().PrintData(rOStream); - } - //*********** STARTING - ENDING METHODS **********// /** @@ -555,9 +544,34 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N */ void Initialize(const ProcessInfo& rCurrentProcessInfo) override; -protected: + ///@} + ///@name Input and output + ///@{ + // Turn back information as a string. + std::string Info() const override + { + std::stringstream buffer; + buffer << "SPRISM Element #" << Id(); + return buffer.str(); + } + + /// Print information about this object. + void PrintInfo(std::ostream& rOStream) const override + { + rOStream << "SPRISM Element #" << Id(); + } + + /// Print object's data. + void PrintData(std::ostream& rOStream) const override + { + GetGeometry().PrintData(rOStream); + } + + ///@} +protected: ///@name Protected definitions + ///@{ /** * @class CartesianDerivatives @@ -575,7 +589,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N // Gauss nodes array_1d, 6> TransversalCartesianDerivativesGauss; - /* Inverse of the Jaconians */ + /* Inverse of the Jacobians */ BoundedMatrix JInvPlaneLower; BoundedMatrix JInvPlaneUpper; @@ -584,7 +598,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N */ void clear() { - for (IndexType i = 0; i < 6; i++) { + for (unsigned int i = 0; i < 6; i++) { noalias(InPlaneCartesianDerivativesGauss[i]) = ZeroMatrix(2, 4); noalias(TransversalCartesianDerivativesGauss[i]) = ZeroMatrix(6, 1); } @@ -870,27 +884,30 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N /** * @brief Check if the node has a neighbour: * @param Index The index of the node - * @param NeighbourNode The neighbours nodes + * @param rNeighbourNode The neighbours nodes * @return A boolean that indicates if the node has a neighbour */ bool HasNeighbour( const IndexType Index, - const Node& NeighbourNode - ) const ; + const Node& rNeighbourNode + ) const; /** * @brief Calculates the number of active neighbours: - * @param pNeighbourNodes The neighbours nodes + * @param rNeighbourNodes The neighbours nodes * @return An integer with the number of neighbours of the node */ - std::size_t NumberOfActiveNeighbours(const GlobalPointersVector< Node >& pNeighbourNodes) const; + std::size_t NumberOfActiveNeighbours(const GlobalPointersVector& rNeighbourNodes) const; /** - * @brief It gets the nodal coordinates, according to the configutaion + * @brief It gets the nodal coordinates, according to the configuration + * @param rNodesCoordinates The nodal coordinates + * @param rNeighbourNodes The neighbours nodes + * @param ThisConfiguration The configuration (initial or current) */ void GetNodalCoordinates( - BoundedMatrix& NodesCoord, - const GlobalPointersVector< Node >& pNeighbourNodes, + BoundedMatrix& rNodesCoordinates, + const GlobalPointersVector& rNeighbourNodes, const Configuration ThisConfiguration ) const; @@ -901,6 +918,8 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N /** * @brief Calculate the necessary components for the Kinematic calculus + * @param rCommonComponents The common components + * @param rCartesianDerivatives The cartesian derivatives */ void CalculateCommonComponents( CommonComponents& rCommonComponents, @@ -909,11 +928,12 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N /** * @brief Calculates the Local Coordinates System + * @param rOrthogonalBase The orthogonal base * @param ThisOrthogonalBaseApproach The chosen approximation * @param ThisAngle Angle of rotation of the element */ void CalculateLocalCoordinateSystem( - OrthogonalBase& ThisOrthogonalBase, + OrthogonalBase& rOrthogonalBase, const OrthogonalBaseApproach ThisOrthogonalBaseApproach, const double ThisAngle ); @@ -925,11 +945,11 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N /** * @brief Calculate the local derivatives of the element for a given coordinates - * @param LocalDerivativePatch The local derivatives of the element + * @param rLocalDerivativePatch The local derivatives of the element * @param rLocalCoordinates The local coordinates */ void ComputeLocalDerivatives( - BoundedMatrix& LocalDerivativePatch, + BoundedMatrix& rLocalDerivativePatch, const array_1d& rLocalCoordinates ); @@ -939,205 +959,209 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N * @param NodeGauss The Gauss node index */ void ComputeLocalDerivativesQuadratic( - BoundedMatrix& rLocalDerivativePatch, - const IndexType NodeGauss + BoundedMatrix& rLocalDerivativePatch, + const unsigned int NodeGauss ); /** * @brief Calculate the Jacobian and his inverse - * @param J The Jacobian of the element - * @param Jinv The inverse of the Jacobian - * @param detJ Determinant of the Jacobian - * @param rPointNumber The integration point index + * @param rJ The Jacobian of the element + * @param rJinv The inverse of the Jacobian + * @param rDetJ Determinant of the Jacobian + * @param PointNumber The integration point index * @param ZetaGauss The transversal local coordinates */ void CalculateJacobianCenterGauss( - GeometryType::JacobiansType& J, - std::vector< Matrix >& Jinv, - Vector& detJ, - const IndexType rPointNumber, + GeometryType::JacobiansType& rJ, + std::vector& rJinv, + Vector& rDetJ, + const unsigned int PointNumber, const double ZetaGauss ); /** * @brief Calculate the Jacobian - * @param detJ Determinant of the Jacobian - * @param J The Jacobian of the element - * @param LocalDerivativePatch The local derivatives of the element - * @param NodesCoord The matrix with the coordinates of the nodes of the element + * @param rDetJ Determinant of the Jacobian + * @param rJ The Jacobian of the element + * @param rLocalDerivativePatch The local derivatives of the element + * @param rNodesCoordinates The matrix with the coordinates of the nodes of the element * @param rLocalCoordinates The local coordinates */ void CalculateJacobian( - double& detJ, - BoundedMatrix& J, - BoundedMatrix& LocalDerivativePatch, - const BoundedMatrix& NodesCoord, + double& rDetJ, + BoundedMatrix& rJ, + BoundedMatrix& rLocalDerivativePatch, + const BoundedMatrix& rNodesCoordinates, const array_1d& rLocalCoordinates ); /** * @brief Calculate the Jacobian and its inverse - * @param J The Jacobian of the element - * @param Jinv The inverse of the Jacobian - * @param LocalDerivativePatch The local derivatives of the element - * @param NodesCoord The matrix with the coordinates of the nodes of the element + * @param rJ The Jacobian of the element + * @param rJinv The inverse of the Jacobian + * @param rLocalDerivativePatch The local derivatives of the element + * @param rNodesCoordinates The matrix with the coordinates of the nodes of the element * @param rLocalCoordinates The local coordinates */ void CalculateJacobianAndInv( - BoundedMatrix& J, - BoundedMatrix& Jinv, - BoundedMatrix& LocalDerivativePatch, - const BoundedMatrix& NodesCoord, + BoundedMatrix& rJ, + BoundedMatrix& rJinv, + BoundedMatrix& rLocalDerivativePatch, + const BoundedMatrix& rNodesCoordinates, const array_1d& rLocalCoordinates ); /** * @brief Calculate the Jacobian and his inverse - * @param J The Jacobian of the element - * @param Jinv The inverse of the Jacobian - * @param NodesCoord The matrix with the coordinates of the nodes of the element + * @param rJ The Jacobian of the element + * @param rJinv The inverse of the Jacobian + * @param rNodesCoordinates The matrix with the coordinates of the nodes of the element * @param rLocalCoordinates The local coordinates */ void CalculateJacobianAndInv( - BoundedMatrix& J, - BoundedMatrix& Jinv, - const BoundedMatrix& NodesCoord, + BoundedMatrix& rJ, + BoundedMatrix& rJinv, + const BoundedMatrix& rNodesCoordinates, const array_1d& rLocalCoordinates ); /** * @brief Calculate the Cartesian derivatives in the Gauss points, for the plane - * @param CartesianDerivativesCenter The cartesian derivatives in the plane + * @param rCartesianDerivativesCenter The cartesian derivatives in the plane + * @param rOrthogonalBase The orthogonal base * @param Part The enum that indicates upper or lower face */ void CalculateCartesianDerivativesOnCenterPlane( - BoundedMatrix& CartesianDerivativesCenter, - const OrthogonalBase& ThisOrthogonalBase, + BoundedMatrix& rCartesianDerivativesCenter, + const OrthogonalBase& rOrthogonalBase, const GeometricLevel Part ); /** * @brief Calculate the Cartesian derivatives in the Gauss points, for the plane + * @param rInPlaneCartesianDerivativesGauss The cartesian derivatives in the plane + * @param rNodesCoordinates The matrix with the coordinates of the nodes of the element + * @param rOrthogonalBase The orthogonal base * @param NodeGauss Number of Gauss node calculated * @param Part The index that indicates upper or lower face - * @param NodesCoord The matrix with the coordinates of the nodes of the element - * @param InPlaneCartesianDerivativesGauss The cartesian derivatives in the plane */ void CalculateCartesianDerOnGaussPlane( - BoundedMatrix & InPlaneCartesianDerivativesGauss, - const BoundedMatrix & NodesCoord, - const OrthogonalBase& ThisOrthogonalBase, - const IndexType NodeGauss, + BoundedMatrix& rInPlaneCartesianDerivativesGauss, + const BoundedMatrix& rNodesCoordinates, + const OrthogonalBase& rOrthogonalBase, + const unsigned int NodeGauss, const GeometricLevel Part ); /** * @brief Calculate the Cartesian derivatives in the Gauss points, for the transversal direction - * @param NodesCoord The matrix with the coordinates of the nodes of the element - * @param TransversalCartesianDerivativesGauss The cartesian derivatives in the transversal direction + * @param rNodesCoordinates The matrix with the coordinates of the nodes of the element + * @param rTransversalCartesianDerivativesGauss The cartesian derivatives in the transversal direction + * @param rOrthogonalBase The orthogonal base * @param rLocalCoordinates The local coordinates */ void CalculateCartesianDerOnGaussTrans( - BoundedMatrix & TransversalCartesianDerivativesGauss, - const BoundedMatrix & NodesCoord, - const OrthogonalBase& ThisOrthogonalBase, + BoundedMatrix& rTransversalCartesianDerivativesGauss, + const BoundedMatrix& rNodesCoordinates, + const OrthogonalBase& rOrthogonalBase, const array_1d& rLocalCoordinates ); /** * @brief Calculate the Cartesian derivatives in the center, for the transversal direction * @param rCartesianDerivatives The class containing the cartesian derivatives - * @param NodesCoord The matrix with the coordinates of the nodes of the element + * @param rNodesCoordinates The matrix with the coordinates of the nodes of the element * @param Part 0 for center node of the element, 1 for upper part and 2 for lower part */ void CalculateCartesianDerOnCenterTrans( CartesianDerivatives& rCartesianDerivatives, - const BoundedMatrix& NodesCoord, - const OrthogonalBase& ThisOrthogonalBase, + const BoundedMatrix& rNodesCoordinates, + const OrthogonalBase& rOrthogonalBase, const GeometricLevel Part ); /** - * Calculate the components of the deformation gradient in the plane, for the Gauss nodes: - * @param InPlaneGradientFGauss The components of the deformation gradient in the plane, for the gauss node - * @param InPlaneCartesianDerivativesGauss The cartesian derivatives of a Gauss node in the plane - * @param NodesCoord The coordinates of the nodes of the element + * @briefd Calculate the components of the deformation gradient in the plane, for the Gauss nodes: + * @param rInPlaneGradientFGauss The components of the deformation gradient in the plane, for the gauss node + * @param rInPlaneCartesianDerivativesGauss The cartesian derivatives of a Gauss node in the plane + * @param rNodesCoordinates The coordinates of the nodes of the element * @param NodeGauss Number of Gauss node calculated * @param Part The enum that indicates upper or lower face */ void CalculateInPlaneGradientFGauss( - BoundedMatrix& InPlaneGradientFGauss, - const BoundedMatrix& InPlaneCartesianDerivativesGauss, - const BoundedMatrix& NodesCoord, - const IndexType NodeGauss, + BoundedMatrix& rInPlaneGradientFGauss, + const BoundedMatrix& rInPlaneCartesianDerivativesGauss, + const BoundedMatrix& rNodesCoordinates, + const unsigned int NodeGauss, const GeometricLevel Part ); /** * Calculate the transversal components of the deformation gradient, in the Gauss points: - * @param TransverseGradientF The transversal components of the deformation gradient - * @param TransversalCartesianDerivativesGauss The transversal cartesian derivatives - * @param NodesCoord The coordinates of the nodes of the element + * @param rTransverseGradientF The transversal components of the deformation gradient + * @param rTransversalCartesianDerivativesGauss The transversal cartesian derivatives + * @param rNodesCoordinates The coordinates of the nodes of the element */ void CalculateTransverseGradientF( - array_1d& TransverseGradientF, - const BoundedMatrix& TransversalCartesianDerivativesGauss, - const BoundedMatrix& NodesCoord + array_1d& rTransverseGradientF, + const BoundedMatrix& rTransversalCartesianDerivativesGauss, + const BoundedMatrix& rNodesCoordinates ); /** * @brief Calculate the transversal components of the deformation gradient, in each one of the faces: * @param rTransverseGradientIsoParametric Auxilar components of the deformation gradient - * @param NodesCoord The coordinates of the nodes of the element + * @param rNodesCoordinates The coordinates of the nodes of the element * @param Part The enum that indicates if calculate upper or lower components */ void CalculateTransverseGradientFinP( TransverseGradientIsoParametric& rTransverseGradientIsoParametric, - const BoundedMatrix& NodesCoord, + const BoundedMatrix& rNodesCoordinates, const GeometricLevel Part ); /** * @brief Construction of the membrane deformation tangent matrix: - * @param BMembrane Membrane component of the deformation tangent matrix - * @param CMembrane Membrane component of the Cauchy tensor - * @param InPlaneCartesianDerivativesGauss The in-plane cartesian derivatives of the Gauss points - * @param InPlaneGradientFGauss The in-plane deformation gradient components + * @param rBMembrane Membrane component of the deformation tangent matrix + * @param rCMembrane Membrane component of the Cauchy tensor + * @param rInPlaneCartesianDerivativesGauss The in-plane cartesian derivatives of the Gauss points + * @param rInPlaneGradientFGauss The in-plane deformation gradient components * @param NodeGauss Number of Gauss node calculated */ void CalculateAndAddBMembrane( - BoundedMatrix& BMembrane, - BoundedMatrix& CMembrane, - const BoundedMatrix& InPlaneCartesianDerivativesGauss, - const BoundedMatrix& InPlaneGradientFGauss, - const IndexType NodeGauss + BoundedMatrix& rBMembrane, + BoundedMatrix& rCMembrane, + const BoundedMatrix& rInPlaneCartesianDerivativesGauss, + const BoundedMatrix& rInPlaneGradientFGauss, + const unsigned int NodeGauss ); /** * @brief Construction of the in-plane geometric stiffness matrix: - * @param Kgeometricmembrane Membrane component of the stiffness matrix + * @param rKgeometricmembrane Membrane component of the stiffness matrix * @param rCartesianDerivatives Cartesian derivatives auxiliary struct + * @param rSMembrane The membrane components of the PK2 tensor * @param Part The enum that indicates upper or lower face */ void CalculateAndAddMembraneKgeometric( - BoundedMatrix& Kgeometricmembrane, + BoundedMatrix& rKgeometricmembrane, const CartesianDerivatives& rCartesianDerivatives, - const array_1d& SMembrane, + const array_1d& rSMembrane, const GeometricLevel Part ); /** * @brief Construction of the shear deformation tangent matrix: - * @param BShear Shear component of the deformation tangent matrix - * @param CShear Shear components of the Cauchy tensor + * @param rBShear Shear component of the deformation tangent matrix + * @param rCShear Shear components of the Cauchy tensor * @param rCartesianDerivatives Cartesian derivatives auxiliary struct * @param rTransverseGradient Local deformation gradient components for each Gauss point * @param rTransverseGradientIsoParametric Local deformation gradient components in the isogeometric space * @param Part The enum that indicates upper or lower face */ void CalculateAndAddBShear( - BoundedMatrix& BShear, - BoundedMatrix& CShear, + BoundedMatrix& rBShear, + BoundedMatrix& rCShear, const CartesianDerivatives& rCartesianDerivatives, const TransverseGradient& rTransverseGradient, const TransverseGradientIsoParametric& rTransverseGradientIsoParametric, @@ -1146,54 +1170,55 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N /** * @brief Construction of the shear geometric contribution to the stiffness matrix: - * @param Kgeometricshear The shear geometric contribution to the stiffness matrix + * @param rKgeometricshear The shear geometric contribution to the stiffness matrix * @param rCartesianDerivatives Cartesian derivatives auxiliary struct - * @param SShear The shear components of the PK2 tensor + * @param rSShear The shear components of the PK2 tensor * @param Part The enum that indicates upper or lower face */ void CalculateAndAddShearKgeometric( - BoundedMatrix& Kgeometricshear, + BoundedMatrix& rKgeometricshear, const CartesianDerivatives& rCartesianDerivatives, - const array_1d& SShear, + const array_1d& rSShear, const GeometricLevel Part ); /** * @brief Construction of the transversal deformation tangent matrix: - * @param BNormal Transversal deformation tangent matrix - * @param TransversalCartesianDerivativesGaussCenter Transversal cartesian derivatives in the central point of the element - * @param TransversalDeformationGradientF Transversal components of the deformation gradient in the central point of the element + * @param rBNormal Transversal deformation tangent matrix + * @param rCNormal Transversal component of the Cauchy tensor + * @param rTransversalCartesianDerivativesGaussCenter Transversal cartesian derivatives in the central point of the element + * @param rTransversalDeformationGradientF Transversal components of the deformation gradient in the central point of the element */ void CalculateAndAddBNormal( - BoundedMatrix& BNormal, - double& CNormal, - const BoundedMatrix& TransversalCartesianDerivativesGaussCenter, - const array_1d& TransversalDeformationGradientF + BoundedMatrix& rBNormal, + double& rCNormal, + const BoundedMatrix& rTransversalCartesianDerivativesGaussCenter, + const array_1d& rTransversalDeformationGradientF ); /** * @brief Construction of the transversal geometric contribution to the stiffness matrix: - * @param Kgeometricnormal The transversal geometric contribution to the stiffness matrix - * @param TransversalCartesianDerivativesGaussCenter Transversal cartesian derivatives in the central point of the element + * @param rKgeometricnormal The transversal geometric contribution to the stiffness matrix + * @param rTransversalCartesianDerivativesGaussCenter Transversal cartesian derivatives in the central point of the element * @param SNormal Enhanced transversal component of the PK2 tensor */ void CalculateAndAddNormalKgeometric( - BoundedMatrix& Kgeometricnormal, - const BoundedMatrix& TransversalCartesianDerivativesGaussCenter, + BoundedMatrix& rKgeometricnormal, + const BoundedMatrix& rTransversalCartesianDerivativesGaussCenter, const double SNormal ); /** * @brief Calculates the vector of current position - * @return VectorCurrentPosition: Vector of current position + * @param rVectorCurrentPosition The vector containing the current positions. */ - BoundedMatrix GetVectorCurrentPosition(); + void GetVectorCurrentPosition(BoundedMatrix& rVectorCurrentPosition); /** - * Calculates the vector of previous position - * @return VectorCurrentPosition: Vector of previous position + * @brief Calculates the vector of previous positions of the element nodes. + * @param rVectorPreviousPosition The vector containing the previous positions. */ - BoundedMatrix GetVectorPreviousPosition(); + void GetVectorPreviousPosition(BoundedMatrix& rVectorPreviousPosition); /** * @brief Integrates stresses in zeta using the Gauss Quadrature @@ -1228,19 +1253,19 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N * @brief Calculation and addition of the matrix of the LHS * @param rLocalSystem The local system of equations * @param rVariables The internal variables in the element - * @param rValues Values of the ContstitutiveLaw + * @param rConstitutiveValues Values of the ConstitutiveLaw * @param rEAS The components of the EAS stabilization - * @param AlphaEAS The internal variable for the EAS + * @param rAlphaEAS The internal variable for the EAS */ void CalculateAndAddLHS( LocalSystemComponents& rLocalSystem, GeneralVariables& rVariables, - ConstitutiveLaw::Parameters& rValues, + ConstitutiveLaw::Parameters& rConstitutiveValues, const StressIntegratedComponents& rIntegratedStress, const CommonComponents& rCommonComponents, const CartesianDerivatives& rCartesianDerivatives, const EASComponents& rEAS, - double& AlphaEAS + double& rAlphaEAS ); /** @@ -1249,7 +1274,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N * @param rVariables The internal variables in the element * @param rVolumeForce The force due to the acceleration of the body * @param rEAS The components of the EAS stabilization - * @param AlphaEAS The internal variable for the EAS + * @param rAlphaEAS The internal variable for the EAS */ void CalculateAndAddRHS( LocalSystemComponents& rLocalSystem, @@ -1258,7 +1283,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N const StressIntegratedComponents& rIntegratedStress, const CommonComponents& rCommonComponents, const EASComponents& rEAS, - double& AlphaEAS + double& rAlphaEAS ); /** @@ -1327,19 +1352,19 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N const StressIntegratedComponents& rIntegratedStress, const CommonComponents& rCommonComponents, const EASComponents& rEAS, - double& AlphaEAS + double& rAlphaEAS ); /** * @brief Set Variables of the Element to the Parameters of the Constitutive Law * @param rVariables The internal variables in the element - * @param rValues Values of the ContstitutiveLaw - * @param rPointNumber The integration point index + * @param rValues Values of the ConstitutiveLaw + * @param PointNumber The integration point index */ void SetGeneralVariables( GeneralVariables& rVariables, ConstitutiveLaw::Parameters& rValues, - const IndexType rPointNumber + const unsigned int PointNumber ); /** @@ -1358,13 +1383,13 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N * @brief This method computes the delta position matrix necessary for UL formulation * @param rDeltaPosition The matrix that contents the increase of displacements */ - void CalculateDeltaPosition(Matrix & rDeltaPosition); + void CalculateDeltaPosition(Matrix& rDeltaPosition); /** * @brief Calculate Element Kinematics * @param rVariables The internal variables in the element * @param rIntegrationPoints The integration points of the prism - * @param rPointNumber The integration point index + * @param PointNumber The integration point index * @param AlphaEAS The internal variable for the EAS * @param ZetaGauss The zeta coordinate for the Gauss Quadrature */ @@ -1372,7 +1397,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N GeneralVariables& rVariables, const CommonComponents& rCommonComponents, const IntegrationPointsArrayType& rIntegrationPoints, - const IndexType rPointNumber, + const unsigned int PointNumber, const double AlphaEAS, const double ZetaGauss ); @@ -1381,11 +1406,11 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N * @brief Calculate Fbar from Cbar * @details Assuming that the rotation matrix of the polar decomposition of the F_bar is the same of the polar decomposition of F * @param rVariables The internal variables in the element - * @param rPointNumber The integration point index + * @param PointNumber The integration point index */ void CbartoFbar( GeneralVariables& rVariables, - const int rPointNumber + const unsigned int PointNumber ); /** @@ -1405,26 +1430,26 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N * @brief Initialize Element General Variables * @param rVariables The internal variables in the element */ - void InitializeGeneralVariables(GeneralVariables & rVariables); + void InitializeGeneralVariables(GeneralVariables& rVariables); /** * @brief Finalize Element Internal Variables * @param rVariables The internal variables in the element - * @param rPointNumber The integration point index + * @param PointNumber The integration point index */ void FinalizeStepVariables( - GeneralVariables & rVariables, - const IndexType rPointNumber + GeneralVariables& rVariables, + const unsigned int PointNumber ); /** * @brief Get the Historical Deformation Gradient to calculate aTransverseGradientFter finalize the step * @param rVariables The internal variables in the element - * @param rPointNumber The integration point index + * @param PointNumber The integration point index */ void GetHistoricalVariables( GeneralVariables& rVariables, - const IndexType rPointNumber + const unsigned int PointNumber ); /** @@ -1466,6 +1491,8 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N ///@name Member Variables ///@{ + int mIntegrationOrder = 0; /// Integration order + ///@} ///@name Private Operators ///@{ @@ -1487,9 +1514,9 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N std::vector& rOutput ) { - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints(this->GetIntegrationMethod()); - for ( IndexType point_number = 0; point_number GetValue( rVariable,rOutput[point_number]); } } @@ -1514,16 +1541,15 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N this->InitializeGeneralVariables(general_variables); /* Create constitutive law parameters: */ - ConstitutiveLaw::Parameters Values(GetGeometry(),GetProperties(),rCurrentProcessInfo); + ConstitutiveLaw::Parameters cl_values(GetGeometry(),GetProperties(),rCurrentProcessInfo); /* Set constitutive law flags: */ - Flags &ConstitutiveLawOptions = Values.GetOptions(); - - ConstitutiveLawOptions.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); - ConstitutiveLawOptions.Set(ConstitutiveLaw::COMPUTE_STRESS); + Flags& r_constitutive_law_options = cl_values.GetOptions(); + r_constitutive_law_options.Set(ConstitutiveLaw::USE_ELEMENT_PROVIDED_STRAIN, false); + r_constitutive_law_options.Set(ConstitutiveLaw::COMPUTE_STRESS); /* Reading integration points */ - const IntegrationPointsArrayType& integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); + const IntegrationPointsArrayType& r_integration_points = msGeometryData.IntegrationPoints( this->GetIntegrationMethod() ); double& alpha_eas = this->GetValue(ALPHA_EAS); @@ -1537,20 +1563,21 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N this->CalculateCommonComponents(common_components, this_cartesian_derivatives); // Reading integration points - for ( IndexType point_number = 0; point_number < integration_points.size(); ++point_number ) { - const double zeta_gauss = 2.0 * integration_points[point_number].Z() - 1.0; + for (unsigned int point_number = 0; point_number < r_integration_points.size(); ++point_number) { + const double zeta_gauss = 2.0 * r_integration_points[point_number].Z() - 1.0; // Compute element kinematics C, F ... - this->CalculateKinematics(general_variables, common_components, integration_points, point_number, alpha_eas, zeta_gauss); + this->CalculateKinematics(general_variables, common_components, r_integration_points, point_number, alpha_eas, zeta_gauss); // To take in account previous step writing - if( mFinalizedStep ) + if (mFinalizedStep) { this->GetHistoricalVariables(general_variables,point_number); + } // Set general variables to constitutivelaw parameters - this->SetGeneralVariables(general_variables,Values,point_number); + this->SetGeneralVariables(general_variables, cl_values, point_number); - rOutput[point_number] = mConstitutiveLawVector[point_number]->CalculateValue( Values, rVariable, rOutput[point_number] ); + rOutput[point_number] = mConstitutiveLawVector[point_number]->CalculateValue( cl_values, rVariable, rOutput[point_number] ); } } @@ -1567,18 +1594,12 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N * @param ThisMethod the current integration method * @return the matrix of values of every shape function in each integration point */ - static Matrix CalculateShapeFunctionsIntegrationPointsValues(const IntegrationMethod ThisMethod); + static Matrix CalculateShapeFunctionsIntegrationPointsValues(const int ThisMethod); /** * @brief Generates a container with precomputed shape functions values. * @details This function evaluates and collects the shape function values at integration points - * for various Gauss integration methods. It calls the function - * CalculateShapeFunctionsIntegrationPointsValues() for each of the following methods: - * - GI_GAUSS_1 - * - GI_GAUSS_2 - * - GI_GAUSS_3 - * - GI_GAUSS_4 - * - GI_GAUSS_5 + * for various Gauss integration methods. * The results are stored in a ShapeFunctionsValuesContainerType, with each element * corresponding to the shape function values for a specific Gauss integration method. * @return ShapeFunctionsValuesContainerType containing the shape functions values @@ -1593,7 +1614,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N * @return The vector of the gradients of all shape functions in each integration point */ static ShapeFunctionsGradientsType - CalculateShapeFunctionsIntegrationPointsLocalGradients(const IntegrationMethod ThisMethod); + CalculateShapeFunctionsIntegrationPointsLocalGradients(const int ThisMethod); /** * @brief Computes and returns a container with local gradients for shape functions. @@ -1610,7 +1631,7 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N inline static const GeometryDimension msGeometryDimension = GeometryDimension(3, 3); /// Dimension of the geometry inline static const GeometryData msGeometryData = GeometryData( &msGeometryDimension, - GeometryData::IntegrationMethod::GI_GAUSS_1, + static_cast(0), AllIntegrationPoints(), AllShapeFunctionsValues(), AllShapeFunctionsLocalGradients() @@ -1667,8 +1688,6 @@ class PrismGaussLegendreIntegrationPointsInAxis1 buffer << "Prism Gauss-Legendre quadrature 2, 1 point in plane"; return buffer.str(); } - - }; // Class PrismGaussLegendreIntegrationPointsInAxis1 class PrismGaussLegendreIntegrationPointsInAxis2 @@ -1699,8 +1718,6 @@ class PrismGaussLegendreIntegrationPointsInAxis2 buffer << "Prism Gauss-Legendre quadrature 3, 1 point in plane"; return buffer.str(); } - - }; // Class PrismGaussLegendreIntegrationPointsInAxis2 class PrismGaussLegendreIntegrationPointsInAxis3 @@ -1731,8 +1748,6 @@ class PrismGaussLegendreIntegrationPointsInAxis3 buffer << "Prism Gauss-Legendre quadrature 5, 1 point in plane"; return buffer.str(); } - - }; // Class PrismGaussLegendreIntegrationPointsInAxis3 class PrismGaussLegendreIntegrationPointsInAxis4 @@ -1763,8 +1778,6 @@ class PrismGaussLegendreIntegrationPointsInAxis4 buffer << "Prism Gauss-Legendre quadrature 7, 1 point in plane"; return buffer.str(); } - - }; // Class PrismGaussLegendreIntegrationPointsInAxis4 class PrismGaussLegendreIntegrationPointsInAxis5 @@ -1795,8 +1808,6 @@ class PrismGaussLegendreIntegrationPointsInAxis5 buffer << "Prism Gauss-Legendre quadrature 11, 1 point in plane"; return buffer.str(); } - - }; // Class PrismGaussLegendreIntegrationPointsInAxis5 ///@} From 2070475fe7471e19a089454a91eed50e92f7a5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicente=20Mataix=20Ferr=C3=A1ndiz?= Date: Tue, 20 May 2025 21:20:23 +0200 Subject: [PATCH 9/9] Add GetDeltaDisplacement method to calculate delta displacements --- .../solid_shell_element_sprism_3D6N.cpp | 79 +++++++++++++++++-- .../solid_shell_element_sprism_3D6N.h | 6 ++ 2 files changed, 79 insertions(+), 6 deletions(-) diff --git a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp index 0371105894c2..4125611c43d5 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp +++ b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.cpp @@ -1617,13 +1617,17 @@ void SolidShellElementSprism3D6N::FinalizeNonLinearIteration( const ProcessInfo& IntegrateEASInZeta(general_variables, EAS, zeta_gauss, integration_weight); } - /* Getting the increase of displacements */ - BoundedMatrix delta_disp, current_disp, previous_disp; - GetVectorCurrentPosition(current_disp); - GetVectorPreviousPosition(previous_disp); + // /* Getting the increase of displacements */ + // BoundedMatrix delta_disp, current_disp, previous_disp; + // GetVectorCurrentPosition(current_disp); + // GetVectorPreviousPosition(previous_disp); + + // // Calculates the increase of displacements + // noalias(delta_disp) = current_disp - previous_disp; - // Calculates the increase of displacements - noalias(delta_disp) = current_disp - previous_disp; + /* Getting the increase of displacements */ + BoundedMatrix delta_disp; + GetDeltaDisplacement(delta_disp); /* Update alpha EAS */ if (EAS.mStiffAlpha > std::numeric_limits::epsilon()) { // Avoid division by zero @@ -3313,6 +3317,69 @@ void SolidShellElementSprism3D6N::GetVectorPreviousPosition(BoundedMatrix& rDeltaDisplacement) +{ + KRATOS_TRY; + + // Retrieve geometry and neighbour info + const auto& r_geometry = this->GetGeometry(); + const auto& r_neighbour_nodes = this->GetValue(NEIGHBOUR_NODES); + const unsigned int number_of_nodes = r_geometry.size(); + const unsigned int number_of_active_neighbours = NumberOfActiveNeighbours(r_neighbour_nodes); + const bool all_neighbours_active = (number_of_active_neighbours == number_of_nodes); + + // Auxiliary variables + array_1d previous_position; + + // Element’s own nodes + for (unsigned int node_index = 0; node_index < number_of_nodes; ++node_index) { + // Current position + const array_1d& r_current_position = r_geometry[node_index].Coordinates(); + + // Previous position = original position + last‐step displacement + noalias(previous_position) = r_geometry[node_index].GetInitialPosition().Coordinates() + r_geometry[node_index].FastGetSolutionStepValue(DISPLACEMENT, 1); + + // Delta = current – previous + for (unsigned int component = 0; component < 3; ++component) { + rDeltaDisplacement(node_index*3 + component, 0) = r_current_position[component] - previous_position[component]; + } + } + + // Neighbour nodes + for (unsigned int neighbour_index = 0; neighbour_index < number_of_nodes; ++neighbour_index) { + // Check if the neighbour node is active + const bool neighbour_exists = all_neighbours_active || this->HasNeighbour(neighbour_index, r_neighbour_nodes[neighbour_index]); + + // If neighbour exists, get its current position and previous position + if (neighbour_exists) { + // Get the neighbour node + const auto& r_neighbour_node = r_neighbour_nodes[neighbour_index]; + + // Current position + const array_1d& r_current_position = r_neighbour_node.Coordinates(); + + // Previous position = original position + last‐step displacement + noalias(previous_position) = r_neighbour_node.GetInitialPosition().Coordinates() + r_neighbour_node.FastGetSolutionStepValue(DISPLACEMENT, 1); + + // Delta = current – previous + for (unsigned int component = 0; component < 3; ++component) { + rDeltaDisplacement(18 + neighbour_index*3 + component, 0) = r_current_position[component] - previous_position[component]; + } + } else { + // No neighbour equal to zero displacement increment + for (unsigned int component = 0; component < 3; ++component) { + rDeltaDisplacement(18 + neighbour_index*3 + component, 0) = 0.0; + } + } + } + + KRATOS_CATCH( "" ); +} + + /***********************************************************************************/ /***********************************************************************************/ diff --git a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h index ef7ecfd96058..273311d41035 100644 --- a/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h +++ b/applications/StructuralMechanicsApplication/custom_elements/solid_elements/solid_shell_element_sprism_3D6N.h @@ -1220,6 +1220,12 @@ class KRATOS_API(STRUCTURAL_MECHANICS_APPLICATION) SolidShellElementSprism3D6N */ void GetVectorPreviousPosition(BoundedMatrix& rVectorPreviousPosition); + /** + * @brief Calculates the vector of delta displacements + * @param rDeltaDisplacement The vector containing the delta displacements. + */ + void GetDeltaDisplacement(BoundedMatrix& rDeltaDisplacement); + /** * @brief Integrates stresses in zeta using the Gauss Quadrature * @param rVariables The internal variables in the element