CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   if (NNULLP(T_STORAGE_R_NV(t0, SV_UDSI_G(0)))) (https://www.cfd-online.com/Forums/fluent-udf/230726-if-nnullp-t_storage_r_nv-t0-sv_udsi_g-0-a.html)

lbj007 October 3, 2020 07:12

if (NNULLP(T_STORAGE_R_NV(t0, SV_UDSI_G(0))))
 
I want to know what will happen if the gradient of uds is not allocated. Can it lead to that all the Statements relevant to C_UDSI_G will not be executed?or something else.

http://cdn.img.headns.com/2010/ee8f42698e6f0.png

AlexanderZ October 5, 2020 01:23

NNULLP returns TRUE if storage is allocated for user-defined storage variable

in case the storage has not been allocated if statement will not be executed

lbj007 October 5, 2020 22:11

Quote:

Originally Posted by AlexanderZ (Post 784415)
NNULLP returns TRUE if storage is allocated for user-defined storage variable

in case the storage has not been allocated if statement will not be executed

so how do I know the statement is executed, can I add a printf statement to help me judge?so the NNULLP conditional judgment statement just help to let me know the storage has or hasn't been allocated,it won't affect the other code to be executed,am I right?

AlexanderZ October 6, 2020 03:42

NNULLP conditional i needed to prevent the case, when you read gradient (or any other variable) value , but memory was not allocated.
In that case you will get an error

you can put printf inside if statement,
it is recommended to use Message macro in fluent instead of printf

lbj007 October 6, 2020 05:58

Quote:

Originally Posted by AlexanderZ (Post 784531)
NNULLP conditional i needed to prevent the case, when you read gradient (or any other variable) value , but memory was not allocated.
In that case you will get an error

you can put printf inside if statement,
it is recommended to use Message macro in fluent instead of printf

so if I don't use NNULLP and memory is just not allocated,it will get an error,
then if I use NNULLP and memory is just not allocated,what it would show?


All times are GMT -4. The time now is 05:55.