|
[Sponsors] |
October 24, 2010, 06:59 |
Get gradient from uds
|
#1 |
New Member
qwerty753
Join Date: May 2009
Posts: 16
Rep Power: 17 |
I defined an uds.
As postprocessing fluent allows to read the uds variable by contour etc. I just want to reat the gradient of my variable for a surface integral or a plot. How can i get it? Thank you |
|
October 25, 2010, 02:50 |
|
#2 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
Check the UDF Manual at 3.2.3 Cell Macros (to see when and how you make available the gradients to your udf), and after that try the macro C_UDSI_G.
|
|
October 25, 2010, 07:31 |
|
#3 |
New Member
qwerty753
Join Date: May 2009
Posts: 16
Rep Power: 17 |
Thank you for your help!
I wrote this udf: # include "udf.h" # define domain_ID 2 DEFINE_ON_DEMAND(store_gradient) { Domain *domain; cell_t c; Thread *t; domain=Get_Domain(1); /* Fill the UDM with magnitude of gradient. */ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDMI(c,t,0) = C_UDSI_G(c,t,0)[1]; } end_c_loop (c,t) } This doesn't work becouse if i execute on demand i receive this message: FLUENT received fatal signal (ACCESS_VIOLATION) 1. Note exact events leading to error. 2. Save case/data under new name. 3. Exit program and restart to continue. 4. Report error to your distributor. Error Object: () Indeed if i wrote: DEFINE_ON_DEMAND(store_gradient) { Domain *domain; cell_t c; Thread *t; domain=Get_Domain(1); /* Fill the UDM with magnitude of gradient. */ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDMI(c,t,0) = C_UDSI(c,t,0); } end_c_loop (c,t) } to check if it run...i have no problem, why? |
|
October 25, 2010, 08:25 |
|
#4 | |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
As I said previously :
Quote:
|
||
October 25, 2010, 08:33 |
|
#5 |
New Member
qwerty753
Join Date: May 2009
Posts: 16
Rep Power: 17 |
OK i understood my error...
solve/set/expert and then answering yes to the question Keep temporary solver memory from being freed? i set correctly and now it runs. But i discover that the gradient is calcolated by uds at cell... i need at face because i'm at B.C.. Is there any procedure? |
|
October 25, 2010, 12:38 |
|
#6 |
Senior Member
Dragos
Join Date: Mar 2009
Posts: 648
Rep Power: 20 |
If you use second order discretisation scheme, then the gradient is constant over the entire cell, so you may use the cell value on the boundary face.
Otherwise, just as wild guess try F_UDSI_G. |
|
July 27, 2012, 14:52 |
|
#7 | |
New Member
Join Date: Jul 2012
Posts: 18
Rep Power: 14 |
hey qwerty753,
did you solve your problem? I need the gradient too, but it's inserted in my function, so i dont need to postprocess the gradient directly... look what i've done: Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Gradient of UDS | gemini | Fluent UDF and Scheme Programming | 2 | December 24, 2013 01:24 |
How to compute UDS fourth order gradient | Emma66 | FLUENT | 1 | April 27, 2010 06:44 |
reconstruction gradient of a UDS | gemini | Fluent UDF and Scheme Programming | 0 | June 7, 2009 17:03 |
Gradient UDS | tom | FLUENT | 1 | April 28, 2006 04:46 |
Gradient of a UDS | Ilkay | FLUENT | 0 | March 8, 2000 14:42 |