|
[Sponsors] |
November 1, 2014, 12:56 |
|
#21 | |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26 |
Quote:
So first thing is to calculate the function source you want to apply inside the tank, something like source=f(time, other variables you want to include), expressed in N/m3. Then, I suggest to read the fluent udf manual and look at examples. Macros such as C_R(c,t) and C_U(c,t) are described in the udf user manual. |
||
November 2, 2014, 05:30 |
|
#22 |
Member
Join Date: Sep 2014
Posts: 43
Rep Power: 11 |
Thanks for the help and I'm sorry for the too many questions that I ask you
Ok, I'm reading the manual and approaching to create the source file udf but I'm probably getting wrong...actually my code is this one for example: #include "udf.h" #define w 1 #define a 0.1 #define ph 0 DEFINE_SOURCE(xmom_src,c,t,dS,eqn) { real source; real time=RP_Get_Real("flow-time"); if (time < 5) { source = -w*a*sin((w*time) + ph); dS[eqn] = -w*w*a*cos((w*time) + ph); } else source = 0; return source; } I've set as constants the initial phase (0), omega (1) and amplitude (0.1) and the time step size as 5 seconds. Which corrections have I to add for my purpose? |
|
November 2, 2014, 08:27 |
|
#23 |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26 |
The "source" in your udf must have unit N/m3 (force/volume): did you check it?
dS[eqn] is derivative of "source" in respect to the dependent variable of the transport equation (v(x)): did you check it? Even if time >5 you have to assign dS[eqn]. What do you mean by "initial phase"? |
|
November 2, 2014, 09:04 |
|
#24 |
Member
Join Date: Sep 2014
Posts: 43
Rep Power: 11 |
How can I convert a sinusoidal velocity to N/m3? The only parameters known are these ones: amplitude, phase and pulsation (or frequency, is the same).
The initial phase is the delay/advance ("ritardo/anticipo") regarding the start position of the sine curve. |
|
November 2, 2014, 09:24 |
|
#25 |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26 |
Answers to your questions are partially in the post I reported.
More into details N/m3 is a force in respect to a volume and it's expressed in SI units as (kg*m/s2)*(1/m3). This is the same as multiply acceleration (m/s2) by density (kg/m3). If you have the velocity you can calculate the function for acceleration: accelaration is the variation of the velocity in respect to time, in other words simply d(velocity)/d(time). Then calculate dS as I wrote. So what you have to do is to define two udf: one for x momentum source, with acceleration function that multiply density (C_R(c,t)); one for y momentum source, with gravity force that multiply density. Otherwise, only one udf for x momentum source, but enbable in fluent gui gravity in (-)y direction. |
|
November 2, 2014, 12:19 |
|
#26 |
Member
Join Date: Sep 2014
Posts: 43
Rep Power: 11 |
Okok, now I've understood how to approach the problem better!
So, at first I've to convert the physical quantity that I want to apply in momentum as N/m3, next I define the variable "source" as the quantity previously calculated, and at last "dS[eqn]" represent the derivative of the "source" respect to the velocity...is it right? I've modified the udf code as this one: #include "udf.h" #define w 1 #define a 0.1 #define ph 0 DEFINE_SOURCE(xmom_src,c,t,dS,eqn) { real source; real time=RP_Get_Real("flow-time"); if (time < 5) { source = (-w*w*a*cos((w*time) + ph))*C_R(c,t); dS[eqn] = w*cot((w*time) + ph)*C_R(c,t); } else source = dS[eqn] = 0.; return source; } Are there errors in the formulas? The input quantity is the same sinusoidal velocity: v(t)=-w*a*sin((w*t)+ph)...thanks for the help |
|
November 2, 2014, 12:32 |
|
#27 | |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26 |
Equation for x momentum source seems correct to me.
dS[eqn] is dS/d(vx) so in my opinion it should be 0. Quote:
Last edited by ghost82; November 3, 2014 at 04:45. |
||
November 2, 2014, 12:50 |
|
#28 |
Member
Join Date: Sep 2014
Posts: 43
Rep Power: 11 |
Ah okok, I thought that dS[eqn] was different to 0 because, being the source (acceleration)*(density) and acceleration = (velocity/time), it contains the velocity expression inside of it...essentially I have multiplied and divided the source expression for " sin((w*time) + ph) " to point out the velocity expression.
|
|
November 2, 2014, 15:19 |
|
#29 |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26 |
Maybe you are right, but I'm not 100% sure. Maybe someone else knows.
If it is right, use 1/tan instead of cot.
__________________
Google is your friend and the same for the search button! Last edited by ghost82; November 3, 2014 at 04:17. |
|
November 3, 2014, 04:22 |
|
#30 |
Member
Join Date: Sep 2014
Posts: 43
Rep Power: 11 |
I've tried this type of udf and it works! Only I've explouted the cotangent expression because in udf cotangent command isn't detectedby fluent. Thanks for your help
Now I wanna use for example angular velocity, but I think that this approach "cell to cell" isn't optimal in this case, because effects as centrifugal and coriolis forces are neglected... So how can I resolve this problem? If I would use newly the Dynamic mesh, is it possible applicate the force/movement (translational or angular) to the tank, and so to the water, without deforming the cells? Essentially: the water inside the tank moves, but the initial quad-cells of the tank don't deform. It would be a more precise model |
|
November 3, 2014, 04:33 |
|
#31 |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26 |
Yes, I just commented the above post for cot
Why are you saying centrfugal and coriolis forces are neglected? As far as I know these forces are automatically calculated: you have to define the center and the axis of rotation in the fluid zones. |
|
November 3, 2014, 05:01 |
|
#32 |
Member
Join Date: Sep 2014
Posts: 43
Rep Power: 11 |
Exactly, I didn't notice it!
So are considered all the forces related to the movement imposed? I thought that the effect of coriolis (as centrifugal/centripetal effects) should be an effect regarding the entire structure, not the single cells...but I'm not sure of this. So applying this method to rotational method is reliable? For the udf setting, I can use the same structure of previous code changing constants, source and dS[eqn] terms, right? To have a complete control of the problem, is it possible to apply the dynamic mesh to move the tank without deforming the cell's geometry? |
|
November 3, 2014, 05:11 |
|
#33 | ||||
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26 |
Quote:
Quote:
Quote:
Quote:
However I think the best solution is to apply sources to momentum equation. |
|||||
November 3, 2014, 05:38 |
|
#34 |
Member
Join Date: Sep 2014
Posts: 43
Rep Power: 11 |
Okok, I will try this approach to various cases and I'll let you know
Now I've understood, but I've to set a particular condition to avoid the cell's deformation with this scheme or it's automatic after created the outer domain? Are static also the upper and bottom walls of the outer domain, or only its left and right walls as in the sketch? Another idea: is it possible to extend the outer domain also up and down respect to the tank? So simultaneously I could apply more velocity vectors (for example) in different directions without the problem of cell's deformation. |
|
November 3, 2014, 05:43 |
|
#35 | |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26 |
Quote:
You can extend outer domain the way you want. |
||
November 6, 2014, 17:30 |
|
#36 |
Member
Join Date: Sep 2014
Posts: 43
Rep Power: 11 |
Hi ghost82, I ve tried these days applying dynamic mesh with walls as rigid body and also the default_interior as rigid body, but it doesn't run.
In fact the tank moves but the fluid inside remain at the initial relax position with no sloshing...how can I resolve the problem? Thanks for the help |
|
November 6, 2014, 17:32 |
|
#37 |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26 |
I have to try, not soon, but I'll let you know.
You can try to set as rigid body not the default interior but the fluid zone name.
__________________
Google is your friend and the same for the search button! |
|
November 6, 2014, 17:38 |
|
#38 |
Member
Join Date: Sep 2014
Posts: 43
Rep Power: 11 |
I obtain the same result....ok thanks, for now I post newly the question because I have to go on with my thesis
|
|
November 10, 2014, 16:58 |
|
#39 |
Member
Join Date: Sep 2014
Posts: 43
Rep Power: 11 |
Hi ghost82, returning to the momentum source method to simulate sloshing, how can I write the udf for the rotation source, defining the centre of rotation and the axis? For example, if I want apply the rotation to the centroid of the tank, which commands I've to use?
|
|
November 11, 2014, 08:36 |
|
#40 |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26 |
Hi!
I think that if you want to simulate rotation around a central axis of a 2d rectangle you are assuming a cilindrical tank. If this is not your case I think you have to simulate a 3d geometry. I think there's no need to write udf if your tank rotates at a constant angular velocity (here you simulate steady state solution): assuming your rectangle is centered in xy plane, set up your case with gravity in -y direction and you're ready to go. If you want to do a transient simulation then angular velocity starts from 0 rad/s and reach xx rad/s, so you have equation for angular velocity in respect to time; so, follow what you have done for translational motions. This is for axisymmetric: http://aerojet.engr.ucdavis.edu/flue...ug/node399.htm
__________________
Google is your friend and the same for the search button! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
water sloshing in oscillating tank (problem using udf Define_ZONE_MOTION) | Tamsu | Fluent UDF and Scheme Programming | 8 | November 24, 2021 00:11 |
Filling Tank with Water | leff | CFX | 7 | August 21, 2017 07:47 |
Simple Water Tank Transient | 88phil88 | CFX | 5 | March 17, 2014 03:48 |
Mixture and Decay of a tracer in a Water Tank | Jeffrey1992 | CFX | 2 | July 27, 2012 13:31 |
uptodate water distribution network | fredius,magige,tanzanian,(e.a) | Main CFD Forum | 0 | January 27, 2002 07:10 |