-
-
April 14, 2023 at 10:42 pm
Sashank Gautam
Subscriber**Here is a code that calculates the electrostatic field and the x-component of force from the scalar potential solved in fluent. This works fine in single core,
#include "udf.h" #include "mem.h" #include
#include #define Q 60.e-06 #define e0 8.854e-12 enum { phi, /* 0 - Electric potential*/ E, /* 1 - Electric field*/ Fdix, /* 2 - x-component Dielectrophoretic force*/ }; DEFINE_ADJUST(Adjust_fun, domain) { cell_t c; face_t f; real dp= 300.0e-09; real ep = 4.6; Thread *t; ; thread_loop_c(t,domain) { begin_c_loop_int(c,t) { C_UDSI(c,t,E) = NV_MAG(C_UDSI_G(c,t,phi)); if(C_UDSI(c,t,E)<=0.0) C_UDSI(c,t,E)=0.0; if(C_UDSI(c,t,E)>(Q/e0)) C_UDSI(c,t,E) = Q/e0; C_UDSI(c,t,Fdix) = (2.*coff*C_UDSI(c,t,E)*(C_UDSI_G(c,t,E)[0])); } end_c_loop_int(c,t) } thread_loop_f(t,domain) { begin_f_loop(f,t) { if(NULL !=THREAD_STORAGE(t, SV_UDS_I(phi)) && NULL != T_STORAGE_R_NV(t->t0,SV_UDSI_G(phi))) F_UDSI(f,t,E)=C_UDSI(F_C0(f,t), t->t0, E); if(NULL != THREAD_STORAGE(t,SV_UDS_I(E))&& NULL != T_STORAGE_R_NV(t->t0, SV_UDSI_G(E))) { if PRINCIPAL_FACE_P(f,t) F_UDSI(f,t,Fdix)=C_UDSI(F_C0(f,t), t->t0, Fdix); } } end_f_loop(f,t) -
April 17, 2023 at 12:52 pm
SRP
SubscriberHi,
I recommend you to please check ansys customization manual: 7.3. Parallelizing Your Serial UDF (ansys.com)
If you are not able to access the link, please refer to this forum discussion: https://forum.ansys.com/forums/topic/using-help-with-links/#latest
Thank you
-
April 17, 2023 at 5:53 pm
Sashank Gautam
SubscriberThank you for the suggestion.
Yes, I have referred to the parallel computing chapter of the Ansys help document. The challenge is that the examples/information is targeted toward computing a single value from all the computation nodes assigned to the solver. For example, calculating the average pressure drop across the entire domain. Here they record the pressure drop values in all the cells from individual nodes and then pass it to node-0 which calculates the final answer.My challenge is that I am working with UDS values on every cell. My result relies on accurate values of these UDS on the cells at the end (when the individual nodes pass the values to node-0). I tried message-passing commands such as PRF_CRECV_INT(i, UDSI(c,t,0), 1, i), however, the results do not match the results obtained from a single core. It would be really helpful to see examples suitable for my case or a couple of lines of codes I could work from.
-
-
April 18, 2023 at 11:47 am
Rob
Ansys EmployeeThe operation will be at the same level for all cases: ie the loops. So the other examples should hold. What surface/zone are you comparing? https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v231/en/flu_udf/flu_udf_sec_cell_face_partition_boundaries.html may be relevent if you're looking at interior surfaces.
-
April 18, 2023 at 3:33 pm
Sashank Gautam
SubscriberI am looking to get the values in the entire domain. Just like plotting a vector field of velocity requires the correct values of the velocity vector of each cell, I need the correct values of the Electrostatic force (Calculated through UDF) in each cell. Each computing node has some "overlapping" exterior cells, so, I want to know how I can extract/pass the values from each node properly such that a "compiled" domain made of all of the nodes merged together represents the resulting domain with each cells having the correct values (the overlapping cells being merged correctly I guess).
Hence, in the end, when I plot a contour of a plane running alongside the length of the entire domain, I get the same values as in a single-core setup.
PS I cannot open the link that you mentioned above, It sends me to the signup page for the customer portal.
Thank you for your reply Rob.
-
-
April 19, 2023 at 8:57 am
Rob
Ansys EmployeeClick on Help in Fluent and then paste the link into the browser: the software adds a token/cookie/biscuit to the browser until you close the browser.
You should just need to deal with the thread loops as in the examples in the manual: basically that's what RP_HOST and RP_NODE are for. There are a couple of other bits to be careful with if you have interior zone partition faces, but again it's all covered.
-
April 19, 2023 at 8:01 pm
Sashank Gautam
SubscriberBased on the example 7.3.3 and 7.3.5 I have used the RP_NODE and RP_HOST in the code. However, the values are unaffected. I also tried to only loop over principal faces only using PRINCIPAL_FACE_P(face,thread). This also did not change the results. I have attached the updated code here.
My goal is to just get the right values of the Electric field and forces of the entire domain (compiled from all the cells and faces from each node). I am not sure if I have to pass the C_UDSI(c,t,E) and F_UDSI(f,t,Fdix) from the compute nodes to node-0.
So, do I have to use the PRF_CRECV_REAL(node_zero, array, size, node_zero) command here (As in the example from 7.4.2)?
It would be helpful if you could point out which example would be more suitable for my case.
Thank you.
-
April 20, 2023 at 10:59 am
Rob
Ansys EmployeeYou're looping over cell and face threads, so I'd start here https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v231/en/flu_udf/flu_udf_ChapParallelUDFUsage.html Note, we can't give much advice on UDFs.
-
April 20, 2023 at 3:14 pm
Sashank Gautam
SubscriberThank you for your suggestions, Rob.
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- Difference between K-epsilon and K-omega Turbulence Model
- The solver failed with a non-zero exit code of : 2
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error: Received signal SIGSEGV
-
5290
-
3311
-
2471
-
1308
-
1016
© 2023 Copyright ANSYS, Inc. All rights reserved.