From 8a033c0fc44dc21acd0919df5b22e357fe3aa434 Mon Sep 17 00:00:00 2001 From: Nathan Miller Date: Fri, 27 Sep 2024 18:22:41 -0600 Subject: [PATCH] MAINT: Accomodated case where the previous plastic multiplier was large --- ...omorphicDruckerPragerPlasticityOptimization.cpp | 6 +++--- ...omorphicDruckerPragerPlasticityOptimization.cpp | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cpp/tardigrade_hydraMicromorphicDruckerPragerPlasticityOptimization.cpp b/src/cpp/tardigrade_hydraMicromorphicDruckerPragerPlasticityOptimization.cpp index 0ceca56..ceb74bd 100644 --- a/src/cpp/tardigrade_hydraMicromorphicDruckerPragerPlasticityOptimization.cpp +++ b/src/cpp/tardigrade_hydraMicromorphicDruckerPragerPlasticityOptimization.cpp @@ -441,7 +441,7 @@ namespace tardigradeHydra{ if ( ( *get_macroYield( ) ) > 0 ){ // Perturb the plastic multiplier - floatType delta = ( *hydra->getRelativeTolerance( ) ) * ( *get_macroYield( ) ) + ( *hydra->getAbsoluteTolerance( ) ); + floatType delta = std::fmax( ( *get_plasticMultipliers( ) )[ 0 ], ( *hydra->getRelativeTolerance( ) ) * ( *get_macroYield( ) ) + ( *hydra->getAbsoluteTolerance( ) ) ); indices.push_back( ( *getStateVariableIndices( ) )[ 0 ] ); values.push_back( delta ); @@ -452,7 +452,7 @@ namespace tardigradeHydra{ if ( ( *get_microYield( ) ) > 0 ){ // Perturb the plastic multiplier - floatType delta = ( *hydra->getRelativeTolerance( ) ) * ( *get_microYield( ) ) + ( *hydra->getAbsoluteTolerance( ) ); + floatType delta = std::fmax( ( *get_plasticMultipliers( ) )[ 1 ], ( *hydra->getRelativeTolerance( ) ) * ( *get_microYield( ) ) + ( *hydra->getAbsoluteTolerance( ) ) ); indices.push_back( ( *getStateVariableIndices( ) )[ 1 ] ); values.push_back( delta ); @@ -465,7 +465,7 @@ namespace tardigradeHydra{ if ( ( *get_microGradientYield( ) )[ i ] > 0 ){ // Perturb the plastic multiplier - floatType delta = ( *hydra->getRelativeTolerance( ) ) * ( *get_microGradientYield( ) )[ i ] + ( *hydra->getAbsoluteTolerance( ) ); + floatType delta = std::fmax( ( *get_plasticMultipliers( ) )[ i + 2 ], ( *hydra->getRelativeTolerance( ) ) * ( *get_microGradientYield( ) )[ i ] + ( *hydra->getAbsoluteTolerance( ) ) ); indices.push_back( ( *getStateVariableIndices( ) )[ i + 2 ] ); values.push_back( delta ); diff --git a/src/cpp/tests/test_tardigrade_hydraMicromorphicDruckerPragerPlasticityOptimization.cpp b/src/cpp/tests/test_tardigrade_hydraMicromorphicDruckerPragerPlasticityOptimization.cpp index 1371189..d5e3a1a 100644 --- a/src/cpp/tests/test_tardigrade_hydraMicromorphicDruckerPragerPlasticityOptimization.cpp +++ b/src/cpp/tests/test_tardigrade_hydraMicromorphicDruckerPragerPlasticityOptimization.cpp @@ -1658,9 +1658,9 @@ BOOST_AUTO_TEST_CASE( test_suggestInitialIterates, * boost::unit_test::tolerance unsigned int configuration_unknown_count = 45; - floatType tolr = 1e-2; + floatType tolr = 1e-9; - floatType tola = 1e-3; + floatType tola = 1e-9; unsigned int maxIterations = 24; @@ -1812,11 +1812,11 @@ BOOST_AUTO_TEST_CASE( test_suggestInitialIterates, * boost::unit_test::tolerance const std::vector< unsigned int > index_answer2 = { 100, 101, 102, 103, 104 }; floatVector answer1( 10, 0 ); - answer1[ 5 ] = tolr * R.macroYield + tola; - answer1[ 6 ] = tolr * R.microYield + tola; - answer1[ 7 ] = tolr * R.microGradientYield[ 0 ] + tola; - answer1[ 8 ] = tolr * R.microGradientYield[ 1 ] + tola; - answer1[ 9 ] = tolr * R.microGradientYield[ 2 ] + tola; + answer1[ 5 ] = 0.01; + answer1[ 6 ] = 0.02; + answer1[ 7 ] = 0.03; + answer1[ 8 ] = 0.04; + answer1[ 9 ] = 0.05; floatVector answer2( 5, 0 ); answer2[ 0 ] = -R2.macroYield;