getfem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-commits] r5262 - in /trunk/getfem: interface/src/ src/ src/getfe


From: logari81
Subject: [Getfem-commits] r5262 - in /trunk/getfem: interface/src/ src/ src/getfem/
Date: Wed, 23 Mar 2016 12:14:41 -0000

Author: logari81
Date: Wed Mar 23 13:14:40 2016
New Revision: 5262

URL: http://svn.gna.org/viewcvs/getfem?rev=5262&view=rev
Log:
add some auxiliary functions for elastoplasticity and do some code reordering

Modified:
    trunk/getfem/interface/src/gf_asm.cc
    trunk/getfem/interface/src/gf_model_get.cc
    trunk/getfem/src/getfem/getfem_plasticity.h
    trunk/getfem/src/getfem_plasticity.cc

Modified: trunk/getfem/interface/src/gf_asm.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/interface/src/gf_asm.cc?rev=5262&r1=5261&r2=5262&view=diff
==============================================================================
--- trunk/getfem/interface/src/gf_asm.cc        (original)
+++ trunk/getfem/interface/src/gf_asm.cc        Wed Mar 23 13:14:40 2016
@@ -21,6 +21,7 @@
 
 #include <getfem/getfem_interpolation.h>
 #include <getfem/getfem_nonlinear_elasticity.h>
+#include <getfem/getfem_plasticity.h>
 #include <getfem/getfem_fourth_order.h>
 #include <getfem/getfem_contact_and_friction_nodal.h>
 #include <getfem/getfem_contact_and_friction_integral.h>
@@ -1182,6 +1183,56 @@
        getfem::ga_undefine_function(name);
        );
 
+    /address@hidden ('define linear hardening function', @str name, @scalar 
sigma_y0, @scalar H, ... address@hidden 'Frobenius'])
+      Define a new linear hardening function under the name `name`, with
+      initial yield stress `sigma_y0` and hardening modulus H.
+      If an extra string argument with the value 'Frobenius' is provided,
+      the hardening function is expressed in terms of Frobenius norms of its
+      input strain and output stress, instead of their Von-Mises equivalents. 
@*/
+    sub_command
+      ("define linear hardening function", 3, 4, 0, 0,
+       std::string name = in.pop().to_string();
+       const double sigma_y0 = in.pop().to_scalar();
+       const double H = in.pop().to_scalar();
+       bool frobenius(false);
+       if (in.remaining()) frobenius = (in.pop().to_integer() != 0);
+       getfem::ga_define_linear_hardening_function(name, sigma_y0, H, 
frobenius);
+       );
+
+    /address@hidden ('define Ramberg Osgood hardening function', @str name, 
@scalar sigma_ref, address@hidden eps_ref | @scalar E, @scalar alpha}, @scalar 
n[, @str 'Frobenius'])
+      Define a new Ramberg Osgood hardening function under the name `name`,
+      with initial yield stress `sigma_y0` and hardening modulus H.
+      If an extra string argument with the value 'Frobenius' is provided,
+      the hardening function is expressed in terms of Frobenius norms of its
+      input strain and output stress, instead of their Von-Mises equivalents. 
@*/
+    sub_command
+      ("define Ramberg Osgood hardening function", 4, 6, 0, 0,
+       const std::string name = in.pop().to_string();
+       const double sigma_ref = in.pop().to_scalar();
+       double eps_ref = in.pop().to_scalar();
+       double n = in.pop().to_scalar();
+
+       bool frobenius(false);
+       if (in.remaining()) {
+         mexarg_in argin = in.pop();
+         if (argin.is_string()) {
+           frobenius = cmd_strmatch(argin.to_string(), "frobenius");
+           if (in.remaining())
+             THROW_BADARG( "Wrong types of input arguments");
+         } else {
+           const double E(eps_ref);
+           const double alpha(n);
+           eps_ref = alpha*sigma_ref/E;
+           n = argin.to_scalar();
+           if (in.remaining())
+             frobenius = cmd_strmatch(in.pop().to_string(), "frobenius");
+         }
+       }
+
+       getfem::ga_define_Ramberg_Osgood_hardening_function
+         (name, sigma_ref, eps_ref, n, frobenius);
+       );
+
 
     /address@hidden ('expression analysis', @str expression [, address@hidden 
mesh | @tmim mim}] [, der_order] [, @tmodel model] [, @str varname, @int 
is_variable[, address@hidden mf | @tmimd mimd}], ...])
       Analyse a high-level generic assembly expression and print

