|
[Sponsors] |
How to define Cp*Temperature as scalar in UDS? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 22, 2020, 05:13 |
How to define Cp*Temperature as scalar in UDS?
|
#1 |
Senior Member
Arun raj.S
Join Date: Jul 2011
Posts: 207
Rep Power: 16 |
1. What changes I must make in the below UDF? Does any changes required?
2. If not in UDF, where should I include? ************************************************** ********************/ /* UDF that implements a simplified advective term in the */ /* scalar transport equation */ /************************************************** ********************/ #include "udf.h" DEFINE_UDS_FLUX(my_uds_flux,f,t,i) { cell_t c0, c1 = -1; Thread *t0, *t1 = NULL; real NV_VEC(psi_vec), NV_VEC(A), flux = 0.0; c0 = F_C0(f,t); t0 = F_C0_THREAD(f,t); F_AREA(A, f, t); /* If face lies at domain boundary, use face values; */ /* If face lies IN the domain, use average of adjacent cells. */ if (BOUNDARY_FACE_THREAD_P(t)) /*Most face values will be available*/ { real dens; /* Depending on its BC, density may not be set on face thread*/ if (NNULLP(THREAD_STORAGE(t,SV_DENSITY))) dens = F_R(f,t); /* Set dens to face value if available */ else dens = C_R(c0,t0); /* else, set dens to cell value */ NV_DS(psi_vec, =, F_U(f,t), F_V(f,t), F_W(f,t), *, dens); flux = NV_DOT(psi_vec, A); /* flux through Face */ } else { c1 = F_C1(f,t); /* Get cell on other side of face */ t1 = F_C1_THREAD(f,t); NV_DS(psi_vec, =, C_U(c0,t0),C_V(c0,t0),C_W(c0,t0),*,C_R(c0,t0)); NV_DS(psi_vec, +=, C_U(c1,t1),C_V(c1,t1),C_W(c1,t1),*,C_R(c1,t1)); flux = NV_DOT(psi_vec, A)/2.0; /* Average flux through face */ } /* ANSYS FLUENT will multiply the returned value by phi_f (the scalar's value at the face) to get the "complete'' advective term. */ return flux; } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Laminar Kinetic Energy Model (Walters 2008) | logoswort | Fluent UDF and Scheme Programming | 2 | May 19, 2017 20:41 |
Division by zero exception - loop over scalarField | Pat84 | OpenFOAM Programming & Development | 6 | February 18, 2017 06:57 |
Can UDS get more than one scalar information? | marialhm | FLUENT | 2 | January 5, 2017 21:32 |
An odd ERROR | mdakbari | Fluent UDF and Scheme Programming | 7 | April 4, 2016 05:30 |
is internalField(U) equivalent to zeroGradient? | immortality | OpenFOAM Running, Solving & CFD | 7 | March 29, 2013 02:27 |