CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   whats wrong with "sqr(internalField(U.x))"? (http://www.cfd-online.com/Forums/openfoam-solving/112798-whats-wrong-sqr-internalfield-u-x.html)

immortality February 5, 2013 14:27

whats wrong with "sqr(internalField(U.x))"?
 
why OpenFOAM gives an error about U.x?
Code:

Selecting turbulence model type laminar

Starting time loop

Time = 5.6e-09

Courant Number mean: 2.703201494e-20 max: 1.290382332e-16
diagonal:  Solving for rho, Initial residual = 0, Final residual = 0, No Iterations 0
swak4Foam: Allocating new repository for sampledGlobalVariables
DILUPBiCG:  Solving for Ux, Initial residual = 1, Final residual = 2.073282789e-22, No Iterations 2
DILUPBiCG:  Solving for Uy, Initial residual = 1, Final residual = 2.073273772e-22, No Iterations 2
DILUPBiCG:  Solving for e, Initial residual = 0.0006828527063, Final residual = 3.08254255e-26, No Iterations 2


--> FOAM FATAL ERROR:
Parser Error at "1.34" :"syntax error, unexpected '.', expecting ')'"
"1+(gamma-1)/2*sqr(internalField(U.x))/(gamma*R*internalField(T))"
"                                  ^                            "

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

FOAM exiting


immortality February 5, 2013 18:07

I've examined other possible types but the error persists.

wyldckat February 5, 2013 20:10

Try:
Code:

internalField(U).x

immortality February 12, 2013 13:40

thanks.
are sqr(mag(internalField(U))) and magSqr(internalField(U)) the same?

wyldckat February 12, 2013 18:15

Hi Ehsan,

Right now I'm too sleepy to properly think. I can't figure out how these operations affect vectors, but I think that for matrix tensors those two are not the same.

But if you take a look at the OpenFOAM Programmers Guide, pages 16, 19 and 20, you'll find more specific information on this. Maybe start reading from the beginning of Chapter 1 is the best. This will give you a better understanding of how OpenFOAM handles math operations, which you might have to document in your thesis.

There is a PDF file of the Programmers Guide in the main OpenFOAM source code folder, specifically at "doc/Guides-a4".
Be careful with this guide, because it has some flaws in it... but I think "mag", "sqr" and "magSqr" should all be properly defined.

Best regards,
Bruno

immortality February 13, 2013 07:53

thanks dear Bruno
I had read that before and took a look again.but nothing had write definitely about these terms.I think they are related to groovyBC library.Im going to have a look at its guidance if help.
any idea is appreciated.

immortality February 26, 2013 19:20

have anyone any idea about the expressions?are they different or equivalent certainly?

jherb September 10, 2013 14:59

For the definitions given on http://www.foamcfd.org/Nabla/guides/...sGuidese4.html the two things should be the same.
Quote:

Originally Posted by immortality (Post 407467)
thanks.
are sqr(mag(internalField(U))) and magSqr(internalField(U)) the same?



All times are GMT -4. The time now is 23:00.