Modified: trunk/getfem/interface/src/gf_model_get.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/interface/src/gf_model_get.cc?rev=5262&r1=5261&r2=5262&view=diff
==============================================================================
--- trunk/getfem/interface/src/gf_model_get.cc  (original)
+++ trunk/getfem/interface/src/gf_model_get.cc  Wed Mar 23 13:14:40 2016
@@ -832,6 +832,32 @@
        );
 
 
+    /address@hidden ('elastoplasticity next iter', @tmim mim, @str varname, 
@str previous_dep_name, @str projname, @str datalambda, @str datamu, @str 
datathreshold, @str datasigma)
+      Compute and save the stress constraints sigma for other hypothetical 
iterations.
+      'mim' is the integration method to use for the computation.
+      'varname' is the main variable of the problem.
+      'previous_dep_name' represents the displacement at the previous time 
step.
+      'projname' is the type of projection to use. For the moment it could 
only be 'Von Mises' or 'VM'.
+      'datalambda' and 'datamu' are the Lame coefficients of the material.
+      'datasigma' is a vector which will contain the new stress constraints 
address@hidden/
+    sub_command
+      ("elastoplasticity next iter", 8, 8, 0, 1,
+       getfem::mesh_im *mim = to_meshim_object(in.pop());
+       std::string varname = in.pop().to_string();
+       std::string previous_dep = in.pop().to_string();
+       std::string projname = in.pop().to_string();
+       std::string datalambda = in.pop().to_string();
+       std::string datamu = in.pop().to_string();
+       std::string datathreshold = in.pop().to_string();
+       std::string datasigma = in.pop().to_string();
+
+
+       getfem::elastoplasticity_next_iter
+       (*md, *mim, varname, previous_dep,
+        abstract_constraints_projection_from_name(projname),
+        datalambda, datamu, datathreshold, datasigma);
+       );
+
     /address@hidden V = ('compute elastoplasticity Von Mises or Tresca', @str 
datasigma, @tmf mf_vm[, @str version])
       Compute on `mf_vm` the Von-Mises or the Tresca stress of a field for 
plasticity and return it into the vector V.
       `datasigma` is a vector which contains the stress constraints values 
supported by the mesh.
@@ -855,36 +881,6 @@
        (*md, datasigma, *mf, VMM, tresca);
        out.pop().from_dcvector(VMM);
        );
-
-
-
-
-    /address@hidden ('elastoplasticity next iter', @tmim mim, @str varname, 
@str previous_dep_name, @str projname, @str datalambda, @str datamu, @str 
datathreshold, @str datasigma)
-      Compute and save the stress constraints sigma for other hypothetical 
iterations.
-      'mim' is the integration method to use for the computation.
-      'varname' is the main variable of the problem.
-      'previous_dep_name' represents the displacement at the previous time 
step.
-      'projname' is the type of projection to use. For the moment it could 
only be 'Von Mises' or 'VM'.
-      'datalambda' and 'datamu' are the Lame coefficients of the material.
-      'datasigma' is a vector which will contains the new stress constraints 
address@hidden/
-    sub_command
-      ("elastoplasticity next iter", 8, 8, 0, 1,
-       getfem::mesh_im *mim = to_meshim_object(in.pop());
-       std::string varname = in.pop().to_string();
-       std::string previous_dep = in.pop().to_string();
-       std::string projname = in.pop().to_string();
-       std::string datalambda = in.pop().to_string();
-       std::string datamu = in.pop().to_string();
-       std::string datathreshold = in.pop().to_string();
-       std::string datasigma = in.pop().to_string();
-
-
-       getfem::elastoplasticity_next_iter
-       (*md, *mim, varname, previous_dep,
-       abstract_constraints_projection_from_name(projname),
-       datalambda, datamu, datathreshold, datasigma);
-       );
-
 
     /address@hidden V = ('compute plastic part', @tmim mim, @tmf mf_pl, @str 
varname, @str previous_dep_name, @str projname, @str datalambda, @str datamu, 
@str datathreshold, @str datasigma)
       Compute on `mf_pl` the plastic part and return it into the vector V.

Modified: trunk/getfem/src/getfem/getfem_plasticity.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_plasticity.h?rev=5262&r1=5261&r2=5262&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_plasticity.h (original)
+++ trunk/getfem/src/getfem/getfem_plasticity.h Wed Mar 23 13:14:40 2016
@@ -320,6 +320,43 @@
                             model_real_plain_vector &plast);
 
 
