Dear Michel Dupront,
You have at least tso manner to prescribe the value only on one point.
You can use the generic bricks
gf_model_set(model M, 'add constraint with multipliers', string varname,
string multname, spmat B, vec L)
or
gf_model_set(model M, 'add constraint with penalization', string
varname, scalar coeff, spmat B, vec L)
where you prescribe an arbitrary constraint on a variable in the form BU
= L, B having an arbitrary number of lines.
Of course, in that case, you have to now what degrees of freedom
correspond to the point where you want to prescribe the solution.
A second manner, for recent version of Getfem (the svn one) is to use
one of the bricks
gf_model_set(model M, 'add pointwise constraints with multipliers',
string varname, string dataname_pt[, string dataname_unitv] [, string
dataname_val])
or
gf_model_set(model M, 'add pointwise constraints with penalization',
string varname, scalar coeff, string dataname_pt[, string
dataname_unitv] [, string dataname_val])
These bricks allows to set the solution on a given set of points (and
possibly on a given components on a given set of points) even if these
points do not correspond to degrees of freedom.
Yves.
Le 18/06/2012 12:07, Michel Dupront a écrit :
> Hello,
> I am a new user.
> I attached a small python script that I am using
> to understand how getfem++ works.
> Here I am trying to cruch a cube.
> In this case the three components of the displacement are imposed at
> each node
> of the boundary.
> For example at the top surface the imposed displacement is such that
> u_x = 0,
> u_y = 0 and u_z =-0.3.
> Is it possible (and how?) to impose only one component of the
> displacement
> at only one point?
> For example I would like to impose only ux=0,uy=0 and let uz free
> at a corner point.
>
> Thank in advance
>
>
> script
> ====
>
>
> import getfem as gf
> import numpy as np
>
> tol = 1.e-6
>
> mesh = gf.Mesh('regular_simplices', np.arange(0,1.1,0.1),
> np.arange(0,1.1,0.1), np.arange(0,1.1,0.1))
>
> mfu = gf.MeshFem(mesh,3)
> mfu.set_fem(gf.Fem('FEM_PK(3,1)'))
>
> mim = gf.MeshIm(mesh, gf.Integ('IM_TETRAHEDRON(1)'))
>
> Points = mesh.pts()
> ctop = (abs(Points[2,:] - 1) < tol)
> cbot = (abs(Points[2,:] ) < tol);
>
> pidtop=np.compress(ctop, range(0, mesh.nbpts()))
> pidbot=np.compress(cbot, range(0, mesh.nbpts()))
>
> ftop = mesh.faces_from_pid(pidtop)
> fbot = mesh.faces_from_pid(pidbot)
>
> BD_TOP = 1
> BD_BOT = 2
>
> mesh.set_region(BD_TOP,ftop)
> mesh.set_region(BD_BOT,fbot)
>
> md = gf.Model('real')
> md.add_fem_variable('u', mfu)
>
> E=1e5
> Nu=0.3
> Lambda = E*Nu/((1+Nu)*(1-2*Nu))
> Mu =E/(2*(1+Nu))
> md.add_initialized_data('lambda', [Lambda])
> md.add_initialized_data('mu', [Mu])
>
> md.add_isotropic_linearized_elasticity_brick(mim,'u','lambda','mu')
>
> deltaZ = -0.3
> md.add_initialized_data('bd_top', [0.,0.,deltaZ])
> md.add_Dirichlet_condition_with_multipliers(mim, 'u', mfu, BD_TOP,
> 'bd_top')
> md.add_initialized_data('bd_bot', [0.,0.,0.])
> md.add_Dirichlet_condition_with_multipliers(mim, 'u', mfu, BD_BOT,
> 'bd_bot')
>
> md.solve()
>
> u = md.variable('u')
> mfu.export_to_pos('u.pos',u,'Computed solution')
>
>
> _______________________________________________
> Getfem-users mailing list
> [email protected]
> https://mail.gna.org/listinfo/getfem-users
--
Yves Renard ([email protected]) tel : (33) 04.72.43.87.08
Pole de Mathematiques, INSA-Lyon fax : (33) 04.72.43.85.29
20, rue Albert Einstein
69621 Villeurbanne Cedex, FRANCE
http://math.univ-lyon1.fr/~renard
---------
_______________________________________________
Getfem-users mailing list
[email protected]
https://mail.gna.org/listinfo/getfem-users