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

change of boundary condition

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   May 16, 2008, 05:46
Default change of boundary condition
  #1
Giacomo de Renzi
Guest
 
Posts: n/a
Hello,

I need to switch a boundary condition (from OUTFLOW to WALL, and from INLET-VELOCITY to WALL) depending on the temperature value on a Zone.

[my problem is the analogous to the functioning of an air conditioning system: if a check temperature is higher than a fixed value the air conditioner must be ON (INLET-VELOCITY) whereas in the opposite case the air conditioner must be OFF (WALL)]

is it possible to switch the boundary condition automatically?? for example with some kind ok UDF??

thanks to everybody, Giacomo
  Reply With Quote

Old   May 16, 2008, 09:41
Default Re: change of boundary condition
  #2
vijay
Guest
 
Posts: n/a
Hi Giacomo de Renzi,

There is one UDF written for changing the boundary condition type with respect to time written by Fluent Enginners it is available in www.fluentusers.com, whether r u able to access that one..

Because i am also solving manifold problem in that i need to change my boundary condition from wall to pressure outlet with respect to time...

So i am also trying for that UDF....Suppose if u get that means please forward it to me...

With regards, Vijay
  Reply With Quote

Old   May 16, 2008, 12:39
Default Re: change of boundary condition
  #3
Giacomo de Renzi
Guest
 
Posts: n/a
thanks for answering, I'm not able to access www.fluentusers.com until monday when I'll be at the University, if you have it and you can, could you get the UDF and write it here? otherwise I must wait two days..

otherwise I'll get it on monday or tuesday,

thanks, Giacomo
  Reply With Quote

Old   May 17, 2008, 01:11
Default Re: change of boundary condition
  #4
vijay
Guest
 
Posts: n/a
Hi Giacomo,

Here i dont have access to use that site.. So please send me that udf a copy to me... Its is found in fluentuser in that to go UDF archeive... In that u can find one UDF names as changing the Boundary type...

So please send me an copy of that UDF after u get it...

With regds, Vijay
  Reply With Quote

Old   May 17, 2008, 06:13
Default Re: change of boundary condition
  #5
Giacomo de Renzi
Guest
 
Posts: n/a
ok, I'm going to send it to you when I'll get it, I guess it will happen on tuesday morning
  Reply With Quote

Old   May 18, 2008, 23:38
Default Re: change of boundary condition
  #6
vijay
Guest
 
Posts: n/a
Ok giacomo thanks for that.......
  Reply With Quote

Old   May 20, 2008, 16:21
Default Re: change of boundary condition
  #7
Giacomo de Renzi
Guest
 
Posts: n/a
this is the UDF got by www.fluentusers.com... I'm trying to understan how does it run... it isn't easy..

#include "udf.h"

/* The RP_Set_List_of_Integer function does not in V6.1 but is in V6.2 */ /* Remove next line and list_of_integer.[ch] files for V6.2 */ #include "list_of_integer.h"

#define N_SWITCHES 4

#define UNKNOWN 0 #define LEAVE 0 #define CLOSED 1 #define OPENED 2

