parabolic inlet velocity condition
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 
Quote:
http://www.cfdonline.com/Forums/ope...ion17a.html (which gives you pointers at two alternate approaches) 
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! 
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 
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 
Quote:

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 
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) 
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 
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 Quote:

Parser Error for driver PatchValueExpressionDriver at "1.85" :"syntax error, unexpect
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 
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 
oh sorry,I did not mean to.
I will tag next time. And thank you very much for the reply. Thamali 
All times are GMT 4. The time now is 04:55. 