Skip to content

Commit

Permalink
Add record of iteration counter
Browse files Browse the repository at this point in the history
  • Loading branch information
TLCFEM committed Oct 11, 2024
1 parent a112a44 commit 88acb53
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Material/Material1D/vonMises/Subloading1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Subloading1D::Subloading1D(const unsigned T, DataSubloading1D&& D, const double
int Subloading1D::initialize(const shared_ptr<DomainBase>&) {
trial_stiffness = current_stiffness = initial_stiffness = elastic;

initialize_history(4);
initialize_history(5);

return SUANPAN_SUCCESS;
}
Expand All @@ -55,6 +55,7 @@ int Subloading1D::update_trial_status(const vec& t_strain) {
auto& d = trial_history(1);
auto& q = trial_history(2);
auto& z = trial_history(3);
auto& iteration = trial_history(4);

auto gamma = 0., ref_error = 0.;
auto start_z = current_z;
Expand Down Expand Up @@ -123,6 +124,7 @@ int Subloading1D::update_trial_status(const vec& t_strain) {
suanpan_error("Somehow the plastic multiplier is negative, likely a bug.\n");
return SUANPAN_FAIL;
}
iteration = counter;
trial_stress -= elastic * gamma * n;
trial_stiffness += elastic / det(jacobian) * elastic * jacobian(1, 1);
return SUANPAN_SUCCESS;
Expand Down
12 changes: 7 additions & 5 deletions Material/Material3D/vonMises/SubloadingMetal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SubloadingMetal::SubloadingMetal(const unsigned T, DataSubloadingMetal&& D, cons
int SubloadingMetal::initialize(const shared_ptr<DomainBase>&) {
trial_stiffness = current_stiffness = initial_stiffness = tensor::isotropic_stiffness(elastic, poissons_ratio);

initialize_history(14);
initialize_history(15);

return SUANPAN_SUCCESS;
}
Expand All @@ -52,12 +52,13 @@ int SubloadingMetal::update_trial_status(const vec& t_strain) {
trial_history = current_history;
const auto& current_q = current_history(0);
const auto& current_z = current_history(1);
const vec current_alpha(&current_history(2), 6, false, true);
const vec current_d(&current_history(8), 6, false, true);
const vec current_alpha(&current_history(3), 6, false, true);
const vec current_d(&current_history(9), 6, false, true);
auto& q = trial_history(0);
auto& z = trial_history(1);
vec alpha(&trial_history(2), 6, false, true);
vec d(&trial_history(8), 6, false, true);
auto& iteration = trial_history(2);
vec alpha(&trial_history(3), 6, false, true);
vec d(&trial_history(9), 6, false, true);

const vec trial_s = tensor::dev(trial_stress);

Expand Down Expand Up @@ -176,6 +177,7 @@ int SubloadingMetal::update_trial_status(const vec& t_strain) {
suanpan_error("Somehow the plastic multiplier is negative, likely a bug.\n");
return SUANPAN_FAIL;
}
iteration = counter;
trial_stress -= gamma * double_shear * n;
trial_stiffness -= double_shear * double_shear * gamma / norm_zeta * unit_dev_tensor - double_shear * double_shear * (gamma / norm_zeta + jacobian(1, 1) / det(jacobian)) * n * n.t();
return SUANPAN_SUCCESS;
Expand Down

0 comments on commit 88acb53

Please sign in to comment.