# Gradient of a variable in CFX

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

 February 9, 2011, 10:31 Gradient of a variable in CFX #1 Member   Shahid Parvez Join Date: Jul 2009 Location: Pakistan Posts: 37 Rep Power: 10 Hi Is it possible in CFX to calculate the Gradient of "My defined Variable" with respect to temperature? i,e My defined Variable.Gradient T It is not working for me saying "T" is not recognized. When I replace "T" with "X" then it is OK.

 February 9, 2011, 19:36 #2 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 13,808 Rep Power: 107 You cannot do it directly. You can only do gradients like that WRT space. But dV/dT=dV/dX * 1/(dT/dX) so you should be able to calculate it from the spatial gradients of your variable and temperature.

 February 10, 2011, 00:12 #3 Member   Shahid Parvez Join Date: Jul 2009 Location: Pakistan Posts: 37 Rep Power: 10 Thanks Glenn. Your response always helped me. I tried your suggestion and got the following error message. Any comments Please... | PROBLEM ENCOUNTERED WHEN EXECUTING CFX EXPRESSION LANGUAGE | | | | The CFX expression language was evaluating: | | Additional Variable Value | | | | The problem was: | | DIVIDE-BY-ZERO | | | | FURTHER INFORMATION | | | | The problem was encountered in executing the expression for: | | GradSurfTension | | The complete expression is: | | Surface Tension.Gradient X*(1/T.Gradient X) | | The error occurs on sub-expression: | | 1/T.Gradient X

 February 10, 2011, 02:56 #4 Senior Member   Lance Join Date: Mar 2009 Posts: 610 Rep Power: 14 Your expression T.Gradient X is zero... due to uniform initial conditions maybe?

 February 10, 2011, 05:15 #5 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 13,808 Rep Power: 107 Um, why are you doing this? If you have a surface tension set as a function of temperature you already know the gradient of the surface tension WRT to temperature, so why get CFX to calculate it?

 February 10, 2011, 06:07 #6 Member   Shahid Parvez Join Date: Jul 2009 Location: Pakistan Posts: 37 Rep Power: 10 Hi Glenn, If you look at the expression, Surface Tension is NOT set as a gradient of Temperature rather set as "X" and I want to calculate the Surface Tension as a Gradient of Temperature in a way as you mentioned in your previous reply.

 February 10, 2011, 06:59 #7 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 13,808 Rep Power: 107 OK, no problem.

 February 10, 2011, 09:29 #8 Member   Shahid Parvez Join Date: Jul 2009 Location: Pakistan Posts: 37 Rep Power: 10 Just noticed in Cfx Post that "T.Gradient X" is zero at t=0, and then nonzero. Any solution then? How to skip t=0 in transient analysis?

 February 10, 2011, 16:36 #9 Senior Member   Edmund Singer P.E. Join Date: Aug 2010 Location: Minneapolis, MN Posts: 512 Rep Power: 14 Perhaps add a non zero value to the T.Gradient.X term and a step function. Like (T.Gradient X+0.0001 [K m^-1]*step(.00001-t*1[s^-1]) for a quick and dirty solution. Make sure you change .00001 to something that suits your time step.

 February 10, 2011, 18:00 #10 Super Moderator   Glenn Horrocks Join Date: Mar 2009 Location: Sydney, Australia Posts: 13,808 Rep Power: 107 Back to my previous post.... I am still puzzled by what you are trying to do. Surface tension is usually constant (so dS/dT=0 where S is surface tension and T is temperature) so if it is not constant you must have set it to be a function of something. So why not simply work out the derivative of that function WRT temperature? Can you explain what function you have set surface tension to?

 February 10, 2011, 23:03 #11 Member   Shahid Parvez Join Date: Jul 2009 Location: Pakistan Posts: 37 Rep Power: 10 I want to calculate the Marangoni Force such that MF=dS/dT*dT/dX [N m^-2] (where S is in N/m) and apply it as a BC. So in my case S is not constant but a function of temperature and temperature is a function of "X". In CFX, as you mentioned earlier, dS/dT can not be calculated directly and that is why all this stuff come.

 February 10, 2011, 23:22 #12 Member   Shahid Parvez Join Date: Jul 2009 Location: Pakistan Posts: 37 Rep Power: 10 Problem solved. Thanks to all who replied to this post. I followed Singer's instructions by adding a small value of 1e-10 [K m^-1] to T.Gradient X and it worked.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Val Main CFD Forum 3 June 10, 2011 02:20 wilko OpenFOAM Running, Solving & CFD 1 March 13, 2009 13:30 romance CFX 0 December 23, 2007 08:11 Hamidur Rahman CFX 2 September 21, 2007 14:18 Pandu Sattvika CFX 1 December 1, 2001 05:07

All times are GMT -4. The time now is 08:33.