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

code in dynamic meshing udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 9, 2011, 05:05
Default code in dynamic meshing udf
  #1
Senior Member
 
raymond
Join Date: Nov 2009
Posts: 149
Rep Power: 17
wlt_1985 is on a distinguished road
I have gone through the UDF reference guide provided by FLUENT and the following is the dynamic mesh UDF in the reference guide.

/************************************************** **********
* 1-degree of freedom equation of motion (x-direction)
* compiled UDF
************************************************** **********/
#include "udf.h"
static real v_prev = 0.0;
DEFINE_CG_MOTION(piston,dt,vel,omega,time,dtime)
{
Thread *t;
face_t f;
real NV_VEC(A);
real force, dv;
/* reset velocities */
NV_S(vel, =, 0.0);
NV_S(omega, =, 0.0)
;
if (!Data_Valid_P())
return;
/* get the thread pointer for which this motion is defined */
t = DT_THREAD(dt);
}
/* compute pressure force on body by looping through all faces */
force = 0.0;
begin_f_loop(f,t)
{
F_AREA(A,f,t);
force += F_P(f,t) * NV_MAG(A);
}
end_f_loop(f,t)
/* compute change in velocity, i.e., dv = F * dt / mass
velocity update using explicit Euler formula */
dv = dtime * force / 50.0;
v_prev += dv;
Message ("time = %f, x_vel = %f, force = %f\n", time, v_prev,
force);
/* set x-component of velocity */
vel[0] = v_prev;
}

I am facing difficulties in understanding the UDF written especially as red-marked as above. Can please anyone explain the meaning for me? Thanks for your help.

Best regard
wlt_1985 is offline   Reply With Quote

Old   April 10, 2011, 12:57
Default
  #2
New Member
 
Petrut Teodor
Join Date: Feb 2010
Location: Romania
Posts: 12
Rep Power: 16
teopetre is on a distinguished road
The utility NV_V or NV_S performs an operation on two vectors.
NV comes from Normal Vector, NV_MAG(A) returns the magnitude of area faces.
NV_S initializes the velocity vector and angular velocity vector with the scalar 0 value, S is from scalar. Variable v_prev is a static variable.
NV_V(a, =, x);
a[0] = x[0]; a[1] = x[1]; etc.
Note that if you use + = instead of = in the above equation, then you get
a[0]+=x[0]; etc.

See the fluent manual at http://jullio.pe.kr/fluent6.1/help/pdf/udf/fl61udf.pdf chapter 6 section 6.

Last edited by teopetre; April 10, 2011 at 13:51.
teopetre is offline   Reply With Quote

Old   April 10, 2011, 22:06
Default
  #3
Senior Member
 
raymond
Join Date: Nov 2009
Posts: 149
Rep Power: 17
wlt_1985 is on a distinguished road
Quote:
Originally Posted by teopetre View Post
The utility NV_V or NV_S performs an operation on two vectors.
NV comes from Normal Vector, NV_MAG(A) returns the magnitude of area faces.
NV_S initializes the velocity vector and angular velocity vector with the scalar 0 value, S is from scalar. Variable v_prev is a static variable.
NV_V(a, =, x);
a[0] = x[0]; a[1] = x[1]; etc.
Note that if you use + = instead of = in the above equation, then you get
a[0]+=x[0]; etc.

See the fluent manual at http://jullio.pe.kr/fluent6.1/help/pdf/udf/fl61udf.pdf chapter 6 section 6.

Thanks a lot, Teopetre. What is 0.0? Is it value of zero? What is the difference between 0 and 0.0?

Best regard
wlt_1985 is offline   Reply With Quote

Old   April 21, 2011, 15:33
Default Very good question!
  #4
New Member
 
Petrut Teodor
Join Date: Feb 2010
Location: Romania
Posts: 12
Rep Power: 16
teopetre is on a distinguished road
I've never noticed this fact, I'm not quite sure about the answer I'm gonna give it to you: those capital letter functions you have in your program are in fact calling functions from the Fluent's code programming Scheme, a LISP dialect, and this programming language doesn't make any difference between integer, real or floating point numbers. So, '0.0' and '0' are the same working variable type in Scheme. You may try putting just '0' to see what's happening, both in 2d and 2ddp.
Sorry for the late intervention.
teopetre is offline   Reply With Quote

Reply


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
UDF CG_MOTION rotation dynamic mesh Mads FLUENT 2 April 15, 2014 04:30
negative cell volume during dynamic meshing Tamjid FLUENT 1 September 5, 2011 03:33
Is there a free CFD code with dynamic mesh? lzgwhy Main CFD Forum 0 September 18, 2010 03:37
Dynamic Meshing James FLUENT 0 May 31, 2004 08:27
Design Integration with CFD? John C. Chien Main CFD Forum 19 May 17, 2001 16:56


All times are GMT -4. The time now is 10:05.