getfem-commits
[Top][All Lists]
Advanced

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

[Getfem-commits] r4714 - in /trunk/getfem: interface/src/ interface/test


From: Yves . Renard
Subject: [Getfem-commits] r4714 - in /trunk/getfem: interface/src/ interface/tests/matlab/ src/ src/getfem/
Date: Tue, 15 Jul 2014 09:52:46 -0000

Author: renard
Date: Tue Jul 15 11:52:45 2014
New Revision: 4714

URL: http://svn.gna.org/viewcvs/getfem?rev=4714&view=rev
Log:
adding the more symmetric version of the contact brick

Modified:
    trunk/getfem/interface/src/gf_model_set.cc
    trunk/getfem/interface/tests/matlab/demo_large_sliding_contact.m
    trunk/getfem/src/getfem/getfem_contact_and_friction_large_sliding.h
    trunk/getfem/src/getfem_contact_and_friction_large_sliding.cc

Modified: trunk/getfem/interface/src/gf_model_set.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/interface/src/gf_model_set.cc?rev=4714&r1=4713&r2=4714&view=diff
==============================================================================
--- trunk/getfem/interface/src/gf_model_set.cc  (original)
+++ trunk/getfem/interface/src/gf_model_set.cc  Tue Jul 15 11:52:45 2014
@@ -2936,7 +2936,7 @@
         out.pop().from_integer(int(ind + config::base_index()));
         );
 
-     /address@hidden ind = ('add integral large sliding contact brick 
raytracing', @str dataname_r, @scalar release_distance, [, @str dataname_fr[, 
@str dataname_alpha]])
+     /address@hidden ind = ('add integral large sliding contact brick 
raytracing', @str dataname_r, @scalar release_distance, [, @str dataname_fr[, 
@str dataname_alpha[, @int version]]])
       Adds a large sliding contact with friction brick to the model.
       This brick is able to deal with self-contact, contact between
       several deformable bodies and contact with rigid obstacles.
@@ -2947,10 +2947,11 @@
       (generally a few times a mean element size, and less than the
       thickness of the body). Initially, the brick is added with no contact
       boundaries. The contact boundaries and rigid bodies are added with
-      special functions. @*/
+      special functions. `version` is 0 for the non-symmetric version
+      and 1 for the symmetric one (0 by default). @*/
 
      sub_command
