From f8f4b400afd5702459beaed30101a2c32450ad64 Mon Sep 17 00:00:00 2001 From: janzen Date: Tue, 11 Jul 2023 07:30:46 -0500 Subject: [PATCH 1/3] Added a work scale to account for small damage values --- .libs/libneml-opt.lai | 41 +++++++++++++++++++++++++++++++++++++++++ include/damage.h | 1 + src/damage.cxx | 34 ++++++++++++++++++---------------- 3 files changed, 60 insertions(+), 16 deletions(-) create mode 100644 .libs/libneml-opt.lai diff --git a/.libs/libneml-opt.lai b/.libs/libneml-opt.lai new file mode 100644 index 00000000..6ca0e3d3 --- /dev/null +++ b/.libs/libneml-opt.lai @@ -0,0 +1,41 @@ +# libneml-opt.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.6 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='libneml-opt.so.0' + +# Names of this library. +library_names='libneml-opt.so.0.0.0 libneml-opt.so.0 libneml-opt.so' + +# The name of the static archive. +old_library='' + +# Linker flags that cannot go in dependency_libs. +inherited_linker_flags=' -fopenmp' + +# Libraries that this one depends upon. +dependency_libs='' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for libneml-opt. +current=0 +age=0 +revision=0 + +# Is this an already installed library? +installed=yes + +# Should we warn about portability when linking against -modules? +shouldnotlink=no + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/home/janzen/moose/neml' diff --git a/include/damage.h b/include/damage.h index c98ceb2f..1c4b2e7a 100644 --- a/include/damage.h +++ b/include/damage.h @@ -670,6 +670,7 @@ class NEML_EXPORT WorkDamage: public ScalarDamage { std::shared_ptr Wcrit_; double n_; double eps_; + double work_scale_; bool log_; }; diff --git a/src/damage.cxx b/src/damage.cxx index 8d6bce89..dde5f867 100644 --- a/src/damage.cxx +++ b/src/damage.cxx @@ -1293,6 +1293,7 @@ WorkDamage::WorkDamage(ParameterSet & params) : Wcrit_(params.get_object_parameter("Wcrit")), n_(params.get_parameter("n")), eps_(params.get_parameter("eps")), + work_scale_(params.get_parameter("work_scale")), log_(params.get_parameter("log")) { } @@ -1310,6 +1311,7 @@ ParameterSet WorkDamage::parameters() pset.add_parameter("Wcrit"); pset.add_parameter("n"); pset.add_optional_parameter("eps", 1e-30); + pset.add_optional_parameter("work_scale", 1.0); pset.add_optional_parameter("log", false); return pset; @@ -1341,10 +1343,10 @@ void WorkDamage::damage(double d_np1, double d_n, double dt = t_np1 - t_n; - double val = Wcrit(wrate); + double val = Wcrit(wrate / work_scale_); - *dd = d_n + n_ * std::pow(std::fabs(d_np1), (n_-1.0)/n_) * - wrate * dt / val; + *dd = d_n + n_ * std::pow(std::fabs(d_np1), (n_-1.0)/n_) * + wrate * dt / val / work_scale_; } void WorkDamage::ddamage_dd(double d_np1, double d_n, @@ -1366,8 +1368,8 @@ void WorkDamage::ddamage_dd(double d_np1, double d_n, return; } - double val = Wcrit(wrate); - double deriv = dWcrit(wrate); + double val = Wcrit(wrate / work_scale_); + double deriv = dWcrit(wrate / work_scale_); double dt = t_np1 - t_n; double S[36]; @@ -1375,13 +1377,13 @@ void WorkDamage::ddamage_dd(double d_np1, double d_n, double e[6]; mat_vec(S, 6, s_np1, 6, e); double f = dot_vec(s_np1, e, 6); - double x = -wrate / (1.0 - std::fabs(d_np1)) + + double x = -wrate / (1.0 - std::fabs(d_np1)) / work_scale_ + (1.0 - std::fabs(d_np1)) * f / dt; double other = n_*std::pow(fabs(d_np1), (n_-1.0)/n_) * - dt / val * (1.0 - wrate / val *deriv) * x; + dt / val * (1.0 - wrate / val * deriv / work_scale_) * x; *dd = (n_-1.0)*std::pow(std::fabs(d_np1), -1.0/n_) * - wrate * dt / val + other; + wrate * dt / val / work_scale_ + other; } void WorkDamage::ddamage_de(double d_np1, double d_n, @@ -1401,11 +1403,11 @@ void WorkDamage::ddamage_de(double d_np1, double d_n, return; } - double val = Wcrit(wrate); - double dval = dWcrit(wrate); + double val = Wcrit(wrate / work_scale_); + double dval = dWcrit(wrate / work_scale_); double fact = n_ * std::pow(std::fabs(d_np1), (n_-1.0)/n_) / val * - (1.0 - wrate / val * dval) * (1.0 - std::fabs(d_np1)); + (1.0 - wrate / val * dval / work_scale_) * (1.0 - std::fabs(d_np1)); for (size_t i = 0; i < 6; i++) { dd[i] = fact * s_np1[i]; @@ -1427,8 +1429,8 @@ void WorkDamage::ddamage_ds(double d_np1, double d_n, return; } - double val = Wcrit(wrate); - double dval = dWcrit(wrate); + double val = Wcrit(wrate / work_scale_); + double dval = dWcrit(wrate / work_scale_); double S[36]; elastic_->S(T_np1, S); @@ -1447,7 +1449,7 @@ void WorkDamage::ddamage_ds(double d_np1, double d_n, mat_vec(S, 6, s_np1, 6, e); double fact = n_ * std::pow(fabs(d_np1), (n_-1.0)/n_) / val * - (1.0 - wrate / val * dval)*(1.0-std::fabs(d_np1)); + (1.0 - wrate / val * dval / work_scale_)*(1.0-std::fabs(d_np1)); for (size_t i = 0; i < 6; i++) { dd[i] = fact * (de[i] - dee[i] - (1.0-std::fabs(d_np1))*e[i]); @@ -1471,7 +1473,7 @@ double WorkDamage::workrate( double ds[6]; double de[6]; for (int i=0; i<6; i++) { - ds[i] = stress_np1[i] *(1.0-d_np1) - stress_n[i]*(1.0-d_n); + ds[i] = stress_np1[i]*(1.0-d_np1) - stress_n[i]*(1.0-d_n); de[i] = strain_np1[i] - strain_n[i]; } @@ -1483,7 +1485,7 @@ double WorkDamage::workrate( dp[i] = de[i] - dee[i]; } - return fabs(dot_vec(stress_np1, dp, 6) / dt * (1.0 - d_np1)); + return fabs(dot_vec(stress_np1, dp, 6) / dt * (1.0 - d_np1)) * work_scale_; } double WorkDamage::Wcrit(double Wdot) const From 336c522c2b3156e5d61bb155a76d24e9fd9884d6 Mon Sep 17 00:00:00 2001 From: janzen Date: Tue, 11 Jul 2023 07:38:58 -0500 Subject: [PATCH 2/3] removed lib --- .libs/libneml-opt.lai | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 .libs/libneml-opt.lai diff --git a/.libs/libneml-opt.lai b/.libs/libneml-opt.lai deleted file mode 100644 index 6ca0e3d3..00000000 --- a/.libs/libneml-opt.lai +++ /dev/null @@ -1,41 +0,0 @@ -# libneml-opt.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libneml-opt.so.0' - -# Names of this library. -library_names='libneml-opt.so.0.0.0 libneml-opt.so.0 libneml-opt.so' - -# The name of the static archive. -old_library='' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags=' -fopenmp' - -# Libraries that this one depends upon. -dependency_libs='' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libneml-opt. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/home/janzen/moose/neml' From 41b98e52f2cab9fa2330db79b6bcd6a41886331e Mon Sep 17 00:00:00 2001 From: Gary Hu Date: Fri, 14 Jul 2023 08:03:40 -0500 Subject: [PATCH 3/3] Uncomment the data header in NEML2 verification test files --- util/neml2_verification/README.md | 2 +- util/neml2_verification/run_neml2_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/util/neml2_verification/README.md b/util/neml2_verification/README.md index 20757a1a..541bf54f 100644 --- a/util/neml2_verification/README.md +++ b/util/neml2_verification/README.md @@ -19,7 +19,7 @@ viscoplastic.xml viscoplastic_linear_isotropic xx xx no_temperature 1e-5 1e-8 Compare Perzyna viscoplasticity with linear isotropic hardening # Test input as a space-separated list of time strain stress and # (optionally) temperature values -# time strain_xx strain_yy strain_zz strain_yz strain_xz strain_xy stress_xx stress_yy stress_zz stress_yz stress_xz stress_xy (temperature) +time strain_xx strain_yy strain_zz strain_yz strain_xz strain_xy stress_xx stress_yy stress_zz stress_yz stress_xz stress_xy (temperature) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.001 -0.0005 -0.0005 0.0 0.0 0.0 100 0 0 0 0 0 0 ... diff --git a/util/neml2_verification/run_neml2_test.py b/util/neml2_verification/run_neml2_test.py index 9d9e4731..2cf18038 100755 --- a/util/neml2_verification/run_neml2_test.py +++ b/util/neml2_verification/run_neml2_test.py @@ -94,7 +94,7 @@ def drive_all_strain(model, emax, erate, nsteps, T): f.write("# Comment line\n") f.write("\n") f.write("# The following uses the Mandel convention to store the strain and stress\n") - data_header = "# time strain_xx strain_yy strain_zz strain_yz strain_xz strain_xy stress_xx stress_yy stress_zz stress_yz stress_xz stress_xy" + data_header = "time strain_xx strain_yy strain_zz strain_yz strain_xz strain_xy stress_xx stress_yy stress_zz stress_yz stress_xz stress_xy" if use_T: data_header += " temperature" f.write(data_header + "\n")