|
[Sponsors] |
October 5, 2023, 14:30 |
Simple Udf HELP
|
#1 |
New Member
Mohammadreza Tohidi
Join Date: Jul 2023
Posts: 4
Rep Power: 2 |
hello guys.
Anyone can help me to update the prev_b only at the end of each time step? in the code i wrote here prev_b will be updated at each iteration Any suggestion? #include "udf.h" real k = 0.1; real L = 0.01; real T_inf_BC2 = 273.15; real T_inf_BC1 = 270.15; real T_inf_BC3 = 280.0; real h_BC2 = -2000.0; real h_BC3 = -10.0; real b = 0; real m_snow = 4; real prev_b = 0; // Variable to store the previous value of 'b' DEFINE_PROFILE(heat_flux_bc, thread, position) { real x[ND_ND]; real flux; real time = CURRENT_TIME; real i = time / CURRENT_TIMESTEP; face_t f; real t_face; real h_BC1 = -(k / L); begin_f_loop(f, thread) { F_CENTROID(x, f, thread); t_face = C_T(f, thread); //[K] if (t_face < 273.15) { flux = h_BC1 * (t_face - T_inf_BC1); b = prev_b + m_snow - 1; } else { if (i > 300) { flux = h_BC3 * (t_face - T_inf_BC3); //[w/m2] b = prev_b + flux - m_snow; } else { flux = h_BC2 * (t_face - T_inf_BC2); //[w/m2] b = prev_b + m_snow + 1; } } F_PROFILE(f, thread, position) = flux; } end_f_loop(f, thread) prev_b = b; Message("t_face = %.5f K\n", t_face); Message("flux = %.5f w/m2\n", flux); Message("i = %.5f \n", i); Message("b = %.5f K\n", b); Message("prev_b = %.5f K\n", prev_b); } |
|
October 5, 2023, 23:58 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
DEFINE_EXECUTE_AT_END macro
__________________
best regards ****************************** press LIKE if this message was helpful |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Simple UDF for piston movement | NicolasCheshire | Fluent UDF and Scheme Programming | 1 | October 7, 2016 10:36 |
Simple parabolic velocity UDF with symmetry - what am I not understanding!?! | NPGrad | FLUENT | 1 | September 30, 2016 11:42 |
Error in Simple UDF! | Abhya | Fluent UDF and Scheme Programming | 1 | March 14, 2013 08:36 |
FLUENT UDF Simple error. | startup0820 | Fluent UDF and Scheme Programming | 0 | August 14, 2012 03:54 |
simple rigid body motion UDF | Dan | FLUENT | 0 | January 11, 2006 05:48 |