|
[Sponsors] |
UDF: Change boundary condition. Velocity inlet to pressure inlet at time "t" |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 3, 2015, 14:14 |
UDF: Change boundary condition. Velocity inlet to pressure inlet at time "t"
|
#1 |
Senior Member
Jordi Pina
Join Date: Mar 2015
Posts: 157
Rep Power: 11 |
Hello!
I'm trying to simulate an injection moulding process. An injection process is defined by two phases: 1) Filling phase: The polymer fills the mould. It is a velocity controlled phase were the inlet flow is fixed and the machine sets the necessary pressure in order to maintain this flow. 2) Packaging phase: Once the cavity is 98% full. The machine switches from velocity control to pressure control, where the cavity is "packed out" at a constant pressure. I would like to know how could I make an inlet be a velocity or flow inlet from time 0 to time "t" and a pressure inlet after time "t". I guess I should develop a UDF but maybe there's some other way? I appreciate your help! |
|
April 3, 2015, 18:59 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Velocity inlet and pressure inlet are two distinct inlet conditions. Fluent needs to know to change between these two conditions and a simple DEFINE_PROFILE or UDF wouldn't suffice.
Try running a scheme file every time step (under calculation activities) which makes the switch between velocity to pressure inlet (TUI command) after a certain time (if statement). |
|
April 7, 2015, 15:14 |
|
#3 |
Senior Member
Jordi Pina
Join Date: Mar 2015
Posts: 157
Rep Power: 11 |
Dear `e`,
I've been trying to do what you suggested me. I created a macro, which changes the inlet_velocity boundary condition to an inlet_pressure condition. In the calculation activities I set the following command: *IF,CURRENT_TIME,GT,3,THEN,macro-2,*ENDIF However, when solving the problem, Fluent says: *IF,invalid command [*IF] CURRENT_TIME,GT,3,THEN,macro-2,*ENDIF I will appreciate your help. |
|
April 7, 2015, 19:09 |
|
#4 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
What is your macro that "changes the inlet_velocity boundary condition to an inlet_pressure condition"? You need to create a scheme file with the relevant TUI commands for changing the inlet velocity boundary to a pressure inlet boundary condition.
Find these TUI commands and then include them in your scheme file with ti-menu-load-string, for example: Code:
(ti-menu-load-string "tui-command-goes-here") 1) run the simulation for a few time steps and then change the inlet condition with the GUI (checks if Fluent won't crash from changing this inlet condition) 2) reset and run the simulation for a few time steps and then changing the inlet condition with the TUI 3) write a scheme file (using ti-menu-load-string) with the commands you used in step 2) and then run this scheme file after a number of time steps (if statement) |
|
April 9, 2015, 11:17 |
|
#5 |
Senior Member
Jordi Pina
Join Date: Mar 2015
Posts: 157
Rep Power: 11 |
Dear `e`,
I'm afraid I need a little bit of help. I have succeeded on changing the boundary condition from velocity to pressure: define/boundary-conditions/zone-type inlet pressure_inlet However, I don't know how to make a line for setting the pressure. If I make define/boundary-conditions/pressure-inlet I can set the pressure when fluent asks for it, but it is now suitable for making a .scm... Thanks!!!!!! Last edited by jpina; April 9, 2015 at 12:18. |
|
April 9, 2015, 12:33 |
|
#6 |
Senior Member
Jordi Pina
Join Date: Mar 2015
Posts: 157
Rep Power: 11 |
I just found the solution, in case anyone needs it, it's:
Define/boundary-conditions pressure-inlet inlet mixture yes no 6000000 no 0 no 300 no yes Where the answers to the questions without commas must be written. |
|
April 9, 2015, 17:28 |
|
#7 |
Senior Member
Jordi Pina
Join Date: Mar 2015
Posts: 157
Rep Power: 11 |
I'm facing the following problem... I have created a .scm file with:
*if,CURRENT_TIME,gt,3,then ;Change inlet boundary condition (ti-menu-load-string "define/boundary-conditions/zone-type inlet_velocity pressure-inlet") ;Set the pressure of the inlet boundary condition (ti-menu-load-string "define/boundary-conditions pressure-inlet inlet_velocity mixture yes no 6000000 no 0 no 300 no yes") *endif However, something seems to happen with the if statement. When I do File-Read-Scheme Fluent says: Error: eval: unbound variable Error Object: *if #f The same scheme file without the if works. Does anybody know what is happening? Thanks! |
|
April 9, 2015, 18:25 |
|
#8 |
Senior Member
Andrew Kokemoor
Join Date: Aug 2013
Posts: 122
Rep Power: 14 |
The correct syntax for if is
Code:
(if conditional-statement then-statement else-statement) Code:
(if (> current_time 3) ( (ti-menu-load-string "define/boundary-conditions/zone-type inlet_velocity pressure-inlet") ) (if (> current_time 3) ( (ti-menu-load-string "define/boundary-conditions pressure-inlet inlet_velocity mixture yes no 6000000 no 0 no 300 no yes") ) If I was, though... this is what I'd try. Code:
(if (> current_time 3) (map ti-menu-load-string '("define/boundary-conditions/zone-type inlet_velocity pressure-inlet" "define/boundary-conditions pressure-inlet inlet_velocity mixture yes no 6000000 no 0 no 300 no yes"))) |
|
April 10, 2015, 03:33 |
|
#9 |
Senior Member
Jordi Pina
Join Date: Mar 2015
Posts: 157
Rep Power: 11 |
Dear Kokemoor,
first of all thanks for your help. I'm afraid to ask an obviety but... In which programming language is the code you typed? I had looked for distinct APDL manuals and none of them showed this 'if statement' structure, for example the manual https://caeai.com/sites/default/files/APDL_0.pdf shows an estructure like: *IF, VAL1, Oper1, VAL2, AND / OR, VAL3, Oper2, VAL4, THEN Your code is not C either :S |
|
April 10, 2015, 07:34 |
|
#10 | |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
We've both stated that you're creating a Scheme file: the programming language is Scheme (a dialect of LISP). LISP is the second oldest high-level programming language (second to Fortran), have a read of the Wikipedia article if you're interested. Scheme was created in the 1970s over in MIT (Wikipedia). I'll quote what I've typed in another thread:
Quote:
|
||
April 11, 2015, 15:19 |
|
#11 |
Senior Member
Jordi Pina
Join Date: Mar 2015
Posts: 157
Rep Power: 11 |
Hi everybody!
I've solved my problem, I expose here the definitive solution in case it's someday useful for somebody: For changing a boundary condition at a time t: Create a .scm file with the following content: (if (> (rpgetvar' flow-time) 0.05) ; Set que inlet_velocity boundary to pressure-inlet (ti-menu-load-string "define/boundary-conditions/zone-type inlet_velocity pressure-inlet") ; Set the pressure value to 6000000 (ti-menu-load-string "define/boundary-conditions pressure-inlet inlet_velocity mixture yes no 6000000 no 0 no 300 no yes") ) In the Calculation Activities make this scheme file be executed every time_step with: (load "velocity_to_pressure_inlet.scm") I hope to be helpful after all the received help |
|
Tags |
change, inlet pressure, inlet velocity, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Star cd es-ice solver error | ernarasimman | STAR-CD | 2 | September 12, 2014 01:01 |
Radiation interface | hinca | CFX | 15 | January 26, 2014 18:11 |
An error has occurred in cfx5solve: | volo87 | CFX | 5 | June 14, 2013 18:44 |
Velocity inlet boundary condition for porous medium | Chander | CFX | 3 | March 11, 2012 22:18 |
can i set the velocity and pressure at the inlet at the same time by UDF | minyang.cau | FLUENT | 0 | July 15, 2009 00:14 |