Skip to content

Commit

Permalink
(A) Line search algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
j507 committed Jul 11, 2024
1 parent 7ca52c1 commit 3f2fb3a
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/gCP/gradient_crystal_plasticity.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,11 @@ class GradientCrystalPlasticitySolver
void update_trial_solution(const std::vector<double>
relaxation_parameter);

double line_search_algorithm();

double line_search_algorithm(
dealii::Vector<double> residual_l2_norms,
const unsigned int block_id);
void store_trial_solution(
const bool flag_store_initial_trial_solution = false);

Expand Down
72 changes: 72 additions & 0 deletions source/gradient_crystal_plasticity/solve.cc
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,78 @@ namespace gCP



template <int dim>
double GradientCrystalPlasticitySolver<dim>::
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 <int dim>
double GradientCrystalPlasticitySolver<dim>::
line_search_algorithm(
dealii::Vector<double> 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 <int dim>
void GradientCrystalPlasticitySolver<dim>::store_trial_solution(
const bool flag_store_initial_trial_solution)
Expand Down

0 comments on commit 3f2fb3a

Please sign in to comment.