|
[Sponsors] |
![]() |
![]() |
#1 |
New Member
Sharey
Join Date: Jul 2020
Posts: 4
Rep Power: 6 ![]() |
Hello everyone,
I am trying to work on a UDF, the function is to transfer the mass from steam to water using VOF Explicit (Volume fraction discretization) approach. The UDF is initially showing the parse error in line parse error in line 16 and showing undeclared variable in line 17. UDF is given as: #include <udf.h> #include <mem.h> #include <sg_mphase.h> #define domain_ID 1 float h_lg = 2085.0; /* 1. Filling up the UDS with the Volume Fraction for the vapor phase */ DEFINE_ADJUST(gradient_vapor, mix_domain) { Thread *mixture_thread; cell_t c; mix_domain = Get_Domain(domain_ID); Domain *sub_domain; sub_domain = Get_Domain(2); int phase_domain_index = PHASE_DOMAIN_INDEX(sub_domain); // Domain *vapor = DOMAIN_SUB_DOMAIN(mix_domain, phase_domain_index); Thread *vap = THREAD_SUB_THREAD(mixture_thread, phase_domain_index); thread_loop_c(vap, sub_domain) { begin_c_loop(c, vap) { C_UDSI(c, vap, 0) = C_VOF(c, vap); } end_c_loop(c, vap) } } /* 2. Filling up the UDS with the Volume Fraction for the liquid phase */ DEFINE_ADJUST(gradient_liq, mix_domain) { Thread *mixture_thread; cell_t c; mix_domain = Get_Domain(domain_ID); Domain *sub_domain; sub_domain = Get_Domain(3); int phase_domain_index = PHASE_DOMAIN_INDEX(sub_domain); // Domain *liquid = DOMAIN_SUB_DOMAIN(mix_domain, phase_domain_index); Thread *liq = THREAD_SUB_THREAD(mixture_thread, phase_domain_index); thread_loop_c(liq, sub_domain) { begin_c_loop(c, liq) { C_UDSI(c, liq, 1) = C_VOF(c, liq); } end_c_loop(c, liq) } } /* 3. DEFINE_MASS_TRASFER SOURCE */ DEFINE_MASS_TRANSFER(source, c, mix_thread, from_phase_index, from_species_index, to_phase_index, to_species_index) { real m_lg; float h_lg = 2085.0; mix_domain = Get_Domain(domain_ID); Thread *vapor = THREAD_SUB_THREAD(mix_thread, from_phase_index); Thread *liquid = THREAD_SUB_THREAD(mix_thread, to_phase_index); if( C_VOF(c, vapor) != 0.0 && C_VOF(c, vapor) != 1.0) { m_lg = (0.6/h_lg)* NV_DOT(C_T_G(cell, vapor), C_UDSI_G(cell, vapor, 0)); } if(C_VOF(c, liquid) != 0.0 && C_VOF(c, liquid) != 1.0) { m_lg = - (0.6/h_lg)* NV_DOT(C_T_G(cell, liquid), C_UDSI_G(cell, liquid, 1)); } else { m_lg = 0.; } return m_lg; } Can anyone please help me regarding the error i am getting in above UDF? Thanks |
|
![]() |
![]() |
![]() |
![]() |
#2 |
New Member
Sharey
Join Date: Jul 2020
Posts: 4
Rep Power: 6 ![]() |
Anybody?????
|
|
![]() |
![]() |
![]() |
![]() |
#3 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 ![]() ![]() |
change lines order
was Code:
mix_domain = Get_Domain(domain_ID); Domain *sub_domain; Code:
Domain *sub_domain; mix_domain = Get_Domain(domain_ID); show log file
__________________
best regards ****************************** press LIKE if this message was helpful |
|
![]() |
![]() |
![]() |
![]() |
#4 |
New Member
Sharey
Join Date: Jul 2020
Posts: 4
Rep Power: 6 ![]() |
Hi Alexander, thanks for replying. I am still facing the Segmentation error while hooking the function (DEFINE_ON_DEMAND) on EXECUTE ON DEMAND dialog box. Any, suggestion for this.
|
|
![]() |
![]() |
![]() |
Tags |
fluent vof, parse error, udf, undeclared variable |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Urgent help for UDF Code needed | force_95 | FLUENT | 2 | October 25, 2019 08:35 |
Parse Error while Interpreting UDF | zh_cfd | Fluent UDF and Scheme Programming | 0 | September 25, 2018 06:47 |
parse error while interpreting udf | chem engineer | Fluent UDF and Scheme Programming | 10 | September 18, 2015 10:06 |
Parse Error for Surface Reaction UDF | cgravell | Main CFD Forum | 0 | March 6, 2013 10:30 |
parse error in transient udf | spring | FLUENT | 1 | July 6, 2010 07:26 |