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

UDF boundary

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 11, 2019, 23:14
Default UDF boundary
  #1
New Member
 
Li Xiaoying
Join Date: Jun 2018
Posts: 8
Rep Power: 7
Lxy2018 is on a distinguished road
#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)
}
Lxy2018 is offline   Reply With Quote

Old   March 11, 2019, 23:23
Default
  #2
New Member
 
Li Xiaoying
Join Date: Jun 2018
Posts: 8
Rep Power: 7
Lxy2018 is on a distinguished road
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!
Lxy2018 is offline   Reply With Quote

Old   March 12, 2019, 01:32
Default
  #3
New Member
 
Join Date: May 2018
Posts: 3
Rep Power: 7
zyfantastic is on a distinguished road
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)
}
zyfantastic is offline   Reply With Quote

Old   March 12, 2019, 03:49
Default
  #4
New Member
 
Li Xiaoying
Join Date: Jun 2018
Posts: 8
Rep Power: 7
Lxy2018 is on a distinguished road
Thanks for your reply!
I will try it!thanks!
Lxy2018 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
3D Windturbine simulation in SU2 k.vimalakanthan SU2 15 October 12, 2023 05:53
Radiation in semi-transparent media with surface-to-surface model? mpeppels CFX 11 August 22, 2019 07:30
Domain Imbalance HMR CFX 5 October 10, 2016 05:57
Error - Solar absorber - Solar Thermal Radiation MichaelK CFX 12 September 1, 2016 05:15
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00


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