|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
AaronSyu
Join Date: Jun 2015
Posts: 13
Rep Power: 11 ![]() |
Hello every one
I tried to store y-direction gradient using UDS but fail. when I interpreted UDF , fluent returns an error message "Error: C:/Users/USER/AppData/Local/Temp/12_2.c.5332.6.c: line 81: subscripted expression is not an array or pointer: float." Thanks for your help, I am much obliged to you. Here is the part of my UDF code below , if I delete line 81, then every goes perfect. ----------------------------------------------- DEFINE_ADJUST(adjust_gradient, domain) { Thread *t; cell_t c; face_t f; domain = Get_Domain(domain_ID); /* Fill UDS with the variable. */ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDSI(c,t,0) = C_VOF(c,t); } end_c_loop (c,t) } thread_loop_f (t,domain) { if (THREAD_STORAGE(t,SV_UDS_I(0))!=NULL) begin_f_loop (f,t) { F_UDSI(f,t,0) = F_VOF(f,t); } end_f_loop (f,t) } } 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,gvof) = NV_MAG(C_UDSI_G(c,t,0)); C_UDMI(c,t,ygvof) = NV_MAG(C_UDSI_G(c,t,0)[1]); /* here is line 81 */ /* I chenged line 81 like "C_UDMI(c,t,ygvof) = C_UDSI_G(c,t,0)[1];"*/ /* and interpreted success but after I Execute on Demand, fluent returns a MPI error message*/ } end_c_loop (c,t) } } --------------------------------- |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 ![]() |
C_UDMI(c,t,ygvof) = NV_MAG(C_UDSI_G(c,t,0)[1]);
This line gives you the magnitude of the gradient in Y direction, which does not make much sense. If you want the gradient in Y direction, use C_UDMI(c,t,ygvof) = C_UDSI_G(c,t,0)[1]; |
|
![]() |
![]() |
![]() |
![]() |
#3 | |
New Member
AaronSyu
Join Date: Jun 2015
Posts: 13
Rep Power: 11 ![]() |
Quote:
Thank you , When I changed C_UDMI(c,t,ygvof) =NV_MAG( C_UDSI_G(c,t,0)[1]); to C_UDMI(c,t,ygvof) = C_UDSI_G(c,t,0)[1]; fluent returns MPI error message I really don't know what's wrong with my UDF code.... |
||
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 ![]() |
Try to compile. Compiling is 100 times better than interpreting.
|
|
![]() |
![]() |
![]() |
![]() |
#5 |
New Member
AaronSyu
Join Date: Jun 2015
Posts: 13
Rep Power: 11 ![]() |
Thank you, but compile/interpreted won't bring this problem.
|
|
![]() |
![]() |
![]() |
![]() |
#6 | |
New Member
AaronSyu
Join Date: Jun 2015
Posts: 13
Rep Power: 11 ![]() |
Quote:
The problem happened cause I FORGOT RETURN MY CALCULATION |
||
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question about C_UDMI and F_UDMI and How to define the gradient of a UDM? | aestas | Fluent UDF and Scheme Programming | 4 | May 14, 2018 11:50 |
question regarding LES of pipe flow - pimpleFoam | Dan1788 | OpenFOAM Running, Solving & CFD | 37 | December 26, 2017 15:42 |
Gradient Computation: finite differences and adjoint method | doan.nak | SU2 | 3 | November 22, 2017 06:37 |
[General] Problem in calculating Gradient | masaaki | ParaView | 0 | March 16, 2015 07:38 |
Doubts UDS Flux, UDS Unsteady for VOF model | kel85uk | FLUENT | 0 | March 17, 2010 09:53 |