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] problem with funkySetFields (https://www.cfd-online.com/Forums/openfoam-community-contributions/94112-problem-funkysetfields.html)

lg88 November 6, 2011 00:11

problem with funkySetFields
 
hi everyone
I need to set an initial field.but when i run the funkysetFields, i met the problem:

Create mesh for time = 0

Time = 0
Using funkySetFieldsDict

Part: a1
Putting "0" into field alpha1 at t = "0" if condition "sqrt(sqr(pos().x-4*(10,-2))+sqr(pos().y-16*(10,-3))+(sqr(pos().z-5*(10,-3))) <= 0.005" is true



--> FOAM FATAL ERROR:
Parser Error at "1.23" :"syntax error, unexpected ','"
"sqrt(sqr(pos().x-4*(10,-2))+sqr(pos().y-16*(10,-3))+(sqr(pos().z-5*(10,-3))) <= 0.005"
" ^ "

From function parsingValue
in file lnInclude/CommonValueExpressionDriverI.H at line 718.


I don't kown how to deal with it?
Thank you for your help


Best regards.

lg88

lg88 November 6, 2011 07:13

This is my funkySetFieldsDict.


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.0.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object funkySetFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

expressions
(
a1
{
field alpha1;
expression_r "0";
condition "sqrt(sqr(pos().x-4*(10,-2))+sqr(pos().y-16*(10,-3))+(sqr(pos().z-5*(10,-3))) <= 0.005";
}

a2
{

field alpha1;
expression_r "1";
condition "sqrt(sqr(pos().x-2*(10,-2))+sqr(pos().y-16*(10,-3))+(sqr(pos().z-5*(10,-3))) > 0.005";
}
);

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


now when i input the command :funkySetFieldsDict -time 0 ,the problem is different with the former one.The new one is :


--> FOAM FATAL IO ERROR:
keyword expression is undefined in dictionary "::a1"

file: ::a1 from line 22 to line 24.

From function dictionary::lookupEntry(const word&, bool, bool) const
in file db/dictionary/dictionary.C at line 400.

FOAM exiting


what is the problem? Can you help me ?

Thank you very much


Best regards
lg88

gschaider November 7, 2011 08:11

Quote:

Originally Posted by lg88 (Post 330890)
hi everyone
I need to set an initial field.but when i run the funkysetFields, i met the problem:

Create mesh for time = 0

Time = 0
Using funkySetFieldsDict

Part: a1
Putting "0" into field alpha1 at t = "0" if condition "sqrt(sqr(pos().x-4*(10,-2))+sqr(pos().y-16*(10,-3))+(sqr(pos().z-5*(10,-3))) <= 0.005" is true



--> FOAM FATAL ERROR:
Parser Error at "1.23" :"syntax error, unexpected ','"
"sqrt(sqr(pos().x-4*(10,-2))+sqr(pos().y-16*(10,-3))+(sqr(pos().z-5*(10,-3))) <= 0.005"
" ^ "

From function parsingValue
in file lnInclude/CommonValueExpressionDriverI.H at line 718.


I don't kown how to deal with it?
Thank you for your help


Best regards.

lg88

OK. The ^ points to the wrong location (which FSF-version are you using?). It should point to the "," in "(10,-2)". What is (10,-2) supposed to mean?

gschaider November 7, 2011 08:14

Quote:

Originally Posted by lg88 (Post 330921)
This is my funkySetFieldsDict.


/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.0.1 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object funkySetFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

expressions
(
a1
{
field alpha1;
expression_r "0";
condition "sqrt(sqr(pos().x-4*(10,-2))+sqr(pos().y-16*(10,-3))+(sqr(pos().z-5*(10,-3))) <= 0.005";
}

a2
{

field alpha1;
expression_r "1";
condition "sqrt(sqr(pos().x-2*(10,-2))+sqr(pos().y-16*(10,-3))+(sqr(pos().z-5*(10,-3))) > 0.005";
}
);

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


now when i input the command :funkySetFieldsDict -time 0 ,the problem is different with the former one.The new one is :


--> FOAM FATAL IO ERROR:
keyword expression is undefined in dictionary "::a1"

file: ::a1 from line 22 to line 24.

From function dictionary::lookupEntry(const word&, bool, bool) const
in file db/dictionary/dictionary.C at line 400.

FOAM exiting


what is the problem? Can you help me ?

Thank you very much


Best regards
lg88

That is quite plain: It asks for a keyword "expression", you give it "expression_r1". Loose the _r1

diwakaranant February 5, 2013 06:37

Problem regarding funkySetFields
 
Hi

I am using funkySetFields for initializing a exponential pressure distribution.
But when I am running the command "funkySetFields -time 0", the domain
is getting initialized correctly but the boundary conditions in the 0/p file is getting changed on its own.

Can anyone tell why is this happening ?

Thanks
Anant

gschaider February 5, 2013 12:33

Quote:

Originally Posted by diwakaranant (Post 406089)
Hi

I am using funkySetFields for initializing a exponential pressure distribution.
But when I am running the command "funkySetFields -time 0", the domain
is getting initialized correctly but the boundary conditions in the 0/p file is getting changed on its own.

Can anyone tell why is this happening ?

You didn't read the docu. That happended ;)

Probably you didn't set "keepPatches" http://openfoamwiki.net/index.php/Co...ctionary_usage


All times are GMT -4. The time now is 04:31.