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

convert 2D udf to 3D udf/internal ballistic

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 5, 2023, 22:20
Default convert 2D udf to 3D udf/internal ballistic
  #1
New Member
 
Cheng Lu
Join Date: Dec 2023
Posts: 4
Rep Power: 2
erlebnisse is on a distinguished road
Hi,everyone.It's about the simulation of internal ballistic processes.A model of a porous region, the inlet is a mass flow inlet, set the energy source term and mass source term to characterise the combustion in the porous region, the 2D model can be operated, but the creation of a 3D model reported an error, space reasons to provide part of the udf, thank you very much for your help!if you need more udf programs, please contact me.

DEFINE_PROFILE(pressure_inlet, t, i)
{
face_t f;
int id = THREAD_ID(t);
begin_f_loop(f, t)
{
F_PROFILE(f, t, i) = 0.564474 * pressure_static[id - inlet_id[0]];
}
end_f_loop(f, t)
}
DEFINE_SOURCE(energy_source_term, c, t, ds, eqn)
{
double source = 0.0;
double rho, v_mag, k, miu, re, hc, Tg, Tps, Asf, es, Qr;
Tps = C_UDMI(c, t, id_tps);
if (Tps < 453.0)
{
rho = C_R(c, t);
v_mag = sqrt(C_VMAG2(c, t));
miu = C_MU_L(c, t);
es = C_POR(c, t);
re = get_Rep(rho, v_mag, miu, d_ep); // * es;
k = C_K_L(c, t);
hc = h_sf(k, re);
Tg = C_T(c, t);
Asf = 6.0 * (1.0 - es) / d_ep;
source = hc * (Tps - Tg) * Asf + 0.8 * sigmap * (pow(Tps, 4) - pow(Tg, 4)) * Asf;
ds[eqn] = -Asf * (hc + 0.8 * sigmap * 4.0 * pow(Tg, 3));
return source;
}
else
{
Qr = Q_v * rho_p * (1.0 - es0) * C_UDMI(c, t, id_dpsi);
ds[eqn] = 0.0;
return Qr;
}
}
DEFINE_SOURCE(mass_source_term, c, t, ds, eqn)
{
double Tps, mr;
Tps = C_UDMI(c, t, id_tps);
if (Tps < 453.0)
{
ds[eqn] = 0.0;
return 0.0;
}
else
{
mr = rho_p * (1.0 - es0) * C_UDMI(c, t, id_dpsi);
ds[eqn] = 0.0;
return mr;
}
}
erlebnisse is offline   Reply With Quote

Old   December 6, 2023, 05:35
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
check
Code:
 C_VMAG2(c, t)
erlebnisse likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   December 6, 2023, 21:31
Default
  #3
New Member
 
Cheng Lu
Join Date: Dec 2023
Posts: 4
Rep Power: 2
erlebnisse is on a distinguished road
I changed v_mag = C_VMAG2(c,t) to v_mag = sqrt(C_U(c, t) * C_U(c, t) + C_V(c, t) * C_V(c, t) + C_W(c, t) * C_W(c, t)) and the problem still exists, the UDF can be loaded and initialised but running the calculation reports an error:Received signal SIGSEGV.Thanks for your answer, I will try to check the other parts.
erlebnisse is offline   Reply With Quote

Reply

Tags
internal ballistic, mass-flow inlet, porous zone


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
Call defined property by UDF to another UDF Selawe97 FLUENT 0 December 27, 2022 08:57
UDF for vapor pressure anuarun Fluent UDF and Scheme Programming 12 December 24, 2021 10:12
Replicating Scalable Wall Function with a UDF yousefaz FLUENT 0 August 4, 2017 02:30
Fluent Radiation/porous media Schmitt pierre-Louis FLUENT 26 September 1, 2016 10:29
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 06:12


All times are GMT -4. The time now is 18:01.