Moving mesh udf problem
Dear users.
I try to define flapping plate having center gravity moving. I use the simple udf DEFINE_CG_MOTION(foil0, dt, cg_vel, cg_omega, time, dtime) { cg_omega[2] = ThetAmp*ang_vel*cos(ang_vel*time); } The udf hooked to constant center of rotation. However, in my problem, the rotation center is moving as well. My question is: which way can I define move of rotation center. Thank you a lot in advance. |
|
Dear blackmask.
Thank you for so quick and useful response. wXdr = wVdT in i direction and wUdT in j direction, so i changed the udf in following manner: cg_vel[0] = -0.7*w*sin(w*time)+w*cg_vel[1]*dtime; cg_vel[1] = 0.7*w*cos(w*time)+w*cg_vel[0]*dtime; just added linear component. and cg_omega[2] = w*0.7; when 0.7 is r-r0. the result was similar to snail shield. What wrong in my view of the problem? Thank you a lot in advance. |
Dear blackmask.
First of all thank you so much for so informative help collaboration. The general trajectory of rotation center is elliptical. By the way the rotation center is not gravity center in this case. But it is no matter because both of them is known, and gravity center detection is not take place in the udf. Again, thank you a lot for the help. |
Quote:
|
Dear blackmask.
The body has elliptical trajectory in stationary domain, however, orientation of body is not strongly in direction of trajectory but tilted. That a reason why i've thought to move the body relative, say, point [0,0], thereafter rotate it relative new rotation (mass center) position. Unfortunately i can read the mass center of body each time step, but i don't know to define center rotation point via udf. |
I am so sorry that I did not test before I answered your question. The method I proposed before simply does not work. I managed to modify the CoG(CoR) by modifying three (init, tmp, current) state variables at the same time. The body does change the center of rotation, however an abrupt translation of the body is observed at the same time. Below is the code for your reference. The rigid body is a two-dimensional airfoil whose leading and trailing edge point is located at (0, 0) and (1, 0), respectively. It first rotate around (0, 0) at an angular velocity of for one second, and then its center of rotation is changed to . Note that when this UDF is executed, the CoG(CoR) in the GUI is changed accordingly.
Code:
DEFINE_CG_MOTION(from_ori_to_cg, dt, cg_vel, cg_omega, time, dtime) |
Wow,that exactly what i am looking for.
Thank you so much... Tell me pls, where do you take list of all functions, libraries,structures,sub-structures and variables for udf? I have not found it in fluent manual and tutorials? Thank you very much again.... |
Dear blackmask
The code works perfect. However i still have a problem. Ones i use: cg_vel[0] = -ang_vel*sin(ang_vel*time); cg_vel[1] = ang_vel*cos(ang_vel*time); with manually defined rotation center,(in my case is [0,0] i get circular translation. Ones i use: cg_omega[2] = ang_vel; with manually defined rotation center,(in my case is [0.7,0] i get rotation on the place around it selves (because radius vector is 0). What means, ones i change rotation center, translation and rotation should be independent. However it does not happen. I get snail shield trajectory. The code is: #include "udf.h" #define freq 1 #define XAmp 0.7 #define YAmp 0.7 #define ang_vel 2*M_PI*freq DEFINE_CG_MOTION(test, dt, cg_vel, cg_omega, time, dtime) { /*center rotation of body-function of time*/ dt->current_state.cg[0] =XAmp*cos(ang_vel*time); dt->current_state.cg[1] =YAmp*sin(ang_vel*time); dt->init_state.cg[0] = XAmp*cos(ang_vel*time); dt->init_state.cg[1] = YAmp*sin(ang_vel*time); dt->tmp_state.cg[0] = XAmp*cos(ang_vel*time); dt->tmp_state.cg[1] = YAmp*sin(ang_vel*time); /*rotation*/ cg_omega[2] = ang_vel; /*i suppose the rotation does not have effect on body position, only on orientation*/ /*center translation definition-point [0,0]*/ dt->current_state.cg[0] = 0.0; dt->current_state.cg[1] = 0.0; dt->init_state.cg[0] = 0.0; dt->init_state.cg[1] = 0.0; dt->tmp_state.cg[0] = 0.0; dt->tmp_state.cg[1] = 0.0; /*translation-hase effect only on position of body but not on otientation*/ cg_vel[0] = -ang_vel*sin(ang_vel*time); cg_vel[1] = ang_vel*cos(ang_vel*time); } Something incorrect there. Thank you a lot in advance |
You can find that there is no presence of follow lines in the code:
/* * rotation and translation in the absolute reference frame */ DT_NEST_LOC_ROT_P(dt) = FALSE; DT_NEST_LOC_TRAN_P(dt) = FALSE; Because with the lines, code do not pass compilation with next error message: error C2106: '=' : left operand must be l-value may be this is a problem? Thanks |
The following two lines
Quote:
Code:
dt->nested_local_rot_p = FALSE; |
Dear blackmask.
I tried the version and got response: error C2039: 'nested_local_rot_p' : is not a member of 'dynamic_thread_struct' error C2039: 'nested_local_tran_p' : is not a member of 'dynamic_thread_struct' may be i should use additional header (library) and use : DT_NEST_LOC_ROT_P(dt) = FALSE; DT_NEST_LOC_TRAN_P(dt) = FALSE; ??? Thanks |
Which version do you use? In v18 the
Code:
struct dynamic_thread_struct |
I use fluent 16.1
|
Should i hook "dynamesh_tools.h" in some way?
Or it hooked automatically once i use #include "udf.h" |
Tried to add
#include "dynamesh_tools.h" The problem is still.... |
Ok, I have changed fluent version, so with
DT_NEST_LOC_ROT_P(dt) = FALSE; DT_NEST_LOC_TRAN_P(dt) = FALSE; compiling was passed, but it still snail shield trajectory.... |
even with
DT_NEST_LOC_ROT_P(dt) = TRUE; DT_NEST_LOC_TRAN_P(dt) = TRUE; it doesn't works |
They change the data structure across various versions. You can take a look at the header files and find if there is anything you can do about it.
|
All times are GMT -4. The time now is 06:21. |