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

settings a gradient on boundary using groovyBC

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 10, 2011, 10:36
Default settings a gradient on boundary using groovyBC
  #1
Member
 
Join Date: May 2009
Posts: 51
Rep Power: 8
gfilip is on a distinguished road
Hello,

I am experimenting with groovyBC and can successfully use the valueExpression on a patch. When I try to set a gradientExpression for pressure, such as:
Code:
   
inlet
    {
        type            groovyBC;
        //valueExpression               "100";
        gradientExpression      "100";

    }
and then calculate the normal gradient of pressure on the inlet, I get non-constant values much different than 100. When using the gradientExpression I also obtain a 0 pressure on the inlet boundary. I also tried using:
gradientExpression "vector(100,0,0)&normal()" but that gives the same result.

This is a simple 2D case with an oscillatingFixedValue velocity inlet ran using pisoFoam.

Am I interpreting the gradientExpression patch parameter wrong?
gfilip is offline   Reply With Quote

Old   November 10, 2011, 12:11
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
From the documentation:
Code:
* fractionExpression 
   Determines whether the face is Dirichlet (1) or Neumann (0). Defaults to 1
You can probably see the problem. Fix fractionExpression and all will be good.

Last edited by akidess; November 10, 2011 at 12:11. Reason: formatting
akidess is offline   Reply With Quote

Old   November 10, 2011, 12:14
Default
  #3
Member
 
Join Date: May 2009
Posts: 51
Rep Power: 8
gfilip is on a distinguished road
Hi Anton,

I have in fact tested the fractionExpression as well, but setting it to 0 did not help.
gfilip is offline   Reply With Quote

Old   November 10, 2011, 20:37
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 gfilip View Post
Hello,

I am experimenting with groovyBC and can successfully use the valueExpression on a patch. When I try to set a gradientExpression for pressure, such as:
Code:
   
inlet
    {
        type            groovyBC;
        //valueExpression               "100";
        gradientExpression      "100";

    }
and then calculate the normal gradient of pressure on the inlet, I get non-constant values much different than 100. When using the gradientExpression I also obtain a 0 pressure on the inlet boundary. I also tried using:
gradientExpression "vector(100,0,0)&normal()" but that gives the same result.

This is a simple 2D case with an oscillatingFixedValue velocity inlet ran using pisoFoam.

Am I interpreting the gradientExpression patch parameter wrong?
I'm just wondering whether I'm misinterpreting your posting. "I get non-constant values much different than 100" Do you mean "I calculated the gradient using the value in the next cell and the delta coefficient and it was much different from 100". In that case there is a problem. Or did you mean "'value' on the patch is different from 100". That is to be expected because you're only setting the gradient on the patch (basically the relative change to the next cell) NOT the value with a Neuman condition
gschaider is offline   Reply With Quote

Old   May 3, 2012, 10:05
Default
  #5
Member
 
Albert Tong
Join Date: Dec 2010
Location: Perth, WA, Australia
Posts: 76
Blog Entries: 1
Rep Power: 6
tfuwa is on a distinguished road
Hi All,

I would like to set up a gradient B.C., ∂p/∂x = cos (2*pi*t) .

Is there a way to do this with groovyBC or openfoam official tools?

Cheers.
__________________
Kind regards,

Albert
tfuwa is offline   Reply With Quote

Old   May 3, 2012, 11:24
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 tfuwa View Post
Hi All,

I would like to set up a gradient B.C., ∂p/∂x = cos (2*pi*t) .

Is there a way to do this with groovyBC or openfoam official tools?
In groovyBC this would be something like this:
valueExpression "0"; // this doesn't matter
fractionExpression "0"; // no value, all gradient
gradientExpression "sin(2*pi*time())";

Official tools: you can do something similar with some C++-programming with the codedMixed-BC I guess
gschaider is offline   Reply With Quote

Old   May 4, 2012, 09:41
Default
  #7
Member
 
Albert Tong
Join Date: Dec 2010
Location: Perth, WA, Australia
Posts: 76
Blog Entries: 1
Rep Power: 6
tfuwa is on a distinguished road
Thanks Bernhard! It works perfect.
__________________
Kind regards,

Albert
tfuwa 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
Calculation of pressure gradient in periodic boundary condition ksaat FLUENT 7 May 16, 2011 03:59
temperature normal gradient on a boundary Sandrine Main CFD Forum 2 June 10, 2009 16:34
normal temperature gradient on a boundary Sandrine FLUENT 0 June 10, 2009 12:29
Boundary condition vector field gradient from two sides of patch face quba OpenFOAM 0 December 12, 2007 06:26
Boundary conditions? Tom Main CFD Forum 0 November 5, 2002 02:54


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