|
[Sponsors] |
SEGMENTATION fault while using DEFINE_PROPERTY macro |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
January 24, 2018, 08:57 |
SEGMENTATION fault while using DEFINE_PROPERTY macro
|
#1 |
New Member
Leonard
Join Date: Dec 2017
Posts: 4
Rep Power: 8 |
Dear all,
I am relatively new to programming in c, and completely new in writing UDF's for Fluent. Now, I want to write an UDF that defines the thermal conductivity for the primary phase and the secondary phase. I am using the DEFINE_PROPERTY macro to do this. I have tried this in the following way: Code:
/********************************************************************* UDF that simulates the correlation for the conductivity proposed by Shen et al. **********************************************************************/ #include "udf.h" DEFINE_PROPERTY(cell_conductivity,cell,thread) { /* Variable fluid properties for water-vapor subcooling @353.15 K as defined by Mills */ real T_SAT = 373.15; real k_v = 24.8e-3; real k_l = 0.674; real ktc_; /* Enhancement factor n, as proposed by Shen. Enhances the energy transportation in the two-phase region. */ real n = 1.; Domain *subdomain_gas; Domain *subdomain_liq; int phase_domain_index_gas; int phase_domain_index_liq; Thread *gas; Thread *liq; real temp; subdomain_gas = Get_Domain(2); /* retrieve pointer to primary phase domain */ subdomain_liq = Get_Domain(3); /* retrieve pointer to secondary phase domain */ phase_domain_index_gas = PHASE_DOMAIN_INDEX(subdomain_gas); phase_domain_index_liq = PHASE_DOMAIN_INDEX(subdomain_liq); gas = THREAD_SUB_THREAD(thread, phase_domain_index_gas); liq = THREAD_SUB_THREAD(thread, phase_domain_index_liq); temp = C_T(cell,thread); if (temp >= T_SAT){ ktc_ = C_VOF(cell,liq) * k_l + C_VOF(cell,gas) * k_v; } else { ktc_ = C_VOF(cell,liq) * k_l + n * C_VOF(cell,gas) * k_v; } return ktc_; } I would be very happy if someone could help me. Also, feel free to give any tips on programming if you like. Cheers! |
|
Tags |
define_property, segmentaion fault, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Segmentation fault when running dieselFoam or dieselEngineFoam in parallel | francesco | OpenFOAM Bugs | 4 | May 2, 2017 21:59 |
Segmentation fault in SU2 V5.0 | ygd | SU2 | 2 | March 1, 2017 04:38 |
Segmentation fault when running in parallel | Pj. | OpenFOAM Running, Solving & CFD | 3 | April 8, 2015 08:12 |
Segmentation Fault w/ compiled OF 2.2.0 - motorBike example | sudo | OpenFOAM Running, Solving & CFD | 3 | April 2, 2013 17:27 |
segmentation fault when installing OF-2.1.1 on a cluster | Rebecca513 | OpenFOAM Installation | 9 | July 31, 2012 15:06 |