-       ("add integral large sliding contact brick raytracing", 2, 4, 0, 1,
+       ("add integral large sliding contact brick raytracing", 2, 5, 0, 1,
         
         std::string dataname_r = in.pop().to_string();
         scalar_type d = in.pop().to_scalar();
@@ -2960,10 +2961,12 @@
         std::string dataname_alpha = "1";
         if (in.remaining()) dataname_alpha = in.pop().to_string();
         if (dataname_alpha.size() == 0) dataname_alpha = "1";
+        bool sym_v = false;
+        if (in.remaining()) sym_v = (in.pop().to_integer() != 0);
 
         size_type  ind
         = getfem::add_integral_large_sliding_contact_brick_raytracing
-        (md->model(), dataname_r, d, dataname_fr, dataname_alpha);
+        (md->model(), dataname_r, d, dataname_fr, dataname_alpha, sym_v);
         out.pop().from_integer(int(ind + config::base_index()));
         );
 

Modified: trunk/getfem/interface/tests/matlab/demo_large_sliding_contact.m
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/interface/tests/matlab/demo_large_sliding_contact.m?rev=4714&r1=4713&r2=4714&view=diff
==============================================================================
--- trunk/getfem/interface/tests/matlab/demo_large_sliding_contact.m    
(original)
+++ trunk/getfem/interface/tests/matlab/demo_large_sliding_contact.m    Tue Jul 
15 11:52:45 2014
@@ -19,7 +19,7 @@
 clear all;
 gf_workspace('clear all');
 
-test_case = 0; % 0 = 2D punch on a rigid obstacle
+test_case = 1; % 0 = 2D punch on a rigid obstacle
                % 1 = 2D punch on a deformable obstacle (one slave, one master)
                % 2 = 2D with two different meshes
                % 3 = 2D with multi-body and only one mesh
@@ -32,7 +32,7 @@
 f_coeff = 0.5;              % Friction coefficient
 
 test_tangent_matrix = false;
-nonlinear_elasticity = true;
+nonlinear_elasticity = false;
 max_iter = 50;
 draw_mesh = false;
 do_plot = true;
@@ -347,7 +347,7 @@
   gf_model_set(md, 'add integral large sliding contact brick raytrace', mcff, 
'r', 'f', 'alpha');
 end
 
-for nit=1:15
+for nit=1:20
   disp(sprintf('Iteration %d', nit));
 
   if (test_tangent_matrix) 

Modified: trunk/getfem/src/getfem/getfem_contact_and_friction_large_sliding.h
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem/getfem_contact_and_friction_large_sliding.h?rev=4714&r1=4713&r2=4714&view=diff
==============================================================================
--- trunk/getfem/src/getfem/getfem_contact_and_friction_large_sliding.h 
(original)
+++ trunk/getfem/src/getfem/getfem_contact_and_friction_large_sliding.h Tue Jul 
15 11:52:45 2014
@@ -59,7 +59,7 @@
   size_type add_integral_large_sliding_contact_brick_raytracing
   (model &md, const std::string &augm_param,
   scalar_type release_distance, const std::string &f_coeff = "0",
-   const std::string &alpha = "1");
+   const std::string &alpha = "1", bool sym_v = false);
 
   /** Adds a contact boundary to an existing large sliding contact
       with friction brick. When a boundary is declared slave, a multiplier

Modified: trunk/getfem/src/getfem_contact_and_friction_large_sliding.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem_contact_and_friction_large_sliding.cc?rev=4714&r1=4713&r2=4714&view=diff
==============================================================================
--- trunk/getfem/src/getfem_contact_and_friction_large_sliding.cc       
(original)
+++ trunk/getfem/src/getfem_contact_and_friction_large_sliding.cc       Tue Jul 
15 11:52:45 2014
@@ -2312,6 +2312,8 @@
     model::varnamelist vl, dl;
     model::mimlist ml;
 
+    bool sym_version;
+
     void add_contact_boundary(model &md, const mesh_im &mim, size_type region,
                               bool is_master, bool is_slave,
                               const std::string &u,
@@ -2362,38 +2364,13 @@
       cb.is_slave = is_slave;
       cb.mim = &mim;
       if (is_slave) {
-        cb.expr =
-          // -lambda.Test_u
-          "-"+lambda+".Test_"+u
-          // Interpolate_filter(trans, lambda.Interpolate(Test_ug,
-          //                                               contact_trans), 1)
-          + "+ Interpolate_filter("+transformation_name+","+lambda
-          + ".Interpolate(Test_"+u_group+","
-          + transformation_name+"), 1)"
-          // -(1/r)*lambda.Test_lambda
-          + "-(1/"+augmentation_param+")*"+lambda+".Test_"+lambda
-          // Interpolate_filter(trans,
-          //   (1/r)*Coulomb_friction_coupled_projection(lambda,
-          //     Transformed_unit_vector(Grad_u, Normal), (u-w)*alpha,
-          //     (Interpolate(x,trans)-x-u).Transformed_unit_vector(Grad_u,
-          //                                                        Normal),
-          //     f, r).Test_lambda, 2)
-          + "+ Interpolate_filter("+transformation_name+","
-          + "(1/"+augmentation_param+")*Coulomb_friction_coupled_projection("
-          + lambda+", Transformed_unit_vector(Grad_"+u+", Normal),"
-          + "("+u+(w.size() ? ("-"+w):"")+")*"+alpha
-          + ",(Interpolate(x,"+transformation_name+")-x-"+u
-          + ").Transformed_unit_vector(Grad_"+u+", Normal),"
-          + friction_coeff+","+augmentation_param+").Test_"+lambda+", 2)"
-          // Interpolate_filter(trans,
-          //   (1/r)*Coulomb_friction_coupled_projection(lambda,
-          //      Transformed_unit_vector(Grad_u, Normal),
-          //      (u-Interpolate(ug,trans)-(w-Interpolate(wg,trans)))*alpha,
-          //      (Interpolate(x,trans)+Interpolate(ug,trans)-x-u).
-          //        Transformed_unit_vector(Grad_u, Normal),
-          //      f, r).Test_lambda, 1)
-          + "+ Interpolate_filter("+transformation_name+","
-          + "(1/"+augmentation_param+")*Coulomb_friction_coupled_projection("
+        // Coulomb_friction_coupled_projection(lambda,
+        //    Transformed_unit_vector(Grad_u, Normal),
+        //    (u-Interpolate(ug,trans)-(w-Interpolate(wg,trans)))*alpha,
+        //    (Interpolate(x,trans)+Interpolate(ug,trans)-x-u).
+        //      Transformed_unit_vector(Grad_u, Normal), f, r)
+        std::string coupled_projection_def =
+          "Coulomb_friction_coupled_projection("
           + lambda+", Transformed_unit_vector(Grad_"+u+", Normal),x+"
           + "("+u+"-Interpolate("+u_group+","+transformation_name+")"
           + (w.size() 
@@ -2402,7 +2379,48 @@
           +")*"+alpha+","
           + "(Interpolate(x,"+transformation_name+")+Interpolate("+u_group+","
           + transformation_name+")-x-"+u+").Transformed_unit_vector(Grad_"
-          + u+", Normal),"+friction_coeff+","+augmentation_param+").Test_"
+          + u+", Normal),"+friction_coeff+","+augmentation_param+")";
+
+        // Coulomb_friction_coupled_projection(lambda,
+        //   Transformed_unit_vector(Grad_u, Normal), (u-w)*alpha,
+        //   (Interpolate(x,trans)-x-u).Transformed_unit_vector(Grad_u,
+        //                                                      Normal), f, r)
+        std::string coupled_projection_rig =
+          "Coulomb_friction_coupled_projection("
+          + lambda+", Transformed_unit_vector(Grad_"+u+", Normal),"
+          + "("+u+(w.size() ? ("-"+w):"")+")*"+alpha
+          + ",(Interpolate(x,"+transformation_name+")-x-"+u
+          + ").Transformed_unit_vector(Grad_"+u+", Normal),"
+          + friction_coeff+","+augmentation_param+")";
+
+        cb.expr =
+          // -lambda.Test_u for non-symmetric version
+          (sym_version ? "" : ("-"+lambda+".Test_"+u))
+          // -coupled_projection_def.Test_u and -coupled_projection_rig.Test_u
+          // for symmetric version
+          + (sym_version ? ("+ Interpolate_filter("+transformation_name+",-"
+                            +coupled_projection_def+".Test_"+u+",1)") : "")
+          + (sym_version ? ("+ Interpolate_filter("+transformation_name+",-"
+                            +coupled_projection_rig+".Test_"+u+",2)") : "")
+          // Interpolate_filter(trans,
+          //                   lambda.Interpolate(Test_ug, contact_trans), 1)
+          // or
+          // Interpolate_filter(trans,
+          //       coupled_projection_def.Interpolate(Test_ug, contact_trans), 
1)
+          + "+ Interpolate_filter("+transformation_name+","
+          + (sym_version ? coupled_projection_def : lambda)
+          + ".Interpolate(Test_"+u_group+","
+          + transformation_name+"), 1)"
+          // -(1/r)*lambda.Test_lambda
+          + "-(1/"+augmentation_param+")*"+lambda+".Test_"+lambda
+          // Interpolate_filter(trans, 
(1/r)*coupled_projection_rig.Test_lambda, 2)
+          + "+ Interpolate_filter("+transformation_name+","
+          + "(1/"+augmentation_param+")*"+ coupled_projection_rig
+          + ".Test_"+lambda+", 2)"
+          // Interpolate_filter(trans,
+          //   (1/r)*coupled_projection_def.Test_lambda, 1)
+          + "+ Interpolate_filter("+transformation_name+","
+          + "(1/"+augmentation_param+")*" + coupled_projection_def + ".Test_"
           + lambda+", 1)";
       }
     }
@@ -2449,7 +2467,8 @@
     (const std::string &r,
      const std::string &f_coeff,const std::string &ug,
      const std::string &wg, const std::string &tr,
-     const std::string &alpha_ = "1") {
+     const std::string &alpha_ = "1", bool sym_v = false) {
+      sym_version = sym_v;
       transformation_name = tr;
       u_group = ug; w_group = wg;
       friction_coeff = f_coeff;
@@ -2569,7 +2588,7 @@
   size_type add_integral_large_sliding_contact_brick_raytracing
   (model &md, const std::string &augm_param,
    scalar_type release_distance, const std::string &f_coeff, 
-   const std::string &alpha) {
+   const std::string &alpha, bool sym_v) {
 
     char ugroupname[50], wgroupname[50], transname[50];
     for (int i = 0; i < 10000; ++i) {
@@ -2602,7 +2621,7 @@
     
     intergral_large_sliding_contact_brick_raytracing *p
       = new intergral_large_sliding_contact_brick_raytracing
-      (augm_param, f_coeff, ugroupname, wgroupname, transname, alpha);
+      (augm_param, f_coeff, ugroupname, wgroupname, transname, alpha, sym_v);
     pbrick pbr = p;
     p->dl = dl;
 




reply via email to

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