CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

derivative in CEL expressions

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree19Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 27, 2010, 23:47
Default derivative in CEL expressions
  #1
Senior Member
 
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17
alinik is on a distinguished road
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
alinik is offline   Reply With Quote

Old   November 28, 2010, 14:09
Default
  #2
Senior Member
 
Join Date: Mar 2009
Location: Europe
Posts: 169
Rep Power: 17
joey2007 is on a distinguished road
Guess it requires user fortran.
joey2007 is offline   Reply With Quote

Old   November 28, 2010, 17:02
Default
  #3
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,697
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
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.
ghorrocks is offline   Reply With Quote

Old   November 30, 2010, 04:03
Default
  #4
Member
 
Join Date: Dec 2009
Posts: 44
Rep Power: 16
cfdgremlin is on a distinguished road
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)
...
cfdgremlin is offline   Reply With Quote

Old   November 30, 2010, 18:03
Default
  #5
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 20
singer1812 is on a distinguished road
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.
brunoc, happy, Ram and 7 others like this.
singer1812 is offline   Reply With Quote

Old   November 30, 2010, 18:25
Default
  #6
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,697
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
That is a nice trick Edmind, I did not know that one. Very useful.
ghorrocks is offline   Reply With Quote

Old   December 1, 2010, 01:33
Default
  #7
Senior Member
 
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17
alinik is on a distinguished road
I didn't get it right. Still I need to use USER_FORTRAN. isn't it?
alinik is offline   Reply With Quote

Old   December 1, 2010, 09:44
Default
  #8
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 20
singer1812 is on a distinguished road
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.
singer1812 is offline   Reply With Quote

Old   December 1, 2010, 09:54
Default
  #9
Senior Member
 
ali
Join Date: Oct 2009
Posts: 318
Rep Power: 17
alinik is on a distinguished road
Thank you very much edmund!
alinik is offline   Reply With Quote

Old   April 4, 2011, 09:05
Default
  #10
New Member
 
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 15
Matjaz is on a distinguished road
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
Matjaz is offline   Reply With Quote

Old   April 4, 2011, 09:32
Default
  #11
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 20
singer1812 is on a distinguished road
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
singer1812 is offline   Reply With Quote

Old   April 4, 2011, 10:12
Default
  #12
New Member
 
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 15
Matjaz is on a distinguished road
Thank you very much, exactly that happens in my Ansys v13.
Regards, Matjaz
Matjaz is offline   Reply With Quote

Old   April 5, 2011, 03:59
Default
  #13
New Member
 
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 15
Matjaz is on a distinguished road
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
Matjaz is offline   Reply With Quote

Old   April 5, 2011, 09:28
Default
  #14
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 20
singer1812 is on a distinguished road
I am unclear on what you are asking.
singer1812 is offline   Reply With Quote

Old   April 5, 2011, 10:04
Default
  #15
New Member
 
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 15
Matjaz is on a distinguished road
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
Matjaz is offline   Reply With Quote

Old   April 5, 2011, 10:24
Default
  #16
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 20
singer1812 is on a distinguished road
Ohh, yes of course. Use one of the functions to evaluate it and make it single valued.
singer1812 is offline   Reply With Quote

Old   April 6, 2011, 05:18
Default
  #17
New Member
 
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 15
Matjaz is on a distinguished road
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
Matjaz is offline   Reply With Quote

Old   April 6, 2011, 09:27
Default
  #18
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 20
singer1812 is on a distinguished road
Where are you getting your delta_velocity from?
singer1812 is offline   Reply With Quote

Old   April 6, 2011, 09:32
Default
  #19
New Member
 
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 15
Matjaz is on a distinguished road
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.
Matjaz is offline   Reply With Quote

Old   April 6, 2011, 09:35
Default
  #20
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 20
singer1812 is on a distinguished road
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 pre-ran fortran routine, and delta_velocity is already set for the CFX run.
singer1812 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 12:28.