Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Subloading surface model with viscosity for metals" #224

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions Example/Material/SubloadingViscous1D.supan

This file was deleted.

9 changes: 0 additions & 9 deletions Example/Material/SubloadingViscous1D2.supan

This file was deleted.

2 changes: 1 addition & 1 deletion MSVC/suanPan/suanPan/suanPan.vcxproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommandArguments>-f SubloadingViscous1D</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>-f SubloadingMetal</LocalDebuggerCommandArguments>
<LocalDebuggerWorkingDirectory>..\..\..\.dirty</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
Expand Down
8 changes: 4 additions & 4 deletions Material/Material1D/Material1D
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#include "Elastic/Sinh1D.h"
#include "Elastic/Tanh1D.h"
#include "Hysteresis/AFC.h"
#include "Hysteresis/BWBN.h"
#include "Hysteresis/BilinearOO.h"
#include "Hysteresis/BilinearPO.h"
#include "Hysteresis/BoucWen.h"
#include "Hysteresis/BWBN.h"
#include "Hysteresis/ComplexHysteresis.h"
#include "Hysteresis/CoulombFriction.h"
#include "Hysteresis/Flag.h"
Expand All @@ -44,9 +44,6 @@
#include "Viscosity/Nonviscous01.h"
#include "Viscosity/Viscosity01.h"
#include "Viscosity/Viscosity02.h"
#include "Wrapper/Parallel.h"
#include "Wrapper/Sequential.h"
#include "Wrapper/Uniaxial.h"
#include "vonMises/ArmstrongFrederick1D.h"
#include "vonMises/Bilinear1D.h"
#include "vonMises/BilinearMises1D.h"
Expand All @@ -59,3 +56,6 @@
#include "vonMises/NonlinearMises1D.h"
#include "vonMises/Subloading1D.h"
#include "vonMises/VAFCRP1D.h"
#include "Wrapper/Parallel.h"
#include "Wrapper/Sequential.h"
#include "Wrapper/Uniaxial.h"
60 changes: 18 additions & 42 deletions Material/Material1D/vonMises/Subloading1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

#include "Subloading1D.h"

#include <Domain/DomainBase.h>
#include <Domain/Factory.hpp>

const double DataSubloading1D::Saturation::root_one_half = sqrt(1.5);

