getfem-commits
[Top][All Lists]
Advanced

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

[Getfem-commits] r5079 - in /trunk/getfem/interface: src/gf_mesh_fem.cc


From: Yves . Renard
Subject: [Getfem-commits] r5079 - in /trunk/getfem/interface: src/gf_mesh_fem.cc tests/matlab/demo_crack.m
Date: Fri, 04 Sep 2015 17:38:28 -0000

Author: renard
Date: Fri Sep  4 19:38:27 2015
New Revision: 5079

URL: http://svn.gna.org/viewcvs/getfem?rev=5079&view=rev
Log:
work in progress

Modified:
    trunk/getfem/interface/src/gf_mesh_fem.cc
    trunk/getfem/interface/tests/matlab/demo_crack.m

Modified: trunk/getfem/interface/src/gf_mesh_fem.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/interface/src/gf_mesh_fem.cc?rev=5079&r1=5078&r2=5079&view=diff
==============================================================================
--- trunk/getfem/interface/src/gf_mesh_fem.cc   (original)
+++ trunk/getfem/interface/src/gf_mesh_fem.cc   Fri Sep  4 19:38:27 2015
@@ -24,6 +24,7 @@
 #include <getfemint_mesh_fem.h>
 #include <getfemint_mesh.h>
 #include <getfem/getfem_mesh_fem_sum.h>
+#include <getfem/getfem_mesh_fem_product.h>
 #include <getfemint_levelset.h>
 #include <getfemint_mesh_levelset.h>
 #include <getfem/getfem_mesh_fem_level_set.h>
@@ -71,7 +72,14 @@
     subc_tab[cmd_normalize(name)] = psubc;                             \
   }
 
-
+/address@hidden MF = ('.mesh', @tmesh m[, @int Qdim1=1[, @int Qdim2=1, ...]])
+  Build a new @tmf object.
+  
+  The `Qdim` parameters specifies the dimension of the field represented
+  by the finite element method. Qdim1 = 1 for a scalar field,
+  Qdim1 = n for a vector field off size n, Qdim1=m, Qdim2=n for
+  a matrix field of size mxn ...
+  Returns the handle of the created object. @*/
 
 void gf_mesh_fem(getfemint::mexargs_in& m_in,
                 getfemint::mexargs_out& m_out) {
@@ -80,7 +88,7 @@
 
   if (subc_tab.size() == 0) {
 
-      /address@hidden MF = ('load', @str fname[, @tmesh m])
+    /address@hidden MF = ('load', @str fname[, @tmesh m])
       Load a @tmf from a file.
 
       If the mesh `m` is not supplied (this kind of file does not store the
@@ -117,7 +125,7 @@
        );
 
 
-      /address@hidden MF = ('clone', @tmf mf)
+    /address@hidden MF = ('clone', @tmf mf)
       Create a copy of a @address@hidden/
     sub_command
       ("clone", 1, 1, 0, 1,
@@ -129,12 +137,11 @@
        mmf->mesh_fem().read_from_file(ss);
        );
 
-
-      /address@hidden MF = ('sum', @tmf mf1, @tmf mf2[, @tmf mf3[, ...]])
-      Create a @tmf that combines two (or more) @tmf's.
-
-      All @tmf must share the same mesh (see
-      ``FEM:INIT('interpolated_fem')`` to map a @tmf onto another).
+    
+    /address@hidden MF = ('sum', @tmf mf1, @tmf mf2[, @tmf mf3[, ...]])
+      Create a @tmf that spans two (or more) @tmf's.
+
+      All @tmf must share the same mesh.
 
       After that, you should not modify the FEM of `mf1`, `mf2` address@hidden/
     sub_command
@@ -156,6 +163,25 @@
        msum->adapt();
        );
 
+    /address@hidden MF = ('product', @tmf mf1, @tmf mf2)
+      Create a @tmf that spans all the product of a selection of shape
+      functions of `mf1` by all shape functions of `mf2`.
+      Designed for Xfem enrichment.
+
+      `mf1` and `mf2` must share the same mesh.
+
+      After that, you should not modify the FEM of `mf1`, address@hidden/
+    sub_command
+      ("product", 2, 2, 0, 1,
+       getfemint_mesh_fem *gfimf1 = in.pop().to_getfemint_mesh_fem();
+       getfemint_mesh_fem *gfimf2 = in.pop().to_getfemint_mesh_fem();
+       getfem::mesh_fem_product *mprod = 
+         new getfem::mesh_fem_product(gfimf1->mesh_fem(), gfimf2->mesh_fem());
+       mmf = getfemint_mesh_fem::get_from(mprod);
+       workspace().set_dependance(mmf, gfimf1);
+       workspace().set_dependance(mmf, gfimf2);
+       );
+
 
     /address@hidden MF = ('levelset', @tmls mls, @tmf mf)
       Create a @tmf that is conformal to implicit surfaces defined in
@@ -200,12 +226,12 @@
        );
 
 
