CFD Online Logo CFD Online URL
Home > Forums > Fluent UDF and Scheme Programming

Calculating Gradient of a Scalar

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

LinkBack Thread Tools Display Modes
Old   August 3, 2011, 04:17
Question Calculating Gradient of a Scalar
New Member
Join Date: Mar 2011
Posts: 27
Rep Power: 8
ali hemmati is on a distinguished road
Sponsored Links

I am going to calculate gradient of a scalar (UDS) which is solved through iterations, and its quantity is known. Here is my 'on demand' UDF which tries(!) to store x-gradient of scalar 0 to scalar 1, yet after executing the UDF, I receive an 'ACCESS VIOLATION' error.
Would you please help me.


#include "udf.h"


Domain *domain;
Thread *t;
cell_t c;

domain = Get_Domain(1);

			C_UDSI(c,t,1) = C_UDSI_G(c,t,0)[0];		

ali hemmati is offline   Reply With Quote
Sponsored Links

Old   August 3, 2011, 15:10
Senior Member
Amir's Avatar
Join Date: May 2009
Location: Montreal, QC
Posts: 739
Blog Entries: 1
Rep Power: 16
Amir is on a distinguished road
Did you activate 2 UDSs?
Did you set a command in TUI in order to store gradients during iteration?
if yes, before executing this macro, allocate 2nd UDS simply by patching it with arbitrary value.

Amir is offline   Reply With Quote

Old   August 4, 2011, 04:05
New Member
Join Date: Mar 2011
Posts: 27
Rep Power: 8
ali hemmati is on a distinguished road
Hi Amir,

Thanks for your help. I pursued these two methods and got desired solution:

1. I solved the problem with defining all UDSs before iterating.
2. I solved the problem just by defining scalar 0 and after convergence, I patched scalar 1 to fluid zone with arbitrary value.

Subsequent to things done above, I executed the UDF without any error.

Thanks again.
ali hemmati is offline   Reply With Quote


access violation error, gradient, uds

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
How to compute the gradient of a scalar as a post-processing ayoros OpenFOAM Post-Processing 15 August 7, 2015 04:48
dieselFoam problem!! trying to introduce a new heat transfer model vivek070176 OpenFOAM Programming & Development 10 December 24, 2014 00:48
Gradient of Scalar calculation in 3D BFCskew grids james T Phoenics 0 March 28, 2007 07:12
How to update polyPatchbs localPoints liu OpenFOAM Running, Solving & CFD 6 December 30, 2005 18:27
gradient for scalar quantity tseo FLUENT 6 August 5, 2005 23:15

Sponsored Links

All times are GMT -4. The time now is 19:38.