|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
Aureliano Sancho
Join Date: May 2013
Location: Salvador-Ba-Brasil
Posts: 26
Rep Power: 13 ![]() |
Hi everyone,
I would like to simulate the flow in pipe using the axisymmetry in order to do this I created on rectangle and apply the axisymmetry, but I need to get the radius of the pipe or the coordinate y of the each cell because my source term is a force that depend of distance between the cell and axis and I want to do it to all cell in each iterate. I put for write the coordinate and the source term in the screen and it seems that the uff to remain in loop to only cell. How do I fix this? DEFINE_SOURCE(electroosmotic,cell,thread,dS,eqn) { double source; double Ir; double IR; double k; double y; FILE *saida; real xc[ND_ND]; begin_c_loop_all(cell, thread) { C_CENTROID(xc,cell,thread); y = xc[1]; k = (1/pow(((ee*Kb*T)/(2*NA*pow(el,2)*ninf)),0.5)); Ir = 1 + pow((k*y)/2,2) + pow((k*y)/2,4)/4 + pow((k*y)/2,6)/24 + pow((k*y)/2,8)/(24*24) + pow((k*y)/2,10)/(120*120); IR = 1 + pow((k*R1)/2,2) + pow((k*R1)/2,4)/4 + pow((k*R1)/2,6)/24 + pow((k*R1)/2,8)/(24*24) + pow((k*R1)/2,10)/(120*120); source = -ee*U0*pow(k,2)*Ex*(Ir/IR); saida = fopen("saidaR.txt","a"); fprintf(saida,"%g %g\n", y, source); fclose(saida); dS[eqn] = 0.0; return source; } end_c_loop_all(cell, thread) } |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Join Date: Sep 2017
Posts: 246
Rep Power: 11 ![]() |
Hi SanchoBuendia,
Quoting from the ANSYS Fluent Customization Manual: Your UDF will need to compute the real source term only for a single cell and return the value to the solver So you don't need a cell loop at all. (And anyway, if you did, it would be a bad idea to open a file, write a line, and close the file on every iteration of a cell loop. And any fopen/fprintf/fclose commands are incompatible with parallel. You could consider Message("y=%g source=%g\n",y,source); to send output to the Fluent command window.) Please look at the manual and try to adapt the examples. Good luck! Ed |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
sadik
Join Date: Feb 2018
Posts: 7
Rep Power: 8 ![]() |
Hi everyone,
I am working on parabolic trough receiver and have heat flux data from ray tracing model (the set of data is as shown below. I want to hook the data to Ansys Fluent tool using UDF as wall boundary condition. in trying to do so, the following codes were used. But whenever i interpret the second code it display parse error line 1. please can someone help me out? #include ''udf.h'' #include ''sg. h'' DEFINE_ON_DEMAND(copy_uds_to_udm) { Domain*d=Get_Domain(1); Thread*t; cell_t c; thread_loop_c(t,d) { begin_c_loop(c,t) { c_UDMI(c,t,0) =c_UDSI(c,t,0); } end_c_loop(c,t) } return; } Second codes DEFINE_SOURCE( solar_heat, c,t,ds,eqn) { real source; ds[eqn] =0.0; source =C_UDMI(c,t,0); return source; } The data set sample is: circumferencial angle heat flux (w/m2) -90 987 -80 784 -70 654 -60 453 -50 441 -40 342 -30 231 -20 212 -10 187 0 143 10 121 20 78 . . . 90 0 Thank you for given me the opportunity to share my problem. hope to have your kind assistance. |
|
![]() |
![]() |
![]() |
![]() |
#4 |
Senior Member
Join Date: Sep 2017
Posts: 246
Rep Power: 11 ![]() |
Hi Sumagaji
(Why isn't this a separate thread, by the way?) Are these two separate files? If so, you need #include ''udf.h'' at the start of each. Or, if you prefer, put both into one file. Good luck! Ed |
|
![]() |
![]() |
![]() |
![]() |
#5 |
New Member
sadik
Join Date: Feb 2018
Posts: 7
Rep Power: 8 ![]() |
Thank you for the responses but actually sir, i used them as two separate thread and i put #include"udf.h" as header and got same error
|
|
![]() |
![]() |
![]() |
Tags |
cylindrical coordinates, define_source, loop, udf |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to use UDF to get a grid cell centroid coordinates? | lvanlee | FLUENT | 4 | December 20, 2021 06:55 |
CFX and cylindrical coordinates | VSB | CFX | 16 | December 10, 2019 08:53 |
Cylindrical coordinates in Post for a tilted cone | **Anny** | CFX | 0 | June 28, 2015 11:16 |
Pressure correction in cylindrical coordinates | new_at_this | Main CFD Forum | 0 | April 12, 2012 01:47 |
cylindrical or rectangular coordinates | Maldoror | ANSYS Meshing & Geometry | 0 | October 10, 2009 21:09 |