
[Sponsors] 
Any hints for userdefined BCs without using groovyBC/Swak4Foam? 

LinkBack  Thread Tools  Display Modes 
March 21, 2013, 09:22 
Any hints for userdefined BCs without using groovyBC/Swak4Foam?

#1 
Member
David Long
Join Date: May 2012
Location: Germany
Posts: 54
Rep Power: 5 
Hi Foamers,
as I am not very clear about the idea/principle behind Swak4Foam/groovyBC, so I was wondering, is there some easy way to define some customized boundary conditions? For instance: assuming inlet z coordinates is from z = 0 m to z = 4 m, I want to define an "alpha 1" source from z =0 to z =2 m at the inlet with a velocity 2 m/s at xaxis, while the pressure of outlet is fixed to 0. Or more complex, I want the source velocity varying from: Vx =  2*sin(t* 2*Pi/T)  (absolute value) , where T is the period. So how to implement these BCs without using predefine Swak4Foam? Any recommendations or hints will be highly appreciated. 

March 21, 2013, 10:02 

#2  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40 
Quote:
The expressions you mention would be "pos().z<2 ? 1 : 0" for alpha1 (if I understand your description correctly) and "2*sin(time()*2*pi/42)" (with a period 42) in groovyBC which I think (but I'm biased) is pretty straightforward. It's a bit more typing (but not exactly rocketscience) in coded/C++
__________________
Note: I don't use "Friend"feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request 

March 21, 2013, 10:13 
Implement your own Boundary Condition

#3 
Senior Member
Jose Rey
Join Date: Oct 2012
Posts: 122
Rep Power: 8 
There is a tutorial by Hakan Nilsson from Chalmers University on how to implement your own boundary condition. You can find it here:
http://www.tfd.chalmers.se/~hani/kurser/OS_CFD/implementBoundaryCondition.pdf The tutorial seems to be current as of version 2.0.x. 

March 21, 2013, 14:54 

#4  
Member
David Long
Join Date: May 2012
Location: Germany
Posts: 54
Rep Power: 5 
Quote:
Quote:
What I want is to code a small fraction of C++ and make it usable for calculating the specified BCs. The difficult part is the OFAPI that operates on the mesh properties like cell faces, coordinates and so on. In this way I might be able to make a wavegeneration BCs with varying the "alpha1" position according to the wave period T and other parameters. 

October 29, 2013, 10:10 

#5 
New Member
Join Date: Mar 2013
Posts: 5
Rep Power: 4 
Hi bernard!
Yesterday I started to have a look on swak and in particular the capabilities of groovybc,but in truth i've not understood a lot !(my brain after thesis is cooked!). I was interested to know how to produce the input speed with only conditions of geometric type as you suggested to keepfit for alpha1 but obviously for me is a velocity vector. The idea is to produce subareas without having to change each time the mesh. For example on a square produce strips with input speed not anything. How could I do? for example 1<x<3, 0<y<1, & 4<x<6, 2<y<3 ecc.... suggestions? 

October 29, 2013, 12:41 

#6  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40 
Quote:
"((1<pos().x && pos().x<3 && 0<pos().y && pos().y<1)  (4<pos().x && pos().x<6 && 2<pos().y && pos().y<3)) ? 1 : 0" would give the value 1 on these two rectangles and 0 elsewhere
__________________
Note: I don't use "Friend"feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request 

October 30, 2013, 06:56 

#7 
New Member
Join Date: Mar 2013
Posts: 5
Rep Power: 4 
thanks a lot!works perfectly...
caldaiasemplificata_ingresso_ariaprimaria { type groovyBCFixedValue; valueExpression "((1<pos().x && pos().x<2 && 22<pos().y && pos().y<21)  (3<pos().x && pos().x<4 && 28<pos().y && pos().y<26)) ? vector(0,0,0.6) : vector(0,0,0)"; } thanks again 

Tags 
boundary condition, user defined function 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
[ICEM] How can I define different zones in ICEM?  llrr  ANSYS Meshing & Geometry  13  August 4, 2014 20:04 
UDF link fortran source  yorelchr  Fluent UDF and Scheme Programming  0  February 7, 2013 04:44 
using METIS functions in fortran  dokeun  Main CFD Forum  7  January 29, 2013 05:06 
Dealing with BC's in OF 1.6  vkrastev  OpenFOAM Running, Solving & CFD  5  September 4, 2012 11:58 
OpenFOAM static build on Cray XT5  asaijo  OpenFOAM Installation  9  April 6, 2011 12:21 