Dear Andriy, I tried this before but this brick is not available in my 2010 getfem version, that I use to get rid of the difficult installation of the 2017 one. (Windows and Matlab) However, the following code for example, returns the correct Y coordinates of all the nodes in my mesh and not only the first one.

## Advertising

get(mfd, 'eval', {'y'}) >>ans: Columns 1 through 2100 0.0014 0.0017 0.0018 0.0014 0.0020 0.0016 0.0010 0.0021 0.0015 0.0006 0.0022 ... Once I calculated the force for each node, I set it as VolumicData in the source term brick. Moreover, the result is very similar to the one I get with my previous way of doing. Your solution is very elegant and I will use on gf2017, but are you sure there is a problem with mine ? Best regards, Simon De : Andriy Andreykiv [mailto:andriy.andrey...@gmail.com] Envoyé : jeudi 1 février 2018 18:50 À : SIMON AMEYE - U510180 <simon.am...@mpsa.com> Objet : Re: [Getfem-users] Centrifugal force >>> Real sender address / Reelle adresse d expedition : >>> andriy.andrey...@gmail.com<mailto:andriy.andrey...@gmail.com> <<< ________________________________ Dear Simon, It's sure fast, but I'm not entirely sure it's correct. You see, "X" is a keyword in generic assembly that defines a current coordinate. You're using x and y and I don't think they are recognized as coordinates. In your case only "X(1)" and "X(2)" would be recognized as what you mean by x and y. You also don't need to add each body force component separately. As I suggested before "constant * X" is already an expression you can use in the assembly. Hence, you need to add your "constant" as a scalar data. Then you need to use a generic brick: ind = gf_model_set(model M, 'add source term generic assembly brick', mesh_im mim, string expression[, int region]) and instead of string expression pub "constant * X" with constant already in the model. Best regards, Andriy On 1 February 2018 at 12:39, SIMON AMEYE <simon.am...@mpsa.com<mailto:simon.am...@mpsa.com>> wrote: Here it is ! Thank you very much Andriy ! It is so fast now! F = Rho * W^2 * Distance_with_center.*Projection_On_[x or y] FX = get(mfd, 'eval', {[num2str(Rho),'.*',num2str(Rotat_Speed),'.^2.*(x.^2+y.^2).^0.5 .*x./((x.^2+y.^2).^0.5)']}); FY = get(mfd, 'eval', {[num2str(Rho),'.*',num2str(Rotat_Speed),'.^2.*(x.^2+y.^2).^0.5 .*y./((x.^2+y.^2).^0.5)']}); gf_model_set(md, 'add initialized fem data', 'VolumicData', mfd, [FX;FY]); gf_model_set(md, 'add source term brick', mim, 'u', ['VolumicData']); Have a nice day, Simon De : Andriy Andreykiv [mailto:andriy.andrey...@gmail.com<mailto:andriy.andrey...@gmail.com>] Envoyé : jeudi 1 février 2018 17:29 À : SIMON AMEYE - U510180 <simon.am...@mpsa.com<mailto:simon.am...@mpsa.com>> Objet : Re: [Getfem-users] Centrifugal force >>> Real sender address / Reelle adresse d expedition : >>> andriy.andrey...@gmail.com<mailto:andriy.andrey...@gmail.com> <<< ________________________________ Dear Simon, OK, I understand you cannot use axisymmetry. Yes, you can assign any source term in one step. Source term brick doesn't assign force, it assigns traction or volume specific force, hence you don't need to calculate the area/volume of the element, as the expression you are going to calculate is going to be integrated over the the element (hence, multiplied by the volume/area already). So, you don't set the expression on the nodes, it will be integrated and subsequently assembled into the nodes. One way I think you can assign centrifugal body force is by setting the source term expression simply as "constant * X". High level assembly treats "X" as a vector of coordinates. So, "constant * X" gives you a force with magnitude "R * constant" directed away from (0, 0). I hope this helps, Andriy On 1 February 2018 at 10:49, SIMON AMEYE <simon.am...@mpsa.com<mailto:simon.am...@mpsa.com>> wrote: Dear Andriy, Thank you for your quick answer, Unfortunately, my mesh is not axisymmetric. I need to take into account the 2D shape of my mesh. My question was about the ways of applying centrifugal force on it. But here may be one solution : I just noticed that if I use the standard source term brick I can apply all the forces I previously calculated on the nodes in only one step! But I don't understand why the applied force resulting is so low. gf_model_set(md, 'add initialized fem data', 'VolumicData', mfd,[Fx_On_nodes,Rotor.Fy_On_nodes] ); gf_model_set(md, 'add source term brick', mim, 'u', ['VolumicData']); Do you have any idea ? Or another way to do so ? Thank you again for your help, Simon De : Andriy Andreykiv [mailto:andriy.andrey...@gmail.com<mailto:andriy.andrey...@gmail.com>] Envoyé : jeudi 1 février 2018 16:34 À : SIMON AMEYE - U510180 <simon.am...@mpsa.com<mailto:simon.am...@mpsa.com>> Cc : getfem-users@nongnu.org<mailto:getfem-users@nongnu.org>; philippe.marchne...@gmail.com<mailto:philippe.marchne...@gmail.com> Objet : Re: [Getfem-users] Centrifugal force >>> Real sender address / Reelle adresse d expedition : >>> andriy.andrey...@gmail.com<mailto:andriy.andrey...@gmail.com> <<< ________________________________ Dear Simon, I think one way to greatly speed up your program is to take into account the axi-symmetry of your problem. Getfem fully supports it. That would mean that you can reduce your 2D problem to 1D. You can create a simple line mesh, but using a type torus_mesh and subsequently create torus_mesh_fem on it. Then you need to apply your force on a single edge/point of your mesh. Best regards, Andriy On 1 February 2018 at 08:35, SIMON AMEYE <simon.am...@mpsa.com<mailto:simon.am...@mpsa.com>> wrote: Hi all, I am asking for help again about my computation, that now works fine thanks to you, but slowly. My 2D mesh represents a part that is spinning around a point (0,0). To considerate the centrifugal force, I now calculate the area of each element, and apply a force using "source term brick" on its boundaries. The problem is that add 2000 sources terms for 2000 elements is slow. Do you have any idea of which brick I need to use to set the force in one step ? The centrifugal force is described this way : " F=constant*R " where R is the distance between the rotation point and the element. To get an idea about my actual code, here it is : Setting all the regions by locating the faces for i = 1:NumberOfElements ftri_rand = get(rot_mesh,'faces from cvid',(i+1)); rot_mesh.set_region(i, ftri_rand); end Applying a force on each region for i = 1: NumberOfElements gf_model_set(md, 'add initialized data', ['VolumicData' num2str(i)], [Fx_tri(i), Fy_tri(i)]./Perimeter(i)); gf_model_set(md, 'add source term brick', mim, 'u', ['VolumicData' num2str(i)], i); end Thank you again for your help, Simon Ameye [cid:image001.png@01D193D3.0D03A420] SIMON AMEYE DQI/DRIA/DSTF/SEPC Apprenti IFP School ________________________________ CENTRE TECHNIQUE VELIZY A /