TAGGED: total-pressure, udf-fluent, write-file
-
-
February 18, 2021 at 3:00 pm
atulsingh92
SubscriberHow do we get the total pressure at a surface? I tried something like followsnvoid dynamic_pressure()nnt = Lookup_Thread(domain, id);? //outlet edge (for a 2D case) is at id=6;nbegin_f_loop(f,t)n{n Amag = NV_MAG(area);n vsquared = pow(C_U(f,t), 2)+ pow(C_V(f,t),2) + pow(C_W(f,t),2);n velocity_squared += vsquared * Amag;n d = C_R(f,t);n density += d * Amag;n}nend_f_loop(f,t)nreturn dynamic_component;nafter the PRF_GRSUM() command on these values, I divide with global area values to get the area averaged quantities as shwon in the examples of the manual.nI then add this to the C_P(f,t), however it did not give the correct result. (the one that area averaged results in fluent console is obtained from the results section)nCould you recommend something else, on how can I obtain the total pressure. I require this via udf to print to an external file, because I want to assign this pressure to another inlet with perhaps the F_PROFILE command, after some other calculations.n -
February 18, 2021 at 3:18 pm
DrAmine
Ansys EmployeeWhat about defining a report definition for it and then accessing that report definition elsewhere in UDF?n -
February 18, 2021 at 3:20 pm
DrAmine
Ansys EmployeeMoreover the dynamic pressure is calculated for each facet and not as average over all facets. Density is not available on boundary just refer to cell next to the facet.n -
February 19, 2021 at 11:40 am
atulsingh92
SubscriberThe customization manual has one example n 3.8.3, but it gives the following errornc(12):error C2099:initializer is not a constantnhere line 12 is the first declaration ofnint rv = Get_Report_Definition_Values(pressure_outlet, 0, &nrOfvalues, NULL, NULL,NULL);ncould you help, how can I solve this error?nThe example was used as it is, with just the name of the report-definition changed.n -
February 19, 2021 at 1:40 pm
YasserSelima
Subscribermake itint rv;nrv = Get_Report_Definition_Values(pressure_outlet, 0, &nrOfvalues, NULL, NULL,NULL);nn -
February 19, 2021 at 1:41 pm
YasserSelima
Subscriberbut is it integer ??n -
February 19, 2021 at 1:47 pm
atulsingh92
SubscriberSo, the pressure_outlet report definition is defined so that I could obtain the total pressure at my outlet, after convergence, so no it is not an integer.nhence I tried with the below, and get the errornfloat rv;nn..\..\src\reportdef.c(12): warning C4142: 'rv:benign redefinition of typen..\..\src\reportdef.c(10): note: see declaration of 'rv'n..\..\src\reportdef.c(12): error C2099: initializer is not a constantnnso help is appreciated.n -
February 19, 2021 at 1:53 pm
YasserSelima
Subscriberit seems that you declared it twice ... once as integer and once as floatremove the line nint rv;nhave only the original declaration nfloat rv;nand the line nrv = Get_Report_Definition_Values(pressure_outlet, 0, &nrOfvalues, NULL, NULL,NULL);nn -
February 19, 2021 at 1:58 pm
atulsingh92
SubscriberThank you for your response, Yasser.nThat is not the case, I have run the example as it is from the 3.8.3 example in fluent customization manual shown as followsnn#include udf.hnn int nrOfvalues=0;n real *values;n int *ids;n int index;n int counter;n float rv;nn rv = Get_Report_Definition_Values(pressure_outlet, 0, &nrOfvalues, NULL, NULL,NULL);nn if (rv==0 && nrOfvalues)n{n Message(Report definition evaluated at iteration has %d values, nrOfvalues);n n values = (real*) malloc(sizeof(real)* nrOfvalues);n ids = (int*) malloc(sizeof(int)* nrOfvalues);n n rv = Get_Report_Definition_Values(pressure_outlet, 0, NULL, values, ids, &index);n n Message(Values correspond to iteration index:%d, index);n n for ( counter = 0; counter < nrOfvalues; counter++ )n   {n     Message(report definition values: %d, %f, ids[counter], values[counter]);n   }n free(values);n free(ids);nn elsen{n if (rv == 1)n   {n     Message(report definition: %s does not exist, pressure_outlet);n   }n else if ( nrOfvalues == 0 )n   {n     Message(report definition: %s not evaluated at iteration level, pressure_outlet);n   }nThe error is the same.ninitializer is not a constantn -
February 19, 2021 at 2:07 pm
YasserSelima
Subscriberinitializer is not a constant means that you declare variable and put it in equation on the same step ... I can not see you doing this in this coden -
February 20, 2021 at 1:10 pm
atulsingh92
SubscriberWhat about defining a report definition for it and then accessing that report definition elsewhere in UDF?/forum/discussion/comment/107260#Comment_107260
Could you suggest how can I do this?. -
February 21, 2021 at 7:39 pm
Surya Deb
Ansys EmployeeHello, nI think you will need to include this API within the DEFINE_REPORT_DEFINITION_FN UDF. Also keep the int rv = .. definition from the API example. nSomething like this should work. n#include udf.hnDEFINE_REPORT_DEFINITION_FN(UDF_name)n{ n...(include the rest of the API structure here)nn}nGive this a try. nRegards,nSDn
-
Viewing 11 reply threads
- The topic ‘obtaining total pressure from UDF’ is closed to new replies.
Ansys Innovation Space
Trending discussions
Top Contributors
-
3597
-
1283
-
1107
-
1068
-
983
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.