diff --git a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.cpp b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.cpp index 377b05b271b0..49c65a840460 100644 --- a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.cpp +++ b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.cpp @@ -336,14 +336,14 @@ void SmallStrainUDSM3DLaw::SetAttributes(const Properties& rMaterialProperties) std::vector StateVariables; const auto& MaterialParameters = rMaterialProperties[UMAT_PARAMETERS]; - pUserMod(&IDTask, &modelNumber, &isUndr, &iStep, &iteration, &iElement, &integrationNumber, - &Xorigin, &Yorigin, &Zorigin, &time, &deltaTime, &(MaterialParameters.data()[0]), - &(mStressVectorFinalized.data()[0]), &excessPorePressurePrevious, - StateVariablesFinalized.data(), &(mDeltaStrainVector.data()[0]), (double**)mMatrixD, - &bulkWater, &(mStressVector.data()[0]), &excessPorePressureCurrent, - StateVariables.data(), &iPlastic, &nStateVariables, &mAttributes[IS_NON_SYMMETRIC], - &mAttributes[IS_STRESS_DEPENDENT], &mAttributes[IS_TIME_DEPENDENT], - &mAttributes[USE_TANGENT_MATRIX], mProjectDirectory.data(), &nSizeProjectDirectory, &iAbort); + mpUserMod(&IDTask, &modelNumber, &isUndr, &iStep, &iteration, &iElement, &integrationNumber, + &Xorigin, &Yorigin, &Zorigin, &time, &deltaTime, &(MaterialParameters.data()[0]), + &(mStressVectorFinalized.data()[0]), &excessPorePressurePrevious, + StateVariablesFinalized.data(), &(mDeltaStrainVector.data()[0]), (double**)mMatrixD, + &bulkWater, &(mStressVector.data()[0]), &excessPorePressureCurrent, + StateVariables.data(), &iPlastic, &nStateVariables, &mAttributes[IS_NON_SYMMETRIC], + &mAttributes[IS_STRESS_DEPENDENT], &mAttributes[IS_TIME_DEPENDENT], + &mAttributes[USE_TANGENT_MATRIX], mProjectDirectory.data(), &nSizeProjectDirectory, &iAbort); KRATOS_ERROR_IF_NOT(iAbort == 0) << "The specified UDSM returns an error while call UDSM with IDTASK" @@ -387,14 +387,14 @@ int SmallStrainUDSM3DLaw::GetNumberOfStateVariablesFromUDSM(const Properties& rM std::vector StateVariables; const auto& MaterialParameters = rMaterialProperties[UMAT_PARAMETERS]; - pUserMod(&IDTask, &modelNumber, &isUndr, &iStep, &iteration, &iElement, &integrationNumber, - &Xorigin, &Yorigin, &Zorigin, &time, &deltaTime, &(MaterialParameters.data()[0]), - &(mStressVectorFinalized.data()[0]), &excessPorePressurePrevious, - StateVariablesFinalized.data(), &(mDeltaStrainVector.data()[0]), (double**)mMatrixD, - &bulkWater, &(mStressVector.data()[0]), &excessPorePressureCurrent, - StateVariables.data(), &iPlastic, &nStateVariables, &mAttributes[IS_NON_SYMMETRIC], - &mAttributes[IS_STRESS_DEPENDENT], &mAttributes[IS_TIME_DEPENDENT], - &mAttributes[USE_TANGENT_MATRIX], mProjectDirectory.data(), &nSizeProjectDirectory, &iAbort); + mpUserMod(&IDTask, &modelNumber, &isUndr, &iStep, &iteration, &iElement, &integrationNumber, + &Xorigin, &Yorigin, &Zorigin, &time, &deltaTime, &(MaterialParameters.data()[0]), + &(mStressVectorFinalized.data()[0]), &excessPorePressurePrevious, + StateVariablesFinalized.data(), &(mDeltaStrainVector.data()[0]), (double**)mMatrixD, + &bulkWater, &(mStressVector.data()[0]), &excessPorePressureCurrent, + StateVariables.data(), &iPlastic, &nStateVariables, &mAttributes[IS_NON_SYMMETRIC], + &mAttributes[IS_STRESS_DEPENDENT], &mAttributes[IS_TIME_DEPENDENT], + &mAttributes[USE_TANGENT_MATRIX], mProjectDirectory.data(), &nSizeProjectDirectory, &iAbort); KRATOS_ERROR_IF_NOT(iAbort == 0) << "The specified UDSM returns an error while call UDSM with IDTASK" @@ -413,7 +413,7 @@ SizeType SmallStrainUDSM3DLaw::GetNumberOfMaterialParametersFromUDSM(const Prope int nUDSM = rMaterialProperties[UDSM_NUMBER]; int nParameters(0); - pGetParamCount(&nUDSM, &nParameters); + mpGetParamCount(&nUDSM, &nParameters); return static_cast(nParameters); @@ -460,10 +460,10 @@ bool SmallStrainUDSM3DLaw::loadUDSMLinux(const Properties& rMaterialProperties) } // resolve function GetParamCount address - pGetParamCount = (f_GetParamCount)dlsym(lib_handle, "getparamcount"); - if (!pGetParamCount) { - pGetParamCount = (f_GetParamCount)dlsym(lib_handle, "getparamcount_"); - if (!pGetParamCount) { + mpGetParamCount = (f_GetParamCount)dlsym(lib_handle, "getparamcount"); + if (!mpGetParamCount) { + mpGetParamCount = (f_GetParamCount)dlsym(lib_handle, "getparamcount_"); + if (!mpGetParamCount) { KRATOS_INFO("Error in loadUDSMLinux") << "cannot load function GetParamCount in the specified UDSM: " << rMaterialProperties[UDSM_NAME] << std::endl; @@ -473,12 +473,12 @@ bool SmallStrainUDSM3DLaw::loadUDSMLinux(const Properties& rMaterialProperties) } // resolve function GetStateVarCount address - pGetStateVarCount = (f_GetStateVarCount)dlsym(lib_handle, "getstatevarcount"); + mpGetStateVarCount = (f_GetStateVarCount)dlsym(lib_handle, "getstatevarcount"); - pUserMod = (f_UserMod)dlsym(lib_handle, "user_mod"); - if (!pUserMod) { - pUserMod = (f_UserMod)dlsym(lib_handle, "user_mod_"); - if (!pUserMod) { + mpUserMod = (f_UserMod)dlsym(lib_handle, "user_mod"); + if (!mpUserMod) { + mpUserMod = (f_UserMod)dlsym(lib_handle, "user_mod_"); + if (!mpUserMod) { KRATOS_INFO("Error in loadUDSMLinux") << "cannot load function User_Mod in the specified UDSM: " << rMaterialProperties[UDSM_NAME] << std::endl; @@ -521,11 +521,11 @@ bool SmallStrainUDSM3DLaw::loadUDSMWindows(const Properties& rMaterialProperties } // resolve function GetParamCount address - pGetParamCount = (f_GetParamCount)GetProcAddress(hGetProcIDDLL, "getparamcount"); - if (!pGetParamCount) { + mpGetParamCount = (f_GetParamCount)GetProcAddress(hGetProcIDDLL, "getparamcount"); + if (!mpGetParamCount) { // check if the dll is compiled with gfortran - pGetParamCount = (f_GetParamCount)GetProcAddress(hGetProcIDDLL, "getparamcount_"); - if (!pGetParamCount) { + mpGetParamCount = (f_GetParamCount)GetProcAddress(hGetProcIDDLL, "getparamcount_"); + if (!mpGetParamCount) { KRATOS_INFO("Error in loadUDSMWindows") << "cannot load function GetParamCount in the specified UDSM: " << rMaterialProperties[UDSM_NAME] << std::endl; @@ -535,13 +535,13 @@ bool SmallStrainUDSM3DLaw::loadUDSMWindows(const Properties& rMaterialProperties } // resolve function GetStateVarCount address - pGetStateVarCount = (f_GetStateVarCount)GetProcAddress(hGetProcIDDLL, "getstatevarcount"); + mpGetStateVarCount = (f_GetStateVarCount)GetProcAddress(hGetProcIDDLL, "getstatevarcount"); - pUserMod = (f_UserMod)GetProcAddress(hGetProcIDDLL, "user_mod"); - if (!pUserMod) { + mpUserMod = (f_UserMod)GetProcAddress(hGetProcIDDLL, "user_mod"); + if (!mpUserMod) { // check if the dll is compiled with gfortran - pUserMod = (f_UserMod)GetProcAddress(hGetProcIDDLL, "user_mod_"); - if (!pUserMod) { + mpUserMod = (f_UserMod)GetProcAddress(hGetProcIDDLL, "user_mod_"); + if (!mpUserMod) { KRATOS_INFO("Error in loadUDSMWindows") << "cannot load function User_Mod in the specified UDSM: " << rMaterialProperties[UDSM_NAME] << std::endl; @@ -716,14 +716,14 @@ void SmallStrainUDSM3DLaw::CallUDSM(int* pIDTask, ConstitutiveLaw::Parameters& r auto nSizeProjectDirectory = static_cast(mProjectDirectory.size()); const auto& MaterialParameters = rMaterialProperties[UMAT_PARAMETERS]; - pUserMod(pIDTask, &modelNumber, &isUndr, &iStep, &iteration, &iElement, &integrationNumber, - &Xorigin, &Yorigin, &Zorigin, &time, &deltaTime, &(MaterialParameters.data()[0]), - &(mStressVectorFinalized.data()[0]), &excessPorePressurePrevious, - &(mStateVariablesFinalized.data()[0]), &(mDeltaStrainVector.data()[0]), - (double**)mMatrixD, &bulkWater, &(mStressVector.data()[0]), &excessPorePressureCurrent, - &(mStateVariables.data()[0]), &iPlastic, &nStateVariables, &mAttributes[IS_NON_SYMMETRIC], - &mAttributes[IS_STRESS_DEPENDENT], &mAttributes[IS_TIME_DEPENDENT], - &mAttributes[USE_TANGENT_MATRIX], mProjectDirectory.data(), &nSizeProjectDirectory, &iAbort); + mpUserMod(pIDTask, &modelNumber, &isUndr, &iStep, &iteration, &iElement, &integrationNumber, + &Xorigin, &Yorigin, &Zorigin, &time, &deltaTime, &(MaterialParameters.data()[0]), + &(mStressVectorFinalized.data()[0]), &excessPorePressurePrevious, + &(mStateVariablesFinalized.data()[0]), &(mDeltaStrainVector.data()[0]), + (double**)mMatrixD, &bulkWater, &(mStressVector.data()[0]), &excessPorePressureCurrent, + &(mStateVariables.data()[0]), &iPlastic, &nStateVariables, &mAttributes[IS_NON_SYMMETRIC], + &mAttributes[IS_STRESS_DEPENDENT], &mAttributes[IS_TIME_DEPENDENT], + &mAttributes[USE_TANGENT_MATRIX], mProjectDirectory.data(), &nSizeProjectDirectory, &iAbort); if (iAbort != 0) { KRATOS_INFO("CallUDSM, iAbort !=0") diff --git a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.hpp b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.hpp index de7ae9d65739..9c40dd6b02ce 100644 --- a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.hpp +++ b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_udsm_3D_law.hpp @@ -417,9 +417,9 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUDSM3DLaw : public Consti ///@} ///@name Member Variables ///@{ - pF_GetParamCount pGetParamCount; - pF_GetStateVarCount pGetStateVarCount; - pF_UserMod pUserMod; + pF_GetParamCount mpGetParamCount = nullptr; + pF_GetStateVarCount mpGetStateVarCount = nullptr; + pF_UserMod mpUserMod = nullptr; bool mIsModelInitialized = false; bool mIsUDSMLoaded = false; diff --git a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.cpp b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.cpp index bf2d2abb7d96..6526499975cf 100644 --- a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.cpp +++ b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.cpp @@ -291,12 +291,12 @@ bool SmallStrainUMAT3DLaw::loadUMATLinux(const Properties& rMaterialProperties) return false; } if (rMaterialProperties[IS_FORTRAN_UDSM]) { - pUserMod = (f_UMATMod)dlsym(lib_handle, "umat_"); + mpUserMod = (f_UMATMod)dlsym(lib_handle, "umat_"); } else { - pUserMod = (f_UMATMod)dlsym(lib_handle, "umat"); + mpUserMod = (f_UMATMod)dlsym(lib_handle, "umat"); } - if (!pUserMod) { + if (!mpUserMod) { KRATOS_ERROR << "cannot load function User_Mod in the specified UMAT " << rMaterialProperties[UDSM_NAME] << std::endl; return false; @@ -333,8 +333,8 @@ bool SmallStrainUMAT3DLaw::loadUMATWindows(const Properties& rMaterialProperties KRATOS_ERROR << "cannot load the specified UMAT " << rMaterialProperties[UDSM_NAME] << std::endl; } - pUserMod = (f_UMATMod)GetProcAddress(hGetProcIDDLL, "umat"); - if (!pUserMod) { + mpUserMod = (f_UMATMod)GetProcAddress(hGetProcIDDLL, "umat"); + if (!mpUserMod) { KRATOS_INFO("Error in loadUMATWindows") << "cannot load function umat in the specified UMAT: " << rMaterialProperties[UDSM_NAME] << std::endl; @@ -514,12 +514,12 @@ void SmallStrainUMAT3DLaw::CallUMAT(ConstitutiveLaw::Parameters& rValues) // variable to check if an error happened in the model: const auto& MaterialParameters = rValues.GetMaterialProperties()[UMAT_PARAMETERS]; auto nProperties = static_cast(MaterialParameters.size()); - pUserMod(&(mStressVector.data()[0]), &(mStateVariables.data()[0]), (double**)mMatrixD, &SSE, - &SPD, &SCD, nullptr, nullptr, nullptr, nullptr, &(mStrainVectorFinalized.data()[0]), - &(mDeltaStrainVector.data()[0]), &time, &deltaTime, nullptr, nullptr, nullptr, nullptr, - &materialName, &ndi, &nshr, &ntens, &nStateVariables, &(MaterialParameters.data()[0]), - &nProperties, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, &iElement, - &integrationNumber, nullptr, nullptr, &iStep, &iteration); + mpUserMod(&(mStressVector.data()[0]), &(mStateVariables.data()[0]), (double**)mMatrixD, &SSE, + &SPD, &SCD, nullptr, nullptr, nullptr, nullptr, &(mStrainVectorFinalized.data()[0]), + &(mDeltaStrainVector.data()[0]), &time, &deltaTime, nullptr, nullptr, nullptr, + nullptr, &materialName, &ndi, &nshr, &ntens, &nStateVariables, + &(MaterialParameters.data()[0]), &nProperties, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, &iElement, &integrationNumber, nullptr, nullptr, &iStep, &iteration); KRATOS_CATCH("") } diff --git a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.hpp b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.hpp index 9e9d50645469..01a5484430f0 100644 --- a/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.hpp +++ b/applications/GeoMechanicsApplication/custom_constitutive/small_strain_umat_3D_law.hpp @@ -381,7 +381,7 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) SmallStrainUMAT3DLaw : public Consti ///@} ///@name Member Variables ///@{ - pF_UMATMod pUserMod; + pF_UMATMod mpUserMod = nullptr; bool mIsModelInitialized = false; bool mIsUMATLoaded = false; diff --git a/applications/GeoMechanicsApplication/custom_elements/geo_structural_base_element.cpp b/applications/GeoMechanicsApplication/custom_elements/geo_structural_base_element.cpp index 53cf39b6a1f3..05d87cd00d60 100644 --- a/applications/GeoMechanicsApplication/custom_elements/geo_structural_base_element.cpp +++ b/applications/GeoMechanicsApplication/custom_elements/geo_structural_base_element.cpp @@ -20,28 +20,24 @@ namespace Kratos { template -Element::Pointer GeoStructuralBaseElement::Create(IndexType NewId, - NodesArrayType const& ThisNodes, - PropertiesType::Pointer pProperties) const +Element::Pointer GeoStructuralBaseElement::Create(IndexType, + NodesArrayType const&, + PropertiesType::Pointer) const { KRATOS_ERROR << "calling the default Create method for a particular " "element ... illegal operation!!" << std::endl; - - return Element::Pointer(new GeoStructuralBaseElement(NewId, this->GetGeometry().Create(ThisNodes), pProperties)); } //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- template -Element::Pointer GeoStructuralBaseElement::Create(IndexType NewId, - GeometryType::Pointer pGeom, - PropertiesType::Pointer pProperties) const +Element::Pointer GeoStructuralBaseElement::Create(IndexType, + GeometryType::Pointer, + PropertiesType::Pointer) const { KRATOS_ERROR << "calling the default Create method for a particular " "element ... illegal operation!!" << std::endl; - - return Element::Pointer(new GeoStructuralBaseElement(NewId, pGeom, pProperties)); } //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- diff --git a/applications/GeoMechanicsApplication/custom_elements/geo_structural_base_element.hpp b/applications/GeoMechanicsApplication/custom_elements/geo_structural_base_element.hpp index 38a122abed74..d8eb39524a0d 100644 --- a/applications/GeoMechanicsApplication/custom_elements/geo_structural_base_element.hpp +++ b/applications/GeoMechanicsApplication/custom_elements/geo_structural_base_element.hpp @@ -59,11 +59,9 @@ class KRATOS_API(GEO_MECHANICS_APPLICATION) GeoStructuralBaseElement : public El ///---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - Element::Pointer Create(IndexType NewId, - NodesArrayType const& ThisNodes, - PropertiesType::Pointer pProperties) const override; + Element::Pointer Create(IndexType, NodesArrayType const&, PropertiesType::Pointer) const override; - Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, PropertiesType::Pointer pProperties) const override; + Element::Pointer Create(IndexType, GeometryType::Pointer, PropertiesType::Pointer) const override; int Check(const ProcessInfo& rCurrentProcessInfo) const override; diff --git a/applications/GeoMechanicsApplication/python_scripts/piping_analysis.py b/applications/GeoMechanicsApplication/python_scripts/piping_analysis.py index e34fafc20b39..2e6b5332cbbb 100644 --- a/applications/GeoMechanicsApplication/python_scripts/piping_analysis.py +++ b/applications/GeoMechanicsApplication/python_scripts/piping_analysis.py @@ -115,30 +115,23 @@ def RunSolutionLoop(self): KratosMultiphysics.Logger.PrintInfo(self._GetSimulationName(), "--------------------------------------", " ") - is_piping = True - if is_piping: + # todo set this as solver input + max_piping_iterations = 500 - # todo set this as solver input - max_piping_iterations = 500 + grow_pipe = True + while grow_pipe: + self.initialise_grow_step() + piping_converged = False + piping_iter = 0 - grow_pipe = True - while grow_pipe: + while not piping_converged and piping_iter < max_piping_iterations: + self.run_flow_calculation() - self.initialise_grow_step() - piping_converged = False - piping_iter = 0 + # update all pipe heights and check for piping convergence and check if + piping_converged = self.update_pipe_heights() + piping_iter += 1 - while not piping_converged and piping_iter < max_piping_iterations: - self.run_flow_calculation() - - # update all pipe heights and check for piping convergence and check if - piping_converged = self.update_pipe_heights() - piping_iter += 1 - - grow_pipe = self.finalise_grow_step() - - else: - self.run_flow_calculation() + grow_pipe = self.finalise_grow_step() self.OutputSolutionStep() diff --git a/applications/GeoMechanicsApplication/tests/cpp_tests/test_settlement_workflow.cpp b/applications/GeoMechanicsApplication/tests/cpp_tests/test_settlement_workflow.cpp index 0ad7b34c9633..548e3e929cec 100644 --- a/applications/GeoMechanicsApplication/tests/cpp_tests/test_settlement_workflow.cpp +++ b/applications/GeoMechanicsApplication/tests/cpp_tests/test_settlement_workflow.cpp @@ -41,12 +41,13 @@ namespace Kratos::Testing source_directory, temporary_working_directory, std::filesystem::copy_options::overwrite_existing | std::filesystem::copy_options::recursive); - auto settlement = CustomWorkflowFactory::CreateKratosGeoSettlement(); + auto p_settlement = + std::unique_ptr{CustomWorkflowFactory::CreateKratosGeoSettlement()}; for (int i = 0; i < 4; ++i) { const auto project_file = "ProjectParameters_stage" + std::to_string(i + 1) + ".json"; - const int status = settlement->RunStage(temporary_working_directory, project_file, - &flow_stubs::emptyLog, &flow_stubs::emptyProgress, - &flow_stubs::emptyLog, &flow_stubs::emptyCancel); + const int status = p_settlement->RunStage(temporary_working_directory, project_file, + &flow_stubs::emptyLog, &flow_stubs::emptyProgress, + &flow_stubs::emptyLog, &flow_stubs::emptyCancel); const std::string original_file = "test_model_stage" + std::to_string(i + 1) + ".post.orig.res"; const std::string result_file = "test_model_stage" + std::to_string(i + 1) + ".post.res";