|
[Sponsors] |
March 12, 2019, 00:14 |
UDF boundary
|
#1 |
New Member
Li Xiaoying
Join Date: Jun 2018
Posts: 8
Rep Power: 8 |
#include "udf.h"
#include<math.h> DEFINE_PROFILE(inlet_z_velocity_A, t, i) { real x[ND_ND]; real a; real y; face_t f; begin_f_loop(f,t) { F_CENTROID(x,f,t); a=x[0]; y=x[1]; if ((-4.2 <= a) && (a < -3.945)) F_PROFILE(f, t, i) = -0.088*pow(y, 5) - 0.0737*pow(y, 4) + 0.1308*pow(y, 3) + 0.0682*pow(y, 2) - 0.0665*y + 0.3545; if ((-3.945 <= a) && (a < -3.675)) F_PROFILE(f, t, i) = 0.1012*pow(y, 6) + 0.0131*pow(y, 5) - 0.2807*pow(y, 4) - 0.0547*pow(y, 3) + 0.1929*pow(y, 2) + 0.0411*y + 0.3549; if ((-3.675 <= a) && (a < -3.405)) F_PROFILE(f, t, i) = 0.046*pow(y, 6) + 0.0045*pow(y, 5) - 0.1283*pow(y, 4) + 0.0002*pow(y, 3) + 0.1014*pow(y, 2) - 0.0034*y + 0.3668; if ((-3.405 <= a) && (a < -3.135)) F_PROFILE(f, t, i) = 0.0752*pow(y, 6) + 0.0194*pow(y, 5) - 0.2078*pow(y, 4) - 0.0361*pow(y, 3) + 0.1624*pow(y, 2) + 0.0196*y + 0.3454; if ((-3.135 <= a) && (a < -2.865)) F_PROFILE(f, t, i) = -0.6608*pow(y, 6) - 0.0257*pow(y, 5) + 1.4898*pow(y, 4) + 0.0128*pow(y, 3) - 0.9274*pow(y, 2) + 0.012*y + 0.5025; if ((-2.865 <= a) && (a < -2.595)) F_PROFILE(f, t, i) = 0.164*pow(y, 6) + 0.0698*pow(y, 5) - 0.3511*pow(y, 4) - 0.087*pow(y, 3) + 0.2244*pow(y, 2) + 0.0301*y + 0.3417; if ((-2.595 <= a) && (a < -2.325)) F_PROFILE(f, t, i) = -0.0257*pow(y, 5) - 0.0798*pow(y, 4) + 0.022*pow(y, 3) + 0.0863*pow(y, 2) - 0.008*y + 0.3762; if ((-2.325 <= a) && (a < -2.055)) F_PROFILE(f, t, i) = 0.05*pow(y, 6) - 0.0019*pow(y, 5) - 0.1895*pow(y, 4) + 0.0122*pow(y, 3) + 0.1427*pow(y, 2) - 0.0089*y + 0.3693; if ((-2.055 <= a) && (a <= -1.8)) F_PROFILE(f, t, i) = 0.1494*pow(y, 6) - 0.0899*pow(y, 5) - 0.3818*pow(y, 4) + 0.2512*pow(y, 3) + 0.2011*pow(y, 2) - 0.1668*y + 0.4045; } end_f_loop(f,t) } |
|
March 12, 2019, 00:23 |
|
#2 |
New Member
Li Xiaoying
Join Date: Jun 2018
Posts: 8
Rep Power: 8 |
Hello!
Please help me! Thanks! I wrote a UDF to describe the velocity of a air supply diffusion belonging to “velocity-inlet “. And the UDF could be compiled successfully. However, when the iteration reached 500 steps, continuity residual curve kept raising. Then the TUI noted that computational diergence. The above is my UDF. Thanks! |
|
March 12, 2019, 02:32 |
|
#3 |
New Member
Join Date: May 2018
Posts: 3
Rep Power: 8 |
May you try this format for if else ladder in your UDF?
if (testExpression1) { // statement(s) } else if(testExpression2) { // statement(s) } else if (testExpression 3) { // statement(s) } . . else { // statement(s) } |
|
March 12, 2019, 04:49 |
|
#4 |
New Member
Li Xiaoying
Join Date: Jun 2018
Posts: 8
Rep Power: 8 |
Thanks for your reply!
I will try it!thanks! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
3D Windturbine simulation in SU2 | k.vimalakanthan | SU2 | 15 | October 12, 2023 06:53 |
Radiation in semi-transparent media with surface-to-surface model? | mpeppels | CFX | 11 | August 22, 2019 08:30 |
Domain Imbalance | HMR | CFX | 5 | October 10, 2016 06:57 |
Error - Solar absorber - Solar Thermal Radiation | MichaelK | CFX | 12 | September 1, 2016 06:15 |
Error finding variable "THERMX" | sunilpatil | CFX | 8 | April 26, 2013 08:00 |