CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   CFX (https://www.cfd-online.com/Forums/cfx/)
-   -   UDF for particle interception with pt_termination fortran routine (https://www.cfd-online.com/Forums/cfx/157235-udf-particle-interception-pt_termination-fortran-routine.html)

abcdefgh July 23, 2015 10:52

UDF for particle interception with pt_termination fortran routine
 
Hey,

i try to simulate a Filter with a complex geometry. For that I need the Interception of particles. The particles must have a Volume for that (not only being a mass point). The Particle meets the filter a radius before it's mass (middlepoint).This means, that particles get stuck on the filter wall, if they come closer than their radius. I hope you know what I mean.

I think I can realize that with the user fortran routine pt_termination from the Ansys fortran examples.
I first tried it on a sphere (based on a udf here from the forum): thats possible. Here I have die coordinates of the sphere. But for my real geometry I have no coordinates/ can't give it a radius.
Now I had the Idea: can I refer it to the boundary condition of my geometry, The wall of the filter???

For the sphere the code looks:

...
Particle fate : RET(1,1)
C
C Argument variables
C -------------------
C
C Particle mean diameter : ARG(1,1)
C Particle position : ARG(1,2:4)
C Sphere x-position : ARG(1,5)
C Sphere y-position : ARG(1,6)
C Sphere z-position : ARG(1,7)
C
C We know that NLOC is 1 for the particle user source routines!!!!
C================================================= ======================
C
C-----------------------------------------------------------------------
C Calculate the return variables
C-----------------------------------------------------------------------
C
CALL USER_FATE (RET(1,1),ARG(1,1),ARG(1,2),ARG(1,5),ARG(1,6),ARG( 1,7))
C
END

SUBROUTINE USER_FATE (FATE,DIA,PPOS,CPOSX,CPOSY,CPOSZ)
C
C ---------------------------
C Preprocessor includes
C ---------------------------
C
#include "cfd_sysdep.h"
#include "cfd_constants.h"
C
C ------------------------------
C Argument list
C ------------------------------
C
REAL FATE, DIA, PPOS(3), CPOSX, CPOSY, CPOSZ
REAL sphereRAD, PRAD
REAL CONTACT
C
C ------------------------------
C Local variables
C ------------------------------
C
REAL DEAD, ALIVE
C ------------------------------
C Executable statements
C ------------------------------
C
DEAD = 0.
ALIVE = 1.
C
sphereRAD = 0.001
C
C---- Particle starts as alive
C
FATE = ALIVE
C
C---- Calc particle radius
PRAD = ((CPOSX-PPOS(1))**2 + (CPOSY-PPOS(2))**2 + (CPOSZ-PPOS(3))**2)**0.5
CONTACT = sphereRAD - (PRAD - DIA/2.0)
C
C---- Check if user defined criterion was exceeded, stop particle
C --> Set particle mode to __dead__
C
IF (CONTACT.GT.0.0) THEN
FATE = DEAD
ENDIF
C
END





But can I really refer it to the boundary condition. I always get an error. Here is the changed code (the changes are bold):





...
INTEGER NARG, NRET, NLOC
C
CHARACTER*(4) CRESLT
C
REAL ARG(NLOC,NARG), RET(NLOC,NRET)
C
INTEGER IZ(*)
CHARACTER CZ(*)*(1)
DOUBLE PRECISION DZ(*)
LOGICAL LZ(*)
REAL RZ(*)
C
C================================================= ======================
C
C ---------------------------
C Executable Statements
C ---------------------------
C
C================================================= ======================
C
C Return variables:
C -----------------
C
C Particle fate : RET(1,1)
C
C Argument variables
C -------------------
C
C Particle mean diameter : ARG(1,1)
C Particle position : ARG(1,2:4)
C USERREG x-position : ARG(1,5)
C USERREG y-position : ARG(1,6)
C USERREG z-position : ARG(1,7)

C
C We know that NLOC is 1 for the particle user source routines!!!!
C================================================= ======================
C
C-----------------------------------------------------------------------
C Calculate the return variables
C-----------------------------------------------------------------------
C
CALL USER_FATE (RET(1,1),ARG(1,1),ARG(1,2),ARG(1,5),ARG(1,6),ARG( 1,7))
C
END

SUBROUTINE USER_FATE (FATE,DIA,PPOS,CPOSX,CPOSY,CPOSZ)
C
C ---------------------------
C Preprocessor includes
C ---------------------------
C
#include "cfd_sysdep.h"
#include "cfd_constants.h"
C
C ------------------------------
C Argument list
C ------------------------------
C
REAL FATE, DIA, PPOS(3), CPOSX, CPOSY, CPOSZ
REAL USERREG, PRAD
REAL CONTACT
C
C ------------------------------
C Local variables
C ------------------------------
C
REAL DEAD, ALIVE
C ------------------------------
C Executable statements
C ------------------------------
C
DEAD = 0.
ALIVE = 1.

C USERREG = area@Wall
C---- Particle starts as alive
C
FATE = ALIVE
C
C---- Calc particle radius
PRAD = ((CPOSX-PPOS(1))**2 + (CPOSY-PPOS(2))**2 + (CPOSZ-PPOS(3))**2)**0.5
CONTACT = USERREG-(PRAD-DIA/2.0)
C
C---- Check if user defined criterion was exceeded, stop particle
C --> Set particle mode to __dead__
C
IF (CONTACT.GT.0.0) THEN
FATE = DEAD
ENDIF
C
END



Do you know where my mistake is, if it would be possible?

Thank you very much for your help.

Opaque July 23, 2015 11:11

USERREG is unset, i.e. it is not initialized or evaluated anywhere in the shown code.

abcdefgh July 23, 2015 11:17

Is that not enough? "USERREG = area@Wall"

What and where would you write? And do you think its possible to refer it to the wall?

Opaque July 23, 2015 11:19

The line is commented out, and the syntax is invalid anyways.

abcdefgh July 23, 2015 11:23

Oh yes, you're right. Thank you very much.

hm...how else can I write it? Only 'Wall'...areaAve()@Wall...!?!
I have to say 'wall' is my boundary called in the setup.

abcdefgh July 27, 2015 04:40

I'm Sorry, but I didn't find the solution yet.
How can I write instead of sphereRad (see the part of the user Fortran)

C
DEAD = 0.
ALIVE = 1.
C
sphereRAD = 0.001
C
C---- Particle starts as alive
C
FATE = ALIVE
C
C---- Calc particle radius
PRAD = ((CPOSX-PPOS(1))**2 + (CPOSY-PPOS(2))**2 + (CPOSZ-PPOS(3))**2)**0.5
CONTACT = sphereRAD - (PRAD - DIA/2.0)
C


The Problem is, I have no Geometry like a cylinder, thats why I have no Radius. Is it possible to refer it to the boundary condition, the wall of the Filter? What is a valid syntax for that?
Thank you for your help!

surya.tdr October 6, 2019 13:30

hey,
did you have a udf for interception part?


All times are GMT -4. The time now is 20:13.