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

How to use Cp and Cv filds in groovyBC?

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

Like Tree1Likes
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Display Modes
Old   June 23, 2013, 04:38
Default How to use Cp and Cv filds in groovyBC?
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,209
Rep Power: 18
immortality is on a distinguished road
Hi
I want to use Cp and Cv fields in groovyBC as I told in the title.
does it need that these fields necessarily be written in time folders so that groovyBC can use them or not?
how to introduce these fields that computes by the solver(as Mach postProcessing tool uses them) to groovyBC?
I have written these lines in variables:
Code:
//"gamma=thermo.Cp()/thermo.Cv();"
                  //"Cp=thermo.Cp();"
                  //"Cv=thermo.Cv();"
                  "p_3=p0_3/pow(1+magSqr(U)/(2*Cp*T),Cp/(Cp-Cv));"
and the error:
Code:
--> FOAM FATAL ERROR: 
 Parser Error for driver PatchValueExpressionDriver at "1.25-26" :"field Cp not existing or of wrong type"
"p0_3/pow(1+magSqr(U)/(2*Cp*T),Cp/(Cp-Cv))"
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   June 23, 2013, 05:19
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,920
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by immortality View Post
Hi
I want to use Cp and Cv fields in groovyBC as I told in the title.
does it need that these fields necessarily be written in time folders so that groovyBC can use them or not?
how to introduce these fields that computes by the solver(as Mach postProcessing tool uses them) to groovyBC?
I have written these lines in variables:
Code:
//"gamma=thermo.Cp()/thermo.Cv();"
                  //"Cp=thermo.Cp();"
                  //"Cv=thermo.Cv();"
                  "p_3=p0_3/pow(1+magSqr(U)/(2*Cp*T),Cp/(Cp-Cv));"
and the error:
Code:
--> FOAM FATAL ERROR: 
 Parser Error for driver PatchValueExpressionDriver at "1.25-26" :"field Cp not existing or of wrong type"
"p0_3/pow(1+magSqr(U)/(2*Cp*T),Cp/(Cp-Cv))"
At first: groovyBC can only work with fields that are in memory. Depending on the OF-version Cp may or may not be in memory (because it is only computed on demand). It may also be in memory under a different name (see the discussion on aliases in swak elsewhere - a feature that was added for that specific situation. PLEASE try to find it with the search-function of the message board yourself).

If the solver does not provide the field in memory (use the listRegisteredObjects from the simpleFunctionObjects to check) then you can create an expressionField-functionObject to create such a field using the appropriate function from the libswakThermoTurbFunctionPlugin.so (you've got to add that lib to the libs-entry in controlDict then these functions are available to you)
immortality 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   June 23, 2013, 10:03
Default
  #3
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,209
Rep Power: 18
immortality is on a distinguished road
thanks Bernhard for explanations
a little question:in which folder I have to use listRegisteredObjects?
__________________
Injustice Anywhere is a Threat for Justice Everywhere.Martin Luther King.
To Be or Not To Be,Thats the Question!
The Only Stupid Question Is the One that Goes Unasked.
immortality is offline   Reply With Quote

Old   June 24, 2013, 18:33
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,920
Rep Power: 41
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by immortality View Post
thanks Bernhard for explanations
a little question:in which folder I have to use listRegisteredObjects?
That is a regular function object and will only print a table of the objects currently registered with the mesh
__________________
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

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



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