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

UDF - C_UDMI is giving sigsegv error

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 6, 2020, 02:56
Default UDF - C_UDMI is giving sigsegv error
  #1
New Member
 
Amir fit
Join Date: Nov 2019
Posts: 3
Rep Power: 7
fit78 is on a distinguished road
Hello,

I am having issues with C-UDMI with my simple code.

I read all the thread relevant to this but to no avail.

I am using Ansys 2019 R2
- I have allocated a memory in UDM GUI
-The UDF worked fine without C_UDMI.

Anyone can assist?
TQ
Fit78

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

/* UDF to define a simple mass transfer
The "to" phase is the gas phase and the "from" phase is the liquid phase */

#include "udf.h"

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

cell_t c;

Thread *t;

real m_vap,m_air;
real W_I;
real vof_cutoff = 0.05;
real tmr,vmr,amr,vpp;

real P_pvi;
real Diff;

real m_dot, dp, m_source;


Thread *gas = THREAD_SUB_THREAD(thread, to_index);
Thread *liq = THREAD_SUB_THREAD(thread, from_index);


real press = C_P(cell, thread);
real rho_l = C_R(cell,liq);
real rho_v = C_R(cell,gas);
real vof_l = C_VOF(cell,liq);
real vof_v = C_VOF(cell,gas);




m_dot = 0.;

m_vap=18.01528;
m_air=28.97;
//Mass diffusivity for air-water
Diff=0.282;

//total mole ratio - vapor mole ratio -air mole ratio
tmr=m_vap+m_air;
vmr=m_vap/tmr;
amr=m_air/tmr;


if ( (vof_l > vof_cutoff ) && (vof_l < (1 - vof_cutoff) ))

{ /* Evaporative cooling at interface */


//vapor partial pressure
vpp = (vmr/tmr)*press;

//mass fraction at interface
W_I=(m_vap*vpp)/((m_air*(press-vpp))+(m_vap*vpp));

//mass flow rate at interface - supposed to include dw/dr but later
m_dot=(rho_v*Diff)/(1-W_I);

// save mass flow rate to user defined memory in Fluent

C_UDMI(c,t,0) = m_dot;



}


return (m_dot);
}
fit78 is offline   Reply With Quote

Old   August 6, 2020, 03:01
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
use
Code:
C_UDMI(cell,thread,0) = m_dot;
fit78 likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   August 6, 2020, 03:17
Default
  #3
New Member
 
Amir fit
Join Date: Nov 2019
Posts: 3
Rep Power: 7
fit78 is on a distinguished road
Thanks! That did it. Saved me lots of time debugging. Sometimes you just need a fresh pair of eyes. I wonder why the syntax is very inconsistent like this.
fit78 is offline   Reply With Quote

Old   November 6, 2023, 02:49
Default
  #4
New Member
 
anonymous96
Join Date: Nov 2022
Posts: 17
Rep Power: 4
anonymous96_ is on a distinguished road
Hi
I am trying to calculate volumetric flow rate through an interior surface.Following is my piece of code:

DEFINE_ON_DEMAND(ach_udf)
{
Thread *t,*to;
face_t f;
cell_t co;
Domain *d;
d = Get_Domain(1);
real A[ND_ND];
t = Lookup_Thread(d,2);
real ACHt_mean_out=0;
real ACHt_mean_in=0;

begin_f_loop(f,t)
{
F_AREA(A,f,t);
co = F_C0(f, t);
to = THREAD_T0(t);
real vel_roof= C_V(co,to);
if (vel_roof>0)
{
ACHt_mean_out += vel_roof*NV_MAG(A);
}
else
{
ACHt_mean_in +=vel_roof*NV_MAG(A);
}
}
end_f_loop(f,t)
}

This is getting compiled and solved properly. But as soon as I use C_UDMI for storage, it gives error on using execute on demand. Following is the code which gives error:

DEFINE_ON_DEMAND(ach_udf)
{
Thread *t,*to;
face_t f;
cell_t co;
Domain *d;
d = Get_Domain(1);
real A[ND_ND];
t = Lookup_Thread(d,2);
real ACHt_mean_out=0;
real ACHt_mean_in=0;

begin_f_loop(f,t)
{
F_AREA(A,f,t);
co = F_C0(f, t);
to = THREAD_T0(t);
real vel_roof= C_V(co,to);
if (vel_roof>0)
{
ACHt_mean_out += vel_roof*NV_MAG(A);
}
else
{
ACHt_mean_in +=vel_roof*NV_MAG(A);
}
}
end_f_loop(f,t)

C_UDMI (co,to,0)=ACHt_mean_out ;
}

Can you please tell me what is wrong here.
anonymous96_ is offline   Reply With Quote

Old   November 6, 2023, 23:56
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
allocate user defined memory
fluent gui-> user defined -> memory -> user defined memory location change to 1
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   November 7, 2023, 00:05
Default
  #6
New Member
 
anonymous96
Join Date: Nov 2022
Posts: 17
Rep Power: 4
anonymous96_ is on a distinguished road
I have already allocated the UDM in GUI.
anonymous96_ is offline   Reply With Quote

Old   November 7, 2023, 01:14
Default
  #7
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
#include "udf.h"

DEFINE_ON_DEMAND(ach_udf)
{
Thread *t,*to;
face_t f;
cell_t co;
Domain *d;
real ACHt_mean_out=0;
real ACHt_mean_in=0;
real A[ND_ND];
real vel_roof;
d = Get_Domain(1);
t = Lookup_Thread(d,2);

begin_f_loop(f,t)
{
F_AREA(A,f,t);
co = F_C0(f, t);
to = THREAD_T0(t);
vel_roof= C_V(co,to);
if (vel_roof>0)
{
ACHt_mean_out += vel_roof*NV_MAG(A);
}
else
{
ACHt_mean_in +=vel_roof*NV_MAG(A);
}
}
end_f_loop(f,t)

C_UDMI (co,to,0)=ACHt_mean_out ;
}
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   November 7, 2023, 01:41
Default
  #8
New Member
 
anonymous96
Join Date: Nov 2022
Posts: 17
Rep Power: 4
anonymous96_ is on a distinguished road
I have included the header files too just not posted them here. As I said , the code runs successfully without adding C_UDMI(co, to,0)=........., but as soon as I add this to the code, it gives error on using "execute" for execute on demand.
anonymous96_ is offline   Reply With Quote

Reply

Tags
c_udmi, fluent, udf


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
UDF for DPM particle deposition modelingpa haghshenasfard Fluent UDF and Scheme Programming 10 September 15, 2019 03:03
Undeclared Identifier Errof UDF SteveGoat Fluent UDF and Scheme Programming 7 October 15, 2014 08:11
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42
Installation OF1.5-dev ttdtud OpenFOAM Installation 46 May 5, 2009 03:32
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 21:50


All times are GMT -4. The time now is 14:17.