CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

How to use funkySetFields for surface scalar 'phi'?

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

Like Tree1Likes
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Display Modes
Old   March 19, 2014, 18:59
Default How to use funkySetFields for surface scalar 'phi'?
  #1
Member
 
Tony
Join Date: Nov 2013
Posts: 35
Rep Power: 3
wzx1989221 is on a distinguished road
Hi everyone,

I met a problem when using funkySetFields for surface scalar field 'phi'. Basically I want to non-dimensionalise my case through dividing the fields by its reference values. I used the code below for velocity and pressure fields and they worked fine.

Code:
funkySetFields -field p -keepPatches -expression 'p/0.030625' -time 63 -condition "mag(vector(pos().x,pos().y,0))<=1.0"
Code:
funkySetFields -field U -keepPatches -expression 'U/0.175' -time 63 -condition "mag(vector(pos().x,pos().y,0))<=1.0"
However, when it comes to the surface scalar field 'phi', the error turned up like this:
Code:
--> FOAM FATAL ERROR:
 Parser Error for driver FieldValueExpressionDriver at "1.5-11" :"syntax error, unexpected number"
"phi/0.01575"
      ^^^^^^^
------|

Context of the error:


- Driver constructed from scratch
  Evaluating expression "phi/0.01575"


    From function parsingValue
    in file lnInclude/CommonValueExpressionDriverI.H at line 1081.
This is the code I use for phi:
Code:
funkySetFields -field phi -expression 'phi/0.01575' -time 63
Why I can't use funkySetFields for phi? Is there anything wrong in my code?

I really appreciate it if someone could give me a hand. Thank you very much.

Kind regards,
Tony
wzx1989221 is offline   Reply With Quote

Old   March 20, 2014, 15:18
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by wzx1989221 View Post
Hi everyone,

I met a problem when using funkySetFields for surface scalar field 'phi'. Basically I want to non-dimensionalise my case through dividing the fields by its reference values. I used the code below for velocity and pressure fields and they worked fine.

Code:
funkySetFields -field p -keepPatches -expression 'p/0.030625' -time 63 -condition "mag(vector(pos().x,pos().y,0))<=1.0"
Code:
funkySetFields -field U -keepPatches -expression 'U/0.175' -time 63 -condition "mag(vector(pos().x,pos().y,0))<=1.0"
However, when it comes to the surface scalar field 'phi', the error turned up like this:
Code:
--> FOAM FATAL ERROR:
 Parser Error for driver FieldValueExpressionDriver at "1.5-11" :"syntax error, unexpected number"
"phi/0.01575"
      ^^^^^^^
------|

Context of the error:


- Driver constructed from scratch
  Evaluating expression "phi/0.01575"


    From function parsingValue
    in file lnInclude/CommonValueExpressionDriverI.H at line 1081.
This is the code I use for phi:
Code:
funkySetFields -field phi -expression 'phi/0.01575' -time 63
Why I can't use funkySetFields for phi? Is there anything wrong in my code?

I really appreciate it if someone could give me a hand. Thank you very much.

Kind regards,
Tony
You can. But phi is a surfaceScalarField and 0.01575 is (for technical reasons) a volScalarField. So 'phi/interpolate(0.01575)' should do the trick. Have a look at Documentation/swak4FoamReference.org for details.

BTW: for a condition you'll want to use fpos() for the face positions
letzel likes this.
__________________
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   March 20, 2014, 18:36
Default
  #3
Member
 
Tony
Join Date: Nov 2013
Posts: 35
Rep Power: 3
wzx1989221 is on a distinguished road
Dear Bernhard,

Thank you very much for the solution and your kind notice.

I tried with interpolate() and it worked for internal fields, however, I couldn't change the values on the boundary (BTW, I am using cyclic boundary condition). Is it possible to get the flux value on boundary changed as well?

Thanks and regards,
Tony
wzx1989221 is offline   Reply With Quote

Old   March 21, 2014, 19:38
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by wzx1989221 View Post
Dear Bernhard,

Thank you very much for the solution and your kind notice.

I tried with interpolate() and it worked for internal fields, however, I couldn't change the values on the boundary (BTW, I am using cyclic boundary condition). Is it possible to get the flux value on boundary changed as well?
Currently no. The parser underneath funkySetFields only works on internalFields (and changing that requires a lot of work for that one application). funkySetBoundaryFields might work
__________________
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   March 22, 2014, 08:30
Default
  #5
Member
 
Tony
Join Date: Nov 2013
Posts: 35
Rep Power: 3
wzx1989221 is on a distinguished road
Hi Bernhard,

Many thanks for your kind reply. I will have a look at that.

Kind regards,
Tony
wzx1989221 is offline   Reply With Quote

Reply

Tags
error, funkysetfields, phi

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
dieselFoam problem!! trying to introduce a new heat transfer model vivek070176 OpenFOAM Programming & Development 10 December 24, 2014 00:48
compressible flow in turbocharger riesotto OpenFOAM 50 May 26, 2014 01:47
whats the cause of error? immortality OpenFOAM Running, Solving & CFD 11 April 22, 2014 12:32
FATAL ERROR:Maximum number of iterations exceeded zqlhzx OpenFOAM Running, Solving & CFD 3 December 29, 2013 08:07
is internalField(U) equivalent to zeroGradient? immortality OpenFOAM Running, Solving & CFD 7 March 29, 2013 02:27


All times are GMT -4. The time now is 20:13.