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

UDF mass transfer

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 2, 2013, 20:26
Default UDF mass transfer
  #1
New Member
 
cfd^2
Join Date: Mar 2013
Posts: 24
Rep Power: 4
cfd^2 is on a distinguished road
Hi everyone,

I've a question about interphase mass transfer in FLUENT using an Eulerian framework. I'm using Eulerian-Eulerian model, but I am planning to do some tests with mixture model and VOF model as well.

I wrote a UDF to calculate the interphase flux as follows:

DEFINE_MASS_TRANSFER(mass_source_0, cell, thread, from_index,from_species_index, to_index, to_species_index)
{
real m_lg_0;

m_lg_0 = C_UDMI(cell, thread, 0);

return (m_lg_0);
}

"C_UDMI(cell, thread, 0)" is provided by a DEFINE_ADJUST macro, i.e. applied to the whole multiphase domain (right?).

My question is if it adequately represents the interphase exchange, or there is some additional requirement to be included in the code? Have anyone worked with this kind of modeling?

Best Regards.

Last edited by cfd^2; March 2, 2013 at 20:57.
cfd^2 is offline   Reply With Quote

Old   March 2, 2013, 21:36
Default
  #2
New Member
 
cfd^2
Join Date: Mar 2013
Posts: 24
Rep Power: 4
cfd^2 is on a distinguished road
I checked elsewhere that a guy recommended to use the following structure to "mark" the region of mass transfer, taking into account just the interface... It stands for something like this:

DEFINE_MASS_TRANSFER(mass_source_0, cell, thread, from_index,from_species_index, to_index, to_species_index)
{

real m_lg_0;

if ((C_VOF(cell,thread) != 0) && (C_VOF(cell,thread) !=1))
{

m_lg_0 = C_UDMI(cell, thread, 0);

}

return (m_lg_0);
}

