CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   CTRANS and DTRANS in 6DOF in fluent (https://www.cfd-online.com/Forums/fluent-udf/72211-ctrans-dtrans-6dof-fluent.html)

SHEHZAD January 28, 2010 12:52

CTRANS and DTRANS in 6DOF in fluent
 
Hey friends,


Does any one know about how to use the custom rotation matrix and derivative rotation matrix in 6DOF module of fluent.


Basically I want to do the cfd analysis of wind turbine blade.the blade does not have 6DOF it has only one degree of freedom so I want to constrain the motion of blade in one axis rotation only.To constrain the motion of a free falling body we need to use transformation matrices.


I have tried it by using certain transformation matrices but the motion is not constrained as by the requirment.

Please if anyone can help me that what is the basic theme behind CTRANS and DTRANS.


I will be really thankful...

dmoroian February 1, 2010 13:30

You may use sliding mesh
 
Hi,
Why do you want to define the rotation matrix and not use the sliding mesh?

Dragos

skshivas February 3, 2010 00:39

Hai,

U can solve wind turbine releated problems using Sliding Mesh Approach. in case if u need any other details please ref the following journal "Wind tunnel and numerical study of a small vertical axis wind turbine"
Robert Howell*, Ning Qin, Jonathan Edwards, Naveed Durrani.

SHEHZAD February 4, 2010 04:34

Thankyou Dragos and Shiva,

Actually I hav done cfd by turbo machinary and moving wall. Here's the reason why i am trying to use rotation matrices instead of sliding meshes.

Basically by using sliding mesh or moving frame of reference or moving wall(in rotation) or turbomachinary module, we need to give the rpm value to the blade. But the RPM value of blade should be the output of the software by the action of air as happens in reality.

This case resembles to degree of freedom of a body. This is only possible in 6DOF in fluent. For wind turbine there is only one DOF(1 axis rotation)
so that i am trying to constrain the motion by using matrices.

Now i am also using another approach by using a udf macro i.e DEFINE_CG_MOTION. If we want to specify the direction of velocity in the code, we write

v[0]=(some formula) /*for x axis of velocity
v[1]=(some formula) /*for y axis of velocity
v[2]=(some formula) /*for z axis of velocity

Similarly

omega[1]= ....... /*y axis rotation ....stc

If u can help me in either the 6DOF approach, or this new one which i described at the end. How can we specify the direction of force in c++ code as like of linear and angular velocity

I will be very thankful to you

dmoroian February 4, 2010 06:49

P=M*omega
 
Hm, what you get from the solver is a positive pressure torque and a negative torque due to drag. If you don't specify the rpm, the turbine will accelerate until the the pressure torque will balance the friction torque, with the result that no output power will be produced.
I imagine that you want to produce some power with it, so basically you can run your turbine with 0 rpm to estimate the torque and then, from the power you want you get a good approximation of the rpm you need.

SHEHZAD February 7, 2010 12:16

sorry i was late to reply
 
Hey dragos thanks for reply again

I need to tell you that wind turbine blade is not too simple as u r understanding about it.

About your statement "you can run your turbine with 0 rpm to estimate the torque".We cannot estimate the torque value at particular rpm(e.g. 0 rpm),because at every RPM value, the AOA of blade with the air changes.In result of that whole pressure distribution across blade changes.So positive pressure torque and negative torque due to drag will not be same at every RPM.

About your statement "from the power you want you get a good approximation of the rpm you need".If i know power output of the blade then why we need to change the shape of the blade(twist and chord) to optimize for power.Means any kind of blade shape can give us the power as it is my estimation(that i want)

please read below i have written the solution

SHEHZAD February 7, 2010 12:46

Hey DRAGOS i am again here

I have done the cfd analysis of blade by using moving wall condition.what i did is that I give certain rpm value to the blade and after convergence i check the forces or moment value on blade in tangential direction. If the value of force is in such direction that it can accelerate the blade to more rpm I increase the rpm value until at one rpm the tangential torque becomes equal to the frictional torque. This is the net rpm value of the blade.I concluded from the results that

power = torque* omega

power will be maximum where product of torque and omega will be maximum.
And it is at one particular value of rpm and at that rpm there will be a torque value and product of both will be maximum here.
This rpm value is not the maximum or minimum but in between value where power is max.

I did not understand about one of your statement "If you don't specify the rpm, the turbine will accelerate until the the pressure torque will balance the friction torque".

How a body can move or rotate or accelerate without using dynamic mesh
Is it possible in using sliding mesh technique, that by just action of air the turbine will accelerate itself

I will be waiting for your kind reply
I will be very thankful to you

dmoroian February 7, 2010 14:35

Hello Shehzad,
First of all I apologise if any of my previous messages offended you in any way, it was definitely not my intention, maybe just my bad english.
Second, what you said in your last message is actually what I had in mind when I wrote the solution:
- run your turbine MRF 0 rpm;
- estimate the torque;
- change the angle of attack (like any modern wind turbine I've seen on the landscape) and increase the rpm to obtain the aimed power;
- estimate the torque again;
- change again the angle of attack and rpm;
- and so on
When I said that your turbine will accelerate, I was thinking at your 6 DOF approach. As you also said this is not possible if you use an MRF or sliding mesh approach since you fix the rpm.

Dragos

SHEHZAD February 10, 2010 01:08

sory DRAGOS
 
Hey Dragos

I am realy sory, my intention was not to make you incorrect or somthing like this. I was just thinking, by me if some one can get help or seek knowledge , i will be happy. Anyway coming to the point

You are now clear about my point. I have already done all thiis kind of CFD that you are telling.this CFD approach requires a no. of itereations by changing the rpm to get the results. As i have already explained in the above posts. But you can see it is an iterative process.

Now i am free for one month before my final presentation.

So what i am wishing for now, is that we should prepare a model() in fluent with the help of UDF , that just by action of air the blade should start moving itself, so that we would be able to get rid of these indirect techniques.Let me explain to you how.

If you just visit an example in fluent UDF manual written below in the macro of DEFINED_CG_MOTION


Example
Consider the following example where the linear velocity is computed from a simple force balance on the body in the x-direction such that

4.5-1
change in velocity = force * dtime /mass


and the UDF is(dont read or understand the UDF i have explained it below)


/************************************************** **********
* 1-degree of freedom equation of motion (x-direction)
* compiled UDF
/* 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;
************************************************** *******
What he is doing here is integrating the pressure around hte body and finding the force by
Force = pressue * area
And then calculating the velocity by explicit Euler formula at every time step.so body is moving by action of forces generating on it.Now if a body can move due to force generation on it then why it cannot rotate.


I am sory Dragos i have written too much.
thank you for reading


SHEHZAD February 10, 2010 01:30

Explanation to new work
 
Hey Dragos

I have done a little bit work on it. Here we also have two surfaces of blade upper and lower surface. We can find the net pressure difference and then force and then velocity. But it is not too simple as the example of piston above

Reson is at each spanwise location airfoil we have different force direction and to convert it into its component towards tangential direction , it requires a lot of search and work

But the work will be very if we are able to get force or the torque value from the fluent at each time step in tangetial direction. For example we have written some thing to compute pressure force on body by looping through all faces.

We can also wrrite some command that will compute the net torque or force on body and in some direction. like

v[0]=(some formula) /*for x axis of velocity
v[1]=(some formula) /*for y axis of velocity


Similarly

omega[1]= ....... /*y axis rotation ....stc


May you help me in finding out such comand or if you may guide me from where i can get the variables list in which we can search about the words that we need to write in codes.

Thank you very much for bearing me too much.
I will be waiting for your kind reply



dmoroian February 10, 2010 05:10

Hello again,
In case you use 6DOF approach, I don't think the DEFINE_CG_MOTION is appropriate since your rotor CG is not moving. Instead I would suggest DEFINE_SDOF_PROPERTIES with
Code:

properties[SDOF_LOAD_M_X] = torque_value_x
(in case the rotation axis is Ox). The value of the torque is:
Code:

torque_value_x = pressure_torque_x-viscous_torque_x-extracted_torque

SHEHZAD February 11, 2010 13:50

Hey Dragos ,thank you very much for reply
I am extremly grateful to you for giving me the correct direction. still I need to discuss some things with you.

The names you have specified

torque_value_x , pressure_torque_x etc

Are these the macros that you are calling for use or these are the physical names of the things that we need to calculate by using some formeulas approach.I have searched about in fluent UDF manual a lot but i did not find any macros like these. If these are the macros I dont know how to attach them because i have tried to write them in my UDF by different ways but every time there is an error(unrecognized identifier).So these do not seems to be macros.Also there are different ways of attaching the macros with UDF.


Second thing is I have a UDF to check the behaviour of body by applying a constant torque value in "properties[SDOF_LOAD_M_X] " the UDF I hav used is correct and compiled

DEFINE_SDOF_PROPERTIES(Blade,prop,dt,time,dtime)

prop[SDOF_MASS]=10.0;
prop[SDOF_IXX]=10.0;
prop[SDOF_IYY]=10.0;
prop[SDOF_IZZ]=15.0;
{ static real t;
SDOF_LOAD_LOCAL = TRUE;
t=50;
prop[SDOF_LOAD_M_Y] = t;
}
printf ("\Blade: updated 6DOF properties");
}

The thing that I was thinking came out to be correct. The blades did rotate due to constant torque value, as well as they translate also in the direction of flow.This happened due to the 6DOF property. I want to constrain its translation and it can be done by using CTRANS and DTRANS matrices.But I dont know what kind of matrix I should use to get rotation only. My rotation axis is negative y axis.

May you help me in giving constrained to the motion of blades.
Also please guide me to some reference litreture or web site where i could get thorough explanation about torque_value_x and 6DOF properties of fluent

I will be grately thankful to you
I will be waiting for your kind reply

dmoroian February 12, 2010 02:57

Hello Shehzad,
The variables I used in my previous message were just descriptive names and not fluent macros. In order to get their values you just have to use the loop described by you few messages above.
I did a test, and if you don't use gravity, then your rotor will not translate, but only rotate with the conditions you impose (torque only).
I'm not aware of any 6dof howto for fluent.

SHEHZAD February 12, 2010 09:54

Hey Dragos

thank you very dragos about all this discussion. This was my first time i ever have gotten help from some one on internet. The experience was very good and interesting.

i have already used zero gravity condition but blades did move due to action of air. But any way

Again thanks for your too much help.Inshallah, In a couple of days i will try to find out the solution. In any case I would able to get the results or not I will tell you about the situation.

Good bye
thanks again for all discussion

skshivas April 6, 2010 08:26

Hey friends,


Does any one know about how to use the 6DOF module of star ccm++ for wind turbine applications.

Basically I want to do the cfd analysis of wind turbine analysis using star ccm++.


I have tried it by 6 dof body methodologies.but i m not able to get the required rpm.Please if anyone can help me that what is the basic theme behind this methods.

I will be really thankful...

SHEHZAD April 6, 2010 13:39

sorry i do not have any knowledge about star ccm++
i have done all the work in fluent to do the cfd analysis of wind turbine

skshivas April 21, 2010 06:00

Hi,

I am using fluent 6.2 for the flow simulation of vertical axis wind turbine. My problem is how to find out the torque from the moment coefficients value. some times the values are too, in high range!!

I am really in dilema as to what to do!



Please help me.

skshivas April 21, 2010 06:03

Dear Shehzad.

I am using fluent 6.2 for the flow simulation of vertical axis wind turbine in sliding mesh methodology. My problem is how to find out the torque from the moment coefficients value. some times the values are too, in high range!!

I am really in dilema as to what to do!



Please help me

SHEHZAD May 30, 2010 13:40

hi shiva

sorry friend i have been there on internet after a long time . so i could not read ur msgs.
fluent does not has capability of constraining the motion of a free falling body in 6dof. so you need to write a UDF for that. Compute_force_And_moment is the name of a macro which integrates the forces and moments on the body that are generated due to the action of air. you can have the resulting motion by using the euler's formula and get the desired motion, whatever direction u required, as i have described in the above posts about the formula and the direction of motion on body.

caohan June 28, 2010 07:28

Quote:

Originally Posted by SHEHZAD (Post 245758)
Hey Dragos ,thank you very much for reply
I am extremly grateful to you for giving me the correct direction. still I need to discuss some things with you.

The names you have specified

torque_value_x , pressure_torque_x etc

Are these the macros that you are calling for use or these are the physical names of the things that we need to calculate by using some formeulas approach.I have searched about in fluent UDF manual a lot but i did not find any macros like these. If these are the macros I dont know how to attach them because i have tried to write them in my UDF by different ways but every time there is an error(unrecognized identifier).So these do not seems to be macros.Also there are different ways of attaching the macros with UDF.


Second thing is I have a UDF to check the behaviour of body by applying a constant torque value in "properties[SDOF_LOAD_M_X] " the UDF I hav used is correct and compiled

DEFINE_SDOF_PROPERTIES(Blade,prop,dt,time,dtime)

prop[SDOF_MASS]=10.0;
prop[SDOF_IXX]=10.0;
prop[SDOF_IYY]=10.0;
prop[SDOF_IZZ]=15.0;
{ static real t;
SDOF_LOAD_LOCAL = TRUE;
t=50;
prop[SDOF_LOAD_M_Y] = t;
}
printf ("\Blade: updated 6DOF properties");
}

The thing that I was thinking came out to be correct. The blades did rotate due to constant torque value, as well as they translate also in the direction of flow.This happened due to the 6DOF property. I want to constrain its translation and it can be done by using CTRANS and DTRANS matrices.But I dont know what kind of matrix I should use to get rotation only. My rotation axis is negative y axis.

May you help me in giving constrained to the motion of blades.
Also please guide me to some reference litreture or web site where i could get thorough explanation about torque_value_x and 6DOF properties of fluent

I will be grately thankful to you
I will be waiting for your kind reply

Hi Shehzad,
Now, I am learning the dynamic mesh and want to use 6DOF to make my fan's rotate. can you tell me what is the different between prop[SDOF_IYY] and prop[SDOF_LOAD_M_Y], by the way, can you calculate the rotational speed when your blades rotate.
Thanks
Han

Randre June 28, 2010 09:42

Hi

DEFINE_SDOF_PROPERTIES with sub macro SDOF_IYY you need to input your rigid body YY Moment of Inertia.
With SDOF_LOAD_M_Y you define a external moment applied to it.

If you want to calculate angular velocity just use DT_OMEGA_CG macro in your UDF and write it to a file.

Check FLUENT udf manual for more details.

mamyjooooon April 9, 2011 12:54

Hello shehzad and...
I have a problem about the
SDOF_ZERO_TRANS e SDOF_ZERO_ROT properties.

i want to solve flow in a radial turbine wheel(with high RPM).
Because the flow work is done on the blades to make the blades rotating,I decided to use dynamics mesh with 6dof.
When I try to compile the UDF,FLUENT shows me:

..\..\src\stage.c(6) : error C2065: 'SDOF_ZERO_TRANS_X' : undeclared identifier
..\..\src\stage.c(7) : error C2065: 'SDOF_ZERO_TRANS_Y' : undeclared identifier
..\..\src\stage.c(8) : error C2065: 'SDOF_ZERO_TRANS_Z' : undeclared identifier
..\..\src\stage.c(9) : error C2065: 'SDOF_ZERO_ROT_X' : undeclared identifier
..\..\src\stage.c(10) : error C2065: 'SDOF_ZERO_ROT_Y' : undeclared identifier

Here there is my UDF
Quote:

#include"udf.h"

DEFINE_SDOF_PROPERTIES(stage, prop, dt, time, dtime)
{

/* Define the mass matrix */

prop[SDOF_MASS] = 0.02;
prop[SDOF_IXX] = 0.000067;
prop[SDOF_IYY] = 0.000067;
prop[SDOF_IZZ] = 0.000288;

/* Define the Degrees of Freedom allowed - Only z rotation is allowed */

prop[SDOF_ZERO_TRANS_X] = TRUE;
prop[SDOF_ZERO_TRANS_Y] = TRUE;
prop[SDOF_ZERO_TRANS_Z] = TRUE;
prop[SDOF_ZERO_ROT_X] = TRUE;
prop[SDOF_ZERO_ROT_Y] = TRUE;
printf (
"\nstage: updated 6DOF properties");
}


