|
[Sponsors] |
[swak4Foam] problem with a parabolic velocity profile |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 4, 2013, 08:53 |
problem with a parabolic velocity profile
|
#1 |
Member
Claudio
Join Date: Mar 2012
Location: Milano, Italy
Posts: 49
Rep Power: 14 |
Hi all!
I'm trying to apply, as BC, a parabolic velocity profile at the inlet of my problem (a pipe) using groovyBC (from swak4foam). It works, in the sense that I have a parabolic profile, but: I would like to have velocity values (only in x direction) between 0 and 2 instead: I obtain a profile going from -0.11924 (negative!!) to 1.993 , looking only Ux in paraview, and from 1.929e-5 to 1.993 considering the Umagnitude. (see attached pictures) I'm worried about the negative value overall. Do you have any idea why I obtain these results instead of what I expected (zero?! Here how I applied the condition: Code:
{ type groovyBC; value uniform (1 0 0); variables "Vm=2;yp=pos().y;zp=pos().z+0.005;h=-max(zp);a=-Vm/(h*h);b=Vm;"; fractionExpression "1"; valueExpression "vector(a*((yp*yp)+(zp*zp))+b,0,0)"; } I defined zp=pos().z+0.005 because z interval is [-0.0075 : -0.0025]. Thank you in advance! Claudio |
|
June 4, 2013, 14:10 |
|
#2 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
The max not hitting 2 is OK: if the peak of the parabola doesn't "hit" a face-center then you will get a slightly lower value. The "+0.005"-trick can be avoided. Use max(pts().z) to get the maximum of the vertices of the patch. Get the minimum the same way (see how it is done in the pulsating pitzDaily).
__________________
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 |
||
June 5, 2013, 06:41 |
|
#3 | ||
Member
Claudio
Join Date: Mar 2012
Location: Milano, Italy
Posts: 49
Rep Power: 14 |
Hi Bernhard,
thank you for your quick answer! I tried to do what you said, and now it works! I mean: Quote:
Quote:
Code:
{ type groovyBC; value uniform (1 0 0); variables "Vm=2;yp=pos().y;zp=pos().z+0.005;h=-max(pts().z);a=-Vm/(h*h);b=Vm;"; fractionExpression "1"; valueExpression "vector(a*((yp*yp)+(zp*zp))+b,0,0)"; } If you could explain it to me someway it could be usefull! Thank you very much! |
|||
June 18, 2013, 10:34 |
|
#4 | |
Member
Daniel Pielmeier
Join Date: Apr 2012
Posts: 99
Rep Power: 14 |
Quote:
I tried the same but wanted to achieve a fixed volumetric flow rate. I post this here, maybe someone can make use of it. If somebody has a better solution I would be glad to hear it. First I obtain the list of face centres for the x and z coordinate (xp, zp) corrected by the offset between the centre of the pipe inlet and the origin. This way the maximum value is at the centre of the inlet patch. For the parabolic profile (para) I used the same function Claudio used. What I call normalizedFlux is the resulting flux for a parabola with a maximum velocity of 1m/s. The ratio between my desired flux and the normalizedFlux is then used in the valueExpression along with the parabolic profile. This results in the same flux as for the flowRateInletVelocity boundary condition with a uniform value. Code:
inflow { //type flowRateInletVelocity; //volumetricFlowRate 0.000583333; //value uniform (0 0 0); type groovyBC; variables ( "flux=-0.000583333;" "minX=min(pts().x);" "maxX=max(pts().x);" "minZ=min(pts().z);" "maxZ=max(pts().z);" "r=mag((maxZ-minZ)/2.0);" "xOffset=minX+r;" "zOffset=minZ+r;" "xp=pos().x-xOffset;" "zp=pos().z-zOffset;" "para=1-((xp*xp)+(zp*zp))/pow(r,2);" "normalizedFlux=sum(para*area());" "ratio=flux/normalizedFlux;" ); valueExpression "vector(0,ratio*para,0)"; value uniform (0 1 0); } |
||
May 29, 2014, 06:12 |
|
#5 |
Senior Member
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 520
Rep Power: 19 |
Dear All,
I am trying to do the same trick, using the coded BC instead of using swak4Foam, since I can't compile it on the machine where I have to launch my simulations. Do you know how I can fix this? I tried something like Code:
movingWall { type codedFixedValue; value uniform (0 -2 0); redirectType parabolicInlet; code #{ scalar U_0 = 2; scalar a = 0; scalar yp = 0; scalar zp = 0; fixedValueFvPatchVectorField myPatch(*this); forAll(this->patch().Cf(),i) { a = U_0 / (0.5*0.5); yp = pos().y; zp = pos().z+0.005; myPatch=vector(0,-2*a,0); } operator==(myPatch); #}; } Could you help, please? Thanks, Samuele |
|
May 29, 2014, 10:30 |
|
#6 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
I think what you want is (I'm doing this from memory so it might be slightly off. Especially the .y()-part) Code:
yp=this->patch().Cf()[i].y(); zp=this->patch().Cf()[i].z()+0.005; Also replace the next line with Code:
myPatch[i]=vector(0,-2*a,0); Concerning "can't compile it on the machine where I have to launch my simulations": if it is about outdated bison&flex on that machine: the development-version (and next release) of swak have a script to download and build a more up-to-date version of bison and use that. Nothing more than a C++-compiler is needed. And you must have access to that on that machine (otherwise coded wouldn't work)
__________________
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 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
3D UDF Paraboilc Velocity Profile (Can't Maintain) | Sing | FLUENT | 12 | August 7, 2017 07:25 |
atmBoundaryLayerInletVelocity - Velocity Profile not continuous through domain | sdfij6354 | OpenFOAM Running, Solving & CFD | 3 | July 26, 2017 17:16 |
pressure contour and velocity profile problem | alee1293 | Main CFD Forum | 0 | July 18, 2014 11:31 |
Multi step transient UDF velocity profile problem | William177 | FLUENT | 1 | February 3, 2008 07:47 |
Variables Definition in CFX Solver 5.6 | R P | CFX | 2 | October 26, 2004 03:13 |