|
[Sponsors] |
model mass loss due to evaporation across a boundary - writing error |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 11, 2014, 14:26 |
model mass loss due to evaporation across a boundary - writing error
|
#1 |
New Member
syunary
Join Date: Aug 2014
Posts: 7
Rep Power: 12 |
Hi,
I need to model mass loss due to evaporation across a boundary in my domain. The source term is written for a cell and subsequently looped across the boundary. This is just a single phase flow model and I have tried to write a UDF for the mass source term as follows: #include "udf.h" /* CONSTANTS */ #define M 0.018; #define hfg 2600; #define R 8.314; #define pi 3.14; #define pref 101325; #define Tref 373.15; #define pv 15828; #define Tv 343; /*Source Term for evaporation from a boundary*/ DEFINE_SOURCE(mass_evap,c,t,dS,eqn) { real source, pv_eq, Tlv, vol, Acell ; Thread *t_int; face_t f_int; Domain *domain; domain=Get_Domain(1); t_int=Lookup_Thread(domain,3); /*3 is the zone id for the boundary where source term is to be applied*/ begin_c_loop(c,t) /*to loop the source term over all the cells in the boundary*/ { int i=0; f_int=C_FACE(c,t,i); /*to get the global thread of faces for cell with index c and thread pointer t */ F_AREA(area,f_int,t_int); /*area of the boundary face of the cell */ Acell=NV_MAG(area); /*Magnitude of the area*/ Tlv=C_T(c,t); /*Temperature of the cell at the Boundary*/ vol=C_VOLUME(c,t); /*volume of the cell at the Boundary*/ pv_eq=pref*exp((M*hfg/R) * (1/Tref-1/Tlv)); /*expression of equlibrium pressure to be used in the m_evap expression*/ source= - Acell/vol * pow(2*M/(pi*R) , 0.5) * (pv_eq/pow(Tlv ,0.5) - pv/pow(Tv,0.5)); /*Source=(-m_evap*A_cell/V_cell)*/ dS[eqn]=- Acell/vol * pow(2*M/(pi*R) , 0.5) * pv_eq * (1/pow(Tlv,2.5) - 0.5/pow(Tlv,1.5) ); /*Derivative of the source term*/ } end_c_loop(c,t) return source; } I am not able to resolve the errors obtained after compiling. Please help and guide. |
|
December 12, 2014, 01:43 |
|
#2 |
New Member
Simon
Join Date: Aug 2014
Posts: 4
Rep Power: 12 |
Please start your own thread.
[Moderator note: moved this line of discussion from this thread: http://www.cfd-online.com/Forums/flu...tax-error.html] Last edited by wyldckat; December 27, 2014 at 07:37. Reason: added moderator note |
|
December 12, 2014, 04:28 |
|
#3 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
And if you start a new thread, please include the errors that you had. That will make it many times easier for us to find the problem.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM.org] compile error in dynamicMesh and thermophysicalModels libraries | NickG | OpenFOAM Installation | 3 | December 30, 2019 01:21 |
Compile calcMassFlowC | aurore | OpenFOAM Programming & Development | 13 | March 23, 2018 08:43 |
error compiling modified applications | yvyan | OpenFOAM Programming & Development | 21 | March 1, 2016 05:53 |
checking the system setup and Qt version | vivek070176 | OpenFOAM Installation | 22 | June 1, 2010 13:34 |
Version 15 on Mac OS X | gschaider | OpenFOAM Installation | 113 | December 2, 2009 11:23 |