Could you help me please?
Thank you. Kind regards, mamadreza

SHEHZAD April 10, 2011 15:14

please read my posts written above, actually fluent does not have facility to constrain the motion of a body in one or two or more dimensions with put writing udf. if u need to constrain the motion of ur turbine in all directions except in z direction, u need to write complete UDF. Compute_force_and_moment is the name of a macro that calculates teh forces and moments around a body due to the action of air or water. with the help of these moments and forces u can get of the motion of the body in the required direction. the movment of body can b calculated from these forces by using euler's forrmula. as i hav mentioned earlier in above posts.

mamyjooooon April 11, 2011 14:47

hi shehzad
tanks for your reply
1-I find no data about Compute_force_and_moment via udf and internet,
so i don't know how to us this macro,
I'll thank you if give me some information on how to use this macro.
2-I can't find any information about forrmula in pervioyus posts
please guid me to certain post.
3-I want to constrain its translation,but I dont know how should do to get rotation only(the rotation axis is z)!
may you help me in giving constrained to the motion of blades?

Thank you for your attention

cuteapathy January 23, 2013 06:48

Dear shehzad and everyone,

I am new and doing the work which is similar to your case. If I ask some stupid questions here, please don't mind.

My first work is that I analyze the velocity and pressure of the wind turbine with fixed velocity of wind and fixed angular velocity of the wind turbine. My geometry is one wind turbine with three blades in a big cylinder. In this case, I used sliding mesh and didn't use dynamic mesh, and the wind turbine blades could rotate well.

And now, my second case is to do the wind-driven wind turbine case. I am wondering whether I need to use dynamic mesh with 6dof instead of sliding mesh. Could I use the the same settings in the first case and apply a UDF file which calculates the angular velocity to the boundary conditions of the blades instead of fixed angular velocity used in the first case. The formula I will use in the UDF file is:

angular velocity = the previous angular velocity + (torque * time step)/ moment of inertia

Can I get the calculated torque by fluent, and then I could use that in my UDF file?

After reading this thread, I am really confused how to do my second case. If someone can kindly give me some advice or guide, I will be thankful and appreciate your help very much.

Best Regards,
Michelle


All times are GMT -4. The time now is 16:00.