CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] log velocity profile with groovyBC - syntax (https://www.cfd-online.com/Forums/openfoam-community-contributions/85895-log-velocity-profile-groovybc-syntax.html)

LamiaOF2.1 May 14, 2013 10:48

when I did what you said, to add "-normal()*profile(pos().y)"it gives me that message

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading field p

Reading field U



--> FOAM FATAL IO ERROR:
attempt to read beyond EOF

file: /home/lamia/Bureau/CASE/0/U::boundaryField::inlet::lookuptables at line 38.

From function ITstream::read(token&)
in file db/IOstreams/Tstreams/ITstream.C at line 83.

FOAM exiting

why?

LamiaOF2.1 May 14, 2013 10:53

it's okey, I could fix it

LamiaOF2.1 May 15, 2013 11:42

tabular data with groovyBc
 
Hi
if I use this program as condition of my inlet :
boundaryField
{
inlet
{
type groovyBC;

fields
(
U yn
);

lookuptables (
{
name profile;
outOfBounds clamp;
fileName "$FOAM_CASE/profile.data";
valueExpression "-normal()*profile(pos().U)";
}
);

}
and the attached file is the following:
(
(0.00000 0.00000)
(0.14580 0.00001)
(0.19580 0.00002)
(0.22580 0.00003)
(0.25580 0.00004)
(0.27580 0.00005)
(0.29580 0.00006)
(0.30580 0.00007)
(0.31580 0.00008)
(0.32580 0.00009)
(0.33580 0.00010)
(0.34580 0.00011)
(0.35580 0.00012)
(0.36580 0.00013)
(0.37580 0.00014)
(0.38580 0.00015)
(0.39580 0.00017)
(0.40580 0.00018)
(0.41580 0.00020)
(0.42580 0.00021)
(0.43580 0.00023)
(0.44580 0.00025)
(0.45580 0.00027)
(0.46580 0.00029)
(0.48580 0.00033)
(0.47580 0.00033)
(0.49580 0.00035)
(0.50580 0.00038)
(0.51580 0.00040)
(0.52580 0.00043)
(0.53580 0.00046)
(0.54580 0.00048)
(0.55580 0.00051)
(0.56580 0.00055)
(0.57580 0.00058)
(0.58580 0.00061)
(0.59580 0.00065)
(0.60580 0.00068)
(0.61580 0.00072)
(0.62580 0.00076)
(0.63580 0.00080)
(0.64580 0.00085)
(0.65580 0.00089)
(0.66580 0.00094)
(0.67580 0.00098)
(0.68580 0.00103)
(0.69580 0.00108)
(0.70580 0.00114)
(0.71580 0.00119)
(0.72580 0.00125)
(0.73580 0.00130)
(0.74580 0.00136)
(0.75580 0.00143)
(0.76580 0.00149)
(0.77580 0.00155)
(0.78580 0.00162)
(0.79580 0.00169)
(0.80580 0.00176)
(0.81580 0.00184)
(0.82580 0.00191)
(0.83580 0.00199)
(0.84580 0.00207)
(0.85580 0.00215)
(0.86580 0.00224)
(0.87580 0.00232)
(0.88580 0.00241)
(0.89580 0.00250)
(0.90580 0.00260)
(0.91580 0.00269)
(0.92580 0.00279)
(0.93580 0.00289)
(0.94580 0.00300)
(0.95580 0.00310)
(0.96580 0.00321)
(0.97580 0.00332)
(0.98580 0.00344)
(0.99580 0.00356)
(1.00580 0.00368)
(1.01580 0.00380)
(1.02580 0.00392)
(1.03580 0.00405)
(1.04580 0.00418)
(1.05580 0.00432)
(1.06580 0.00445)
(1.07580 0.00459)
(1.08580 0.00474)
(1.09580 0.00488)
(1.10580 0.00503)
(1.11580 0.00518)
(1.12580 0.00534)
(1.13580 0.00550)
(1.14580 0.00566)
(1.15580 0.00583)
(1.16580 0.00600)
(1.17580 0.00617)
(1.18580 0.00634)
(1.19580 0.00652)
(1.20580 0.00670)
(1.21580 0.00689)
(1.22580 0.00708)
(1.23580 0.00727)
(1.24580 0.00747)
(1.25580 0.00767)
(1.26580 0.00788)
(1.27580 0.00808)
(1.28580 0.00830)
(1.29580 0.00851)
(1.30580 0.00873)
(1.31580 0.00895)
(1.32580 0.00918)
(1.33580 0.00941)
(1.34580 0.00965)
(1.35580 0.00989)
(1.36580 0.01013)
(1.37580 0.01038)
(1.38580 0.01063)
(1.39580 0.01089)
(1.40580 0.01115)
(1.41580 0.01142)
(1.42580 0.01169)
(1.43580 0.01196)
(1.44580 0.01224)
(1.45580 0.01252)
(1.46580 0.01281)
(1.47580 0.01310)
(1.48580 0.01340)
(1.49580 0.01370)
(1.50580 0.01400)
(1.51580 0.01431)
(1.52580 0.01463)
(1.53580 0.01495)
(1.54580 0.01527)
(1.55580 0.01560)
(1.56580 0.01594)
(1.57580 0.01628)
(1.58580 0.01662)
(1.59580 0.01697)
(1.60580 0.01733)
(1.61580 0.01769)
(1.62580 0.01805)
(1.63580 0.01843)
(1.64580 0.01880)
(1.65580 0.01918)
(1.66580 0.01957)
(1.67580 0.01996)
(1.68580 0.02036)
(1.69580 0.02076)
(1.70580 0.02117)
(1.71580 0.02158)
(1.72580 0.02200)
(1.73580 0.02243)
(1.74580 0.02286)
(1.75580 0.02330)
(1.76580 0.02374)
(1.77580 0.02419)
(1.78580 0.02464)
(1.79580 0.02510)
(1.80580 0.02557)
(1.81580 0.02604)
(1.82580 0.02652)
(1.83580 0.02701)
(1.84580 0.02750)
(1.85580 0.02799)
(1.86580 0.02850)
(1.87580 0.02901)
(1.88580 0.02952)
(1.89580 0.03004)
(1.90580 0.03057)
(1.91580 0.03111)
(1.92580 0.03165)
(1.93580 0.03220)
(1.94580 0.03275)
(1.95580 0.03331)
(1.96580 0.03388)
(1.97580 0.03445)
(1.98580 0.03504)
(1.99580 0.03562)
(2.00580 0.03620)
(2.01580 0.03682)
(2.02580 0.03743)
(2.03580 0.03805)
(2.04580 0.03867)
(2.05580 0.03930)
(2.06580 0.03994)
(2.07580 0.04058)
(2.08580 0.04123)
(2.09580 0.04189)
(2.10580 0.04256)
(2.11580 0.04323)
(2.12580 0.04391)
(2.13580 0.04460)
(2.14580 0.04530)
(2.15580 0.04600)
(2.16580 0.04671)
(2.17580 0.04743)
(2.18580 0.04816)
(2.19580 0.04889)
(2.20580 0.04963)
(2.21580 0.05038)
(2.22580 0.05114)
(2.23580 0.05190)
(2.24580 0.05268)
(2.25580 0.05346)
(2.26580 0.05425)
(2.27580 0.05505)
(2.28580 0.05585)
(2.29580 0.05667)
(2.30580 0.05749)
(2.31580 0.05832)
(2.32580 0.05916)
(2.33580 0.06001)
(2.34580 0.06086)
(2.35580 0.06173)
(2.36580 0.06260)
(2.37580 0.06348)
(2.38580 0.06437)
(2.39580 0.06527)
(2.40580 0.06618)
(2.41580 0.06709)
(2.42580 0.06802)
(2.43580 0.06895)
(2.44580 0.06989)
(2.45580 0.07084)
(2.46580 0.07181)
(2.47580 0.07278)
(2.48580 0.07375)
(2.49580 0.07474)
(2.50580 0.07574)
(2.51580 0.07675)
(2.52580 0.07776)
(2.53580 0.07879)
(2.54580 0.07982)
(2.55580 0.08087)
(2.56580 0.08192)
(2.57580 0.08298)
(2.58580 0.08405)
(2.59580 0.08514)
(2.60580 0.08623)
(2.61580 0.08733)
(2.62580 0.08844)
(2.63580 0.08956)
(2.64580 0.09069)
(2.65580 0.09184)
(2.66580 0.09299)
(2.67580 0.09415)
(2.68580 0.09532)
(2.69580 0.09650)
(2.70580 0.09769)
(2.71580 0.09889)
(2.72580 0.10011)
(2.73580 0.10133)
(2.74580 0.10256)
(2.75580 0.10380)
(2.76580 0.10506)
(2.77580 0.10632)
(2.78580 0.10760)
(2.79580 0.10888)
(2.80580 0.11018)
(2.81580 0.11149)
(2.82580 0.11280)
(2.83580 0.11413)
(2.84580 0.11547)
(2.85580 0.11682)
(2.86580 0.11818)
(2.87580 0.11956)
(2.88580 0.12094)
(2.89580 0.12233)
(2.90580 0.12374)
(2.91580 0.12516)
(2.92580 0.12659)
(2.93580 0.12803)
(2.94580 0.12948)
(2.95580 0.13094)
(2.96580 0.13241)
(2.97580 0.13390)
(2.98580 0.13540)
(2.99580 0.13690)
(3.00580 0.13842)
(3.01580 0.13996)
(3.02580 0.14150)
(3.03580 0.14306)
(3.04580 0.14463)
(3.05580 0.14621)
(3.06580 0.14780)
(3.07580 0.14940)
(3.08580 0.15102)
(3.09580 0.15265)
(3.10580 0.15429)
(3.11580 0.15594)
(3.12580 0.15760)
(3.13580 0.15928)
(3.14580 0.16097)
(3.15580 0.16267)
(3.16580 0.16439)
(3.17580 0.16612)
(3.18580 0.16786)
(3.19580 0.16961)
(3.20580 0.17137)
(3.21580 0.17315)
(3.22580 0.17494)
(3.23580 0.17675)
(3.24580 0.17856)
(3.25580 0.18039)
(3.26580 0.18224)
(3.27580 0.18409)
(3.28580 0.18596)
(3.29580 0.18784)
(3.30580 0.18974)
(3.31580 0.19165)
(3.32580 0.19357)
(3.33580 0.19551)
(3.34580 0.19746)
(3.35580 0.19942)
(3.36580 0.20140)
(3.37580 0.20339)
(3.38580 0.20539)
(3.39580 0.20741)
(3.40580 0.20944)
(3.41580 0.21148)
(3.42580 0.21354)
(3.43580 0.21562)
(3.44580 0.21770)
(3.45580 0.21980)
(3.46580 0.22192)
(3.47580 0.22405)
(3.48580 0.22619)
(3.49580 0.22835)
(3.50580 0.23052)
(3.51580 0.23271)
(3.52580 0.23491)
(3.53580 0.23713)
(3.54580 0.23936)
(3.55580 0.24160)
(3.56580 0.24386)
(3.57580 0.24614)
(3.58580 0.24842)
(3.59580 0.25073)
(3.60580 0.25305)
(3.61580 0.25538)
(3.62580 0.25773)
(3.63580 0.26009)
(3.64580 0.26247)
(3.65580 0.26486)
(3.66580 0.26727)
(3.67580 0.26970)
(3.68580 0.27214)
(3.69580 0.27459)
(3.70580 0.27706)
(3.71580 0.27955)
(3.72580 0.28205)
(3.73580 0.28457)
(3.74580 0.28710)
(3.75580 0.28965)
(3.76580 0.29221)
(3.77580 0.29479)
(3.78580 0.29739)
(3.79580 0.30000)
(3.81580 0.30527)
(3.82580 0.30793)
(3.83580 0.31061)
(3.84580 0.31330)
(3.85580 0.31601)
(3.86580 0.31873)
(3.87580 0.32147)
(3.88580 0.32423)
(3.89580 0.32700)
(3.90580 0.32979)
(3.91580 0.33260)
(3.92580 0.33542)
(3.93580 0.33827)
(3.94580 0.34112)
(3.95580 0.34400)
(3.96580 0.34689)
(3.97580 0.34979)
(3.98580 0.35272)
(3.99580 0.35566)
(4.00580 0.35862)
(4.01580 0.36160)
(4.02580 0.36459)
(4.03580 0.36760)
(4.05580 0.37367)
(4.15580 0.37673)
(4.15580 0.38291)
(4.15580 0.38603)
(4.15580 0.38916)
(4.15580 0.39231)
(4.15580 0.39548)
(4.15580 0.39866)
(4.15580 0.40187)
(4.15580 0.45000)
(4.15580 0.50000)
(4.15580 0.55000)
(4.15580 0.65000)
(4.15580 0.70000)
(4.15580 0.75000)
(4.15580 0.80000)
(4.15580 0.85000)
(4.15580 0.87500)
)
knowing that the first column is the velocity U while the second represents y
and I get this message:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading field p

Reading field U



--> FOAM FATAL ERROR:
out-of-order value: 0.4758 at index 25


From function Foam::interpolationTable<Type>::checkOrder() const
in file /opt/openfoam211/src/OpenFOAM/lnInclude/interpolationTable.C at line 226.

FOAM exiting

why can I do??
please I need to understand what's wrong

gschaider May 15, 2013 16:50

Quote:

Originally Posted by LamiaOF2.1 (Post 427791)
Hi
if I use this program as condition of my inlet :
boundaryField
{
inlet
{
type groovyBC;

fields
(
U yn
);

lookuptables (
{
name profile;
outOfBounds clamp;
fileName "$FOAM_CASE/profile.data";
valueExpression "-normal()*profile(pos().U)";
}
);

}
and the attached file is the following:
(
(0.00000 0.00000)
(0.14580 0.00001)

<snip>

(0.45580 0.00027)
(0.46580 0.00029)
(0.48580 0.00033)
(0.47580 0.00033)
(0.49580 0.00035)
(0.50580 0.00038)

<snipY

(4.15580 0.65000)
(4.15580 0.70000)
(4.15580 0.75000)
(4.15580 0.80000)
(4.15580 0.85000)
(4.15580 0.87500)
)
knowing that the first column is the velocity U while the second represents y
and I get this message:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading field p

Reading field U



--> FOAM FATAL ERROR:
out-of-order value: 0.4758 at index 25


From function Foam::interpolationTable<Type>::checkOrder() const
in file /opt/openfoam211/src/OpenFOAM/lnInclude/interpolationTable.C at line 226.

FOAM exiting

why can I do??
please I need to understand what's wrong

I think it is rather clear if you look at your data file: the point 0.4758 is out of sequence (it is smaller than the point before it). Clean that up. You'll probably also have a problem in the end where you have multiple values for 4.15580

Clément_G June 24, 2013 15:13

attempt to read beyond EOF (groovyBC)
 
Good afternoon,

I'm on OF 2.2 and I'm trying to put velocity inlet boundary conditions. It's a profile of velocity 2D saved in a data file named "test_profile.data" with 2 columns of datas: 1) U (m/s) and 2) y (altitude in meter) looks like that:
(
(0.0 0)
(5.3 10)
(5.9 20)
(6.4 30)
(7.0 40)
(7.9 50)
(8.0 60)
)
I have reproduced all the syntax you've proposed but the compilation doesn't work and I don't understand the reason of the error:

"--> FOAM FATAL IO ERROR:
attempt to read beyond EOF

file: /home/cgouriou/OpenFOAM/cgouriou-2.2.0/run/tutorials/ejemplo/LIPC/LIPC_2D_refined/lipc4/0/U.boundaryField.inlet.lookuptables at line 55.

From function ITstream::read(token&)
in file db/IOstreams/Tstreams/ITstream.C at line 83.

FOAM exiting"

The syntax of my velocity file U is like that:
boundaryField
{
inlet
{
type groovyBC;

fields
(
y U
);

lookuptables
(
{
name test_profile;
outOfBounds clamp;
fileName "$FOAM_CASE/test_profile.data";
}
valueExpression "vector(velocity(pos().y),0,0)";

);
}
}

I've simplified at the maximum my case in order to get a value of velocity at each point of the mesh, but it still doesn't run. Is that possible to put a velocity profile with less points that the mesh contains?

Could you give me some ideas, please?

thank you for you attention
Clément

gschaider June 24, 2013 18:43

Quote:

Originally Posted by Clément_G (Post 435665)
Good afternoon,

I'm on OF 2.2 and I'm trying to put velocity inlet boundary conditions. It's a profile of velocity 2D saved in a data file named "test_profile.data" with 2 columns of datas: 1) U (m/s) and 2) y (altitude in meter) looks like that:
(
(0.0 0)
(5.3 10)
(5.9 20)
(6.4 30)
(7.0 40)
(7.9 50)
(8.0 60)
)
I have reproduced all the syntax you've proposed but the compilation doesn't work and I don't understand the reason of the error:

"--> FOAM FATAL IO ERROR:
attempt to read beyond EOF

file: /home/cgouriou/OpenFOAM/cgouriou-2.2.0/run/tutorials/ejemplo/LIPC/LIPC_2D_refined/lipc4/0/U.boundaryField.inlet.lookuptables at line 55.

From function ITstream::read(token&)
in file db/IOstreams/Tstreams/ITstream.C at line 83.

FOAM exiting"

The syntax of my velocity file U is like that:
boundaryField
{
inlet
{
type groovyBC;

fields
(
y U
);

lookuptables
(
{
name test_profile;
outOfBounds clamp;
fileName "$FOAM_CASE/test_profile.data";
}
valueExpression "vector(velocity(pos().y),0,0)";

);
}
}

I've simplified at the maximum my case in order to get a value of velocity at each point of the mesh, but it still doesn't run. Is that possible to put a velocity profile with less points that the mesh contains?

Could you give me some ideas, please?

thank you for you attention
Clément

"read beyond EOF" usually is because the user made an error during editing (for instance forgotten ; ). In this concrete case the problem probably is that valueExpression is in the list of the lookuptables (that is probably the line 55 the error message is referring to. It is good practice to go to the reported line in the file and go upwards from it and have a look at the file

Clément_G June 24, 2013 19:19

answer
 
Quote:

Originally Posted by gschaider (Post 435698)
"read beyond EOF" usually is because the user made an error during editing (for instance forgotten ; ). In this concrete case the problem probably is that valueExpression is in the list of the lookuptables (that is probably the line 55 the error message is referring to. It is good practice to go to the reported line in the file and go upwards from it and have a look at the file

Thank you very much for your quick answer.

That was right I removed the "ValueExpression" from the the "lookuptables" and changed the "vector(velocity(pos().y),0,0)" by "-normal()*test_profile(pos().y)" and it ran perfectly!

boundaryField
{
inlet
{
type groovyBC;

fields
(
U y
);

lookuptables
(
{
name test_profile;
outOfBounds clamp;
fileName "$FOAM_CASE/test_profile.data";
}
);
valueExpression "-normal()*test_profile(pos().y)";


}
}

Thank you so much
sincerly
Clément

Clément_G June 26, 2013 11:51

inlet boundary condition for U and k
 
Good morning,

I have succeded in writing velocity inlet boundary conditions thanks to you help on this forum, but now I'd like to add turbulence boundary conditions. I have choosen a "simpleFoam" solveur (turbulence model komegaSST) and just have change the inlet conditions for k (0.org/k) in the same way that I did it for the file 0.org/U (see below).

"#include "include/initialConditions"

dimensions [0 2 -2 0 0 0 0];

internalField uniform $turbulentKE;

boundaryField
{
//- Set patchGroups for constraint patches
#include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes"

//- Define inlet conditions
//#include "include/fixedInlet"

inlet
{
type groovyBC;

fields
(
U y
);

lookuptables
(
{
name profile_tke_inv;
outOfBounds clamp;
fileName "$FOAM_CASE/profile_tke_inv.data";
}
);
valueExpression "vector(profile_tke_inv(pos().y),0,0)";
//"-normal()*profile_tke_inv(pos().y)";
}

atmosphere
{
type symmetryPlane;
}

outlet
{
type inletOutlet;
inletValue $internalField;
value $internalField;
}

ground
{
type kqRWallFunction;
value $internalField;
}

frontAndBack
{
type empty;
}
}"

Morover I have adapted the file include/initialConditions like that:
"//flowVelocity (6 0 0);
pressure 0;
turbulentKE 0;
turbulentOmega 1.78;
#inputMode merge

// ************************************************** *********************** //"

Finally when I look and the log.simplefoam file I get this error message:

"Create time

Create mesh for time = 0

Reading field p

Reading field U

--> FOAM Warning :
From function groovyBCFvPatchField<Type>::groovyBCFvPatchField(c onst fvPatch& p,const DimensionedField<Type, volMesh>& iF,const dictionary& dict)
in file groovyBCFvPatchField.C at line 131
No value defined for U on inlet therefore using 400{(0 0 0)}
Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting RAS turbulence model kOmegaSST
--> FOAM Warning :
From function groovyBCFvPatchField<Type>::groovyBCFvPatchField(c onst fvPatch& p,const DimensionedField<Type, volMesh>& iF,const dictionary& dict)
in file groovyBCFvPatchField.C at line 131
No value defined for k on inlet therefore using 400{0}
bounding k, min: 0 max: 0 average: 0
kOmegaSSTCoeffs
{
alphaK1 0.85034;
alphaK2 1;
alphaOmega1 0.5;
alphaOmega2 0.85616;
gamma1 0.5532;
gamma2 0.4403;
beta1 0.075;
beta2 0.0828;
betaStar 0.09;
a1 0.31;
b1 1;
c1 10;
F3 false;
}

Creating finite volume options
No finite volume options present


SIMPLE: no convergence criteria found. Calculations will run for 500 steps.


Starting time loop

Time = 1

smoothSolver: Solving for Ux, Initial residual = 1, Final residual = 0.0549726, No Iterations 2
smoothSolver: Solving for Uy, Initial residual = 0, Final residual = 0, No Iterations 0
GAMG: Solving for p, Initial residual = 1, Final residual = 0.0741149, No Iterations 7
time step continuity errors : sum local = 0.0787424, global = -0.00602472, cumulative = -0.00602472
smoothSolver: Solving for omega, Initial residual = 0.967767, Final residual = 0.0353544, No Iterations 2


--> FOAM FATAL ERROR:
The expected return type scalar is different from the stored result type "vector"



From function tmp<Field<Type> > ExpressionResult::getResult()
in file ../swak4FoamParsers/lnInclude/ExpressionResultI.H at line 238.

FOAM exiting"

I think that the problem comes from my variable "k" but I have no idea where I can change the type of the stored result, as indicated in the error message.

Thank you for your help
sincerly
Clément

gschaider June 26, 2013 12:57

Please use CODE for output and configuration files. It makes the post MUCH more readable

Quote:

Originally Posted by Clément_G (Post 436144)
Good morning,

I have succeded in writing velocity inlet boundary conditions thanks to you help on this forum, but now I'd like to add turbulence boundary conditions. I have choosen a "simpleFoam" solveur (turbulence model komegaSST) and just have change the inlet conditions for k (0.org/k) in the same way that I did it for the file 0.org/U (see below).

Starting time loop

Time = 1

smoothSolver: Solving for Ux, Initial residual = 1, Final residual = 0.0549726, No Iterations 2
smoothSolver: Solving for Uy, Initial residual = 0, Final residual = 0, No Iterations 0
GAMG: Solving for p, Initial residual = 1, Final residual = 0.0741149, No Iterations 7
time step continuity errors : sum local = 0.0787424, global = -0.00602472, cumulative = -0.00602472
smoothSolver: Solving for omega, Initial residual = 0.967767, Final residual = 0.0353544, No Iterations 2


--> FOAM FATAL ERROR:
The expected return type scalar is different from the stored result type "vector"



From function tmp<Field<Type> > ExpressionResult::getResult()
in file ../swak4FoamParsers/lnInclude/ExpressionResultI.H at line 238.

FOAM exiting"

I think that the problem comes from my variable "k" but I have no idea where I can change the type of the stored result, as indicated in the error message.

Thank you for your help
sincerly
Clément

k is a volScalarField. Your expression
Code:

valueExpression "vector(profile_tke_inv(pos().y),0,0)";
returns a vector. That is what swak complains about. What you probably wanted to say was
Code:

valueExpression "profile_tke_inv(pos().y)";

Clément_G June 26, 2013 14:23

inlet boundary condition for U and k
 
3 Attachment(s)
Hello Bernhard,

Thank you very much an other time for your quick answer.

Quote:

Originally Posted by gschaider (Post 436168)
Please use CODE for output and configuration files. It makes the post MUCH more readable

I will do that now.

Quote:

Originally Posted by gschaider (Post 436168)
k is a volScalarField. Your expression
Code:

valueExpression "vector(profile_tke_inv(pos().y),0,0)";
returns a vector. That is what swak complains about. What you probably wanted to say was
Code:

valueExpression "profile_tke_inv(pos().y)";

Is was exactly what I meant and which was wrong. Now my two profile run "quasi" perfectly.
But I still have an other question: my velocity profile has the right form but the values are wrong (around 10 times higher), and I don't understand how can I get velocity value of 60m/s when my velocity inlet profile has a maximum value of only 8m/s! In which part of my program do I have to change something, please?

Here are my screenshot of the velocity field and the correspondant velocity profile obtained from my velocity inlet conditions.

Thank you for your advices very helpful.
Clément

gschaider June 26, 2013 18:14

Quote:

Originally Posted by Clément_G (Post 436183)
Hello Bernhard,

Thank you very much an other time for your quick answer.


I will do that now.


Is was exactly what I meant and which was wrong. Now my two profile run "quasi" perfectly.
But I still have an other question: my velocity profile has the right form but the values are wrong (around 10 times higher), and I don't understand how can I get velocity value of 60m/s when my velocity inlet profile has a maximum value of only 8m/s! In which part of my program do I have to change something, please?

Here are my screenshot of the velocity field and the correspondant velocity profile obtained from my velocity inlet conditions.

Thank you for your advices very helpful.
Clément

No idea (and I'm not even sure which side you set the profile on. Also you only show the absolute value of the velocity. I've got no idea in which direction it goes)

But my first guess would be the boundary-conditions.

Clément_G June 27, 2013 12:33

boundary layer error value
 
3 Attachment(s)
Good morning Bernhard,

Quote:

Originally Posted by gschaider (Post 436203)
No idea (and I'm not even sure which side you set the profile on. Also you only show the absolute value of the velocity. I've got no idea in which direction it goes)

I understand. In fact the flow goes from the left side at a maximum highspeed of 8m/s.
I'm facing 3 problems that I present to you:

1) When you see at the velocity profile the trend is very good except at the boundary (60m of height) where we can see an absurd horizontal line. I've looked for the reasons of appearance of this abberation but I still haven't found.


Quote:

Originally Posted by gschaider (Post 436203)
But my first guess would be the boundary-conditions.

Here are my boundary conditions:
Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.2.0                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      volVectorField;
    location    "0";
    object      U;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#include        "include/initialConditions"

dimensions      [0 1 -1 0 0 0 0];

internalField  uniform (0 0 0);

boundaryField
{
    //- Set patchGroups for constraint patches
    #include "${WM_PROJECT_DIR}/etc/caseDicts/setConstraintTypes"

    inlet
    {
        type    groovyBC;
   
    fields
    (
      U y
    );
   
    lookuptables
      (
        {
            name profile_reel_U;
            outOfBounds clamp;
            fileName "$FOAM_CASE/profile_reel_U.data";
        }
      );         
      valueExpression "vector(profile_reel_U(pos().y),0,0)";
    //"-normal()*profile_reel_U(pos().y)";
    }

    atmosphere
    {
        type            symmetryPlane;
    }

    outlet
    {
        type            inletOutlet;
        inletValue      uniform (0 0 0);
        value          $internalField;
    }

    ground
    {
        type            fixedValue;
        value          uniform (0 0 0);
    }

    frontAndBack   
    {
        type            empty;
    }
}


// ************************************************************************* //

and here is the velocity inlet list:
Code:

((0.000000 0.000000)
(0.530444 0.250000)
(1.027199 0.500000)
(1.491419 0.750000)
(1.924262 1.000000)
(2.326884 1.250000)
(2.700441 1.500000)
(3.046090 1.750000)
(3.364986 2.000000)
(3.658287 2.250000)
(3.927147 2.500000)
(4.172725 2.750000)
(4.396175 3.000000)
(4.598654 3.250000)
(4.781319 3.500000)
(4.945325 3.750000)
(5.091830 4.000000)
(5.221988 4.250000)
(5.336958 4.500000)
(5.437894 4.750000)
(5.525954 5.000000)
(5.602293 5.250000)
(5.668067 5.500000)
(5.724434 5.750000)
(5.772549 6.000000)
(5.813569 6.250000)
(5.848650 6.500000)
(5.878948 6.750000)
(5.905619 7.000000)
(5.929820 7.250000)
(5.952707 7.500000)
(5.975243 7.750000)
(5.997618 8.000000)
(6.019825 8.250000)
(6.041863 8.500000)
(6.063725 8.750000)
(6.085408 9.000000)
(6.106907 9.250000)
(6.128219 9.500000)
(6.149338 9.750000)
(6.170260 10.000000)
(6.190982 10.250000)
(6.211498 10.500000)
(6.231805 10.750000)
(6.251898 11.000000)
(6.271772 11.250000)
(6.291424 11.500000)
(6.310849 11.750000)
(6.330042 12.000000)
(6.349001 12.250000)
(6.367719 12.500000)
(6.386193 12.750000)
(6.404418 13.000000)
(6.422390 13.250000)
(6.440106 13.500000)
(6.457563 13.750000)
(6.474764 14.000000)
(6.491714 14.250000)
(6.508415 14.500000)
(6.524870 14.750000)
(6.541083 15.000000)
(6.557057 15.250000)
(6.572795 15.500000)
(6.588301 15.750000)
(6.603577 16.000000)
(6.618627 16.250000)
(6.633455 16.500000)
(6.648063 16.750000)
(6.662454 17.000000)
(6.676633 17.250000)
(6.690602 17.500000)
(6.704364 17.750000)
(6.717923 18.000000)
(6.731282 18.250000)
(6.744444 18.500000)
(6.757413 18.750000)
(6.770191 19.000000)
(6.782782 19.250000)
(6.795189 19.500000)
(6.807416 19.750000)
(6.819466 20.000000)
(6.831341 20.250000)
(6.843046 20.500000)
(6.854583 20.750000)
(6.865956 21.000000)
(6.877168 21.250000)
(6.888222 21.500000)
(6.899122 21.750000)
(6.909870 22.000000)
(6.920470 22.250000)
(6.930926 22.500000)
(6.941239 22.750000)
(6.951415 23.000000)
(6.961455 23.250000)
(6.971364 23.500000)
(6.981144 23.750000)
(6.990799 24.000000)
(7.000332 24.250000)
(7.009746 24.500000)
(7.019044 24.750000)
(7.028230 25.000000)
(7.037307 25.250000)
(7.046279 25.500000)
(7.055147 25.750000)
(7.063917 26.000000)
(7.072590 26.250000)
(7.081171 26.500000)
(7.089662 26.750000)
(7.098067 27.000000)
(7.106388 27.250000)
(7.114630 27.500000)
(7.122796 27.750000)
(7.130888 28.000000)
(7.138910 28.250000)
(7.146865 28.500000)
(7.154757 28.750000)
(7.162588 29.000000)
(7.170362 29.250000)
(7.178083 29.500000)
(7.185753 29.750000)
(7.193375 30.000000)
(7.200954 30.250000)
(7.208492 30.500000)
(7.215992 30.750000)
(7.223458 31.000000)
(7.230893 31.250000)
(7.238300 31.500000)
(7.245682 31.750000)
(7.253044 32.000000)
(7.260387 32.250000)
(7.267715 32.500000)
(7.275032 32.750000)
(7.282341 33.000000)
(7.289644 33.250000)
(7.296946 33.500000)
(7.304249 33.750000)
(7.311557 34.000000)
(7.318872 34.250000)
(7.326199 34.500000)
(7.333541 34.750000)
(7.340900 35.000000)
(7.348280 35.250000)
(7.355684 35.500000)
(7.363116 35.750000)
(7.370578 36.000000)
(7.378075 36.250000)
(7.385608 36.500000)
(7.393182 36.750000)
(7.400800 37.000000)
(7.408465 37.250000)
(7.416179 37.500000)
(7.423948 37.750000)
(7.431773 38.000000)
(7.439658 38.250000)
(7.447606 38.500000)
(7.455620 38.750000)
(7.463704 39.000000)
(7.471862 39.250000)
(7.480095 39.500000)
(7.488408 39.750000)
(7.496803 40.000000)
(7.505285 40.250000)
(7.513856 40.500000)
(7.522519 40.750000)
(7.531277 41.000000)
(7.540135 41.250000)
(7.549095 41.500000)
(7.558161 41.750000)
(7.567335 42.000000)
(7.576621 42.250000)
(7.586022 42.500000)
(7.595542 42.750000)
(7.605183 43.000000)
(7.614949 43.250000)
(7.624844 43.500000)
(7.634870 43.750000)
(7.645030 44.000000)
(7.655329 44.250000)
(7.665769 44.500000)
(7.676353 44.750000)
(7.687085 45.000000)
(7.697968 45.250000)
(7.709005 45.500000)
(7.720199 45.750000)
(7.731554 46.000000)
(7.743073 46.250000)
(7.754760 46.500000)
(7.766616 46.750000)
(7.778647 47.000000)
(7.790854 47.250000)
(7.803242 47.500000)
(7.815813 47.750000)
(7.828571 48.000000)
(7.841518 48.250000)
(7.854659 48.500000)
(7.867996 48.750000)
(7.881533 49.000000)
(7.895273 49.250000)
(7.909219 49.500000)
(7.923375 49.750000)
(7.937743 50.000000)
(8      60)
)

2) Moreover I don't understand why at the initial time (t=0), we don't see anything in the velocity field ("all is blue"), although I have put my inlet velocity profile. (see attached files U_t0_x0.png and the correspondant curve_U_t0_x0.png and it's exactly the same for the "tke" profile at t=0)

3) Finally, when I see the film of my simulation at x=0 (entry patch), I don't understand why the inlet velocity profile changes. I thought that it would always be the same because it's constant boundary condition (see last attached file named curve_U_t5_x0.png). Do you have an idea to explain these changing?

I hope my explainations are enough clear.

Thank you,
Sincerly
Clément

gschaider June 27, 2013 14:40

Quote:

Originally Posted by Clément_G (Post 436388)
Good morning Bernhard,


I understand. In fact the flow goes from the left side at a maximum highspeed of 8m/s.
I'm facing 3 problems that I present to you:

1) When you see at the velocity profile the trend is very good except at the boundary (60m of height) where we can see an absurd horizontal line. I've looked for the reasons of appearance of this abberation but I still haven't found.



Here are my boundary conditions:

and here is the velocity inlet list:
Code:

((0.000000 0.000000)
(0.530444 0.250000)
(1.027199 0.500000)
(1.491419 0.750000)
(1.924262 1.000000)
(2.326884 1.250000)

<snip>

(7.803242 47.500000)
(7.815813 47.750000)
(7.828571 48.000000)
(7.841518 48.250000)
(7.854659 48.500000)
(7.867996 48.750000)
(7.881533 49.000000)
(7.895273 49.250000)
(7.909219 49.500000)
(7.923375 49.750000)
(7.937743 50.000000)
(8      60)
)


Is this some kind of test? To test my patience? Did it never occur to you that the problem might be that simply you and OF disagree on which column has which meaning? USUALLY in tables the value you look up with is in the left column, the resulting value in the right. So what is happening here is that at height 8 you've got the velocity 60 which stays constant from then on. Please. Next time think "I have a maximum velocity 60 in my results .... where did I see 60 before .... ah. That is the maximum height of my geometry ...."

Quote:

Originally Posted by Clément_G (Post 436388)
2) Moreover I don't understand why at the initial time (t=0), we don't see anything in the velocity field ("all is blue"), although I have put my inlet velocity profile. (see attached files U_t0_x0.png and the correspondant curve_U_t0_x0.png and it's exactly the same for the "tke" profile at t=0)

That is because paraview does not "understand groovyBC". It uses the value-entry to display the data. Which is 0 at t=0

Quote:

Originally Posted by Clément_G (Post 436388)
3) Finally, when I see the film of my simulation at x=0 (entry patch), I don't understand why the inlet velocity profile changes. I thought that it would always be the same because it's constant boundary condition (see last attached file named curve_U_t5_x0.png). Do you have an idea to explain these changing?


Clément_G June 27, 2013 19:35

groovyBC 2D resolved
 
Quote:

Originally Posted by gschaider (Post 436403)
Is this some kind of test? To test my patience? Did it never occur to you that the problem might be that simply you and OF disagree on which column has which meaning?

Sorry it wasn't a patience's test, I just hadn't found the solution because I believed that the part like that
Code:

fields
    (
      U y
    );

could specify the signification of each column, that's why I had given up that hypothesis.

Quote:

USUALLY in tables the value you look up with is in the left column, the resulting value in the right. So what is happening here is that at height 8 you've got the velocity 60 which stays constant from then on.
Clear explainations.
And finally thank you for the time you took to analyse my problem, it runs perfectly now.

Sincerly
Clément

gschaider June 28, 2013 04:50

Quote:

Originally Posted by Clément_G (Post 436449)
Sorry it wasn't a patience's test, I just hadn't found the solution because I believed that the part like that
Code:

fields
    (
      U y
    );

could specify the signification of each column, that's why I had given up that hypothesis.

I don't think that this fields-entry does anything (that is only used in the simpleFunctionObjects AFAIK and groovyBC ignores it)

Quote:

Originally Posted by Clément_G (Post 436449)
Clear explainations.
And finally thank you for the time you took to analyse my problem, it runs perfectly now.

Good

heling October 28, 2015 11:41

Hello Bernhard,

I've got just one question regarding the Clement's case: since the input data is a discrete velocity field, an interpolation might be required for grid points between the specified values. Does the OpenFOAM interpolate automatically (if yes, which interpolation method is set as default?) or user has to specify the inlet data exactly at boundary points?

Many thanks!

Edit1: I've tried it out, and ideed, OF seems to interpolate the prescribed discrete velocity profile on the boundary. However, I still couldn't find any information on the interpolation method that has been applied. It would be great, if you could provide some info. Thx!

potentialFoam July 6, 2018 08:33

Remark: Warning at initialising groovyBC
 
Thanks for all the hints - I found this thread really helpful! That's why I would like to add a warning where I spend some hours on:
During the first iteration/ time step with a groovyBC-boundary Foam printed:
Code:

--> FOAM Warning :
    From function groovyBCFvPatchField<Type>::groovyBCFvPatchField(const fvPatch& p,const DimensionedField<Type, volMesh>& iF,const dictionary& dict)
    in file groovyBCFvPatchField.C at line 131
    No value defined for nuTilda on INLET therefore using the internal field next to the patch


(Here for a SpalartAllmaras model with specified nuTilda at the inlet.) I took this warning for a sign that groovyBC was not working - wrong! It works perfectly fine as one can see after the first iteration in paraFoam e.g.


So thanks a lot again for the wonderful tool!

gschaider July 7, 2018 09:57

Quote:

Originally Posted by potentialFoam (Post 698410)
Thanks for all the hints - I found this thread really helpful! That's why I would like to add a warning where I spend some hours on:
During the first iteration/ time step with a groovyBC-boundary Foam printed:
Code:

--> FOAM Warning :
    From function groovyBCFvPatchField<Type>::groovyBCFvPatchField(const fvPatch& p,const DimensionedField<Type, volMesh>& iF,const dictionary& dict)
    in file groovyBCFvPatchField.C at line 131
    No value defined for nuTilda on INLET therefore using the internal field next to the patch

(Here for a SpalartAllmaras model with specified nuTilda at the inlet.) I took this warning for a sign that groovyBC was not working - wrong! It works perfectly fine as one can see after the first iteration in paraFoam e.g.


So thanks a lot again for the wonderful tool!


Sorry that this warning message is confusing. This really only happens during initialization. groovyBC can't do any calclations because some of the fields it uses in valueExpression might not yet be in memory (which would lead to the death of the simulation) and there is no "value" defined on the patch. Then it can only "guess" the value. 0 is not a good idea (think of T. or p in a compressible case) so it falls back to using the internal field (which should have a sensible value). But that happens only at the start. All other time-steps work as expected. I only added this warning because in some esoteric cases it could be a problem and the warning would help

Kbshariff December 7, 2020 11:23

logarithmatic velocity inlet
 
Hi foamers,

I would to specify logaritmatic velocity at the inlet of the form



Code:

U=2.5Um*ln*(z*Um/nu) + A
NB/ nu is kinematic viscosity, A and Um defined in variables

My groovyBC look like

Code:

    inlet         
  {
    type            groovyBC;
    variables "zp=pos().z;a=0.197*normal();u_f=0.00787*normal();";
    valueExpression "2.5*u_f*log((zp*u_f)/(nu))+a";

  }


I have the error when i run the case file.
Code:

swak4Foam: Allocating new repository for sampledGlobalVariables


--> FOAM FATAL ERROR:
 Parser Error for driver PatchValueExpressionDriver at "1.26" :"syntax error, unexpected ')'"
"2.5*u_f*log((zp*u_f)/(nu))+a"
                          ^
--------------------------|

Context of the error:


- From dictionary: /home/2016014/kshari01/OpenFOAM/v2006/run/case0_vs/0/U.boundaryField.inlet
  Evaluating expression "2.5*u_f*log((zp*u_f)/(nu))+a"


    From parsingValue
    in file lnInclude/CommonValueExpressionDriverI.H at line 1258.

FOAM exiting

Kindly assist please

I notice the error is within the log function because i tried a case constant value in the argument and the case was fine.
How do I define the log correctly in terms of position and a constant value nu from the transport properties.

Thank you

Kabir

gschaider December 7, 2020 17:12

Quote:

Originally Posted by Kbshariff (Post 789976)
Hi foamers,

I would to specify logaritmatic velocity at the inlet of the form



Code:

U=2.5Um*ln*(z*Um/nu) + A
NB/ nu is kinematic viscosity, A and Um defined in variables

My groovyBC look like

Code:

    inlet         
  {
    type            groovyBC;
    variables "zp=pos().z;a=0.197*normal();u_f=0.00787*normal();";
    valueExpression "2.5*u_f*log((zp*u_f)/(nu))+a";

  }

I have the error when i run the case file.
Code:

swak4Foam: Allocating new repository for sampledGlobalVariables


--> FOAM FATAL ERROR:
 Parser Error for driver PatchValueExpressionDriver at "1.26" :"syntax error, unexpected ')'"
"2.5*u_f*log((zp*u_f)/(nu))+a"
                          ^
--------------------------|

Context of the error:


- From dictionary: /home/2016014/kshari01/OpenFOAM/v2006/run/case0_vs/0/U.boundaryField.inlet
  Evaluating expression "2.5*u_f*log((zp*u_f)/(nu))+a"


    From parsingValue
    in file lnInclude/CommonValueExpressionDriverI.H at line 1258.

FOAM exiting

Kindly assist please

I notice the error is within the log function because i tried a case constant value in the argument and the case was fine.
How do I define the log correctly in terms of position and a constant value nu from the transport properties.

Thank you

Kabir


This is swak4Foams obscure way or saying "I beg your pardon: how is the logarithm of a vector defined?". You multiply the vector u_f with a scalar and divide it by a scalar. Result is a scalar. swak4Foam expects a scalar as the argument for the log-function. So it says "Surely Kabir meant to do something to the vector to give me the scalar that I so desperately need. But I see a ')' which means I won't get the scalar. This makes me sad and I will therefore kill the program" (swak4Foam acts like a spoilt child if it doesn't get what it wants. It learned that from OpenFOAM itself)


My guess is that you wanted to use the absolute value of u_f (with the mag-function) or a component of it


All times are GMT -4. The time now is 06:15.