-
-
December 20, 2020 at 10:30 am
pkgupta108
SubscriberHi! Ansys Fluent users! I am trying to write a UDF for post-processing. Here I need to access FACE values from the WALL Zone, then put them in my equation, and store that evaluated values for examining the results.
So before I do that I wrote a piece of code (the first code below) wherein I am reading (or accessing) variables from FLUENT which are Cell-based values. Here the code is executed on demand. everything is well, and even results I can plot using Contour or xy plot.
However, when I replace all the Cell-based data access to FACE-based, the FLUENT crashes giving errors. I have attached the same Code for FACE-based access (the second code below).
December 21, 2020 at 5:50 pmSurya Deb
Ansys EmployeeHello, nFrom the brief investigation of the UDF, I think you don't need the thread_loop_f macro. You already have the information of the thread from the Lookup_Thread macro. Why do you want to loop over all threads again? You just need to loop over all the faces in that particular thread. nPlease test it without that loop. That might fix the issue.nAlso, please check if the connectivity macros are needed although I doubt it.nYou will get more information here.nI hope this helps.nnRegards,nSuryanDecember 22, 2020 at 10:34 ampkgupta108
SubscriberThank you sdeb! It did work out, and the UDF is executing upon Execute-on_demand. However, I am puzzled as to why values at faces of wall boundary showing ZERO. I tried with other flow variables, such as Volume fraction, Velmag, Granular temperature, but still in all cases, the values shown after executing the UDf is simply ZERO. In fact, I even assigned a value of constant 2650 to F_UDMI, but still the values in contour plot shows zero!!!nCan you please tell me the reason for this? Here is the modified piece of code:n#include udf.hn#include mem.hn#include surf.hn#include metric.hnDEFINE_ON_DEMAND(erosionrate)n{n   real velu, velv, velw, velmag, grantemp, volfrac, afunc, bfunc, cfunc;n   real dens =2650;n   real k =0.000000002;n   int zone_ID=6; /*corresponding to the Wall_Zone_ID = 6 */n   Thread *sandthread;n   Domain *sanddomain;n   face_t faceidentifier;n   sanddomain=Get_Domain(3);  /* Corresponding to Secondary Phase Domain_ID = 3 */n   sandthread=Lookup_Thread(sanddomain,zone_ID);nn   begin_f_loop(faceidentifier,sandthread)n   if PRINCIPAL_FACE_P(faceidentifier,sandthread)n   {n       #if !RP_HOSTn       velu=F_U(faceidentifier,sandthread);n       velv=F_V(faceidentifier,sandthread);n       velw=F_W(faceidentifier,sandthread);n       velmag=sqrt(pow(velu,2)+pow(velv,2)+pow(velw,2));n       grantemp=F_GT(faceidentifier,sandthread);n       volfrac=F_VOF(faceidentifier,sandthread);n       afunc=0.1*pow(2*grantemp,1.5)/sqrt(3.14159265);n       bfunc=0.05*pow(velmag,2)*sqrt(2*grantemp/3.14159265);n       cfunc=0.09*velmag*grantemp;n       F_UDMI(faceidentifier,sandthread,0)=volfrac;n       F_UDMI(faceidentifier,sandthread,1)=velmag;n       F_UDMI(faceidentifier,sandthread,2)=grantemp;n       F_UDMI(faceidentifier,sandthread,3)=velu;n       F_UDMI(faceidentifier,sandthread,4)=velv;n       F_UDMI(faceidentifier,sandthread,5)=velw;n       F_UDMI(faceidentifier,sandthread,6)=dens;n       #endifn   }n   end_f_loop(faceidentifier,sandthread)nn}nDecember 22, 2020 at 11:50 pmSurya Deb
Ansys EmployeeHello, nThe value stored in the F_UDMI cannot be checked through contour plots. Please store the F_UDMI values in the C_UDMI values in the cell next to the boundary face and check the values. You can use the connectivity macros (i shared a link earlier) for this. You should then be able to display the C_UDMI values.nnRegards,nSuryanDecember 27, 2020 at 5:20 ampkgupta108
SubscriberThanks Surya! Your help is deeply appreciated.nI have now developed a UDF where I am calculating some values. Now the issue is the following:nThe wall shear accessed using F_STORAGE_R_N3V shows negative values, but the same is showing positive values when wall shear stress is contour plotted for wall boundary. Why is this?n I also observed a similar thing with velocity (and its three components). When I access velocity components using F_U(c,t), it shows a very small value, almost 4-5 orders of magnitude smaller than those observed when I plot the velocity components in FLUENT using contour. Why is this difference?nPlease help me out with this. Thanks!nViewing 4 reply threads- The topic ‘Can anyone help me out with writing a UDF for accessing face centered values on the wall zone’ is closed to new replies.
Innovation SpaceTrending discussionsTop Contributors-
4703
-
1565
-
1386
-
1242
-
1021
Top Rated Tags© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-
The Ansys Learning Forum is a public forum. You are prohibited from providing (i) information that is confidential to You, your employer, or any third party, (ii) Personal Data or individually identifiable health information, (iii) any information that is U.S. Government Classified, Controlled Unclassified Information, International Traffic in Arms Regulators (ITAR) or Export Administration Regulators (EAR) controlled or otherwise have been determined by the United States Government or by a foreign government to require protection against unauthorized disclosure for reasons of national security, or (iv) topics or information restricted by the People's Republic of China data protection and privacy laws.