I tried to run it, but FLUENT tells me that I got an ACCESS VIOLATION... Is this approach valid... if yes, could anyone tell me what is wrong (why I'm violating FLUENT access?)...

Please, help me....
cfd^2 is offline   Reply With Quote

Old   March 3, 2013, 06:15
Default
  #3
Senior Member
 
SSL
Join Date: Oct 2012
Posts: 227
Rep Power: 5
msaeedsadeghi is on a distinguished road
The problem is with C_UDMI. Where have you defined it?
msaeedsadeghi is offline   Reply With Quote

Old   March 3, 2013, 08:11
Default
  #4
New Member
 
cfd^2
Join Date: Mar 2013
Posts: 24
Rep Power: 4
cfd^2 is on a distinguished road
Quote:
Originally Posted by msaeedsadeghi View Post
The problem is with C_UDMI. Where have you defined it?
In a DEFINE_ADJUSt macro that is compiled along with the DEFINE_MASS_TRANSFER one.
cfd^2 is offline   Reply With Quote

Old   March 4, 2013, 00:54
Default
  #5
Senior Member
 
SSL
Join Date: Oct 2012
Posts: 227
Rep Power: 5
msaeedsadeghi is on a distinguished road
The whole UDF should be investigated.
msaeedsadeghi is offline   Reply With Quote

Old   May 23, 2013, 17:35
Default
  #6
Member
 
pranab_jha's Avatar
 
Pranab N Jha
Join Date: Nov 2009
Location: Houston, TX
Posts: 83
Rep Power: 7
pranab_jha is on a distinguished road
C_UDMI only works inside a cell loop I believe. You can try and see if that works out for you.
begin...
C_UDMI(c,t,i);
end_c_loop(c,t)
pranab_jha is offline   Reply With Quote

Old   May 24, 2013, 01:27
Default
  #7
Member
 
Shashank
Join Date: Apr 2011
Posts: 70
Rep Power: 6
shashank312 is on a distinguished road
The line marked in red in your post #2 does not necessarily define the interface.

Secondly, the "thread" here is a mixture thread and your VOF command cannot be passed over a mixture thread. You have to use a THREAD_SUB_THREADS function to locate the phase thread for which the VOF is being calculated.

Also, I would advise you to share the adjust routine if you want folks to help you out here.
shashank312 is offline   Reply With Quote

Old   May 28, 2013, 13:00
Default running in parallel mass_trasfer udf
  #8
Senior Member
 
rkhr
Join Date: May 2011
Posts: 222
Rep Power: 7
Kanarya is on a distinguished road
Hi

I have problem to run in parallel this code?It is simple C_UDMI which is calculated before:
DEFINE_MASS_TRANSFER(water1,c,t,from_index, from_species_index, to_index, to_species_index)
{
#if !RP_HOST

return(C_UDMI(c,t,10));

#endif

}

in serial it is ok but parallel giving me following error:
warning C4716: 'water1' : must return a value.

is there anyone had expericed before?

Thanks in advance!!!
Kanarya is offline   Reply With Quote

Old   May 28, 2013, 14:18
Default Phase thread
  #9
Member
 
pranab_jha's Avatar
 
Pranab N Jha
Join Date: Nov 2009
Location: Houston, TX
Posts: 83
Rep Power: 7
pranab_jha is on a distinguished road
Shashank312 is spot on! You have to define the fluid interface correctly using VOF_G(radient) macro and also use the phase thread instead of the mixture thread.

@Kanarya
I have used C_UDMI in parallel and did not get any errors. But to let you know, I ran in batch mode over a remote server using a pbs (batch job) file.

Listing the pbs script file here, if it is of any use:
...
#!/bin/bash
#PBS -l nodes=2pn=1

module add fluent
cd $PBS_O_WORKDIR
cp /home/* .
/cm/shared/apps/Fluent.Inc/bin/fluent 2d -t2 -g -ssh -mpi=hp -cnf=$PBS_NODEFILE -i file.jou
...

The line starting with "cp" does the trick of copying all variables for parallel processing (Note the space between {*} and {.} at the end of the same line). Of course, you will have to use the -t2 in the last line for specifying the number of processors.
pranab_jha is offline   Reply With Quote

Old   May 28, 2013, 17:20
Default
  #10
Senior Member
 
rkhr
Join Date: May 2011
Posts: 222
Rep Power: 7
Kanarya is on a distinguished road
Hi pranab_jha,

thanks for quick answer!
OK!
did you use #if !RP_HOST or #if !RP_NOPE?
or you did not use any of them..
is it working without parallelising?

Thanks again for the answer!

#!/bin/bash
#PBS -l nodes=2pn=1

module add fluent
cd $PBS_O_WORKDIR
cp /home/* .
/cm/shared/apps/Fluent.Inc/bin/fluent 2d -t2 -g -ssh -mpi=hp -cnf=$PBS_NODEFILE -i file.jou
...

The line starting with "cp" does the trick of copying all variables for parallel processing (Note the space between {*} and {.} at the end of the same line). Of course, you will have to use the -t2 in the last line for specifying the number of processors.[/QUOTE]
Kanarya is offline   Reply With Quote

Old   May 29, 2013, 10:56
Default parallel consideration
  #11
Member
 
pranab_jha's Avatar
 
Pranab N Jha
Join Date: Nov 2009
Location: Houston, TX
Posts: 83
Rep Power: 7
pranab_jha is on a distinguished road
Quote:
Originally Posted by Kanarya View Post
Hi pranab_jha,

thanks for quick answer!
OK!
did you use #if !RP_HOST or #if !RP_NOPE?
or you did not use any of them..
is it working without parallelising?

Thanks again for the answer!
[/QUOTE]

I think the problem might be that you are trying to return a value from one of the nodes that does not generate the UDMI value. In serial, the value is being generated by THE only node. But not in parallel.

I think you might try using !RP_NODE. That will ensure that only the host process is returning the data. Let us know if that works. I used the UDMI (a while back) in parallel, but used it regardless of the NODE or HOST. So, it gave me an output for each node. So, for example, for each time step, I had multiple values of either 0 or non-zero from each node. Later, I had to filter the values out in Matlab. You are doing it the right way!
pranab_jha is offline   Reply With Quote

Old   November 16, 2013, 13:13
Wink
  #12
Member
 
mehdimoradi
Join Date: Jun 2013
Posts: 50
Rep Power: 4
mehdimoradi. is on a distinguished road
Quote:
Originally Posted by msaeedsadeghi View Post
The problem is with C_UDMI. Where have you defined it?

I have a question about mass transfer in multiphase problems;
we have used DEFINE-MASS TRANSFER macro for species transport from solid phase to gas phase as a udf, recently. I want to know this udf is updated in each iteration or not? if not what work must be done to do this?
Tashakor

Last edited by mehdimoradi.; November 24, 2013 at 00:46.
mehdimoradi. is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
mass transfer in ANSYS thipps ANSYS 1 August 29, 2013 11:05
Simulation with UDF for species mass fraction and velocity profile virgy Fluent UDF and Scheme Programming 8 February 7, 2012 05:30
Multiphase Multicomponent mass transfer -Initial condition pannsave CFX 10 February 9, 2011 02:12
Mass Transfer UDF using Fluent VOF Anirudh_Deodhar FLUENT 0 February 7, 2011 16:10
Help with mass transfer in heat and water vapor exchanger mullenc525 CFX 7 January 26, 2011 00:26


All times are GMT -4. The time now is 05:50.