CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Post-Processing

Problem to calculate grad(U) using swak4Foam

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   March 15, 2012, 17:43
Default Problem to calculate grad(U) using swak4Foam
  #1
New Member
 
Hugo
Join Date: Jan 2011
Location: Montreal
Posts: 25
Rep Power: 6
Hugoles is on a distinguished road
Dear Foamers,

I need to calculate the strain rate tensor S_ij . In OpenFOAM this is made using the relation S_ij = symm(grad(U)). I am trying do this with swak4Foam (funkyDoCalc) but I just can't calculate grad(U). The error is the following:
Code:
Time = 1100
strainRate : swak4Foam: Allocating new repository for sampledGlobalVariables


--> FOAM FATAL ERROR: 
 Parser Error at "1.7" :"syntax error, unexpected ')'"
"grad(U)"
"       ^"

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

FOAM exiting
I can calculate grad(U.x), so I wonder if this problem has to do with how swak4Foam handles tensors. OpenFOAM can handle this expression without a problem, but it would be nice to avoid the (little) programming. Any ideas?

Thanks,

Hugo
Hugoles is offline   Reply With Quote

Old   March 15, 2012, 19:06
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Hugoles View Post
Dear Foamers,

I need to calculate the strain rate tensor S_ij . In OpenFOAM this is made using the relation S_ij = symm(grad(U)). I am trying do this with swak4Foam (funkyDoCalc) but I just can't calculate grad(U). The error is the following:
Code:
Time = 1100
strainRate : swak4Foam: Allocating new repository for sampledGlobalVariables


--> FOAM FATAL ERROR: 
 Parser Error at "1.7" :"syntax error, unexpected ')'"
"grad(U)"
"       ^"

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

FOAM exiting
I can calculate grad(U.x), so I wonder if this problem has to do with how swak4Foam handles tensors. OpenFOAM can handle this expression without a problem, but it would be nice to avoid the (little) programming. Any ideas?

Thanks,

Hugo
Had a quick look at the grammar. Seems that the gradient of a vector is currently not supported. Can't fix that today. Could you please write a bug-report so that I don't forget
gschaider is offline   Reply With Quote

Old   March 15, 2012, 19:52
Default
  #3
New Member
 
Hugo
Join Date: Jan 2011
Location: Montreal
Posts: 25
Rep Power: 6
Hugoles is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Had a quick look at the grammar. Seems that the gradient of a vector is currently not supported. Can't fix that today. Could you please write a bug-report so that I don't forget
Done! Likewise, can swak make operations over tensors such as mag(symm(grad(U))) ? Not sure if the feature is about only the grad of vectors or about tensors in general.

Thanks Bernhard,

Hugo
Hugoles is offline   Reply With Quote

Old   March 19, 2012, 17:16
Default
  #4
New Member
 
Hugo
Join Date: Jan 2011
Location: Montreal
Posts: 25
Rep Power: 6
Hugoles is on a distinguished road
Thanks for the patch!

I applied it to 1.6 but I still get the

Code:
Parser Error at "1.1-4" :"field grad not existing or of wrong type"
"grad(U)"
" ^^^^  "

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

FOAM exiting
when I try to calculate grad(U).

Furthermore, I pulled the developing version with mercurial and I get errors when trying to recompile in OF 1.7.1 on OS X 10.6.8. I tried in a desktop and in a laptop with the same result. The recompilation in Ubuntu 11.04 showed -apparently- no errors.

Could you please take a look at the attachment ?

Thanks!

h
Attached Files
File Type: gz logInstallOSX.txt.gz (15.1 KB, 6 views)
File Type: gz logInstallUbuntu.txt.gz (5.2 KB, 5 views)
Hugoles is offline   Reply With Quote

Old   March 20, 2012, 19:43
Default
  #5
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Hugoles View Post
Thanks for the patch!

I applied it to 1.6 but I still get the

Code:
Parser Error at "1.1-4" :"field grad not existing or of wrong type"
"grad(U)"
" ^^^^  "

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

FOAM exiting
when I try to calculate grad(U).

Furthermore, I pulled the developing version with mercurial and I get errors when trying to recompile in OF 1.7.1 on OS X 10.6.8. I tried in a desktop and in a laptop with the same result. The recompilation in Ubuntu 11.04 showed -apparently- no errors.

Could you please take a look at the attachment ?

Thanks!

h
The Mac-Problem: seems like the compiler can't find any of the .H-files in your OF-installation. I can only guess why that is. Try at least removing all deb-files with rmdeball. If that still happens have a look whether directories like $FOAM_SRC/OpenFOAM/lnINclude are there
gschaider is offline   Reply With Quote

Old   August 28, 2014, 04:23
Default
  #6
Senior Member
 
