
[Sponsors] 
March 26, 2012, 15:19 
parabolic inlet velocity condition

#1 
New Member
solOF
Join Date: Mar 2012
Posts: 26
Rep Power: 6 
Hi,
I'm trying to program a parabolic inlet velocity condition with openFOAM2.0 for a 3D channel. My function is: U(0,y,z)=U*y*z*(Hy)/H^4 where U=U(0,H/2,H/2,t) and H is the height of the channel. I've copied parabolicVelocityFvPatchVectorField.C parabolicVelocityFvPatchVectorField.H on ~/OpenFoam/OFOrg2.0/OpenFOAM2.0.0/src/finiteVolume/fields/fvPatchFields/derived/parabolicVelocity/. and now I'm trying to modify this file, but I don't know how I can get U=U(0,H/2,H/2,t) Could you help me please? Or could you give me a piece of advice to do it on a different way? Thank you! solOF 

March 26, 2012, 16:18 

#2  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,920
Rep Power: 41 
Quote:
parabolicVelocity as boundary condition in OF1.7? (which gives you pointers at two alternate approaches) 

March 27, 2012, 04:35 

#3 
New Member
solOF
Join Date: Mar 2012
Posts: 26
Rep Power: 6 
Thank you for the fast reply!
I'm going to use groovyBC, however I still don't know how I could define the velocity Um of my function: U(0,y,z)=Um*y*z*(Hy)/H^4 where Um=U(0,H/2,H/2,t) could you help me, please? Thank you! 

March 27, 2012, 14:45 

#4  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,920
Rep Power: 41 
Quote:
Just one remark: I don't know what you want to acomplish with U@in: if it is to access a remote patch: the syntax has changed in swak4Foam. Also: in your case it is not required: variables are calculated on patch "in" anyway 

March 27, 2012, 19:10 

#5 
New Member
solOF
Join Date: Mar 2012
Posts: 26
Rep Power: 6 
Hi,
thank you! What I want to do is to take U(0,H/2,H/2) from the "in" patch. I thought that it was a possible way to do that, but I'm not sure... It seems to be wrong, doesn't it? I think that what you told me is that I should install swak4Foam and then I should implement the function: U(0,y,z)=Um*y*z*(Hy)*(Hz)/h^4 V=0 W=0 where Um=4*U(0,H/2,H/2,t) on that way: in { type groovyBC; variables "yp{in}=pts().y;zp{in}=pts().z;minZ=min(zp);maxZ=m ax(zp);H =(maxZminZ)/2;v{in}=4*v(0,H,H);"; valueExpression "vector(v*yp*zp*(Hyp)*(Hzp)/pow(H,4),0,0)"; } Am I wrong? Thank you very much 

March 27, 2012, 19:34 

#6  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,920
Rep Power: 41 
Quote:


April 7, 2012, 10:40 

#7 
New Member
solOF
Join Date: Mar 2012
Posts: 26
Rep Power: 6 
Thank you for your help,
Finally groovyBC is working. I have changed the extension ".so" by ".dylib" and now OpenFoam is able to find the library. Now I have a different problem. I have program the boundary conditions on that way: in { type groovyBC; variables "yp=pts().y;zp=pts().z;minZ=min(zp);maxZ=max(zp);m inY=min(yp);maxY=max(yp);Hz=(maxZminZ)/2;Hy=(maxYminY)/2;v=4*U(0,Hy,Hz)/9;"; valueExpression "vector(16*v*yp*zp*(Hyyp)*(Hzzp)/pow(H,4),0,0)"; } I want to extract the velocity in (0,Hy,Hz), but it seems that I have a syntax error and I get: > FOAM FATAL ERROR: Parser Error at "1.3" :"syntax error, unexpected '(', expecting $end" "4*U(0,Hy,Hz)/9" " ^ " From function parsingValue in file PatchValueExpressionDriver.C at line 192. FOAM exiting How can I extract the velocity in that point? Thank you Ofslcm 

April 9, 2012, 17:39 

#8  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,920
Rep Power: 41 
Quote:
Quote:
But first: you're sure you want to make the BC depend on the current solution? I just ask because there are all kinds of ways that this kind of feedback can make your simulation instable The workaround would be to define a sampled set at the location in question (for instance named probe). Then you can use it in the variables as "v{set'probe}=4*U/9;" (U is the value at the probe location). The only downside is that the location of the probe currently can't be calculated (for details on using that see either the fillingTheDam case in the swakExamples or the presentation from last years workshop) 

April 11, 2012, 12:16 

