CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Problem storing values at UDM for tranisient dynamic mesh simulation

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By xab

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 15, 2016, 04:06
Default Problem storing values at UDM for tranisient dynamic mesh simulation
  #1
xab
New Member
 
xabi
Join Date: Apr 2015
Posts: 13
Rep Power: 11
xab is on a distinguished road
Hi guys,

I am working on a simulation of a gear rotating inside a tank filled with oil and air just like the attached image. During the simulation I would like to store the moment needed to rotate the gear so I wrote the Compute_Force_And_Moment macro inside my UDF. I would also like to monitor this moment during the simulation so I tried with an UDM but I didn't get reasonable results. I am not really used to work with UDF's so I think it is a problem of the script. Here is the code I am using for the UDF.
#include "udf.h"
DEFINE_CG_MOTION(gear, dt, vel, omega, time, dtime)
{
Domain *domain;
Thread *t;
real x_cg[3],force[3], moment[3];
face_t f;
domain = Get_Domain(1);
t =Lookup_Thread (domain, 5);
omega[2]=100.0;
x_cg[0]=0;
x_cg[1]=0;
x_cg[2]=0;
Compute_Force_And_Moment(domain, t, x_cg, force, moment, TRUE);
begin_c_loop(f,t)
{
F_UDMI(f,t,0)=moment[2];
}
end_c_loop(f,t)
Message ("momento %g \n", moment[2]);
}
I am now trying to simulate the same problem without the VOF model (just with one fluid) to make easier the problem.

Any suggestion?
Thank you in advance, any help would be apreciated.
Xabi
Attached Images
File Type: jpg ezgif.com-crop.jpg (11.1 KB, 4 views)
xab is offline   Reply With Quote

Old   December 15, 2016, 04:11
Default
  #2
xab
New Member
 
xabi
Join Date: Apr 2015
Posts: 13
Rep Power: 11
xab is on a distinguished road
By the way, here is the contour of the UDM after few time steps.
Attached Images
File Type: jpg UDMI result.jpg (47.8 KB, 3 views)
xab is offline   Reply With Quote

Old   December 15, 2016, 08:10
Default
  #3
Member
 
Howard
Join Date: Jun 2012
Posts: 43
Rep Power: 14
twcp0104 is on a distinguished road
You might try writing a file... like a text file... if you separate the values by "\t", it gets in excel pretty easily... I mean like:

FILE *data;
data=fopen("C:\randomAddress\data.txt",w+);
fprintf(data,"%g\t%g\t%g\t%g\t%.5g\t",time,x,y,z,m oment);
fclose(data);


What do you think? would that work?

You could also have a message in the log mid-simulation, if you just want to monitor the moment:

DEFINE_EXECUTE_AT_END(print_log)
{
Message("\n****time: %g\tx: %g\ty: %g\tz: %g\tmoment: %.5g\t",time, x,y,z,moment);

}
twcp0104 is offline   Reply With Quote

Old   December 15, 2016, 09:14
Default
  #4
xab
New Member
 
xabi
Join Date: Apr 2015
Posts: 13
Rep Power: 11
xab is on a distinguished road
First of all, thank you for your replay.

Yes I think it would work but I also would like to be able to plot it and understand how UDMs work. This model it is just a first attempt to familiarize with this kind of simulation (VOF & UDFs) afterwards, I would like to simulate other things such as losses inside a gearbox and others.

I have read in another thread some info about the pointers to the different domains (cell and face) that it might enlighten me a little about using UDM. I'll work a little on that and update the info in case it could be helpful for somebody else.
twcp0104 likes this.
xab is offline   Reply With Quote

Old   December 22, 2016, 05:10
Default
  #5
xab
New Member
 
xabi
Join Date: Apr 2015
Posts: 13
Rep Power: 11
xab is on a distinguished road
Hi again,
Finally I have some results on my simulation. I was using wrong the domain ID and the boundary ID. This is the script that I am using now and it is working.
#include "udf.h"


DEFINE_CG_MOTION(gear, dt, vel, omega, time, dtime)

{

Domain *domain;

Thread *t;
Thread *tc;
real x_cg[3],force[3], moment[3];
cell_t c;

domain = Get_Domain(1);
t =Lookup_Thread (domain, 5);

tc=Lookup_Thread (domain, 1);

omega[2]=100.0;

x_cg[0]=0;
x_cg[1]=0;
x_cg[2]=0;
Compute_Force_And_Moment(domain, t, x_cg, force, moment, TRUE);


thread_loop_c(tc,domain)
{
begin_c_loop(c,tc)
{
C_UDMI(c,tc,0)=moment[2];
}
end_c_loop(c,tc)
}



Message ("momento %g \n", moment[2]);
}
Hope this would help someone
xab is offline   Reply With Quote

Reply

Tags
udf, udmi, vof


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 10:38
Waterwheel shaped turbine inside a pipe simulation problem mshahed91 CFX 3 January 10, 2015 12:19
Dynamic mesh update problem. David FLUENT 3 March 15, 2012 06:02
Dynamic Mesh Problem peatmac FLUENT 9 March 14, 2012 07:11
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55


All times are GMT -4. The time now is 04:19.