Dear Simon,
A priori, you computation seems ok to me. May be apart that you extract
mesh vertex indices withgf_mesh_get(magn_mesh, 'pid'); and not the
finite element node indices which are generally non-coinciding (use
gf_mesh_fem_get instead of gf_mesh_get).
Of course, representing the force density would be simpler (and note
that extraction/interpolation of values is easier with the use of
interpolation functions. for instancegf_model_get(md, 'interpolation',
'mult_on_u', set_of_points | mf) can directly get you the value of an
arbitrary expression on a set of points or on a Lagrange fem).
Best regards,
Yves
Le 24/01/2018 à 10:32, SIMON AMEYE a écrit :
Hi all,
As I was not able to use the contact brick between two meshes, I now
try to use another way:
I want to compute the forces at the boundary (dirichlet condition)
with my first part.
And then, I want to use those forces on a second finite element analysis.
Everything is ok except I am not able to associate the forces I get
with the correct nodes.
I use this code :
% End of the fem computation
gf_model_set(md, 'add generalized Dirichlet condition with
multipliers', mim, 'u', mfu, 1,'VECTOR', 'H');
gf_model_get(md, 'solve');
U = gf_model_get(md, 'variable', 'u');
VM = gf_model_get(md, 'compute isotropic linearized Von Mises or
Tresca', 'u', 'lambda', 'mu', mfdu);
% Forces recovery (from previous getfem++ thread)
% get the tangent matrix
tangent_matrix = gf_model_get(md, 'tangent_matrix');
% get the multipliers
mult = gf_model_get(md, 'variable', 'mult_on_u');
% mult2 = gf_model_get(md, 'variable', 'mult_on_u');
% get the number of multipliers and DOFs
nb_mult = size(mult,2);
nb_dof = gf_mesh_fem_get(mfu,'nbdof');
% part of the tangent matrix concerning the multipliers
mult_matrix = zeros(nb_dof,nb_mult);
fori = 1:nb_dof
forj = 1:nb_mult
mult_matrix(i,j) = tangent_matrix(nb_mult+i,j);
end
end
% computing the nodal forces by multiplying the multipliers
% with the right part of the tangent matrix
nodalforce = -(mult_matrix*transpose(mult));
% extract the x-, y- components
fori = 0:(size(nodalforce,1)/2)-1
nodalforce_x(i+1) = nodalforce(2*i+1);
nodalforce_y(i+1) = nodalforce(2*i+2);
end
% Associate the forces with the nodes
[nodalforce_x,nodalforce_y] = GetTheForce(md,mfu,'mult_on_u');
F = [nodalforce_x' nodalforce_y'];
ID = gf_mesh_get(magn_mesh, 'pid');
Coor = gf_mesh_get(magn_mesh, 'pts',ID)';
Coor = Coor(1:end,:);
% Plot the forces with segments on nodes
gf_plot(mfdu,VM,'deformed_mesh','on',
'deformation',U,'deformation_mf',mfu,'refine', 4,
'deformation_scale',DEFO_SCALE*100*0*mod(i,2));hold on;
plot([Coor2(:,1)';Coor2(:,1)'+F(:,1)'*1e-4],[Coor2(:,2)';Coor2(:,2)'+F(:,2)'*1e-4])
Result :
As you can see with this result, the forces are not well located as
there are forces outside the boundary.
(The boundary used for the dirichlet condition is the outside of the mesh)
Do anyone have a solution ?
Thank you again,
Simon
**
cid:[email protected]**
**
*SIMON AMEYE*
DQI/DRIA/DSTF/SEPC
Apprenti IFP School
------------------------------------------------------------------------
CENTRE TECHNIQUE VELIZY A /
**
--
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
---------