|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
Ali
Join Date: Mar 2011
Posts: 27
Rep Power: 14 ![]() |
Hello,
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. Thanks. Code:
#include "udf.h" DEFINE_ON_DEMAND(grad_calc) { Domain *domain; Thread *t; cell_t c; domain = Get_Domain(1); thread_loop_c(t,domain) { begin_c_loop(c,t) { C_UDSI(c,t,1) = C_UDSI_G(c,t,0)[0]; } end_c_loop(c,t) } } |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
|
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 |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Ali
Join Date: Mar 2011
Posts: 27
Rep Power: 14 ![]() |
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. |
|
![]() |
![]() |
![]() |
Tags |
access violation error, gradient, uds |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to compute the gradient of a scalar as a post-processing | ayoros | OpenFOAM Post-Processing | 16 | March 21, 2018 06:02 |
dieselFoam problem!! trying to introduce a new heat transfer model | vivek070176 | OpenFOAM Programming & Development | 10 | December 23, 2014 23: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 17:27 |
gradient for scalar quantity | tseo | FLUENT | 6 | August 5, 2005 23:15 |