From 3f2fb3af06e779065492bbb70181e9aabfbb897e Mon Sep 17 00:00:00 2001 From: j507 Date: Thu, 11 Jul 2024 17:37:16 +0200 Subject: [PATCH] (A) Line search algorithms --- include/gCP/gradient_crystal_plasticity.h | 5 ++ source/gradient_crystal_plasticity/solve.cc | 72 +++++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/include/gCP/gradient_crystal_plasticity.h b/include/gCP/gradient_crystal_plasticity.h index 11abd85..d5e48a2 100644 --- a/include/gCP/gradient_crystal_plasticity.h +++ b/include/gCP/gradient_crystal_plasticity.h @@ -264,6 +264,11 @@ class GradientCrystalPlasticitySolver void update_trial_solution(const std::vector relaxation_parameter); + double line_search_algorithm(); + + double line_search_algorithm( + dealii::Vector residual_l2_norms, + const unsigned int block_id); void store_trial_solution( const bool flag_store_initial_trial_solution = false); diff --git a/source/gradient_crystal_plasticity/solve.cc b/source/gradient_crystal_plasticity/solve.cc index 79138b4..91ac97d 100644 --- a/source/gradient_crystal_plasticity/solve.cc +++ b/source/gradient_crystal_plasticity/solve.cc @@ -628,6 +628,78 @@ namespace gCP + template + double GradientCrystalPlasticitySolver:: + line_search_algorithm() + { + double relaxation_parameter = 1.0, + objective_function_value = + LineSearch::get_objective_function_value( + fe_field->get_l2_norm(residual)); + + while (!line_search->suficient_descent_condition( + objective_function_value, relaxation_parameter)) + { + relaxation_parameter = + line_search->get_lambda(objective_function_value, + relaxation_parameter); + + reset_trial_solution(); + + update_trial_solution(relaxation_parameter, 0); + + reset_and_update_quadrature_point_history(); + + assemble_residual(); + + objective_function_value = + LineSearch::get_objective_function_value( + fe_field->get_l2_norm(residual)); + } + + return relaxation_parameter; + } + + + + template + double GradientCrystalPlasticitySolver:: + line_search_algorithm( + dealii::Vector residual_l2_norms, + const unsigned int block_id) + { + double relaxation_parameter = 1.0, + objective_function_value = + LineSearch::get_objective_function_value( + residual_l2_norms[block_id]); + + while (!line_search->suficient_descent_condition( + objective_function_value, relaxation_parameter)) + { + relaxation_parameter = + line_search->get_lambda(objective_function_value, + relaxation_parameter); + + reset_trial_solution(); + + update_trial_solution(relaxation_parameter, block_id); + + reset_and_update_quadrature_point_history(); + + assemble_residual(); + + residual_l2_norms = fe_field->get_sub_l2_norms(residual); + + objective_function_value = + LineSearch::get_objective_function_value( + residual_l2_norms[block_id]); + } + + return relaxation_parameter; + } + + + template void GradientCrystalPlasticitySolver::store_trial_solution( const bool flag_store_initial_trial_solution)