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

[swak4Foam] how can use a property at a point in groovyBC?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By gschaider
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 23, 2013, 06:44
Default how can use a property at a point in groovyBC?
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,208
Rep Power: 26
immortality is on a distinguished road
i want to use value of pressure at a point to set a boundary condition.more clear i need to set a p0,T0 boundary condition when shock is reached at the end of the channel.what command shouldp i use at fractionExpression?
immortality is offline   Reply With Quote

Old   January 23, 2013, 08:32
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by immortality View Post
i want to use value of pressure at a point to set a boundary condition.more clear i need to set a p0,T0 boundary condition when shock is reached at the end of the channel.what command shouldp i use at fractionExpression?
You've got to use a "remote" variable (that can be calculated on sampled sets or patches. Your post does not make clear what you mean with "point"). The usage is described in my presentation from the 6th workshop (see the swak-page) and there are several examples in the swak4Foam-distribution
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   April 3, 2013, 07:28
Default
  #3
Member
 
Join Date: Nov 2012
Posts: 58
Rep Power: 13
startingWithCFD is on a distinguished road
Hello, I have more or less the same problem.
I would like to set the pressure on a patch equal to a fraction of the pressure in a specific point inside the domain.
So far I was not able to finish the job just by looking at the fillingTheDam example.
Below is what I have done so far.

file 0/p:

Code:
myPatch
{
  type            groovyBC;
  value           uniform 10000;
  valueExpression "pinside/2.";
  storedVariables 
  (
    {
      name pinside;
      initialValue "10000";
    }
  );
  variables 
  (
    "pupstream=p;"
  );
}
file system/controlDict:

Code:
functions
(
  defineInsidePoint
  {
    type createSampledSet;
    outputControl timeStep;
    outputInterval 1;
    setName insidePoint;
    set
    {
      type cloud;
      axis x;
      points
      (
        (1. 0. 0.)
      );
    }
  }

...

);
Could you please let me know how I can connect these two?
startingWithCFD is offline   Reply With Quote

Old   April 3, 2013, 07:58
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by startingWithCFD View Post
Hello, I have more or less the same problem.
I would like to set the pressure on a patch equal to a fraction of the pressure in a specific point inside the domain.
So far I was not able to finish the job just by looking at the fillingTheDam example.
Below is what I have done so far.

file 0/p:

Code:
myPatch
{
  type            groovyBC;
  value           uniform 10000;
  valueExpression "pinside/2.";
  storedVariables 
  (
    {
      name pinside;
      initialValue "10000";
    }
  );
  variables 
  (
    "pupstream=p;"
  );
}
file system/controlDict:

Code:
functions
(
  defineInsidePoint
  {
    type createSampledSet;
    outputControl timeStep;
    outputInterval 1;
    setName insidePoint;
    set
    {
      type cloud;
      axis x;
      points
      (
        (1. 0. 0.)
      );
    }
  }

...

);
Could you please let me know how I can connect these two?
A variable like
Code:
pInside{set'insidePoint}=average(p);
would get p at the set insidePoint and put it into pInside (just the way it is shown in that example. The storedVariable-business there is just so that the inlet doesn't switch back once it has been switched. Depends on your application whether you need such a thing)
__________________
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   April 3, 2013, 09:30
Default
  #5
Member
 
Join Date: Nov 2012
Posts: 58
Rep Power: 13
startingWithCFD is on a distinguished road
First of all thanks a lot for your answer, it was very helpful.
I have changed the pressure file as follows:

Code:
myPatch
{
  type            groovyBC;
  value           uniform 10000;
  variables 
  (
    "pinside{set'insidePoint}=average(p);"
  );
  valueExpression "pinside/2.";
}
It seems to work :-) I was originally confused about {set'insidePoint} going on the left hand side, but it now seems more clear.
If I understand correctly, the average function indicates an averaging of the pressure values of the cells around the point only, right?
startingWithCFD is offline   Reply With Quote

Old   April 3, 2013, 09:49
Default
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by startingWithCFD View Post
First of all thanks a lot for your answer, it was very helpful.
I have changed the pressure file as follows:

Code:
myPatch
{
  type            groovyBC;
  value           uniform 10000;
  variables 
  (
    "pinside{set'insidePoint}=average(p);"
  );
  valueExpression "pinside/2.";
}
It seems to work :-) I was originally confused about {set'insidePoint} going on the left hand side, but it now seems more clear.
I know. The original synax of "pinside@set'insidePoint" might have been clearer. But @ is a valid character in OF-names so that might have caused problems with fields/patches/sets with that kind of name

Quote:
Originally Posted by startingWithCFD View Post
If I understand correctly, the average function indicates an averaging of the pressure values of the cells around the point only, right?
No. It's just a precaution. These "external variables" only allow one value. So if your set has more than one point it will do an arithmetic average of those and use that. In your case: the general expression for the average value of one value is left as an exercise to the reader
startingWithCFD 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   July 15, 2015, 06:40
Default
  #7
Member
 
Hrushi
Join Date: Jan 2013
Posts: 58
Rep Power: 13
hrushi.397 is on a distinguished road
Hi Bernhard,

Sorry, I am a bit late on this thread, but I have the same problem. I want to find out the value of alpha variable for a velocity boundary condition in openfoam and I need the value of alpha variable on the neighbouring face center. I know from documentation that I can find out the face center of the neighbouring cell using fn(), but can I use this information to find out value of alpha on that cell face for a velocity boundary condition?

Regards,

Hrushikesh
hrushi.397 is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] Change in alpha and U with groovyBC in twoPhaseEulerFoam dani2702 OpenFOAM Community Contributions 0 November 17, 2016 03:30
CFD-post: defining (or projecting) point on surface bongbang CFX 1 April 1, 2015 12:16
[swak4Foam] groovyBC issue - k and epsilon sagnikmazumdar OpenFOAM Community Contributions 24 March 1, 2015 07:16
[blockMesh] How to use blockMesh to generate cylindrical T-junction norkistar OpenFOAM Meshing & Mesh Conversion 2 January 28, 2013 20:53
matching variable data with grid point data anfho OpenFOAM Programming & Development 0 May 6, 2011 15:28


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