DEFINE_ON_DEMAND(set_switches) { #if !RP_NODE /* only does things on HOST or SERIAL */

static int states[N_SWITCHES] = {UNKNOWN,UNKNOWN,UNKNOWN,UNKNOWN};

real shifts[N_SWITCHES] = {0.0, 90.0, 270.0, 180.0};

int i, change, switches[N_SWITCHES]; real rpm = 6000.0; real time, period, phase, shift_phase;

period = 60.0/rpm; /* seconds */ time=CURRENT_TIME;

Message("\n-----------------------------------------------\n");

period = 60.0/rpm; /* seconds */

time= CURRENT_TIME + CURRENT_TIMESTEP; /* time at NEXT time step */ Message("Time is %f(s)\n",time);

phase=time/period; phase=360.0*(phase-floor(phase)); /* degrees */ Message("Phase is %f(degs)\n",phase);

for (i=0;i<N_SWITCHES;i++)

{

shift_phase = phase + shifts[i];

while(shift_phase >= 360.0) /* refix modulo after addition of shift */

shift_phase -= 360.0;

if(shift_phase< 80.0)

change=OPENED;

else

change=CLOSED;

if(states[i]==change)

switches[i]=LEAVE;

else

{

states[i]=change;

switches[i]=change;

}

}

RP_Set_List_of_Integer("udf-switches", switches, N_SWITCHES);

Message("-----------------------------------------------\n"); #endif /* !RP_NODE */ }

DEFINE_PROFILE(Mprof, ft, m) { face_t f;

begin_f_loop(f, ft)

{

F_PROFILE(f, ft, m) = 250;

} end_f_loop(f, ft) }

/* list_of_integer.c */ #include "cxserv.h"

static void rpsetvar(char *s, Pointer val) { Pointer p; stack *oldstk = Save_Stack(); extern Pointer sym_quote; Pointer sym_uienv; Pointer sym_rpsetvarlocal;

sym_uienv = intern("user-initial-environment"); sym_rpsetvarlocal = intern("rpsetvarlocal");

Push_Stack0(val); /* protect val from garbage collection */ /* (eval `(rpsetvarlocal ',s ',v) user-initial-environment) */ Push_Stack(p); p = cons(NIL,NIL); CAR(p) = cons(val,NIL); CAR(p) = cons(sym_quote,CAR(p)); p = cons(NIL,p); CAR(p) = cons(intern(s),NIL); CAR(p) = cons(sym_quote,CAR(p)); p = cons(sym_rpsetvarlocal,p); (void) eval(p, eval(sym_uienv,NIL)); Restore_Stack(oldstk); }

void RP_Set_List_of_Integer(char *s, int a[], int len) { int n; Pointer result = NIL; stack *oldstk;

if (len <= 0) err("RP_Set_List_of_Integer: zero length list", NIL);

oldstk = Save_Stack(); Push_Stack(result);

for (n=len-1; n>=0; n--)

{

result = cons(NIL,result);

CAR(result) = fixcons(a[n]);

}

rpsetvar(s,result); Restore_Stack(oldstk); }

/* list_of_integer.h */ void RP_Set_List_of_Integer(char *s, int a[], int len);

;; switch.scm ;; load this file into fluent so that (run-switched nts) is available

(if (not (rp-var-object 'udf-switches))

(rp-var-define 'udf-switches () 'list #f))

(define run-switched/stop-filename "run-switched-stop.txt")

(define (run-switched . t-steps) (if

(do ((i (car t-steps) (- i 1)))

((or (= i 0) (file-exists? run-switched/stop-filename)) (> i 0))

(let ((list)(len)(state))

(format "~%Time Steps Remaining ~d~%" i)

(%udf-on-demand "set_switches")

(set! list (%rpgetvar 'udf-switches))

(set! len (length (%rpgetvar 'udf-switches)))

(do ((j 1 (+ j 1))) ((> j len) j)

(set! state (car list))

(set! list (cdr list))

(if (= state 1)

(ti-menu-load-string

(format #f "/def/bc/mz/zone-type/mass_flow_inlet.~d wall~%" j)))

(if (= state 2)

(begin

(ti-menu-load-string

(format #f "/def/bc/mz/zone-type/ mass_flow_inlet.~d mass-flow-inlet~%" j))

(ti-menu-load-string

(format #f "/def/bc/mfi mass_flow_inlet.~d n y y \"udf\" \"Mprof\" n 330 n 0 y y y n 1 n 0 n 0~%" j))

))

)

(err-protect (physical-time-steps 1

(rpgetvar 'max-iterations-per-step)))))

(begin

(remove-file run-switched/stop-filename)

(format "~%(run-switched ~d) Stopped~%" (car t-steps)))

(format "~%(run-switched ~d) Completed~%" (car t-steps))))

  Reply With Quote

Old   May 21, 2008, 01:46
Default Re: change of boundary condition
  #8
Vijay
Guest
 
Posts: n/a
Hi,

Thanks for ur co operation giacomo, and me too stuggling hard to study this one... First twenty lines is some what clear after that i cant understand properly...

Whether have u got some idea about this udf tell me?????

With regards, Vijay
  Reply With Quote

Old   May 22, 2008, 05:18
Default Re: change of boundary condition
  #9
Giacomo de Renzi
Guest
 
Posts: n/a
I couldn't still understand the UDF... and you?? I found that in fluentusers.com there was also a little explanation of the UDF, that's the seguent:

"In time dependent runs, it is often desirable to change an inlet to a wall or an outlet to an inlet. Normally this needs some sort of journal file. The scheme file below defines a funtion (run-switched n-time-steps) that does standard timestepping but calls an on-demand udf before each timestep. The on-demand sets an array of switches (list of integers in scheme) that tells the (run-switched) function which actions to perform before the next timestep. These actions can be anything you'd put in a journal file, so changing BC types or values is possible. Currently I've only done an unsteady version, but such events could be done in a steady solver on an iteration-by-iteration basis. The first C file is the ON_DEMAND UDF. It does a simple cylinder valve port open close cycle. The next C & .h file are not needed in V6.2 but V6.1 doesnt have the RP_Set_List_of_Integer function. The final scheme is the main switch testing loop. The user need only change the (format) functions to change the operation due to each switch. Example case & data files (3d & 3d_parallel) are available on request. The (run-switched n-time-steps) must be run instead of the usual timestepping command. Interrupting is also not possible, so to stop the timestepping, a checkpointing file is used. create a file called "run-switched-stop.txt" with anything in it and if it is found in the current fluent directory, the timestepping will stop cleanly."

but even with this I can't understand how to create my UDF... I hope this will help you so you could help me!! greetings Giacomo
  Reply With Quote

Old   May 22, 2008, 06:42
Default Re: change of boundary condition
  #10
vijay
Guest
 
Posts: n/a
S giacomo let me take some days to understand this UDF first... After that we will try to solve our analysis...

With regards, Vijay
  Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
┬┐Change boundary condition type? David FLUENT 8 April 17, 2013 12:35
Change wall boundary condition in multiphase? Jacques FLUENT 0 November 27, 2008 07:26
change boundary condition via UDF gerhard zalusky FLUENT 2 July 12, 2007 03:51
Change a boundary condition with routines yolan CFX 0 August 14, 2006 06:48
UDF, using DEFINE_ADJUST to change a boundary condition Jonas Larsson FLUENT 4 March 21, 2000 19:51


All times are GMT -4. The time now is 18:21.