CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

how radiative source term can be added into energy equation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 22, 2021, 07:24
Smile how radiative source term can be added into energy equation
  #1
New Member
 
bilal
Join Date: Oct 2021
Location: pakistan
Posts: 27
Rep Power: 5
hbilal1076 is on a distinguished road
I am working on a Flame Combustor, I want to add "radiation" to my model. my supervisor suggested me to use P1 radiation modeling using User Define Scalars (UDS) from fluent manual under three different conditions i.e.
(1) Optical Thin Assumption Model (OTA) (gray gas model) (2) Narrow Band Correlated K- Distribution Model (NBCK) and (3) Full Spectrum Correlated K- Distribution Model (FSCK).
Although I have fluent manual but as I don't have any programing knowledge/skill to edit and use the below "User Define Function (UDF)" for above three condition.
In summary, how radiative source term can be added into energy equation for above model using macro define source?

Below is the example (P1 radiation model using UDS) from the fluent manual.


#include "udf.h"
#include "sg.h"

/* Define which user-defined scalars to use. */
enum
{
P1,
N_REQUIRED_UDS
};

static real abs_coeff = 0.2; /* absorption coefficient */
static real scat_coeff = 0.0; /* scattering coefficient */
static real las_coeff = 0.0; /* linear-anisotropic */
/* scattering coefficient */

static real epsilon_w = 1.0; /* wall emissivity */

DEFINE_ADJUST(p1_adjust, domain)
{
/* Make sure there are enough user defined-scalars. */
if (n_uds < N_REQUIRED_UDS)
Internal_Error("not enough user-defined scalars allocated");
}

DEFINE_SOURCE(energy_source, c, t, dS, eqn)
{
dS[eqn] = -16.*abs_coeff*SIGMA_SBC*pow(C_T(c, t), 3.);
return -abs_coeff * (4.*SIGMA_SBC*pow(C_T(c, t), 4.) - C_UDSI(c, t, P1));
}

DEFINE_SOURCE(p1_source, c, t, dS, eqn)
{
dS[eqn] = -abs_coeff;
return abs_coeff * (4.*SIGMA_SBC*pow(C_T(c, t), 4.) - C_UDSI(c, t, P1));
}

DEFINE_DIFFUSIVITY(p1_diffusivity, c, t, i)
{
return 1. / (3.*abs_coeff + (3. - las_coeff)*scat_coeff);
}

DEFINE_PROFILE(p1_bc, thread, position)
{
face_t f;
real A[ND_ND], At;
real dG[ND_ND], dr0[ND_ND], es[ND_ND], ds, A_by_es;
real aterm, alpha0, beta0, gamma0, Gsource, Ibw;
real Ew = epsilon_w / (2.*(2. - epsilon_w));
Thread *t0 = thread->t0;
/* Do nothing if areas are not computed yet or not next to fluid. */
if (!Data_Valid_P() || !FLUID_THREAD_P(t0)) return;
begin_f_loop(f, thread)
{
cell_t c0 = F_C0(f, thread);
BOUNDARY_FACE_GEOMETRY(f, thread, A, ds, es, A_by_es, dr0);
At = NV_MAG(A);
if (NULLP(T_STORAGE_R_NV(t0, SV_UDSI_G(P1))))
Gsource = 0.; /* if gradient not stored yet */
else
BOUNDARY_SECONDARY_GRADIENT_SOURCE(Gsource, SV_UDSI_G(P1), dG, es, A_by_es, 1.);
gamma0 = C_UDSI_DIFF(c0, t0, P1);
alpha0 = A_by_es / ds;
beta0 = Gsource / alpha0;
aterm = alpha0 * gamma0 / At;
Ibw = SIGMA_SBC * pow(WALL_TEMP_OUTER(f, thread), 4.) / M_PI;

/* Specify the radiative heat flux. */
F_PROFILE(f, thread, position) = aterm * Ew / (Ew + aterm)*(4.*M_PI*Ibw - C_UDSI(c0, t0, P1) + beta0);
}
end_f_loop(f, thread)
}

DEFINE_HEAT_FLUX(heat_flux, f, t, c0, t0, cid, cir)
{
real Ew = epsilon_w / (2.*(2. - epsilon_w));
cir[0] = Ew * F_UDSI(f, t, P1);
cir[3] = 4.0 * Ew * SIGMA_SBC;
}
hbilal1076 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SparceImage v1.7.x Issue on MAC OS X rcarmi OpenFOAM Installation 4 August 14, 2014 07:42
[swak4Foam] Error bulding swak4Foam sfigato OpenFOAM Community Contributions 18 August 22, 2013 13:41
"parabolicVelocity" in OpenFoam 2.1.0 ? sawyer86 OpenFOAM Running, Solving & CFD 21 February 7, 2012 12:44
Source term energy equation for reactive flows DaIN Main CFD Forum 0 October 6, 2011 16:11


All times are GMT -4. The time now is 17:36.