CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Question about C_UDMI use (https://www.cfd-online.com/Forums/fluent-udf/113314-question-about-c_udmi-use.html)

NPat February 17, 2013 17:09

Question about C_UDMI use
 
Hi friends,

I've had some questions about the use of C_UDMI for UDF coding. I've tried to interpret the following codes in FLUENT (two separate files):

#include "udf.h"

DEFINE_ADJUST(teste, domain)
{
Thread *t;
cell_t c;

thread_loop_c(t, domain)
{
begin_c_loop_all(c, t)
{
C_UDMI(c,t,0) = 1.;
}
end_c_loop_all(c, t)
}
}


#include "udf.h"

DEFINE_MASS_TRANSFER(mass_exchange_3, cell, thread, from_index,from_species_index, to_index, to_species_index)
{
real m_lg;
m_lg = C_UDMI(cell, thread, 0);
return (m_lg);
}

I don't have any problem interpreting this functions, but when I ran it in FLUENT I checked the mass transfer rate and I got 0.0. Moreover, in post processing the value of C_UDMI is also 0.0. There is any problem whith these codes?

Please, help me with this issue...

NPat February 17, 2013 18:10

Friends,

I already solved this problem. Thank you!

Regards,
Natan

vidyadhar November 14, 2018 01:30

received a fatal signal - during calculation of evaporation using UDF
 
Hello Natan,


I am also working on evaporation of a liquid using VOF method.
I have written the following UDF (single file) for simulating mass transfer.

After interpretation and initialization, I am facing this problem-

Error: received a fatal signal (Segmentation fault). Error Object: #f

when I press the "Run Calculate ----> calculate" button:




-------------------------------------------------

I request you to help me what is wrong in the UDF.


#include "udf.h"
#include "sg_mphase.h"
#define T_SAT 343
#define LAT_HT 339.8e3
#define CON 3.2

DEFINE_ADJUST(my_adjust,d)
{
real source;
Thread *t0;
face_t f;
cell_t c0;
int ID=3; /* 3 IS THE ZONE ID FOR MENISCUS AS SEEN IN BOUNDARY CONDITIONS PANEL*/
/*BELOW MENTIONED IS THE POINTER FOR DOMAIN OF PHASE*/
Domain *domain = Get_Domain (3); /*CHECK WHETHER I HAVE TO SPECIFY 1-MIXTURE OR 2-PRIMARY PHASE OR 3-SECONDARY PHASE.*/
Thread *thread = Lookup_Thread(domain,ID);
begin_f_loop(f,thread)
{
/*TO SELECT ONE LAYER OF CELLS ADJACENT TO MENISCUS*/
c0 = F_C0(f,thread); /*See ADJACENT CELL INDEX*/
t0 = THREAD_T0(thread); /*See ADJACENT CELL THREAD*/
source= 0.002; /*MENTION SOURCE HERE*/;
if(C_T(c0,thread) >= T_SAT)
{
C_UDMI(c0,t0,0)=source;
}
}
end_f_loop(f,thread) /*the semicolon should be present or not check*/
}

DEFINE_MASS_TRANSFER(liq_gas_source,cell,mix_th,fr om_index,from_species_index,to_index,to_species_in dex)
{
real m_lg=0;
Thread *liq=THREAD_SUB_THREAD(mix_th,from_index);
Thread *gas=THREAD_SUB_THREAD(mix_th,to_index);
m_lg=C_UDMI(cell,liq,0);
return (m_lg);
}



--------------------------------------------



Quote:

Originally Posted by NPat (Post 408345)
Hi friends,

I've had some questions about the use of C_UDMI for UDF coding. I've tried to interpret the following codes in FLUENT (two separate files):

#include "udf.h"

DEFINE_ADJUST(teste, domain)
{
Thread *t;
cell_t c;

thread_loop_c(t, domain)
{
begin_c_loop_all(c, t)
{
C_UDMI(c,t,0) = 1.;
}
end_c_loop_all(c, t)
}
}


#include "udf.h"

DEFINE_MASS_TRANSFER(mass_exchange_3, cell, thread, from_index,from_species_index, to_index, to_species_index)
{
real m_lg;
m_lg = C_UDMI(cell, thread, 0);
return (m_lg);
}

I don't have any problem interpreting this functions, but when I ran it in FLUENT I checked the mass transfer rate and I got 0.0. Moreover, in post processing the value of C_UDMI is also 0.0. There is any problem whith these codes?

Please, help me with this issue...


AlexanderZ November 14, 2018 22:54

did you set correct number of UDMs in FLuent GUI, which you are using in code?
user-defined -> memory -> UDM Locations switch to 1

best regards

vidyadhar November 14, 2018 23:03

Quote:

Originally Posted by AlexanderZ (Post 715495)
did you set correct number of UDMs in FLuent GUI, which you are using in code?
user-defined -> memory -> UDM Locations switch to 1

best regards


Thanks for the reply.


Yes, I have swithced UDM locations to 1.
Even then, I am facing the problem:

Error: received a fatal signal (Segmentation fault). Error Object: #f



I wanted to apply the source terms on one layer of cells adjacent to "meniscus" boundary zone (with Zone ID=3) in the liquid phase domain(Domain ID=3).


May I request you to correct me if I have done any mistake in the UDF.

Is there any mistake in the "loop" of the code?
Is placing C_UDMI under DEFINE_ADJUST and using it in DEFINE_MASS_TRANSFER works?


Thanks in advance!
Vidyadhar


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