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? 
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 xdirection at the current time step? 
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. 
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 
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. 
2 Attachment(s)
Quote:
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? 
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! 
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.

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..

Quote:

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. 
Ahh, i see. Acceleration is not constant. Please ignore last post.

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. 
Quote:
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] 
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. 
acceleration is a function of the flow solution and so it is being updated every time step

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 10:33. 