const double Subloading1D::rate_bound = -log(z_bound);
Expand All @@ -34,12 +31,10 @@ Subloading1D::Subloading1D(const unsigned T, DataSubloading1D&& D, const double
: DataSubloading1D{std::move(D)}
, Material1D(T, R) {}

int Subloading1D::initialize(const shared_ptr<DomainBase>& D) {
if(nullptr != D) incre_time = &D->get_factory()->modify_incre_time();

int Subloading1D::initialize(const shared_ptr<DomainBase>&) {
trial_stiffness = current_stiffness = initial_stiffness = elastic;

initialize_history(4u + static_cast<unsigned>(b.size() + c.size()));
initialize_history(3u + static_cast<unsigned>(b.size() + c.size()));

return SUANPAN_SUCCESS;
}
Expand All @@ -56,25 +51,21 @@ int Subloading1D::update_trial_status(const vec& t_strain) {
trial_history = current_history;
const auto& current_q = current_history(1);
const auto& current_z = current_history(2);
const auto& current_zv = current_history(3);
auto& iteration = trial_history(0);
auto& q = trial_history(1);
auto& z = trial_history(2);
auto& zv = trial_history(3);

const vec current_alpha(&current_history(4), b.size(), false, true);
const vec current_d(&current_history(4 + b.size()), c.size(), false, true);
vec alpha(&trial_history(4), b.size(), false, true);
vec d(&trial_history(4 + b.size()), c.size(), false, true);

const auto norm_mu = mu / (incre_time && *incre_time > 0. ? *incre_time : 1.);
const vec current_alpha(&current_history(3), b.size(), false, true);
const vec current_d(&current_history(3 + b.size()), c.size(), false, true);
vec alpha(&trial_history(3), b.size(), false, true);
vec d(&trial_history(3 + b.size()), c.size(), false, true);

iteration = 0.;
auto gamma = 0., ref_error = 0.;
auto start_z = current_z;

vec3 residual, incre;
mat33 jacobian;
vec2 residual, incre;
mat22 jacobian;

auto counter = 0u;
while(true) {
Expand All @@ -99,7 +90,7 @@ int Subloading1D::update_trial_status(const vec& t_strain) {
for(auto I = 0llu; I < b.size(); ++I) bottom_alpha(I) = 1. + b[I].r() * gamma;
for(auto I = 0llu; I < c.size(); ++I) bottom_d(I) = 1. + c[I].r() * gamma;

const auto n = trial_stress(0) - a * sum(current_alpha / bottom_alpha) + (zv - 1.) * y * sum(current_d / bottom_d) > 0. ? 1. : -1.;
const auto n = trial_stress(0) - a * sum(current_alpha / bottom_alpha) + (z - 1.) * y * sum(current_d / bottom_d) > 0. ? 1. : -1.;

for(auto I = 0llu; I < b.size(); ++I) alpha(I) = (b[I].rb() * gamma * n + current_alpha(I)) / bottom_alpha(I);
for(auto I = 0llu; I < c.size(); ++I) d(I) = (c[I].rb() * gamma * n + current_d(I)) / bottom_d(I);
Expand All @@ -110,8 +101,7 @@ int Subloading1D::update_trial_status(const vec& t_strain) {
const auto s = (y * sum_d + a * sum_alpha - current_stress(0)) / (trial_stress(0) - current_stress(0));
if(s >= 1.) {
// elastic unloading
zv = ((trial_stress(0) - a * sum_alpha) / y - sum_d) / (n - sum_d);
z = zv / current_zv * current_z;
z = ((trial_stress(0) - a * sum_alpha) / y - sum_d) / (n - sum_d);
return SUANPAN_SUCCESS;
}
if(s > 0.) start_z = 0.;
Expand All @@ -123,24 +113,15 @@ int Subloading1D::update_trial_status(const vec& t_strain) {

const auto trial_ratio = yield_ratio(z);
const auto avg_rate = u * trial_ratio(0);
const auto fraction_term = (cv * z - zv) * norm_mu * gamma + 1.;
const auto power_term = pow(fraction_term, nv - 1.);

residual(0) = fabs(trial_stress(0) - elastic * gamma * n - a * sum_alpha + (zv - 1.) * y * sum_d) - zv * y;
residual(0) = fabs(trial_stress(0) - elastic * gamma * n - a * sum_alpha + (z - 1.) * y * sum_d) - z * y;
residual(1) = z - start_z - gamma * avg_rate;
residual(2) = zv - fraction_term * power_term * z;

jacobian(0, 0) = n * ((zv - 1.) * (y * dd + sum_d * dy) - (a * dalpha + sum_alpha * da)) - elastic - zv * dy;
jacobian(0, 0) = n * ((z - 1.) * (y * dd + sum_d * dy) - (a * dalpha + sum_alpha * da)) - elastic - z * dy;
jacobian(0, 1) = n * y * sum_d - y;
jacobian(0, 2) = 0.;

jacobian(1, 0) = -avg_rate;
jacobian(1, 1) = 0.;
jacobian(1, 2) = 1. - u * gamma * trial_ratio(1);

jacobian(2, 0) = -z * nv * power_term * (cv * z - zv) * norm_mu;
jacobian(2, 1) = 1. + z * nv * power_term * norm_mu * gamma;
jacobian(2, 2) = -power_term * (fraction_term + z * nv * cv * norm_mu * gamma);
jacobian(1, 1) = 1. - u * gamma * trial_ratio(1);

if(!solve(incre, jacobian, residual)) return SUANPAN_FAIL;

Expand All @@ -154,19 +135,14 @@ int Subloading1D::update_trial_status(const vec& t_strain) {
}
iteration = counter;
trial_stress -= elastic * gamma * n;
trial_stiffness += elastic / det(jacobian) * elastic * det(jacobian.submat(1, 1, 2, 2));
trial_stiffness += elastic / det(jacobian) * elastic * jacobian(1, 1);
return SUANPAN_SUCCESS;
}

gamma -= incre(0);
zv -= incre(1);
z -= incre(2);
if(z < 0.) z = 0.;
else if(z > 1.) z = 1. - datum::eps;
if(is_viscous) {
if(zv < z) zv = z;
else if(zv > cv * z) zv = cv * z - datum::eps;
}
z -= incre(1);
if(z > 1.) z = 1. - datum::eps;
else if(z < 0.) z = 0.;
}
}

Expand Down Expand Up @@ -195,6 +171,6 @@ int Subloading1D::reset_status() {
}

void Subloading1D::print() {
suanpan_info("A uniaxial combined hardening material using subloading surface model with optional viscosity.\n");
suanpan_info("A uniaxial combined hardening material using subloading surface model.\n");
Material1D::print();
}
20 changes: 10 additions & 10 deletions Material/Material1D/vonMises/Subloading1D.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,18 @@ struct DataSubloading1D {
};

const double elastic; // elastic modulus
const double initial_iso, k_iso, saturation_iso, m_iso;
const double initial_kin, k_kin, saturation_kin, m_kin;
const double initial_iso;
const double k_iso;
const double saturation_iso;
const double m_iso;
const double initial_kin;
const double k_kin;
const double saturation_kin;
const double m_kin;
const double u;
const double cv;
const double mu;
const double nv;

const std::vector<Saturation> b, c;
const std::vector<Saturation> b;
const std::vector<Saturation> c;
};

class Subloading1D final : protected DataSubloading1D, public Material1D {
Expand All @@ -66,10 +70,6 @@ class Subloading1D final : protected DataSubloading1D, public Material1D {

static vec2 yield_ratio(double);

const double* incre_time = nullptr;

const bool is_viscous = mu > 0. && nv > 0.;

public:
Subloading1D(
unsigned, // tag
Expand Down
45 changes: 2 additions & 43 deletions Material/MaterialParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2948,47 +2948,11 @@ void new_subloading1d(unique_ptr<Material>& return_obj, istringstream& command)
return;
}

DataSubloading1D para{p(0), p(1), p(2), p(3), p(4), p(5), p(6), p(7), p(8), p(9), 1., 0., 0., {{p(10), 1.}}, {{p(11), p(12)}}};
DataSubloading1D para{p(0), p(1), p(2), p(3), p(4), p(5), p(6), p(7), p(8), p(9), {{p(10), 1.}}, {{p(11), p(12)}}};
if(para.m_iso < 0. || para.m_kin < 0.) {
suanpan_error("The evolution rate must be positive.\n");
return;
}
if(para.cv < 1.) {
suanpan_error("The viscous limit c_v must be greater than unity.\n");
return;
}

return_obj = make_unique<Subloading1D>(tag, std::move(para), density);
}

void new_subloadingviscous1d(unique_ptr<Material>& return_obj, istringstream& command) {
unsigned tag;
if(!get_input(command, tag)) {
suanpan_error("A valid tag is required.\n");
return;
}

vec p{2E5, 2E2, 0., 2E2, 1E1, 2E2, 0., 2E2, 1E1, 1E1, 1., 0., 0., 1E1, 1E1, .7};
if(!get_optional_input(command, p)) {
suanpan_error("Valid inputs are required.\n");
return;
}

auto density = 0.;
if(!command.eof() && !get_input(command, density)) {
suanpan_error("A valid density is required.\n");
return;
}

DataSubloading1D para{p(0), p(1), p(2), p(3), p(4), p(5), p(6), p(7), p(8), p(9), p(10), p(11), p(12), {{p(13), 1.}}, {{p(14), p(15)}}};
if(para.m_iso < 0. || para.m_kin < 0.) {
suanpan_error("The evolution rate must be positive.\n");
return;
}
if(para.cv < 1.) {
suanpan_error("The viscous limit c_v must be greater than unity.\n");
return;
}

return_obj = make_unique<Subloading1D>(tag, std::move(para), density);
}
Expand Down Expand Up @@ -3031,15 +2995,11 @@ void new_multisubloading1d(unique_ptr<Material>& return_obj, istringstream& comm
}
}

DataSubloading1D para{p(0), p(1), p(2), p(3), p(4), p(5), p(6), p(7), p(8), p(9), 1., 0., 0., std::move(back), std::move(core)};
DataSubloading1D para{p(0), p(1), p(2), p(3), p(4), p(5), p(6), p(7), p(8), p(9), std::move(back), std::move(core)};
if(para.m_iso < 0. || para.m_kin < 0.) {
suanpan_error("The evolution rate must be positive.\n");
return;
}
if(para.cv < 1.) {
suanpan_error("The viscous limit c_v must be greater than unity.\n");
return;
}

return_obj = make_unique<Subloading1D>(tag, std::move(para), p(10));
}
Expand Down Expand Up @@ -3644,7 +3604,6 @@ int create_new_material(const shared_ptr<DomainBase>& domain, istringstream& com
else if(is_equal(material_id, "Stacked")) new_stacked(new_material, command);
else if(is_equal(material_id, "SteelBRB")) new_steelbrb(new_material, command);
else if(is_equal(material_id, "Subloading1D")) new_subloading1d(new_material, command);
else if(is_equal(material_id, "SubloadingViscous1D")) new_subloadingviscous1d(new_material, command);
else if(is_equal(material_id, "MultiSubloading1D")) new_multisubloading1d(new_material, command);
else if(is_equal(material_id, "SubloadingMetal")) new_subloadingmetal(new_material, command);
else if(is_equal(material_id, "Substepping")) new_substepping(new_material, command);
Expand Down