#9 
New Member
solOF
Join Date: Mar 2012
Posts: 26
Rep Power: 6 
Hi,
the version that I'm using of OpenFOAM is 2.0. But I don't know why it doesn't recognize the extension ".so". Thank you for your answer. I've been having a look to the fillingTheDam example. As you told me, I can program it to get U(0,H,H) doing this: in { type groovyBC; value uniform(0,0,0); valueExpression "((pos().y==(max(pos().y)+min(pos().y)/2) && pos().z==(max(pos().z)+min(pos().z)/2)) ? normal() : vector(0,0,0))"; storedVariables( { name probe; initialValue "0"; } ); variables( "v{set'probe}=4*U/9;" ); } However, I get the following error: > FOAM Warning : From function entry::getKeyword(keyType&, Istream&) in file db/dictionary/entry/entryIO.C at line 77 Reading ./cylinder_00/0/U found on line 58 the punctuation token ')' expected either } or EOF > FOAM FATAL IO ERROR: ill defined primitiveEntry starting at keyword 'variables(' on line 60 and ending at line 70 file: ./cylinder_00/0/U at line 70. From function primitiveEntry::readEntry(const dictionary&, Istream&) in file db/dictionary/primitiveEntry/primitiveEntryIO.C at line 165. FOAM exiting Why? On the other hand, I'm interested in defining: valueExpression "vector(16*v*yp*zp*(Hyyp)*(Hzzp)/pow(H,4),0,0)"; Is it possible to define 2 valueExpression? One with the conditional sentence followed by another one with this vector expression? Thank you 

April 11, 2012, 15:42 

#10  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,920
Rep Power: 41 
Quote:
Quote:
A note about the expression: == hardly ever works with floating point. You'd better check that the value is within a (small) range I don't understand: The boundary condition can only have one value 

February 4, 2014, 13:51 
Parser Error for driver PatchValueExpressionDriver at "1.85" :"syntax error, unexpect

#11 
Member
Thamali
Join Date: Jul 2013
Posts: 55
Rep Power: 4 
Dear all,
I am new to swak4Foam and I am trying to develop a boundary condition to make a fixed temperature using temperature gradient.Real application is to find out the temperature using radiative heat as a heat flux at the boundary. so lambda*epsilon*grad(ts) =radiative heat(which requires (Tenv^4Tboundary^4) So both grad and radiative heat requires Tboundary. I am trying to implement this boundary condition using the following. interFace { type groovyBC; #include "commonVariables" gradientExpression "sig*emiss*2*(pow(Tenv,4)pow(ts,4))*pow((epsilon*effectiveThermalConductivi tyS*delta),1)" ; fractionExpression "1"; value uniform 298; } &(commonVariables) variables "sig=5.67e8;emiss=0.9;Tenv=773;Yvolat=YCOs+YCO2s+YH2s+YCH4s+ YCxHyOzs;epsilon=0.5+0.5*((0.7207Yvolat)+(0.1457Ychar)+(0.0426Yash));"; But Iam getting the following error,which I cannot fix. swak4Foam: Allocating new repository for sampledGlobalVariables > FOAM FATAL ERROR: Parser Error for driver PatchValueExpressionDriver at "1.85" :"syntax error, unexpected ')', expecting '('" "sig*emiss*2*(pow(Tenv,4)pow(ts,4))*pow((epsilon*effectiveThermalConductivi tyS*delta),1)" ^  Context of the error:  From dictionary: /home/thamali/OpenFOAM/thamali2.2.2/run/tutorials/combustion/woodchipcombustion/wood_chip_boiler6/0/ts.boundaryField.interFace Evaluating expression "sig*emiss*2*(pow(Tenv,4)pow(ts,4))*pow((epsilon*effectiveThermalConductivi tyS*delta),1)" From function parsingValue in file lnInclude/CommonValueExpressionDriverI.H at line 1181. FOAM exiting I saw a similar thing in this thread ,so I choosed to write here anticipating for a reply from anyone. Thanks in advance. Thamali 

February 4, 2014, 19:39 

#12  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,920
Rep Power: 41 
Quote:
Point 2: please enclose output and code in the CODEtag (the # above). It makes it much more readable (especially the position indicator of the error) I guess the problem is the variable delta. The patchparser has a function delta() (this is a discretization property of the patch) and your variable clashes with that. You'll have to rename the variable
__________________
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 

February 5, 2014, 01:30 

#13 
Member
Thamali
Join Date: Jul 2013
Posts: 55
Rep Power: 4 
oh sorry,I did not mean to.
I will tag next time. And thank you very much for the reply. Thamali 

Tags 
boundary conditions, parabolic inlet, parabolic velocity 
Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
UDF error  parabolic velocity profile  3D turbine  Zaqie  Fluent UDF and Scheme Programming  9  Yesterday 19:08 
velocity profile inlet boundary condition question  Lcw  FLUENT  3  August 3, 2012 05:53 
Inlet velocity boundary condition in Polyflow  ZHANG XianMing  Main CFD Forum  0  October 18, 2006 21:06 
udf parabolic velocity inlet with unsteady case  Faruk Beyca  FLUENT  3  November 28, 2005 15:25 
UDF problem : inlet velocity in cyl. coord. system  Jongdae Kim  FLUENT  0  June 15, 2004 11:21 