+  // Finite strain elastoplasticity
+
+  /** Add a linear function with the name specified by `name` to represent
+      linear isotropoc hardening in plasticity with initial yield limit
+      `sigma_y0` and hardening modulus `H`.
+      A true value of the `frobenius` argument will express the hardening
+      function in terms of Frobenius norms both for the strain input and
+      the stress output, instead of the corresponding Von-Mises quantities.
+  */
+  void ga_define_linear_hardening_function
+  (const std::string &name, scalar_type sigma_y0, scalar_type H, bool 
frobenius=true);
+
+  /** Add a Ramberg-Osgood hardening function with the name specified by
+     `name`, for reference stress and strain given by `sigma_ref` and
+      `eps_ref` respectively and for a hardening exponent `n`.
+      A true value of the `frobenius` argument will express the hardening
+      function in terms of Frobenius norms both for the strain input and
+      the stress output, instead of the corresponding Von-Mises quantities.
+  */
+  void ga_define_Ramberg_Osgood_hardening_function
+  (const std::string &name,
+   scalar_type sigma_ref, scalar_type eps_ref, scalar_type n,
+   bool frobenius=false);
+
+  /** Add a Ramberg-Osgood hardening function with the name specified by
+     `name`, for reference stress `sigma_ref`, Young's modulus `E`,
+      offset parameter `alpha` and hardening parameter `n`.
+      A true value of the `frobenius` argument will express the hardening
+      function in terms of Frobenius norms both for the strain input and
+      the stress output, instead of the corresponding Von-Mises quantities.
+  */
+  inline void ga_define_Ramberg_Osgood_hardening_function
+  (const std::string &name, scalar_type sigma_ref, scalar_type E, 
+   scalar_type alpha, scalar_type n, bool frobenius=false) {
+    ga_define_Ramberg_Osgood_hardening_function
+      (name, sigma_ref, alpha*sigma_ref/E, n, frobenius);
+  }
 
 
 

Modified: trunk/getfem/src/getfem_plasticity.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem_plasticity.cc?rev=5262&r1=5261&r2=5262&view=diff
==============================================================================
--- trunk/getfem/src/getfem_plasticity.cc       (original)
+++ trunk/getfem/src/getfem_plasticity.cc       Wed Mar 23 13:14:40 2016
@@ -25,7 +25,7 @@
 #include "getfem/getfem_interpolation.h"
 #include "getfem/getfem_generic_assembly.h"
 #include "gmm/gmm_dense_matrix_functions.h"
-
+#include <iomanip>
 
 namespace getfem {
 
@@ -1077,5 +1077,40 @@
   bool predef_operators_plasticity_initialized
     = init_predef_operators();
 
+
+  // Finite strain elastoplasticity
+
+  const std::string _TWOTHIRD_("0.6666666666666666667");
+  const std::string _FIVETHIRD_("1.6666666666666666667");
+  const std::string _SQRTTHREEHALF_("1.2247448713915889407");
+
+  void ga_define_linear_hardening_function
+  (const std::string &name, scalar_type sigma_y0, scalar_type H, bool 
frobenius)
+  {
+     if (frobenius) {
+       sigma_y0 *= sqrt(2./3.);
+       H *= 2./3.;
+     }
+     std::stringstream expr, der;
+     expr << std::setprecision(17) << sigma_y0 << "+" << H << "*t";
+     der << std::setprecision(17) << H;
+     ga_define_function(name, 1, expr.str(), der.str());
+  }
+
+  void ga_define_Ramberg_Osgood_hardening_function
+  (const std::string &name,
+   scalar_type sigma_ref, scalar_type eps_ref, scalar_type n, bool frobenius)
+  {
+    scalar_type coef = sigma_ref / pow(eps_ref, 1./n);
+    if (frobenius)
+      coef *= pow(2./3., 0.5 + 0.5/n); // = sqrt(2/3) * sqrt(2/3)^(1/n)
+
+    std::stringstream expr, der;
+    expr << std::setprecision(17) << coef << "*pow(t+1e-12," << 1./n << ")";
+    der << std::setprecision(17) << coef/n << "*pow(t+1e-12," << 1./n-1 << ")";
+    ga_define_function(name, 1, expr.str(), der.str());
+  }
+
+
 }  /* end of namespace getfem.  */
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]