getfem-commits
[Top][All Lists]
Advanced

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

[Getfem-commits] r5329 - in /trunk/getfem/contrib/test_plasticity: conv_


From: Yves . Renard
Subject: [Getfem-commits] r5329 - in /trunk/getfem/contrib/test_plasticity: conv_test_small_strain_plasticity.py test_small_strain_plasticity.py
Date: Fri, 27 May 2016 14:21:33 -0000

Author: renard
Date: Fri May 27 16:21:32 2016
New Revision: 5329

URL: http://svn.gna.org/viewcvs/getfem?rev=5329&view=rev
Log:
minor changes

Modified:
    trunk/getfem/contrib/test_plasticity/conv_test_small_strain_plasticity.py
    trunk/getfem/contrib/test_plasticity/test_small_strain_plasticity.py

Modified: 
trunk/getfem/contrib/test_plasticity/conv_test_small_strain_plasticity.py
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/contrib/test_plasticity/conv_test_small_strain_plasticity.py?rev=5329&r1=5328&r2=5329&view=diff
==============================================================================
--- trunk/getfem/contrib/test_plasticity/conv_test_small_strain_plasticity.py   
(original)
+++ trunk/getfem/contrib/test_plasticity/conv_test_small_strain_plasticity.py   
Fri May 27 16:21:32 2016
@@ -61,8 +61,8 @@
   filename = resultspath+('/U_%d.dat' % (NT))
   os.system("cp %s %s" % (filename, refname_U))
 
-# hrange=[LX/16, LX/22.5, LX/32, LX/45, LX/64, LX/90., LX/128.]
-hrange=[LX/16, LX/22.5, LX/32, LX/45, LX/64]
+hrange=[LX/16, LX/22.5, LX/32, LX/45, LX/64, LX/90., LX/128.]
+# hrange=[LX/16, LX/22.5, LX/32, LX/45, LX/64]
 
 for order in [1, 2]:
 

Modified: trunk/getfem/contrib/test_plasticity/test_small_strain_plasticity.py
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/contrib/test_plasticity/test_small_strain_plasticity.py?rev=5329&r1=5328&r2=5329&view=diff
==============================================================================
--- trunk/getfem/contrib/test_plasticity/test_small_strain_plasticity.py        
(original)
+++ trunk/getfem/contrib/test_plasticity/test_small_strain_plasticity.py        
Fri May 27 16:21:32 2016
@@ -32,7 +32,7 @@
 import os
 import sys
 
-option = 2     # 1 : without hardening, im_data and plastic multiplier
+option = 1     # 1 : without hardening, im_data and plastic multiplier
                # 2 : without hardening, with im_data and plastic multiplier
                # 3 : with kinematic and isotropic hardening,
                #     with plastic multiplier
@@ -45,12 +45,14 @@
 load_type = 1  # 1 : vertical
                # 2 : horizontal
 
-constraint_at_np1 = True
-trapezoidal = False  # trapezoidal or generalized mid-point  (for option 2 
only for the moment ...)
+constraint_at_np1 = False
+trapezoidal = False  # Trapezoidal or generalized mid-point  (for option 2 
only for the moment ...)
                
 bi_material = False
 test_tangent_matrix = False
-do_export = True
+do_export = 2  # 0 : no export,
+               # 1 : export_solution only,
+               # 2 : export for graphical post-treatment.
 
 resultspath = './exported_solutions'
 
@@ -70,7 +72,7 @@
 
 # Numerical parameters
 T = 10.
-NT = 50
+NT = 40
 LX = 40.
 LY = 20.
 NX = 40
@@ -101,15 +103,17 @@
       resultspath=a[12:]; print 'resultspath set to %s from argv' % resultspath
       continue
   if (a[0:10] == 'do_export='):
-      do_export=a[10:]; print 'do_export set to %s from argv' % do_export
+      do_export=int(a[10:]); print 'do_export set to %s from argv' % do_export
       continue
   print "Unknow argument '%s' from the command line, exiting" % a; exit(1);
 
 NY = int(np.ceil(NX * LY / (2 * LX))*2)
 DT = T/NT
 
-
-if (do_export):
+gf.util('trace_level', 1);
+
+
+if (do_export >= 2):
     if (not os.path.exists(resultspath)):
         os.makedirs(resultspath)
     print('You can vizualize the optimization steps by launching')
@@ -121,7 +125,7 @@
     exit(1)
 
 if (load_type == 1):
-    f = np.array([0., -400.]);
+    f = np.array([0., -1150.]);
     t = np.sin(2*np.pi*(np.arange(0, T+DT/2, DT))/20.);
 else:
     f = np.array([15000., 0.]);
@@ -220,7 +224,7 @@
     # exit(1);
     
     
-    if (theta == 1):
+    if (theta == 1.):
         Etheta = '(Sym(Grad_u))';
         Eptheta = '((Epn+2*mu*xi*Deviator('+Etheta+'))/(1+2*mu*xi))'
         Epnp1 = Eptheta
@@ -232,9 +236,9 @@
         Enp1 =  '(Sym(Grad_u))'
         Etheta = '(theta*'+Enp1+'+(1-theta)*'+En+')'
         if (trapezoidal):
-            md.add_fem_variable('Previous_xi', mf_xi)
+            md.add_fem_data('Previous_xi', mf_xi)
             Epnp1='((Epn+(1-theta)*2*mu*Previous_xi*(Deviator('+En+')-Epn) + 
2*mu*theta*xi*Deviator('+Enp1+'))/(1+2*mu*theta*xi))'
-            Eptheta='(theta*'+Epnp1+'+(1-theta)*'+Epn+')'
+            Eptheta='(theta*'+Epnp1+'+(1-theta)*Epn)'
         else:
           
Eptheta='((Epn+2*mu*theta*xi*Deviator('+Etheta+'))/(1+2*mu*theta*xi))'
           Epnp1 = '(('+Eptheta+'-(1-theta)*Epn)/theta)'
@@ -449,7 +453,7 @@
     U = md.variable('u')
 
     # Compute Von Mises and plastic part for graphical post-treatment
-    if (do_export):
+    if (do_export >= 2):
         if (option == 1):
             sigma_np1 = 'sigma';
         else:
@@ -515,8 +519,13 @@
         md.set_variable('Epn', NewEpn)
         md.set_variable('Previous_u', U)
       
-       
-    if (do_export):
+    if (do_export >= 1):
+        filename = resultspath+('/mf_%d.mf' % (step))
+        mf_u.save(filename, 'with_mesh')
+        filename = resultspath+('/U_%d.dat' % (step))
+        np.savetxt(filename, U)
+        
+    if (do_export >= 2):
         # Export Von Mises and plastic part
         filename = resultspath+('/von_mises_%d.vtk' % (step))
         mf_vm.export_to_vtk(filename, mf_vm, VM.reshape((len(VM))),
@@ -525,11 +534,6 @@
         mf_vm.export_to_vtk(filename, mf_vm, plast.reshape((len(plast))),
                             'Norm of plastic strain tensor', mf_u, U,
                             'Displacements')
-        filename = resultspath+('/mf_%d.mf' % (step))
-        mf_u.save(filename, 'with_mesh')
-        filename = resultspath+('/U_%d.dat' % (step))
-        np.savetxt(filename, U)
-        
 
         # Draw the stress/strain evolution on a selected Gauss point
         if (step == 0):




reply via email to

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