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

Pressure variation UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 24, 2014, 18:26
Default Pressure variation UDF
  #1
New Member
 
Mateusz
Join Date: Mar 2014
Location: Manchester
Posts: 3
Rep Power: 12
Mat.H is on a distinguished road
Hi guys,
I am trying to create a pressure variation with time UDF for the walls of my tank. I will also try to do the same with temperature but I wrote a code for pressure first and I am not sure whether its correct

Its a little long because for each time I have a different pressure


/************************************************** *******************************************/
/*UDF for specifying the pressure variation with time for the conditions surrounding the tank*/
/************************************************** *******************************************/



#include "udf.h"

DEFINE_PROFILE(pressure.profile,t,i)
{
face_t f;
begin_f_loop(f,thread)
{
time=0
F_PROFILE(f,thread,i)=100000
time=20
F_PROFILE(f,thread,i)=98656.6667
time=40
F_PROFILE(f,thread,i)=97313.33333
time=60
F_PROFILE(f,thread,i)=95970
time=80
F_PROFILE(f,thread,i)=94626.66667
time=100
F_PROFILE(f,thread,i)=93283.33333
time=120
F_PROFILE(f,thread,i)=91940
time=140
F_PROFILE(f,thread,i)=90596.66667
time=160
F_PROFILE(f,thread,i)=89253.33333
time=180
F_PROFILE(f,thread,i)=87910
time=200
F_PROFILE(f,thread,i)=86566.66667
time=220
F_PROFILE(f,thread,i)=85223.33333
time=240
F_PROFILE(f,thread,i)=83880
time=260
F_PROFILE(f,thread,i)=82536.66667
time=280
F_PROFILE(f,thread,i)=81193.33333
time=300
F_PROFILE(f,thread,i)=79850
time=320
F_PROFILE(f,thread,i)=78506.66667
time=340
F_PROFILE(f,thread,i)=77163.33333
time=360
F_PROFILE(f,thread,i)=75820
time=380
F_PROFILE(f,thread,i)=74476.66667
time=400
F_PROFILE(f,thread,i)=73133.33333
time=420
F_PROFILE(f,thread,i)=71790
time=440
F_PROFILE(f,thread,i)=70446
time=460
F_PROFILE(f,thread,i)=69103.33
time=480
F_PROFILE(f,thread,i)=67760
time=500
F_PROFILE(f,thread,i)=66416
time=520
F_PROFILE(f,thread,i)=65073
time=540
F_PROFILE(f,thread,i)=63730
time=560
F_PROFILE(f,thread,i)=62386.667
time=580
F_PROFILE(f,thread,i)=61043.33
time=600
F_PROFILE(f,thread,i)=59700
time=620
F_PROFILE(f,thread,i)=58356
time=640
F_PROFILE(f,thread,i)=57013.33
time=660
F_PROFILE(f,thread,i)=55670
time=680
F_PROFILE(f,thread,i)=54326
time=700
F_PROFILE(f,thread,i)=52983.6667
time=720
F_PROFILE(f,thread,i)=51640
time=740
F_PROFILE(f,thread,i)=50296.667
time=760
F_PROFILE(f,thread,i)=48953
time=780
F_PROFILE(f,thread,i)=47610
time=800
F_PROFILE(f,thread,i)=46266.6667
time=820
F_PROFILE(f,thread,i)=44923.333
time=840
F_PROFILE(f,thread,i)=43580
time=860
F_PROFILE(f,thread,i)=42236.667
time=880
F_PROFILE(f,thread,i)=40893.333
time=900
F_PROFILE(f,thread,i)=39550
time=920
F_PROFILE(f,thread,i)=38206.6667
time=940
F_PROFILE(f,thread,i)=36863.333
time=960
F_PROFILE(f,thread,i)=35520
time=980
F_PROFILE(f,thread,i)=34176.6667
time=1000
F_PROFILE(f,thread,i)=32833.333
time=1020
F_PROFILE(f,thread,i)=31490
time=1040
F_PROFILE(f,thread,i)=30146
time=1060
F_PROFILE(f,thread,i)=28803.33
time=1080
F_PROFILE(f,thread,i)=27460
time=1100
F_PROFILE(f,thread,i)=26116.6667
time=1120
F_PROFILE(f,thread,i)=24773.333
time=1140
F_PROFILE(f,thread,i)=23430
time=1160
F_PROFILE(f,thread,i)=22086.6667

if ( 27580> t >1160)
F_PROFILE(f,thread,i)=19400
}
Mat.H is offline   Reply With Quote

Old   April 24, 2014, 20:56
Default
  #2
Senior Member
 
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17
macfly is on a distinguished road
From Ansys Fluent UDF Manual 15.0:

2.3.19.11. Example 9 - Mass Flow Rate UDF for the Mass Flow Inlet
This UDF is used to provide a time-varying specification of the mass flow rate. This boundary condition can be applied using a DEFINE_PROFILE UDF.....


#include "udf.h"
DEFINE_PROFILE(inlet_mf,th,i)
{
face_t f;
begin_f_loop(f,th)
{
if(CURRENT_TIME <= 0.01)
F_PROFILE(f,th,i) = 3.0;
else if(CURRENT_TIME <=0.02 && CURRENT_TIME >0.01)
F_PROFILE(f,th,i) = 4.0;
else
F_PROFILE(f,th,i) = 5.0;
}
end_f_loop(f,th);
}



You just have to do a bunch of else if!

Next time, ask on the UDF forum please: http://www.cfd-online.com/Forums/fluent-udf/
macfly 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
Pressure Outlet Guage pressure Mohsin FLUENT 36 April 29, 2016 17:16
pressure variation with distance eishinsnsayshin Main CFD Forum 0 February 6, 2012 08:08
UDF for transient pressure inlet, mass flow check at nozzle exit and volumetric heat kokoory FLUENT 0 August 17, 2011 02:07
Pressure variation in a heating channel gRomK13 Main CFD Forum 0 August 6, 2009 12:18
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 02:15


All times are GMT -4. The time now is 20:42.