-      /address@hidden MF = ('partial', @tmf mf, @ivec DOFs[, @ivec RCVs])
-        Build a restricted @tmf by keeping only a subset of the degrees of
-        freedom of `mf`.
-
-        If `RCVs` is given, no FEM will be put on the convexes listed in
-        address@hidden/
+    /address@hidden MF = ('partial', @tmf mf, @ivec DOFs[, @ivec RCVs])
+      Build a restricted @tmf by keeping only a subset of the degrees of
+      freedom of `mf`.
+
+      If `RCVs` is given, no FEM will be put on the convexes listed in
+      address@hidden/
     sub_command
       ("partial", 2, 3, 0, 1,
        getfemint_mesh_fem *gmf = in.pop().to_getfemint_mesh_fem();
@@ -244,14 +270,8 @@
     else bad_cmd(init_cmd);
 
   } else if (check_cmd("MeshFem", "MeshFem", m_in, m_out, 1, 7, 0, 1)) {
-    /address@hidden MF = ('.mesh', @tmesh m[, @int Qdim1=1[, @int Qdim2=1, 
...]])
-      Build a new @tmf object.
-
-      The `Qdim` parameters specifies the dimension of the field represented
-      by the finite element method. Qdim1 = 1 for a scalar field,
-      Qdim1 = n for a vector field off size n, Qdim1=m, Qdim2=n for
-      a matrix field of size mxn ...
-      Returns the handle of the created object. @*/
+    /* Documentation iof the commande moved in first position to appear first
+       in the documentation. */
     mm = m_in.pop().to_getfemint_mesh();
     bgeot::multi_index mi;
     dim_type qdim = 1;

Modified: trunk/getfem/interface/tests/matlab/demo_crack.m
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/interface/tests/matlab/demo_crack.m?rev=5079&r1=5078&r2=5079&view=diff
==============================================================================
--- trunk/getfem/interface/tests/matlab/demo_crack.m    (original)
+++ trunk/getfem/interface/tests/matlab/demo_crack.m    Fri Sep  4 19:38:27 2015
@@ -22,6 +22,13 @@
 %
 %%%
 
+variant = 1;
+% variant : 1 : one crack with cutoff enrichement
+%           2 : one crack with a fixed size area Xfem enrichment
+%           3 : a branching crack with a fixed size area Xfem enrichment
+%           4 : variant 2 plus a penalisation of the jump over the cracks
+
+
 gf_workspace('clear all');
 
 % Parameters
@@ -30,34 +37,52 @@
 Lambda     = 1.25e10;   % Lame coefficient
 Mu         = 1.875e10;  % Lame coefficient
 
-% Global Functions
+% Mesh in definition:
+m = gf_mesh('regular_simplices', -0.5:1.0/nx:0.5+1.0/nx, 
-0.5:1.0/nx:0.5+1.0/nx);
+% m = gf_mesh('import','gmsh','quad.msh')
+
+% boundary set:
+gf_mesh_set(m, 'region', DIRICHLET, gf_mesh_get(m,'outer_faces'));
+
+% Basic mesh_fem without enrichment
+mf_pre_u = gf_mesh_fem(m);
+gf_mesh_fem_set(mf_pre_u,'fem',gf_fem('FEM_PK(2,1)'));
+
+
+% Levelset(s) definition
+ls  = gf_levelset(m,1,'y','x');
+mls = gf_mesh_levelset(m);
+gf_mesh_levelset_set(mls,'add',ls);
+if (variant > 2)
+   ls2 =  gf_levelset(m,1,'x+0.125','abs(y)-0.375');
+   gf_mesh_levelset_set(mls,'add',ls2);
+end
+gf_mesh_levelset_set(mls,'adapt');
+
+
+% Global Functions for asymptotic enrichment
 ck0 = gf_global_function('crack',0);
 ck1 = gf_global_function('crack',1);
 ck2 = gf_global_function('crack',2);
 ck3 = gf_global_function('crack',3);
-coff = gf_global_function('cutoff',2,0.4,0.01,0.4);
-ckoff0 = gf_global_function('product', ck0, coff);
-ckoff1 = gf_global_function('product', ck1, coff);
-ckoff2 = gf_global_function('product', ck2, coff);
-ckoff3 = gf_global_function('product', ck3, coff);
 
-% Mesh in action:
-m = gf_mesh('regular_simplices', -0.5:1.0/nx:0.5+1.0/nx, 
-0.5:1.0/nx:0.5+1.0/nx);
-% m = gf_mesh('import','gmsh','quad.msh')
+% Definition of the enriched finite element method
+mfls_u    = gf_mesh_fem('levelset',mls,mf_pre_u);
 
-% boundary set:
-gf_mesh_set(m,'region',DIRICHLET, gf_mesh_get(m,'outer_faces'));
-% MeshFem in action:
-mf_pre_u = gf_mesh_fem(m);
-gf_mesh_fem_set(mf_pre_u,'fem',gf_fem('FEM_PK(2,1)'));
-% Levelset in action:
-ls  = gf_levelset(m,1,'y','x');
-mls = gf_mesh_levelset(m);
-gf_mesh_levelset_set(mls,'add',ls);
-gf_mesh_levelset_set(mls,'adapt');
-mfls_u    = gf_mesh_fem('levelset',mls,mf_pre_u);
-mf_sing_u = gf_mesh_fem('global function',m,ls, 
{ckoff0,ckoff1,ckoff2,ckoff3},1);
-mf_u      = gf_mesh_fem('sum',mf_sing_u,mfls_u);
+if (variant == 1) % Cutoff enrichement 
+  coff = gf_global_function('cutoff',2,0.4,0.01,0.4);
+  ckoff0 = gf_global_function('product', ck0, coff);
+  ckoff1 = gf_global_function('product', ck1, coff);
+  ckoff2 = gf_global_function('product', ck2, coff);
+  ckoff3 = gf_global_function('product', ck3, coff);
+  mf_sing_u = gf_mesh_fem('global function',m,ls, 
{ckoff0,ckoff1,ckoff2,ckoff3},1);
+  mf_u      = gf_mesh_fem('sum',mf_sing_u,mfls_u);
+else
+  mf_part_unity = gf_mesh_fem(m);
+  gf_mesh_fem_set(mf_part_unity, 'classical fem', 1);
+  % + selection des ddls autour du ou des fond de fissure
+end  
+  
 gf_mesh_fem_set(mf_u,'qdim',2);
 % exact solution:
 mf_ue = gf_mesh_fem('global function',m,ls,{ck0,ck1,ck2,ck3});
@@ -108,5 +133,5 @@
 disp('You can view the solution with (for example): gmsh crack.pos\n');
 
 % drawing the solution
-gf_plot(mfvm, VM, 'deformed_mesh', 'on', 'deformation_mf', mfv, 'deformation', 
V, 'deformation_scale', 0.20);
+gf_plot(mfvm, VM, 'deformed_mesh', 'on', 'deformation_mf', mfv, 'deformation', 
V, 'deformation_scale', 0.10);
 colorbar;




reply via email to

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