|
[Sponsors] |
August 6, 2020, 02:56 |
UDF - C_UDMI is giving sigsegv error
|
#1 |
New Member
Amir fit
Join Date: Nov 2019
Posts: 3
Rep Power: 7 |
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); } |
|
August 6, 2020, 03:01 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
use
Code:
C_UDMI(cell,thread,0) = m_dot;
__________________
best regards ****************************** press LIKE if this message was helpful |
|
August 6, 2020, 03:17 |
|
#3 |
New Member
Amir fit
Join Date: Nov 2019
Posts: 3
Rep Power: 7 |
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.
|
|
November 6, 2023, 02:49 |
|
#4 |
New Member
anonymous96
Join Date: Nov 2022
Posts: 17
Rep Power: 4 |
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. |
|
November 6, 2023, 23:56 |
|
#5 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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 |
|
November 7, 2023, 00:05 |
|
#6 |
New Member
anonymous96
Join Date: Nov 2022
Posts: 17
Rep Power: 4 |
I have already allocated the UDM in GUI.
|
|
November 7, 2023, 01:14 |
|
#7 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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 |
|
November 7, 2023, 01:41 |
|
#8 |
New Member
anonymous96
Join Date: Nov 2022
Posts: 17
Rep Power: 4 |
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.
|
|
Tags |
c_udmi, fluent, udf |
|
|
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 |