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

Changing Boundary Condition Types via Scheme/UDF

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By RTN3000
  • 2 Post By `e`
  • 2 Post By `e`

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 26, 2015, 15:20
Default Changing Boundary Condition Types via Scheme/UDF
  #1
New Member
 
Join Date: Sep 2013
Posts: 13
Rep Power: 13
RTN3000 is on a distinguished road
Hey everyone,

I'm looking to create a code to change the type of a boundary condition once.

For example, I'm looking to change a boundary type with known zone ID from whatever it currently is to a velocity inlet, how would I go about doing this?


Background on this, I have a problem which may have 200+ boundary condition locations in which are set as 'walls' during meshing. I'm looking to change these 200+ BCs all at once to their respective ones by either loading a scheme file or using define_execute_on_loading.



Thanks.
Fole likes this.
RTN3000 is offline   Reply With Quote

Old   November 2, 2015, 16:54
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Changing boundary conditions must be done via the GUI or TUI. Using a scheme file, the boundary condition could be changed with the TUI command:

Code:
/define/boundary-conditions/modify-zones/zone-type
However, if you set a user-defined boundary condition then you could code time dependent conditions (but if the boundary was a velocity inlet then it would have to remain as such).
`e` is offline   Reply With Quote

Old   November 3, 2015, 14:37
Default
  #3
New Member
 
Join Date: Sep 2013
Posts: 13
Rep Power: 13
RTN3000 is on a distinguished road
Thanks e for the reply. I was hoping there was a more automated solution.

I believe what I'll end up doing is creating a script to generate either a scheme file or journal file with the zone ids/names, changing the boundaries that fit the certain criteria (most likely just some naming convention) with the TUI command you've stated, then assigning their properties with their respective TUI commands.

I'm not quite sure where to start with scheme programming as it relates to fluent however. Currently I've been using the code below (source) to feed names into my UDF in which I get thread IDs that I use.

Code:
(rp-var-define 'jos-thread-id-list () 'list #f) 
(rpsetvar 'jos-thread-id-list ()) 
(for-each (lambda (t) (rpsetvar 'jos-thread-id-list (list-add 
(rpgetvar 'jos-thread-id-list) (thread-id t)))) 
(get-all-threads)) 
(rpgetvar 'jos-thread-id-list) 


(rp-var-define 'jos-thread-name-list () 'list #f) 
(rpsetvar 'jos-thread-name-list ()) 
(for-each (lambda (t) (rpsetvar 'jos-thread-name-list (list-add 
(rpgetvar 'jos-thread-name-list) (thread-name t)))) 
(get-all-threads)) 
(rpgetvar 'jos-thread-name-list)
In C, I'll use the strstr function to easily search for a string, can anyone help me with an equivalent for a scheme?
Code:
strstr(RP_Get_List_Ref_String("jos-thread-name-list", j_BC), "channel_inlet")
RTN3000 is offline   Reply With Quote

Old   November 3, 2015, 15:28
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Unfortunately, I haven't found a simpler way of changing boundary conditions mid-simulation. There's unofficial documentation on Scheme programming with Fluent which might be useful.

How are you determining which boundaries are modified? Could you write these zone IDs to a file during a time step?
RTN3000 and lytemar like this.
`e` is offline   Reply With Quote

Old   November 3, 2015, 15:43
Default
  #5
New Member
 
Join Date: Sep 2013
Posts: 13
Rep Power: 13
RTN3000 is on a distinguished road
Nice, thanks for the link, the only other document I've found in regards to fluent Scheme programming has all supporting text in German.

From meshing, I've named the boundaries to some common name, for example "channel_inlet" or "channel_outlet." From this, I've created a lookup table in my UDF of zone IDs which I use basically everywhere.

Also, my case is strictly steady state, so this applying of a new boundary type only happens once during the setup of the problem.
RTN3000 is offline   Reply With Quote

Old   November 3, 2015, 16:52
Default
  #6
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
If you know which boundaries are changing beforehand then you could label them with a common prefix, for example "boundarychanges_inlet". The wildcard character can be used with the TUI such that "boundarychanges_*" includes all boundaries that start with "boundarychanges_".
RTN3000 and lytemar like this.
`e` is offline   Reply With Quote

Old   November 3, 2015, 17:28
Default
  #7
New Member
 
Join Date: Sep 2013
Posts: 13
Rep Power: 13
RTN3000 is on a distinguished road
Wow having the ability to use wildcards in TUI commands is very convenient! That makes everything a lot easier.
RTN3000 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
mixed inflow/outflow downstream boundary condition question peob OpenFOAM Running, Solving & CFD 3 February 3, 2017 11:54
Changing Boundary Types otq OpenFOAM Pre-Processing 0 October 8, 2013 13:00
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44
Changing the name of a boundary condition produces errors jorkolino OpenFOAM Bugs 2 January 6, 2011 04:14
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 16:55


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