[Top][All Lists]

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

Re: [Getfem-users] Forces recovery

Subject: Re: [Getfem-users] Forces recovery
Date: Wed, 31 Jan 2018 10:10:57 +0000

C1-Non sensitive


Dear Yves,


Thank you very much for your answer.

I now have a problem with the source term brick :


I have a 2D mesh rotating around the center : (0,0)

I would like to apply a force on all the mesh :

F = R*constant

Where R is the distance with the center of rotation (0,0)


For now, I compute the area of each element ant the distance R, and I apply a source term brick to all elements representing the acceleration force:


Setting all the regions by locating their faces

for i = 1:Rotor.TriNumb

ftri_rand = get(rot_mesh,'faces from cvid',(i+1));

rot_mesh.set_region(20+i, ftri_rand);



Applying a force on each region

for i = 1:Rotor.TriNumb

gf_model_set(md, 'add initialized data', ['VolumicData' num2str(i)], [Rotor.Fx_tri(i),Rotor.Fy_tri(i)]);

gf_model_set(md, 'add source term brick', mim, 'u', ['VolumicData' num2str(i)],20+i);



Do you know how to do so ?


Moreover, I noticed that if I apply a force  'VolumicData' on the 3 edges of each element, the resulting force seems to depend on their length.

Do you know how to apply a force (in Newton) on one element ? Do I need to divide it by the length of the edges ?


Thank you again,


Simon Ameye








Apprenti IFP School








De : Yves Renard [mailto:address@hidden
Envoyé : lundi 29 janvier 2018 15:19
À : SIMON AMEYE - U510180 <address@hidden>; address@hidden
Cc : address@hidden
Objet : Re: [Getfem-users] Forces recovery


>>> Real sender address / Reelle adresse d expedition : address@hidden <<<

Dear Simon,

A priori, you computation seems ok to me. May be apart that you extract mesh vertex indices with gf_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 instance gf_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,


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);

    for i = 1:nb_dof

        for j = 1:nb_mult

            mult_matrix(i,j) = tangent_matrix(nb_mult+i,j);




% 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      

    for i = 0:(size(nodalforce,1)/2)-1

        nodalforce_x(i+1) = nodalforce(2*i+1);

        nodalforce_y(i+1) = nodalforce(2*i+2);



% 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;





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,








Apprenti IFP School






  Yves Renard (address@hidden)       tel : (33)
  Pole de Mathematiques, INSA-Lyon             fax : (33)
  20, rue Albert Einstein
  69621 Villeurbanne Cedex, FRANCE

reply via email to

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