# UDF: gradient of variable and reaction term

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Search this Thread Display Modes
 April 24, 2018, 10:13 UDF: gradient of variable and reaction term #1 New Member   Solal Join Date: Nov 2012 Posts: 6 Rep Power: 12 Hi, I'm trying to implement a combustion model as a UDF. Say I define a variable xi at every active node of the domain. How do I compute d(xi)dx_i? From examining the 'include/csi_libraries.h' file, I've found this function: calc_grad_global_scalar(double *grad_var, int kk, PRECISION *global_var, int ndim, int idim)); What exactly are ndim and idim? The only time this function is used in 'example_src/user_turbulence_model.c'. "ndim" seems to be the size of the array passed, but I'm not sure what idim is for. Also, given the temperature, pressure and mass composition of a cell, can I retrieve the reaction rate? Thank you!

 April 25, 2018, 18:39 #2 New Member     Dan Maciejewski Join Date: Apr 2018 Location: Madison, WI, USA Posts: 11 Rep Power: 7 For CONVERGE 2.4 (and 2.3), you've identified the correct function to calculate the gradient: SHARED_calc_grad_global_scalar_node. This function calculates the gradient of a scalar or vector. The gradient operator raises the dimensionality: gradient of a scalar is a vector; the gradient of a vector is a tensor. The last two arguments relate to the dimension of the input variable and which component of the result is of interest. 1st arg: pointer to an array to hold the computed gradient value 2nd arg: cell index 3rd arg: pointer to variable who's gradient you want to calculate 4rd arg: dimension of the variable you want to calculate 5th arg: index of the first component of the gradient you want to store. To calculate the gradient of a scalar, ndim = 1 (one value per cell), and idim = 0, since you want to store the first three components of the gradient in your new variable; these 3 components are stored in a 1D array, so the first three elements are the 3 components of the gradient of the first cell, next three elements are for the 2nd cell, etc. If taking the gradient of a vector, ndim = 3, and idim may be non-zero. Please contact support@convergecfd.com if taking the gradient of a vector (or tensor). Blanco and ray_lo like this. __________________ Dan Maciejewski Senior Research Engineer, Applications CONVERGECFD

May 7, 2018, 09:15
#3
New Member

Solal
Join Date: Nov 2012
Posts: 6
Rep Power: 12
Thank you for your help!

Quote:
 Originally Posted by Dan.Maciejewski For CONVERGE 2.4 (and 2.3), you've identified the correct function to calculate the gradient: SHARED_calc_grad_global_scalar_node. This function calculates the gradient of a scalar or vector. The gradient operator raises the dimensionality: gradient of a scalar is a vector; the gradient of a vector is a tensor. The last two arguments relate to the dimension of the input variable and which component of the result is of interest. 1st arg: pointer to an array to hold the computed gradient value 2nd arg: cell index 3rd arg: pointer to variable who's gradient you want to calculate 4rd arg: dimension of the variable you want to calculate 5th arg: index of the first component of the gradient you want to store. To calculate the gradient of a scalar, ndim = 1 (one value per cell), and idim = 0, since you want to store the first three components of the gradient in your new variable; these 3 components are stored in a 1D array, so the first three elements are the 3 components of the gradient of the first cell, next three elements are for the 2nd cell, etc. If taking the gradient of a vector, ndim = 3, and idim may be non-zero. Please contact support@convergecfd.com if taking the gradient of a vector (or tensor).

 Tags converge, udf

 Thread Tools Search this Thread Search this Thread: Advanced Search 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 Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post natantyt Fluent UDF and Scheme Programming 8 October 17, 2021 03:35 elmcmaster FLUENT 8 October 6, 2010 05:22 jason FLUENT 0 November 7, 2003 10:45 sivakumar FLUENT 4 February 12, 2002 00:31 La S. Hyuck CFX 1 May 23, 2001 00:07

All times are GMT -4. The time now is 15:17.

 Contact Us - CFD Online - Privacy Statement - Top