derivative in CEL expressions
Hi
How can I use derivative or gradient in CEL expressions? I need to use derivative of velocity with respect to time in one of my boundary conditions. Regards 
Guess it requires user fortran.

Read the documentation about derivative and gradient functions. But you are out of luck  CEL does not support time derivatives. You might be able to grab the variable from something else eg the time derivative of mass is a mass flow rate and MFR can be read directly. If that is not possible then you will have to use fortran.

Actually, you can get the Time Derivative of variables, but you have to employ user fortran (e.g. a User CEL Function). For example:
... CALL USER_GETVAR('Water.Temperature.Time Derivative',CRESLT, & pTDer,CZ,DZ,IZ,LZ,RZ) ... 
Actuallly you can get the derivative from last time step to current time step via use of additional variables settings. If you create an additional variable of the velocity, and add the term using ccl in the ADDITIONAL VARIABLE term:
Update Loop = TRANS_LOOP This will cause that variable to take the old value of the velocity. You can use it to create your derivative. 
That is a nice trick Edmind, I did not know that one. Very useful.

I didn't get it right. Still I need to use USER_FORTRAN. isn't it?

No need to use user Fortran. As an example, edit the additional variable in your LIBRARY with the update loop as follows:
ADDITIONAL VARIABLE: OldVel Option = Definition Tensor Type = SCALAR Units = [m s^1] Variable Type = Specific Update Loop = TRANS_LOOP END You can then use this to create your derivative. 
Thank you very much edmund!

Hello,
could this procedure be also used to sum the calculated velocities for every time step in the past? How could this be achieved anyway? Thank you! Matjaz 
Yes this can. But you need to initialize the variable with a separate artifical run.
For example if you use additional variable Q=Q+1, this will work fine except for the first iteration if Q hasn't been intialized, because CFX will complain that Q doesnt exist for the right hand side of the equation. CFX doesn't let you initialize an algebraic AV (at least at V12.1, havent checked into V13). The workaround is to run a sinlge iteration with the AV set to zero. This result will be saved to the res file. On the next run you set up your AV with the summing expression and use the res file from the first run to initialize it 
Thank you very much, exactly that happens in my Ansys v13.
Regards, Matjaz 
Hello,
another question regarding my problem, could this accumulation of delta velocities from all the previous timesteps using this technique, my AV can not be used as a source velocity for the current timestep. Is it possible to pass it around? Thank you, Matjaz 
I am unclear on what you are asking.

I can not use my AV as a source for a velocity at a start of next time step. Should there be used some callback function, as areaAve, which would return a value? Even when i try to monitor the value during the run, i recive an error, because the AV isn't single valued or sth. like that.
I don't know much about these additional variables, haven't use them much. Regards, Matjaz 
Ohh, yes of course. Use one of the functions to evaluate it and make it single valued.

Hello, i still need some more guidelines for this procedure;
I did edit my AV in cmd editor with trans_loop, then checked name of this AV in both of my domains, where i also wrote expression for AV: velocity = velocity + delta_velocity. Then i created new expression, using areaAve of AV on a 2d locator in my moving domain, and created monitor point of that expression. Unfortunately simulation runs, but my velocity doesn't sum all the previous ones, or it does it much too slow. Did I miss something here? Thank you, Matjaz 
Where are you getting your delta_velocity from?

I get it from user fortran routine, it works fine, just need to accumulate all the past values for current time stem; my trouble is, that i can not save it to a file, but also don't want to bother with mms, which i'm also not familiar with.

You are getting it from a fortran routine that you are calling while CFX is running (User Fortran?)
Or are you getting it from a preran fortran routine, and delta_velocity is already set for the CFX run. 
All times are GMT 4. The time now is 06:55. 