Any hints for user-defined BCs without using groovyBC/Swak4Foam?
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 x-axis, 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. |
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 rocket-science) in coded/C++ |
Implement your own Boundary Condition
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. |
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 OF-API that operates on the mesh properties like cell faces, coordinates and so on. In this way I might be able to make a wave-generation BCs with varying the "alpha1" position according to the wave period T and other parameters. |
1 Attachment(s)
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 sub-areas 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? |
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 |
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 ;) |
All times are GMT -4. The time now is 23:51. |