|
From: | Michel Dupront |
Subject: | [Getfem-users] about dirichlet boundary conditions |
Date: | Mon, 18 Jun 2012 12:07:32 +0200 |
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') |
[Prev in Thread] | Current Thread | [Next in Thread] |