CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   CFX (http://www.cfd-online.com/Forums/cfx/)
-   -   how to use velocity of current time step in next time step to update it (http://www.cfd-online.com/Forums/cfx/123922-how-use-velocity-current-time-step-next-time-step-update.html)

aks September 24, 2013 09:24

how to use velocity of previous time step in current time step to update it
 
Hi,
I am trying to use simple formula: v =u + at,
Well i am doing transient channel flow case in CFX. I want to update the velocity of a moving object using the velocity of this body at the previous time step.
I know the value of acceleration (a), i know the time step(t), well i tried finding (u) using expression: ave(Velocity)@object but it is giving wrong results.
So, I need to know the velocity of the object(moving wall) at the previous time step to get the updated velocity at the current time step.

How can i get the velocity of the moving object at the current time step in CFX using expressions or something else?

aks September 24, 2013 10:29

i tried using (a) minVal(Velocity u)@object
(b) maxVal(Velocity u)@object
(c) ave(Velocity u)@object
(d) probe(tried at different point on the moving wall ) and each result of the probe is also a different value. ??
(e) areaAve(Velocity u)@object


These five expressions are giving totally different values (although it is a rigid moving wall)??
So, what should be the correct expression that gives the correct velocity of the rigid moving wall in x-direction at the current time step?

evcelica September 24, 2013 16:23

Pulling out velocity values would give you the conservative velocity values for the adjacent fluid, not the wall itself.
What does your geometry look like? It's hard to imagine exactly what you are trying to do.

aks September 24, 2013 22:35

i am just trying a simple case of a rectangular channel with upper wall moving but with variable velocity. and iam trying to find the velocity of the upper wall . i know the force acting on the wall, mass of the wall is known,
so acceleration = force/mass
and velocity of next time step should be:
vnew=vold + acc.*dt

where vold is the velocity at the current time step
and vnew is the velocity at the next time step

i am using moving wall option in boundary conditions for the upper wall of the channel. and using an expression for it i.e. vnew instead of a fixed velocity

evcelica September 27, 2013 00:11

OK I see what you are trying to do.
Since you know WallVelocity = WallVelocity + Force*dt/mass.
I'm not sure if this would work but you could write an expression just like this that redefined WallVelocity each time step. You would have to initialize WallVelocity to zero using a step of if statement WallVelocity*(step(t/1[s]-0.0000001))+Force*dt/mass.
Again I'm not sure if it will overwrite the variable each time step as expected.

Another way to do this would be to run multiple steady state runs using input/output parameters, and develop a function for force vs. wall velocity, then solve your function yourself to find the transient velocity of the wall.

aks September 27, 2013 23:42

2 Attachment(s)
Quote:

Originally Posted by evcelica (Post 453822)
Again I'm not sure if it will overwrite the variable each time step as expected.

I ran a transient simulation by using expression for the upper moving wall velocity but the acceleration and velocity variation with time are somewhat unexpected as acceleration is negative but the velocity is still increasing???
i am attaching the images , please take a look, it does not seem to be correct???
can you tell what can be the reason for this?

oldvel=areaAve(Velocity u)@movingwall

newvel=oldvel+(acc*dt)

I thinks as you said it is giving only conservative velocity values for the adjacent fluid and not of the moving wall itself...
So is there any way of getting the velocity of the moving wall itself?

aks September 28, 2013 13:03

Hi Erik,
i also tried using "Update Loop = TRANS_LOOP" and created a new AV by the name oldvel. and then initialized it by giving it a zero value, and
used expression newvel in the B.C. for moving wall where

newvel=areaAve(oldvel)@movingwall + (acceleration*dt)

and tried running the simulation

but it is giving error that oldvel is not available for B.C. of the movingwall
Error processing expression 'global frame vector associated with Wall U'.
The expression is invalid because:
oldvel is not available for use in this term

Error processing expression(s):
Wall U = velnew
Wall V = 0 [m s^-1]
Wall W = 0 [m s^-1]

Hope anyone got some solution for my problem!

evcelica September 30, 2013 10:03

Those functions you use for oldVel with expressions will give you the fluid velocity adjacent to the wall, not the velocity of the moving wall. Read my posts over again, I don't think you tried what I suggested.

aks September 30, 2013 11:03

i need to run a transient case as i need the transient data for analysis. So, i cannot try the steady state cases but i will try the other option you suggested to use if statement and hope it works. I will let you know as soon as i am done with it. Thanks for your suggestion..

aks October 2, 2013 01:07

Quote:

Originally Posted by evcelica (Post 453822)
OK I see what you are trying to do.
Since you know WallVelocity = WallVelocity + Force*dt/mass.

But i get an error regarding cyclic usage ie. usage of Wallvelocity on both sides of the equation.?

singer1812 October 2, 2013 09:53

Why do you need to do this? You are prescribing a wall velocity with a known acceleration and equation.

This is fully prescribed using a single CEL equation that doesnt need to keep track of old values.


You just need to put in the initial velocity (v0) and let time do its thing

Uwall=v0+a*t

Nothing magic needed for this.

singer1812 October 2, 2013 09:56

Ahh, i see. Acceleration is not constant. Please ignore last post.

singer1812 October 2, 2013 09:59

How are you initializing the variable with the Tranloop set?

Typically you have to run a fake 1 iteration run without the logic that calls the transloop variable and then use that run to initialize your real run.

aks October 2, 2013 10:58

Quote:

Originally Posted by singer1812 (Post 454700)
How are you initializing the variable with the Tranloop set?

Typically you have to run a fake 1 iteration run without the logic that calls the transloop variable and then use that run to initialize your real run.

Hi Edmund,
i ran 1 fake iteration by setting zero velocity in the additional variable but then i also had to set the velocity of the movingwall equal to some fixed value to run it and then took the result file as the initial conditions and changed the value of the wall velocity to variable 'newvel' and also set AV by expression 'oldvel' but again the error comes:

Error processing expression 'global frame vector associated with Wall U'.
The expression is invalid because:
oldvel is not available for use in this term

Error processing expression(s):
Wall U = velnew
Wall V = 0 [m s^-1]
Wall W = 0 [m s^-1]

singer1812 October 2, 2013 11:04

is your acceleration a function of the flow solution, or is it just the curve you show in the graph (i.e. known apriori).

If it is known a priori, I go back to my post a few posts before, and say, just put in the Vwall curve. No need to have CFX calcuate that out for you. Do it off line.

aks October 2, 2013 11:09

acceleration is a function of the flow solution and so it is being updated every time step

murx October 16, 2013 07:14

I am facing the same problem. Is there really no way to fix this?

I believe that a while ago, I found a document that said something about an expert parameter that allows CFX to use the hybrid values in functions like areaAve(...).

Also, in another thread I read that there is the possibility to change the "dependency lists" for the additional variable which could possibly fix the error quoted by aks. Can anyone give me some advice on that?

Thanks!
Max


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