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] whats wrong with this groovyBC expression in parenthesis? (https://www.cfd-online.com/Forums/openfoam-community-contributions/118605-whats-wrong-groovybc-expression-parenthesis.html)

immortality May 30, 2013 15:17

whats wrong with this groovyBC expression in parenthesis?
 
Code:

valueExpression "1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))";
Code:

Selecting turbulence model type RASModel
Selecting RAS turbulence model kOmegaSST
kOmegaSSTCoeffs
{
alphaK1        0.85034;
alphaK2        1;
alphaOmega1    0.5;
alphaOmega2    0.85616;
Prt            1;
gamma1          0.5532;
gamma2          0.4403;
beta1          0.075;
beta2          0.0828;
betaStar        0.09;
a1              0.31;
b1              1;
c1              10;
F3              false;
}

fluxScheme: Kurganov

Starting time loop

Mean and max Courant Numbers = 3.846733161 23.44685531
deltaT = 2.127659574e-09
Time = 2.12766e-09

diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal:  Solving for rhoUx, Initial residual = 0, Final residual = 0, No Iterations 0
diagonal:  Solving for rhoUy, Initial residual = 0, Final residual = 0, No Iterations 0
[2] swak4Foam: Allocating new repository for sampledGlobalVariables
[3] swak4Foam: Allocating new repository for sampledGlobalVariables
[0] swak4Foam: Allocating new repository for sampledGlobalVariables
[1] swak4Foam: Allocating new repository for sampledGlobalVariables
smoothSolver:  Solving for Ux, Initial residual = 1, Final residual = 2.261632314e-10, No Iterations 2
smoothSolver:  Solving for Uy, Initial residual = 1, Final residual = 1.356428384e-11, No Iterations 2
diagonal:  Solving for rhoE, Initial residual = 0, Final residual = 0, No Iterations 0
smoothSolver:  Solving for e, Initial residual = 0.003206774438, Final residual = 2.033790977e-08, No Iterations 50000
time step continuity errors : sum local = 5.358600541e-20, global = -5.358600541e-20, cumulative = -5.358600541e-20
smoothSolver:  Solving for omega, Initial residual = 0.009786991015, Final residual = 7.059726646e-08, No Iterations 4
[0] [1]
[1]
[1] --> FOAM FATAL ERROR:
[1] [2]
[3]
[3]
[3]  Parser Error for driver PatchValueExpressionDriver at "1.39" :"syntax error, unexpected ')'"
"1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"
^
----------------------------------------|

Context of the error:


- From dictionary: /home/ehsan/Desktop/Central/nonUniformMesh/Turbulent_WR/main_test/processor1/0/k.boundaryField.left
Evaluating expression "1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"
[1]
[1]
[1]    From function parsingValue
[1]    in file lnInclude/CommonValueExpressionDriverI.H at line 1039.
[1]
FOAM parallel run exiting
[1]
--> FOAM FATAL ERROR:
[3]  Parser Error for driver PatchValueExpressionDriver at "1.39" :"syntax error, unexpected ')'"
"1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"
^
----------------------------------------|

Context of the error:


- From dictionary: /home/ehsan/Desktop/Central/nonUniformMesh/Turbulent_WR/main_test/processor3/0/k.boundaryField.left
Evaluating expression "1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"
[3]
[3]
[3]    From function parsingValue
[3]    in file lnInclude/CommonValueExpressionDriverI.H at line 1039.
[3]
FOAM parallel run exiting
[3]
[2]
[2] --> FOAM FATAL ERROR:
[2]  Parser Error for driver PatchValueExpressionDriver at "1.39" :"syntax error, unexpected ')'"
"1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"
^
----------------------------------------|

Context of the error:


- From dictionary: /home/ehsan/Desktop/Central/nonUniformMesh/Turbulent_WR/main_test/processor2/0/k.boundaryField.left
Evaluating expression "1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"

[0]
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 1 in communicator MPI_COMM_WORLD
with errorcode 1.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
[0] --> FOAM FATAL ERROR:
[0]  Parser Error for driver PatchValueExpressionDriver at "1.39" :"syntax error, unexpected ')'"
"1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"
^
----------------------------------------|

Context of the error:


- From dictionary: /home/ehsan/Desktop/Central/nonUniformMesh/Turbulent_WR/main_test/processor0/0/k.boundaryField.left
Evaluating expression "1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"
[0]
[0]
[0]    From function parsingValue
[0]    in file lnInclude/CommonValueExpressionDriverI.H at line 1039.
[0]
FOAM parallel run exiting
[0]
--------------------------------------------------------------------------
mpirun has exited due to process rank 3 with PID 8236 on
node Ehsan-com exiting without calling "finalize". This may
have caused other processes in the application to be
terminated by signals sent by mpirun (as reported here).
--------------------------------------------------------------------------
[Ehsan-com:08227] 2 more processes have sent help message help-mpi-api.txt / mpi-abort
[Ehsan-com:08227] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages
Killing PID 8223
 PyFoam WARNING on line 232 of file /usr/local/lib/python2.7/dist-packages/PyFoam/Execution/FoamThread.py : Process 8223 was already dead
Getting LinuxMem: [Errno 2] No such file or directory: '/proc/8223/status'


gschaider May 31, 2013 13:01

Quote:

Originally Posted by immortality (Post 431047)
Code:

valueExpression "1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))";
Code:

[0] [1]
[1]
[1] --> FOAM FATAL ERROR:
[1] [2]
[3]
[3]
[3]  Parser Error for driver PatchValueExpressionDriver at "1.39" :"syntax error, unexpected ')'"
"1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"
^
----------------------------------------|

Context of the error:


- From dictionary: /home/ehsan/Desktop/Central/nonUniformMesh/Turbulent_WR/main_test/processor1/0/k.boundaryField.left
Evaluating expression "1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"
[1]
[1]
[1]    From function parsingValue
[1]    in file lnInclude/CommonValueExpressionDriverI.H at line 1039.
[1]
FOAM parallel run exiting
[1]
--> FOAM FATAL ERROR:
[3]  Parser Error for driver PatchValueExpressionDriver at "1.39" :"syntax error, unexpected ')'"
"1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"
^
----------------------------------------|

Context of the error:


- From dictionary: /home/ehsan/Desktop/Central/nonUniformMesh/Turbulent_WR/main_test/processor3/0/k.boundaryField.left
Evaluating expression "1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"
[3]
[3]
[3]    From function parsingValue
[3]    in file lnInclude/CommonValueExpressionDriverI.H at line 1039.
[3]
FOAM parallel run exiting
[3]
[2]
[2] --> FOAM FATAL ERROR:
[2]  Parser Error for driver PatchValueExpressionDriver at "1.39" :"syntax error, unexpected ')'"
"1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"
^
----------------------------------------|

Context of the error:


- From dictionary: /home/ehsan/Desktop/Central/nonUniformMesh/Turbulent_WR/main_test/processor2/0/k.boundaryField.left
Evaluating expression "1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"

[0]
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 1 in communicator MPI_COMM_WORLD
with errorcode 1.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------
[0] --> FOAM FATAL ERROR:
[0]  Parser Error for driver PatchValueExpressionDriver at "1.39" :"syntax error, unexpected ')'"
"1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"
^
----------------------------------------|

Context of the error:


- From dictionary: /home/ehsan/Desktop/Central/nonUniformMesh/Turbulent_WR/main_test/processor0/0/k.boundaryField.left
Evaluating expression "1.5*sqr(I*sum(mag(U.x)*Sf())/sum(Sf()))"
[0]
[0]
[0]    From function parsingValue
[0]    in file lnInclude/CommonValueExpressionDriverI.H at line 1039.
[0]
FOAM parallel run exiting
[0]
--------------------------------------------------------------------------
mpirun has exited due to process rank 3 with PID 8236 on
node Ehsan-com exiting without calling "finalize". This may
have caused other processes in the application to be
terminated by signals sent by mpirun (as reported here).
--------------------------------------------------------------------------
[Ehsan-com:08227] 2 more processes have sent help message help-mpi-api.txt / mpi-abort
[Ehsan-com:08227] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages
Killing PID 8223
 PyFoam WARNING on line 232 of file /usr/local/lib/python2.7/dist-packages/PyFoam/Execution/FoamThread.py : Process 8223 was already dead
Getting LinuxMem: [Errno 2] No such file or directory: '/proc/8223/status'


Is I a field you're using here or is it really your intention to use it as the unit-tensor? This means that the scalar expression you have here is promoted to a spherical tensor and swak doesn't know how to calculate the square of this, so it expects SOMETHING that reduces the tensor to a scalar (or at least a vector) when it encounters the ")"

immortality May 31, 2013 13:41

Hi
'I' is a constant defined in variables equal to .05 according to turbulent kinetic energy formula k=1.5 \, {(l \, I \,U)}^{2} .why OF assumes it as a tensor?for its capital form?

gschaider May 31, 2013 14:03

Quote:

Originally Posted by immortality (Post 431256)
Hi
'I' is a constant defined in variables equal to .05 according to turbulent kinetic energy formula k=1.5 \, {(l \, I \,U)}^{2} .why OF assumes it as a tensor?for its capital form?

In newer versions of swak if no field I is defined then I is assumed to be the unit tensor. Otherwise the field should be used. Maybe this doesn't work with variables. Try for a test to replace it with the actual value. Or another variable name

immortality May 31, 2013 14:22

thanks dear Bernard.
I wrote it as:
Code:

valueExpression "1.5*sqr(I*sum(mag(U.x)*mag(Sf()))/sum(mag(Sf())))";
and doen't show an error on the expression although the run crashes after some(around 12) iterations.

gschaider May 31, 2013 16:14

Quote:

Originally Posted by immortality (Post 431261)
thanks dear Bernard.
I wrote it as:
Code:

valueExpression "1.5*sqr(I*sum(mag(U.x)*mag(Sf()))/sum(mag(Sf())))";
and doen't show an error on the expression

OK. Then this is a bug (concerning the handling of I)

Quote:

Originally Posted by immortality (Post 431261)
although the run crashes after some(around 12) iterations.

That is not a swak-problem

immortality May 31, 2013 18:06

Bernhard do you mean it should display an error on 'I'?I have defined it as a constant why do you say so?
yes that was for a somewhat bad BC.
-----------
and if should report,I have to speak about what aspect of issue?
thanks.

gschaider May 31, 2013 19:20

Quote:

Originally Posted by immortality (Post 431283)
Bernhard do you mean it should display an error on 'I'?I have defined it as a constant why do you say so?
yes that was for a somewhat bad BC.
-----------
and if should report,I have to speak about what aspect of issue?
thanks.

Well. It should say "Ah, there's a variable 'I'. He probably means that and not the unit tensor" but it doesn't. It shouldn't display and error

immortality June 1, 2013 05:00

i think this error was on Sf() .it should have been mag(Sf()) and when i noticed and corrected it,no error displayed.
Anyway i understand what you said about the error but I still think the error should be modified.it says a ) is lost while its about using tensors and/or vectors.

gschaider June 4, 2013 12:34

Quote:

Originally Posted by immortality (Post 431323)
i think this error was on Sf() .it should have been mag(Sf()) and when i noticed and corrected it,no error displayed.
Anyway i understand what you said about the error but I still think the error should be modified.it says a ) is lost while its about using tensors and/or vectors.

Some function (maxPosition for instance) expect a scalar. So if you say "maxPosition(pos())" at the last ")" it says "hey. That can't be all. At least add a .x or so to make it a scalar. But the ')' is to early". This is what "unexpected ')'" means .. sometimes. At other times you just forgot a '('

immortality June 5, 2013 05:50

thanks so much.
a lateral question from your example!:D
I use max(pos().y) for example.whats the difference between function max and function maxPosition?

gschaider June 5, 2013 07:54

Quote:

Originally Posted by immortality (Post 432127)
thanks so much.
a lateral question from your example!:D
I use max(pos().y) for example.whats the difference between function max and function maxPosition?

That is explained in the README file AND the reference documentation (sometimes I seriously wonder why I write those files): the position where the maximum occurs


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