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

UDF: gradient of variable and reaction term

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By Dan.Maciejewski

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 24, 2018, 10:13
Default UDF: gradient of variable and reaction term
  #1
New Member
 
Solal
Join Date: Nov 2012
Posts: 6
Rep Power: 13
solalito is on a distinguished road
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!
solalito is offline   Reply With Quote

Old   April 25, 2018, 18:39
Default
  #2
New Member
 
Dan.Maciejewski's Avatar
 
Dan Maciejewski
Join Date: Apr 2018
Location: Madison, WI, USA
Posts: 11
Rep Power: 8
Dan.Maciejewski is on a distinguished road
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
Dan.Maciejewski is offline   Reply With Quote

Old   May 7, 2018, 09:15
Default
  #3
New Member
 
Solal
Join Date: Nov 2012
Posts: 6
Rep Power: 13
solalito is on a distinguished road
Thank you for your help!



Quote:
Originally Posted by Dan.Maciejewski View Post
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).
solalito is offline   Reply With Quote

Reply

Tags
converge, udf


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
Fluent UDF urgent! Variable reaction rate natantyt Fluent UDF and Scheme Programming 8 October 17, 2021 03:35
Volumatric reaction rate UDF elmcmaster FLUENT 8 October 6, 2010 05:22
again on udf surface reaction jason FLUENT 0 November 7, 2003 10:45
reaction rate as UDF variable sivakumar FLUENT 4 February 12, 2002 00:31
chemical reaction - decompostition La S. Hyuck CFX 1 May 23, 2001 00:07


All times are GMT -4. The time now is 23:45.