CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

mixture level thread

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 11, 2016, 06:07
Default mixture level thread
  #1
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 12
hwet is on a distinguished road
Hi
Does the mixture level thread contain particle data too? Well, I think not.
How can I get the mixture data such as C_VOF into a DEFINE_DPM UDF, I have tried using the Get_Domain and Lookup_Thread macros but they dont seem to work.

Cheers
hwet is offline   Reply With Quote

Old   February 11, 2016, 06:23
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
The DPM macros are generally called for each particle at a particular stage of the solver. The cell where the particle resides in can be accessed with the P_CELL and P_CELL_THREAD macros. For example, in combination with the multiphase subthread macro:

Code:
cell_t c;
Thread *t;
real volume_fraction;

c = P_CELL(p);
t = THREAD_SUB_THREAD(P_CELL_THREAD(p),0);

volume_fraction = C_VOF(c,t);
`e` is offline   Reply With Quote

Old   February 11, 2016, 07:06
Default
  #3
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 12
hwet is on a distinguished road
Hmm
I am trying to run this simple code from one of the posts here. This macro already has the particle cell and thread but I get an access violation (editing: actually it says received a fatal signal (segmentation fault) when i try to use this UDF. Did specify a scalar in the dialog box in Fluent too.

Quote:
Yeah I solved the problem, this is the UDF I used and it works perfect:


#include "udf.h"

DEFINE_DPM_SCALAR_UPDATE(charge,c,t,initialize,p)
{
Thread *phase_t = THREAD_SUB_THREAD(t,1);

if(C_VOF(c,phase_t)>=0.5)
p->stream_index = -1;
}
hwet is offline   Reply With Quote

Old   February 12, 2016, 00:20
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
You don't need a scalar variable for using the DEFINE_DPM_SCALAR_UPDATE macro, scalars are for when you're using UDS. Are you sure you have multiple phases (therefore multiple domains)? Try removing each line of code one step at a time to determine which line of code is causing the segmentation fault (Fluent is trying to access something not there).
`e` is offline   Reply With Quote

Old   February 12, 2016, 02:25
Default
  #5
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 12
hwet is on a distinguished road
I receive a segmentation error when I want to get the C_VOF. If I try to get the particle properties it runs fine. (I dont know if it runs fine, but it does not crash atleast). using the particle properties and trying to abort the particles as their velocity changes has no affect and the particles are never aborted. But that is a problem for later...

I do have multiple phases and the phase ID for the phase I want to get is 3. So I do change it to 3. But still get the segmentation error.

Code:
#include "udf.h"
DEFINE_DPM_SCALAR_UPDATE(charge,c,t,initialize,p)
{
Thread *phase_t = THREAD_SUB_THREAD(t,3);

if(C_VOF(c,phase_t)>=0.5)
p->stream_index = -1;
}
hwet is offline   Reply With Quote

Old   February 12, 2016, 03:39
Default
  #6
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Do you have a simple case you could share with us so we can reproduce the error? Please upload the Workbench archive rather than the Fluent case and data files.
`e` is offline   Reply With Quote

Old   February 12, 2016, 06:44
Default
  #7
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 12
hwet is on a distinguished road
Yes it is a fairly simple case. The idea is to get dust particles trapped by water droplets when they come across one.

I understand you wanted the workbench files but I dont have access to ansys right now (at home and just saw your post), so I am uploading the case and data file only (sorry), but if you will defo need the workbench files I can upload them on Monday (weekend now ).

Here is the link to the stored files. The password is: cfdonline

The .c file you will find is the udf in the current state in which i left it at end of the day today. (ofcourse still wasn't working).

https://cloudstor.aarnet.edu.au/plus...7FTkyZyyIq5bFo

Thanks e
hwet is offline   Reply With Quote

Old   February 12, 2016, 18:08
Default
  #8
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
I'm getting the same error, have you managed to use the C_VOF macro in any other case (perhaps with a different macro)?
`e` is offline   Reply With Quote

Old   February 12, 2016, 22:58
Default
  #9
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 12
hwet is on a distinguished road
Yes, I did try with the DEFINE_DPM_BODY_FORCE marco as well, same error.

Have you ever done something similar? Using C_VOF in a DPM macro?

Also, wondering if it is always this hit and trial thingy with UDF's? Asking since I have been following your posts for quite some time now and consider you an advanced UDF user...
hwet is offline   Reply With Quote

Old   February 15, 2016, 21:29
Default
  #10
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
I've not used the VOF model in Fluent -- does the C_VOF macro work without the DPM enabled? If it's working without the DPM enabled, then double check the thread numbers (using THREAD_SUB_THREAD) are the same with vs without DPM.

Yes, I've found the UDFs (and much of Fluent) to be hit and miss. It's the nature of closed source / commercial software where you don't know how they're calculating and solving the equations (beyond what their guides indicate which aren't exhaustive).
`e` is offline   Reply With Quote

Old   February 15, 2016, 23:16
Default
  #11
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 12
hwet is on a distinguished road
OK, so C_VOF is a phase thread, which thread is the particle in?

If it says 't' is the pointer to thethread where the particle is in, what thread level is it?

The mixture thread? It is a discrete phase not sure if it will be in the mixture thread.

What needs to be done here is get the phase thread from the discrete phase thread, but what thread is the discrete phase in?

Or get the phase thread from mixture thread but then it is all inter-connected, how do i get the mixture thread without any subthreads of the mixture thread in the DEFINE macro. Or if I start with Get_Domain and go from there? But somewhere in between starting from the domain I get stuck as well...ARRRGGGGhhh

Quote:
I've not used the VOF model in Fluent -- does the C_VOF macro work without the DPM enabled?
It will work if there is a macro (DEFINE macro) which passes the phase thread or the mixture thread, so you can get the phase thread of the secondary phase from there.
Maybe I should start with as the guide does for the DEFINE_ON_DEMAND macro which doesn't pass anything and go on form there doing the same thing in the DPM macro instead?
hwet is offline   Reply With Quote

Old   February 17, 2016, 21:17
Default
  #12
Senior Member
 
Join Date: Mar 2014
Posts: 375
Rep Power: 12
hwet is on a distinguished road
Sorted this out now,

used Thread **x and x=THREAD_SUB_THREADS(t) instead of THREAD_SUB_THREAD(t,i), and then when using the macro C_VOF(c,t), use C_VOF(c,x[i]) instead.

cheers
hwet is offline   Reply With Quote

Old   July 19, 2016, 07:32
Smile
  #13
New Member
 
Fangfang Sun
Join Date: Mar 2016
Posts: 3
Rep Power: 10
ffsun is on a distinguished road
I also need C_VOF,how did you sort,here i cannot understand clearly.

Could you share with me your udf? Thanks very much. My email is adnan_laghari@hotmail.com.


Quote:
Originally Posted by hwet View Post
Sorted this out now,

used Thread **x and x=THREAD_SUB_THREADS(t) instead of THREAD_SUB_THREAD(t,i), and then when using the macro C_VOF(c,t), use C_VOF(c,x[i]) instead.

cheers
ffsun is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ANSYS Workbench on "Uncertified" Linux Distros hsr CFX 289 April 20, 2023 10:23
[snappyHexMesh] SHM error: inside mesh not possible Naresh yathuru OpenFOAM Meshing & Mesh Conversion 1 January 11, 2017 00:58
[snappyHexMesh] meshing of very small patches in comparison with the overall geometry christos OpenFOAM Meshing & Mesh Conversion 3 December 17, 2014 17:55
[snappyHexMesh] defining two cellZone in SHM student666 OpenFOAM Meshing & Mesh Conversion 0 July 15, 2014 09:33
mixture mass continuity v.s. volumetric mixture continuity in pressure equation kaifu OpenFOAM 0 June 9, 2011 09:14


All times are GMT -4. The time now is 00:12.