April 26, 2022 at 11:26 pmangelo_97Subscriber
Hello guys I found a problem in a UDF. I have to calculate the distance of the particle respect to the wall. I did a loop to find the minimum distance. My questions are:
1) how can I know in which face of the thread i found the minimum distance
2) how can I create a normal vector in that point in such ba why to project the vector "vec" in that direction
This is my UDF, thanks in advance
/* UDF adding an external body force to the particles */
DEFINE_DPM_BODY_FORCE(particle_body_force, p, i)
/* declaration of variables */
double w, Dh, Ufx, Ufy, Ufz, Gx, rho, a, F_L, c_height, c_length,
c_volume, side, H, W, f_height_total, Renx, Reny, Renz, crDh, mu, aUfx, aUfy, aUfz, C1, C2, C3, C4, C_Ly, C_Lz, z, y, distancewall, cosine;
face_t f; //f is the face index that is inside the face thread t(our wall). You will extract the face area vector from f index
d = Get_Domain(1);
c = P_CELL(p); //cell in witch the particle is currently in
t = Lookup_Thread(d, 9); //9 is the ID number of the upper wall. t is the thread index(pointer) of the wall boundary surface 9
distancewall = 100; //i'm setting a generic initial value
F_CENTROID(xw, f, t); //center of each face
NV_VV(vec, =, xw, -, P_POS(p)); //vector connecting the particle to the face center that is placed at the wall. The NV_VV do the operation between 2 vectors :(vec=xw-P_POS(p))
//now you want to calculate the minimum distance between particle and wall, and so you want to find the minimum of the vector vec doing the loop over all the boundary face
if (distancewall >= NV_MAG(vec))
distancewall = NV_MAG(vec);
end_f_loop(f, t)April 28, 2022 at 1:40 pmRobForum ModeratorYou might be better off finding the cell distance from the nearest wall for every cell, storing that and then getting particles to check that. Otherwise every particle needs to update in every step which might be computationally expensive.
April 29, 2022 at 10:45 pmangelo_97SubscriberThanksfor the answer, my issue is that okay i found the minimum distance of the particle respect to the wall but for example when Inject one particle i see that every DPM interaction i obtain a lot of message of wall distance and other message that i wrote in the Udf. For example i wrote on UDF on message: the min distance is distance Wall but i have a lot of message in the console like this(or i wanna say similar) and I'm not understanding.
In fact if i inject a lot of particles i take like 6/7 minutes only for DPM interaction.
I thought that in the DPM interaction the particle is able to move and fluent will calculate a lot of times, or i don't know if the particles will move only when I do iterations of fluid.
One time step is composed by 20 iterations and i have 2 DPM iterations each 10 itaration.
If i want to inject 2500 particles is not possible because I take a lot of time.
The Udf is written in serial, but when I open fluent i choose parallel with 0 processors because if i use serial and i import my UDF fluent switch automatically to parallel but my UDF is not parallelized and so i cannot compile it.
If i use parallel with 1 processors i get error when I compile.
Thanks in advance
May 3, 2022 at 12:54 pmRobForum ModeratorYes, the wall distance will be calculated every time the DPM position is updated. What error do you see if you try and compile in parallel?
May 3, 2022 at 4:57 pmangelo_97Subscribermy question is: how much time i will enter in the udf. I know that in dpm bodyforce i should enter 3 times for i=0,1 and 2 but i didn't get 3 message in the DPM but more. my question is how much ??
May 3, 2022 at 10:25 pmangelo_97Subscriberand i need your help for the previous question. Thanks in advance.
May 4, 2022 at 7:55 amDrAmineAnsys EmployeeWhy are you writing messages? It will be executed for every particle whenever it is tracked.
I do not understand your question, probably.
May 4, 2022 at 8:38 amangelo_97SubscriberI printed the value of the force and due to UDF body force,fluent will enter 3 times for x,y and z. But i don't see only 3 messages but it's like multiplying a lot of times.
May 4, 2022 at 8:40 amangelo_97SubscriberI have the same problem also if i inject 1 particles.
May 4, 2022 at 8:42 amangelo_97SubscriberI don't understand why i have a lot of messages. I don't know if also in DPM the particle can move and so i have a lot of values but i don't know
May 4, 2022 at 8:46 amRobForum ModeratorEach parcel has it's position checked every time it moves. That's typically on entering a cell, 1-2 time in the cell and on leaving. In transient you get (default) 500 particle sub steps per time step, in steady it's 5000 (which often isn't enough). So, each particle will generate up to 500 messages per time step, or 5000 per track.
May 4, 2022 at 9:02 amangelo_97Subscribersince that I'm using transient simulation with a time step size of 0.001second composed by 20 iterations and a DPM composed by 2 iterations (each 10 itaration), i will get up to 250 messages in a single DPM iteration?
Because the DPM iteration is splitter in 2 times in the time step size.
May 4, 2022 at 10:22 amRobForum ModeratorYou'll get up to 1000 per time step, with up to 500 per DPM update. With the accuracy control tools the number of steps may be reduced if the particles aren't changing direction very much.
May 4, 2022 at 11:03 amangelo_97SubscriberOkay now it's clear thank you so much you was so gently. I have only the last question.
The UDF will calculate the force for each particle? Because I see that if i inject 4 particles the value that i have on the console seems refered only to one particle. I don't know if in the UDF i have to call also the fact that i have more particle. I saw something related to loop over all the injection but i don't know.
Thank you again for the time that you are investing with me
May 4, 2022 at 11:22 amDrAmineAnsys EmployeeThe force will be invoked and the UDF with it for each particle.
May 4, 2022 at 7:17 pmangelo_97SubscriberThank you so much and for the reply, you clarified my doubts.
May 5, 2022 at 7:02 amDrAmineAnsys EmployeeGreat!
Viewing 16 reply threads
Ansys Innovation Space
- The topic ‘Wall distance calculation’ is closed to new replies.
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.
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.Trending discussions
- legend min and max
- Ensight hot iron palette from an image
- Streamlines in EnSight using MRI data
- Import MRI data into Ensight
- FLUENT APPLICATIION ERROR
- Total Surface Heat Flux Calculation in Fluent
- Difference between “total pressure” and “absolute pressure”?
- Drop Test of a Water-Filled Tube
- Minimum Orthogonal Quality Less than 0.01 For Transonic Airfoil Flow Analysis
- obtaining pressure distribution by making points in ansys
Top Rated Tags
© 2023 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.