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

how can use a property at a point in groovyBC?

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

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 23, 2013, 07: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,205
Rep Power: 17
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, 09:32
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 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: 4
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: 3,915
Rep Power: 40
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: 4
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: 3,915
Rep Power: 40
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: 4
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

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
groovyBC elevated inlet. pos() issue grjmell OpenFOAM 6 January 23, 2013 09:14
groovyBC and Eqn.setReference() benk OpenFOAM 3 June 2, 2011 08:49
matching variable data with grid point data anfho OpenFOAM Programming & Development 0 May 6, 2011 15:28
Plot data for a fixed point aut_iut OpenFOAM 0 December 23, 2010 06:16
Can't see the point, streamline and line in Post Atit CFX 0 October 28, 2004 14:53


All times are GMT -4. The time now is 19:51.