
[Sponsors] 
November 28, 2010, 00:47 
derivative in CEL expressions

#1 
Senior Member
ali
Join Date: Oct 2009
Posts: 268
Rep Power: 10 
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 

November 28, 2010, 15:09 

#2 
Senior Member
Join Date: Mar 2009
Location: Europe
Posts: 168
Rep Power: 10 
Guess it requires user fortran.


November 28, 2010, 18:02 

#3 
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 13,616
Rep Power: 105 
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.


November 30, 2010, 05:03 

#4 
Member
Join Date: Dec 2009
Posts: 44
Rep Power: 9 
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) ... 

November 30, 2010, 19:03 

#5 
Senior Member
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 512
Rep Power: 13 
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. 

November 30, 2010, 19:25 

#6 
Super Moderator
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 13,616
Rep Power: 105 
That is a nice trick Edmind, I did not know that one. Very useful.


December 1, 2010, 02:33 

#7 
Senior Member
ali
Join Date: Oct 2009
Posts: 268
Rep Power: 10 
I didn't get it right. Still I need to use USER_FORTRAN. isn't it?


December 1, 2010, 10:44 

#8 
Senior Member
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 512
Rep Power: 13 
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. 

December 1, 2010, 10:54 

#9 
Senior Member
ali
Join Date: Oct 2009
Posts: 268
Rep Power: 10 
Thank you very much edmund!


April 4, 2011, 09:05 

#10 
New Member
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 8 
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 

April 4, 2011, 09:32 

#11 
Senior Member
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 512
Rep Power: 13 
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 

April 4, 2011, 10:12 

#12 
New Member
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 8 
Thank you very much, exactly that happens in my Ansys v13.
Regards, Matjaz 

April 5, 2011, 03:59 

#13 
New Member
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 8 
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 

April 5, 2011, 09:28 

#14 
Senior Member
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 512
Rep Power: 13 
I am unclear on what you are asking.


April 5, 2011, 10:04 

#15 
New Member
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 8 
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 

April 5, 2011, 10:24 

#16 
Senior Member
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 512
Rep Power: 13 
Ohh, yes of course. Use one of the functions to evaluate it and make it single valued.


April 6, 2011, 05:18 

#17 
New Member
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 8 
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 

April 6, 2011, 09:27 

#18 
Senior Member
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 512
Rep Power: 13 
Where are you getting your delta_velocity from?


April 6, 2011, 09:32 

#19 
New Member
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 8 
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.


April 6, 2011, 09:35 

#20 
Senior Member
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 512
Rep Power: 13 
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. 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Cel expressions  RAMAN6089  CFX  13  December 1, 2009 00:17 
junction box routine and CEL function  bornspur  CFX  2  February 3, 2009 03:24 
Cel expressions for trasient problem  Jervds  CFX  0  March 4, 2008 11:03 
Cel expressions Time dependent  Juan Maria Campos  CFX  8  December 27, 2007 19:16 
CEL Expressions  Nick  CFX  3  September 25, 2007 14:54 