CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   UDF mass transfer (http://www.cfd-online.com/Forums/fluent-udf/113989-udf-mass-transfer.html)

cfd^2 March 2, 2013 20:26

UDF mass transfer
 
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.

cfd^2 March 2, 2013 21:36

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....

msaeedsadeghi March 3, 2013 06:15

The problem is with C_UDMI. Where have you defined it?

cfd^2 March 3, 2013 08:11

Quote:

Originally Posted by msaeedsadeghi (Post 411143)
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.

msaeedsadeghi March 4, 2013 00:54

The whole UDF should be investigated.

pranab_jha May 23, 2013 17:35

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)

shashank312 May 24, 2013 01:27

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.

Kanarya May 28, 2013 13:00

running in parallel mass_trasfer udf
 
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!!!

pranab_jha May 28, 2013 14:18

Phase thread
 
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=2:ppn=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.

Kanarya May 28, 2013 17:20

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=2:ppn=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]

pranab_jha May 29, 2013 10:56

parallel consideration
 
Quote:

Originally Posted by Kanarya (Post 430611)
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!

mehdimoradi. November 16, 2013 13:13

Quote:

Originally Posted by msaeedsadeghi (Post 411143)
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


All times are GMT -4. The time now is 19:55.