Tushar Chourushi
Join Date: Jul 2009
Location: IIT-Indore, India
Posts: 319
Blog Entries: 1
Rep Power: 9
Tushar@cfd is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Had a quick look at the grammar. Seems that the gradient of a vector is currently not supported. Can't fix that today. Could you please write a bug-report so that I don't forget
Dear Bernhard,

I wish to use the "grad(U)" function for the inlet boundary condition for "Tau" using groovyBC. Where, U is fully developed flow.

I am getting following error message:

Code:
--> FOAM FATAL ERROR: 
 Parser Error for driver PatchValueExpressionDriver at "1.18-21" :"field grad not existing or of wrong type"
"2*pow(mag(symm(grad(U))),2)"
                 ^^^^
----------------| 

Context of the error:
I found that very similar question was put forward in this thread, I would like to know How to overcome it?
Is "grad(U)" boundary condition possible using groovyBC?

I am using OF-2.1.x installed on Ubuntu 11.04

Thanks in advance!
Tushar@cfd is offline   Reply With Quote

Old   August 28, 2014, 05:07
Default
  #7
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Tushar@cfd View Post
Dear Bernhard,

I wish to use the "grad(U)" function for the inlet boundary condition for "Tau" using groovyBC. Where, U is fully developed flow.

I am getting following error message:

Code:
--> FOAM FATAL ERROR: 
 Parser Error for driver PatchValueExpressionDriver at "1.18-21" :"field grad not existing or of wrong type"
"2*pow(mag(symm(grad(U))),2)"
                 ^^^^
----------------| 

Context of the error:
I found that very similar question was put forward in this thread, I would like to know How to overcome it?
Is "grad(U)" boundary condition possible using groovyBC?

I am using OF-2.1.x installed on Ubuntu 11.04

Thanks in advance!
grad is not available on patches (simply because OF doesn't have it). snGrad is. That is the gradient in the direction of the surface normal
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   August 28, 2014, 05:46
Default
  #8
Senior Member
 
Tushar Chourushi
Join Date: Jul 2009
Location: IIT-Indore, India
Posts: 319
Blog Entries: 1
Rep Power: 9
Tushar@cfd is on a distinguished road
Thank you for quick reply.
Tushar@cfd is offline   Reply With Quote

Old   September 22, 2014, 21:32
Default
  #9
New Member
 
frantov
Join Date: Nov 2011
Posts: 8
Rep Power: 5
frantov is on a distinguished road
Hi Hugo
I need to develop a similar script to plot the strain rates. did you have any success?
Regards
f
frantov is offline   Reply With Quote

Old   September 23, 2014, 00:16
Default
  #10
Senior Member
 
Tushar Chourushi
Join Date: Jul 2009
Location: IIT-Indore, India
Posts: 319
Blog Entries: 1
Rep Power: 9
Tushar@cfd is on a distinguished road
Quote:
Originally Posted by frantov View Post
Hi Hugo
I need to develop a similar script to plot the strain rates. did you have any success?
Regards
f
Use snGrad(U) instead of grad(U) as pointed out by Bernhard in his post.

Quote:
grad is not available on patches (simply because OF doesn't have it). snGrad is.
-
Best Luck!
Tushar@cfd is offline   Reply With Quote

Old   September 24, 2014, 22:38
Default
  #11
New Member
 
Hugo
Join Date: Jan 2011
Location: Montreal
Posts: 25
Rep Power: 6
Hugoles is on a distinguished road
Quote:
Originally Posted by frantov View Post
Hi Hugo
I need to develop a similar script to plot the strain rates. did you have any success?
Regards
f
Hello Frantov,

Yes, you can calculate grad(U) using expressionField and then manipulate the result as with any other field. This way, you could calculate the instantaneous rate of strain and then control the averaging process as convenient. I do this in controlDict and not with funkyDoCalc as I tried originally.

Hope it helps,
Hugoles is offline   Reply With Quote

Old   September 25, 2014, 19:07
Default
  #12
Senior Member
 
ArathoN
Join Date: Jul 2011
Posts: 137
Rep Power: 7
ArathoN is on a distinguished road
doesn't openfoam have the utility to calculate the velocity gradient? what does swakfoam do more that the preloaded utility?
ArathoN is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Importing Geometry ProE to CFX fatb0y CFX 3 January 14, 2012 20:42
urgent help needed (rhie-chow interpolation problem) Ardalan Main CFD Forum 2 March 18, 2011 16:22
how to calculate the mean value of a surface xck1986 OpenFOAM 5 December 3, 2010 17:36
Can I solve this problem by Fluent? Kai_kc FLUENT 1 October 27, 2010 05:29
Adiabatic and Rotating wall (Convection problem) ParodDav CFX 5 April 29, 2007 19:13


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