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

derivative in CEL expressions

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

Like Tree5Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   November 28, 2010, 00:47
Default derivative in CEL expressions
  #1
Senior Member
 
ali
Join Date: Oct 2009
Posts: 152
Rep Power: 7
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, 15:09
Default
  #2
Senior Member
 
Join Date: Mar 2009
Location: Europe
Posts: 168
Rep Power: 7
joey2007 is on a distinguished road
Guess it requires user fortran.
joey2007 is offline   Reply With Quote

Old   November 28, 2010, 18:02
Default
  #3
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 9,716
Rep Power: 77
ghorrocks has a spectacular aura aboutghorrocks has a spectacular aura aboutghorrocks has a spectacular aura about
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, 05:03
Default
  #4
New Member
 
Join Date: Dec 2009
Posts: 29
Rep Power: 6
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, 19:03
Default
  #5
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 432
Rep Power: 10
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 1 others like this.
singer1812 is offline   Reply With Quote

Old   November 30, 2010, 19:25
Default
  #6
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 9,716
Rep Power: 77
ghorrocks has a spectacular aura aboutghorrocks has a spectacular aura aboutghorrocks has a spectacular aura about
That is a nice trick Edmind, I did not know that one. Very useful.
ghorrocks is offline   Reply With Quote

Old   December 1, 2010, 02:33
Default
  #7
Senior Member
 
ali
Join Date: Oct 2009
Posts: 152
Rep Power: 7
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, 10:44
Default
  #8
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 432
Rep Power: 10
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, 10:54
Default
  #9
Senior Member
 
ali
Join Date: Oct 2009
Posts: 152
Rep Power: 7
alinik is on a distinguished road
Thank you very much edmund!
alinik is offline   Reply With Quote

Old   April 4, 2011, 10:05
Default
  #10
New Member
 
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 5
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, 10:32
Default
  #11
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 432
Rep Power: 10
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, 11:12
Default
  #12
New Member
 
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 5
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, 04:59
Default
  #13
New Member
 
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 5
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, 10:28
Default
  #14
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 432
Rep Power: 10
singer1812 is on a distinguished road
I am unclear on what you are asking.
singer1812 is offline   Reply With Quote

Old   April 5, 2011, 11:04
Default
  #15
New Member
 
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 5
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, 11:24
Default
  #16
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 432
Rep Power: 10
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, 06:18
Default
  #17
New Member
 
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 5
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, 10:27
Default
  #18
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 432
Rep Power: 10
singer1812 is on a distinguished road
Where are you getting your delta_velocity from?
singer1812 is offline   Reply With Quote

Old   April 6, 2011, 10:32
Default
  #19
New Member
 
Matjaz Fleisinger
Join Date: Mar 2011
Posts: 17
Rep Power: 5
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, 10:35
Default
  #20
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 432
Rep Power: 10
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
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 On
Pingbacks are On
Refbacks are On


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 15:54


All times are GMT -4. The time now is 01:58.