|
[Sponsors] |
March 16, 2023, 04:38 |
DEFINE_ADJUST to affect DEFINE_PROFILE
|
#1 |
New Member
Davide Masiello
Join Date: Jul 2022
Location: Switzerland
Posts: 2
Rep Power: 0 |
Hi, I have implemented several UDFs in my simulations.
In particular, I have a boundary condition that depends on a parameter which I call FRAC. Code:
#include "udf.h" ... ... DEFINE_PROFILE(myBC,th,i) { real FRAC = Get_Input_Parameter("my_parameter"); begin_f_loop(f,th) { F_PROFILE(f,th,i) = FRAC*...; } end_f_loop(f,th); } ... ... Without going too much into detail, this is based on mass balances so it is physically correct. When seeing the optimized values of FRAC, I realised it depends on another value which can be obtained as an integral of a certain expression over a specific cell thread of my domain. In order to avoid having to optimize FRAC for each Design Point of my simulation, I'd rather calculate it that way. On the UDF User Manual, I found this info: DEFINE_ADJUST is a general-purpose macro that can be used to adjust or modify ANSYS Fluent variables that are not passed as arguments. For example, you can use DEFINE_ADJUST to modify flow variables (for example, velocities, pressure) and compute integrals. You can also use it to integrate a scalar quantity over a domain and adjust a boundary condition based on the result. The last sentence seems to describe exactly what I need to do. Therefore, I have modified by code in the following way Code:
#include "udf.h" real FRAC; ... ... DEFINE_ADJUST(my_adjust,d) { Thread *t = Lookup_Thread(d,7); real my_integral=0.; cell_t c; begin_c_loop(c,t) { my_integral += (UDS dependent expression)*C_VOLUME(c,t); } end_c_loop(c,t) FRAC = my_integral/... ; } DEFINE_PROFILE(myBC,th,i) { begin_f_loop(f,th) { F_PROFILE(f,th,i) = FRAC*...; } end_f_loop(f,th); } ... ... If anyone as any idea/suggestion of why this happens I'd really appreciate it. Have a good day. Davide |
|
Tags |
boundary condition, define_adjust, define_profile |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Particles dont affect simulation | force_95 | FLUENT | 0 | October 1, 2019 04:53 |
Aspect ratio - WHY does it affect the solution | mörli | Main CFD Forum | 0 | September 4, 2019 09:23 |
[ICEM] global size factor affect first layer height? | ranben10 | ANSYS Meshing & Geometry | 1 | September 20, 2017 04:18 |
Does <cache{ grad ( U ) }> affect somehow my turbulence | fimbull | OpenFOAM Running, Solving & CFD | 0 | August 1, 2017 09:20 |
How does the particles' velocity affect the energy balance equation of gas phase | sy2516 | OpenFOAM Running, Solving & CFD | 0 | April 10, 2017 16:05 |