|
[Sponsors] |
March 9, 2015, 20:16 |
define dpm bc
|
#1 |
New Member
anonymous
Join Date: Mar 2015
Posts: 25
Rep Power: 11 |
I am modeling some inert particles flow through a pipe and want to make a udf to define sticking criteria for the particles. The plan is have the ufd check the particle diamter and velcity at impact, calculate the capture velocity and then abort for sticking or track for the particle to bounce off the wall and continue on.
Anyyyyways my question is that the user manual says that if you are going to use this DEFINE_DPM_BC function you must compute the new velocity of the particle after it hits the wall within your udf. I am not altering the coefficients of restitution (my setting is 0.99 - very small particles and assuming no deformation on impact) so do I still need to include this calculation in my udf? Sincerely- trying-not-to-pull-my-hair-out |
|
March 10, 2015, 07:09 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
In your case, the particles have two options (use an if statement) once they hit the wall:
(1) particle is captured by the wall ("stick" == trapped; using a return of PATH_ABORT) (2) particle continues (using a return of PATH_ACTIVE) with reflected velocities. Either assume perfectly elastic conditions or use a relevant equation to calculate the new velocities. If you simply return a particle from the boundary with the same velocities it had, then I suspect the particle would collide with the same boundary again, creating an infinite loop (try this!). |
|
March 10, 2015, 17:53 |
|
#3 | |
New Member
anonymous
Join Date: Mar 2015
Posts: 25
Rep Power: 11 |
Quote:
I have decided I lack the programming experience to get this udf together properly so I will not be able to let you know how it goes. But hopefully soon I will have a not have a not-as-sophisticated method but a workable one |
||
March 10, 2015, 18:20 |
|
#4 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
The concept for this UDF isn't too complicated but I can understand your hesitation without programming experience, but surely it'll be fun!
Here's a start anyway, you'll need to add in the capture velocity equation and how you'll determine the reflected particle velocities. Code:
#include "udf.h" DEFINE_DPM_BC(my_dpm_bc,p,t,f,f_normal,dim) { /* Variable declarations */ real u, v, w, diameter, capture_velocity, critical_capture_velocity=0.; /* Variable evaluations */ u=P_VEL(p)[0]; v=P_VEL(p)[1]; w=P_VEL(p)[2]; diameter=P_DIAM(p); // Calculate the capture velocity with u, v, w and diameter here, then: if (capture_velocity > critical_capture_velocity) // particle travels fast { // Update particle velocities for reflection case return PATH_ACTIVE; } else // particle travels slow and is stuck { return PATH_ABORT; } } |
|
March 10, 2015, 19:55 |
|
#5 |
New Member
anonymous
Join Date: Mar 2015
Posts: 25
Rep Power: 11 |
You are too kind and thank you for the encouragement.
So here is my first attempt. I don't need to calculate the particle velocity so I deleted the u, v and w velocity components. I grabbed an example from the user manual to calc the reflection velocity. I am a bit confused on why in the variable declarations the critical_capture_velocity is equal to zero? (I did try to search this). Is this initializing the variable maybe? I think I'll be up for a while working on this. Let you know how it goes. PHP Code:
|
|
March 10, 2015, 20:08 |
|
#6 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
No worries, syntax and rules of coding languages can be easily found on the internet but it's a bit trickier starting a UDF from scratch without the big picture.
You don't need to initialise the 'critical_capture_velocity' variable; you could either hard code a constant in this initialisation (instead of having zero) or calculate a value as you have now done. Which velocity are you intending to compare with the critical capture velocity, a single component (perpendicular, etc) or magnitude? You're currently comparing an array (P_VEL(p)) with a scalar (critical_capture_velocity). Also: 'diamter' -> 'diameter' |
|
March 10, 2015, 20:26 |
|
#7 |
New Member
anonymous
Join Date: Mar 2015
Posts: 25
Rep Power: 11 |
I would like to compare the velocity magnitude of the particle to the critical capture velocity.
I thought that P_VEL(p) was the velocity magnitude of the particle but I'm guessing if its an array it holds the velocity info for all the particles. Let the google searching commence! |
|
March 10, 2015, 20:31 |
|
#8 |
New Member
anonymous
Join Date: Mar 2015
Posts: 25
Rep Power: 11 |
Ok I am seeing why you had u, v and w originally in the variable evaluations. I need to calculate the particles velocity magnitude.
(slowly but surely) |
|
March 11, 2015, 13:36 |
|
#9 |
New Member
anonymous
Join Date: Mar 2015
Posts: 25
Rep Power: 11 |
I wanted to say thanks again for giving me a place to start from. I actually do enjoy doing this sort of thing its just such a jump from beginning to anything else. A long time ago I took a C class but it was kind of a disacter since most all except myself and another person had programming experience so it was taught to that intermediate level.
Anyhoo since you were so nice I wanted to let you know I am working through getting all the errors I am getting when compiling in fluent. Hopefully soon I'll have this firgured out. PHP Code:
|
|
March 11, 2015, 14:15 |
|
#10 |
New Member
anonymous
Join Date: Mar 2015
Posts: 25
Rep Power: 11 |
The latest excitement...
..\..\src\my_dpm_bc.c(12) : error C2061: syntax error : identifier 'u' ..\..\src\my_dpm_bc.c(12) : error C2059: syntax error : ';' ..\..\src\my_dpm_bc.c(13) : error C2061: syntax error : identifier 'v' ..\..\src\my_dpm_bc.c(13) : error C2059: syntax error : ';' ..\..\src\my_dpm_bc.c(14) : error C2061: syntax error : identifier 'w' ..\..\src\my_dpm_bc.c(14) : error C2059: syntax error : ';' ..\..\src\my_dpm_bc.c(15) : error C2061: syntax error : identifier 'diameter' ..\..\src\my_dpm_bc.c(15) : error C2059: syntax error : ';' ..\..\src\my_dpm_bc.c(16) : error C2061: syntax error : identifier 'particle_velocity' ..\..\src\my_dpm_bc.c(16) : error C2059: syntax error : ';' ..\..\src\my_dpm_bc.c(17) : error C2061: syntax error : identifier 'critical_capture_velocity' ..\..\src\my_dpm_bc.c(17) : error C2059: syntax error : ';' ..\..\src\my_dpm_bc.c(20) : error C2065: 'p' : undeclared identifier ..\..\src\my_dpm_bc.c(20) : error C2099: initializer is not a constant ..\..\src\my_dpm_bc.c(21) : error C2109: subscript requires array or pointer type ..\..\src\my_dpm_bc.c(22) : error C2109: subscript requires array or pointer type ..\..\src\my_dpm_bc.c(23) : error C2109: subscript requires array or pointer type ..\..\src\my_dpm_bc.c(27) : error C2099: initializer is not a constant ..\..\src\my_dpm_bc.c(28) : error C2099: initializer is not a constant ..\..\src\my_dpm_bc.c(32) : error C2059: syntax error : 'if' PHP Code:
|
|
March 11, 2015, 18:08 |
|
#11 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
No worries, I find problem solving enjoyable.
Why is there DEFINE_DPM_BC(bc_reflect,p,t,f,f_normal,dim) nestled inside DEFINE_DPM_BC(my_dpm_bc,p,t,f,f_normal,dim), and the commented title does not have a trailing */? |
|
March 12, 2015, 11:17 |
|
#12 |
New Member
anonymous
Join Date: Mar 2015
Posts: 25
Rep Power: 11 |
cause I'm a spaz and not paying attention...
I got this to compile on fluent with out any errors. So its definitely an understatement to say I'm excited. I did some more research for udf's online and spent a lot of time messing around with them. Lots of guess and check since like I said before I'm very green with this stuff. PHP Code:
|
|
March 12, 2015, 16:36 |
|
#13 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Awesome, glad to hear you've got a working UDF now!
|
|
April 29, 2015, 22:18 |
|
#14 |
New Member
Join Date: Apr 2015
Posts: 16
Rep Power: 11 |
Will the above posted UDF be OK to run in parallel to without any chances made to it? How can I tell if I need to make changes to a UDF to run it in parallel?
|
|
April 29, 2015, 23:01 |
|
#15 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Your DPM BC should run fine in parallel because only a single process calls this macro when a particle collides with the relevant wall (particles are only tracked on a single process at a time from what I can determine).
|
|
September 23, 2015, 22:49 |
|
#16 |
Senior Member
Join Date: Mar 2014
Posts: 375
Rep Power: 13 |
HTML Code:
Your DPM BC should run fine in parallel because only a single process calls this macro when a particle collides with the relevant wall (particles are only tracked on a single process at a time from what I can determine). Is it possible that at some time more than one processes call this UDF. Since for me if I run the simulation for a high number of time steps the fluent particle data file resets. This does not happen if there is no UDF or the number of time steps is small. |
|
September 27, 2015, 18:22 |
|
#17 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Perhaps if multiple particles (on different processes) collide with this boundary at the same time. I've not experienced any issues with using DPM in parallel. However, I've not used the "particle data file" (but expect the developers to have coded for parallel).
|
|
October 7, 2018, 04:38 |
what if I'd like to make some particles trapped by the wall while others pass through
|
#18 | |
New Member
应雯
Join Date: Jan 2018
Posts: 2
Rep Power: 0 |
Quote:
I tried to use "return PATH_ACTIVE", but the particles continued to hit the wall, and it seems that I can't change their position simply by changing the value of P_POS(p)[i]. I wonder that if u can give me some advice! thank u very much! |
||
October 8, 2018, 03:36 |
|
#19 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
How do you imagine particles to 'pass through' your wall? What is on the other side of the wall?
Normally speaking, a wall is the end of your calculation domain. So a particle can not go beyond that wall, it would be outside of the calculation domain. Do you have a very specific situation in which it makes sense to let a particle go through a wall? |
|
October 8, 2018, 04:07 |
|
#20 | |
New Member
应雯
Join Date: Jan 2018
Posts: 2
Rep Power: 0 |
Quote:
The wall is an internal wall, both side of the wall is fluid domain. You can imagine the gas with particles flows in a tube, and there is a net which makes the big particles stop and small ones pass through. Thank u for your reply! |
||
Tags |
dpm, particle, wall boundary conditions |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Define steam flow rate | belkadi | OpenFOAM Programming & Development | 0 | June 27, 2013 08:24 |
UDF carbon conversion | papteo | Fluent UDF and Scheme Programming | 1 | August 18, 2011 08:32 |
DPM and UDS | mighelone | FLUENT | 0 | June 3, 2011 08:27 |
How to define injections in DPM model | lingo | FLUENT | 5 | December 16, 2003 11:22 |
Problem about DPM (how to define injections) | lingo | FLUENT | 2 | November 19, 2003 00:30 |