CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > ANSYS > CFX

solution variable gradient

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

LinkBack Thread Tools Display Modes
Old   July 3, 2007, 09:07
Default solution variable gradient
Posts: n/a
I have calculated a steady state solution for a flow problem. Now I would like to calculate the gradient of one of the solutions. I know I could do it with some postprocessing (e.g. tecplot) using a simple difference scheme. But I would also like to monitor the gradient development during the iterative solution steps.

Is there a way to define the gradient of a variable in CFX-pre (or CFX-post)?

Thanks in advance,

  Reply With Quote

Old   July 3, 2007, 09:20
Default Re: solution variable gradient
Posts: n/a
Dear N.R.

Are you using ANSYS CFX-10.0 or 11.0?

For 10.0:


1 - Define the Additional Variable

2 - Activate the Additional Variable on the domain of interest, and make its components equal to the User CEL Function.. Use an integer to indicates which component the User Function should return.

3- Create a User CEL Function that

- calls USER_GETVAR for the Gradient of the variable of interest.

- copy the components of the gradients to the components of a Vector Algebraic Additional Variable

For 11.0


1 - Create Additional Variable

2 - Activate Additional Variable in the domain interest, select Vector Algebraic Equation

- Set the components to <MyVariableofInterest>.Gradient

For example

Vector xValue = Temperature.Gradient X

Vector yValue = Temperature.Gradient Y

Vector zValue = Temperature.Gradient Z

Hope this helps,


  Reply With Quote

Old   July 5, 2007, 10:08
Default Re: solution variable gradient
Posts: n/a
Opaque, Thanks for your help.

It works well with CFX 11. But I am having problems with variables that anly occur at boundaries (e.g Wall Shear Stress)

"Error in subroutine CAL_TAUWALL_LAM : Error calculating Wall Shear"

I think the problem arises because CFX wants to access values at locations different than the boundary wall.

Do you have any idea, how I could calculate the Wall shear stress gradient?


  Reply With Quote

Old   July 5, 2007, 10:59
Default Re: solution variable gradient
Posts: n/a
Dear NR

The CFX variable Wall Shear only exists on nodes at the boundary; therefore, the calculation of the gradient is not well defined. Do you want the gradient on the boundary surface?

Not sure what you are trying to evaluate. However, since your flow is laminar you can evaluate your shear stress from its definition using Velocity u/v/w.Gradient X/Y/Z (which is available) and compute the gradient of those expressions.

Hope this helps,


  Reply With Quote

Old   July 20, 2007, 07:52
Default Re: solution variable gradient
Posts: n/a
Dear opaque,

with gradient of wall shear stress I mean the spatial gradient of the magnitude of the wall shear stress vector.

I tried to obtain wall shear stress from the velocity gradients for an incompressible newtonian fluid, but the results are not equal. Actually my results using:

e_ij=0.5(du_i/dx_j+du_j/dx_i) and sigma_ij=-pd_ij+2mu(e_ij-1/3d_ij div(u))

with d_ij = 1 for i=j and 0 else I use incompressible fluid, thus in theory div(u) should be 0 but just to make sure I include it. Also p should have no influence on WSS, but for completeness I include it as well.

Then I use the element normal to calculate shear stress

The results are very similar to the product of the CFX variables "shear strain rate" * "dynamic viscosity" but very different to what cfx reports as "wall shear".

Do you have done a similar calculation?
  Reply With Quote


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
grid dependancy gueynard a. Main CFD Forum 19 June 27, 2014 21:22
gradient of a user-defined variable rostamimass Fluent UDF and Scheme Programming 0 May 4, 2011 06:26
Exact solution of Burgers equation mcaro Main CFD Forum 3 January 25, 2011 07:46
Gradient of a User defined Variable Ramadas CFX 2 August 21, 2007 09:19
Wall functions Abhijit Tilak Main CFD Forum 6 February 5, 1999 02:16

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