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

Define Profile, time dependent flow variation query

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   February 11, 2013, 08:35
Default Define Profile, time dependent flow variation query
  #1
New Member
 
Simon DeSmet
Join Date: Feb 2013
Posts: 3
Rep Power: 13
Sdezmond is on a distinguished road
Hello

I'm trying to send a wave down a tank/conduit that is 100m long and 5x5m and filled with 1m of water. To do this im using a UDF to vary the flow at the input face of the tank (one end). essentially all the UDF is supposed to do is check the time, as an if statement to the effect of; if the time is greater than A, but less than B, then set input mass kg/s to x, else set input mass kg/s to y.

This is my first attempt at using fluent or indeed any CFD and im having problems getting it working. I've written two UDFs; one that just inputs a constant flow. I figured if i could get it working at least i would know the basic syntax etc. And one that inputs a wave/flow rise and decline. The first UDF does load in to fluent but doesnt produce the desired result (i don't get any water flowing down the tank), the second wont load as there are syntax issues with the If statement (im not a very experienced programmer and no little about c).

heres my code, can any one give me some pointers?

============
UDF 1 a constant flow

#include “udf.h”

DEFINE_PROFILE(constant_in, t, nv)
{
real x[ND_ND]; real v; face_t f;


begin_f_loop(f,t)
{

F_CENTROID(x,f,t);
v=2;
F_PROFILE(f,t,nv) =v;
}
end_f_loop(f,t)




#include “udf.h”

DEFINE_PROFILE(wave_in, t, nv)
{
real x[ND_ND]; real v =5; face_t f;
real T;
real a =2;
real b=4;


begin_f_loop(f,t)
{

F_CENTROID(x,f,t);
T=RP_Get_real(“flow-time”);

if (T>=a, T<=b);
{

F_PROFILE(f,t,nv) =v;
}
else
{
F_PROFILE(f,t,nv) =2;
}
}
end_f_loop(f,t)
}
Sdezmond is offline   Reply With Quote

 

Tags
define_profile, if statement, time dependent


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
TimeVaryingMappedFixedValue irishdave OpenFOAM Running, Solving & CFD 32 June 16, 2021 06:55
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
Installing OF 1.6 on Mac OS X gschaider OpenFOAM Installation 129 June 19, 2010 09:23
Modeling in micron scale using icoFoam m9819348 OpenFOAM Running, Solving & CFD 7 October 27, 2007 00:36
fluid flow fundas ram Main CFD Forum 5 June 17, 2000 21:31


All times are GMT -4. The time now is 19:55.