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

how to use the 'calculated' boundary condition

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 3, 2012, 09:56
Default how to use the 'calculated' boundary condition
  #1
Member
 
jack
Join Date: Jul 2011
Posts: 52
Rep Power: 6
lg88 is on a distinguished road
hello everyone
I want to solve a pressure Poisson equation with boundary conditions of value calculated on the last step. the P input file I set is as follow:


dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
IN
{
type zeroGradient;
}

OUT
{
type zeroGradient;
}

SIDE
{
type calculated;
}

}

But I get the following error:

FOAM FATAL ERROR:

gradientInternalCoeffs cannot be called for a calculatedFvPatchField on patch outflow of field p in file "/home/lg88/mfmFoam/0/p"
You are probably trying to solve for a field with a default boundary condition.

From function calculatedFvPatchField<Type>::gradientInternalCoef fs() const in file /opt/openfoam210/src/finiteVolume/lnInclude/calculatedFvPatchField.C at line 187.

Does anybody know how to use this boundary condition? where can i find similar tutorials?

Thank you very much!

lg88
lg88 is offline   Reply With Quote

Old   June 3, 2012, 10:59
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 lg88 View Post
But I get the following error:

FOAM FATAL ERROR:

gradientInternalCoeffs cannot be called for a calculatedFvPatchField on patch outflow of field p in file "/home/lg88/mfmFoam/0/p"
You are probably trying to solve for a field with a default boundary condition.

From function calculatedFvPatchField<Type>::gradientInternalCoef fs() const in file /opt/openfoam210/src/finiteVolume/lnInclude/calculatedFvPatchField.C at line 187.

Does anybody know how to use this boundary condition? where can i find similar tutorials?
You can't "use" the calculated-BC. It is only a placeholder when for instance you add two fields like "p1+p2" and is OFs way of saying "I don't know what this means for the boundary condition on this patch that p1 had fixedValue and p2 zeroGradient".
So calculated only makes sense in fields that OF wrote but not as a specification for a physical BC (that's why its in no tutorial)
massive_turbulence likes this.
gschaider is offline   Reply With Quote

Old   June 4, 2012, 03:21
Default
  #3
Member
 
jack
Join Date: Jul 2011
Posts: 52
Rep Power: 6
lg88 is on a distinguished road
Hi
But in the user-guide, the description of type 'calculated' is 'boundary condition phi derived from other fields'.
now I want to set Dirichlet boundary condition for P,but the boundary value will changes with the time.I need to use the last step value of field P1 as the next timestep boundary value of P.So I feel the type 'calculated' is my best choice.But it always occur the error I said above.

Does anyone can give me some suggestions?

Thank you very much!

lg88
lg88 is offline   Reply With Quote

Old   June 4, 2012, 18:30
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 lg88 View Post
Hi
But in the user-guide, the description of type 'calculated' is 'boundary condition phi derived from other fields'.
The UserGuide is right and I'm right. Sorry. "derived from other fields" means "result of a calculation (for instance) of fields". Which is what I explained above

If you don't believe me have a look at the source of the calculated-BC. THere is hardly any calculation going on. "calculated" stands for "has been calculated" not "will be calculated"

Quote:
Originally Posted by lg88 View Post
now I want to set Dirichlet boundary condition for P,but the boundary value will changes with the time.I need to use the last step value of field P1 as the next timestep boundary value of P.So I feel the type 'calculated' is my best choice.But it always occur the error I said above.

Does anyone can give me some suggestions?
Boundary conditions timeVaryingUniform, coded or groovyBC (you'll find information on them either in the UserGuide, this Forum or the Wiki). Depends on how complicated your time-dependence is.
gschaider is offline   Reply With Quote

Old   June 4, 2012, 22:42
Default
  #5
Member
 
jack
Join Date: Jul 2011
Posts: 52
Rep Power: 6
lg88 is on a distinguished road
Hi
Thank you for your quick reply!Now I know that 'calculated' is not my need.I saw a thread here:How to create velocity profile using the previous time step ones
Mybe It is what I want to express.
What I really want to do is using the old time step value of P at SIDE to construct a "new" P for the new time step at the same patch.
So I think function oldTime() is my need? but I don'k know what kind of boundary condition should I use? And I am not sure whether OpenFOAM-1.6-ext contain the function?

Thank you very much

lg88
lg88 is offline   Reply With Quote

Old   June 5, 2012, 03:00
Default
  #6
Member
 
jack
Join Date: Jul 2011
Posts: 52
Rep Power: 6
lg88 is on a distinguished road
Hi
When I set my P input file as:
--------------------------------------------------------------------------
dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
IN
{
type zeroGradient;
}

OUT
{
type zeroGradient;
}

SIDE
{
type groovyBC;
valueExpressions "P@SIDE=oldTime(P@SIDE)";
value uniform 0;
}

}
I get the following error:

FOAM FATAL ERROR:
gradientInternalCoeffs cannot be called for a genericFvPatchField (actual type groovyBC)
on patch UB of field P in file "/home/lg88/FAM_FVMtutorials/0/P"
You are probably trying to solve for a field with a generic boundary condition.

From function genericFvPatchField<Type>::gradientInternalCoeffs( ) const
in file fields/fvPatchFields/basic/generic/genericFvPatchField.C at line 782.

Do you know what it means?

waiting for you reply! Thank you very much!

lg88

Last edited by lg88; June 5, 2012 at 03:18.
lg88 is offline   Reply With Quote

Old   June 5, 2012, 17:16
Default
  #7
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 lg88 View Post
Hi
When I set my P input file as:
--------------------------------------------------------------------------
dimensions [0 2 -2 0 0 0 0];

internalField uniform 0;

boundaryField
{
IN
{
type zeroGradient;
}

OUT
{
type zeroGradient;
}

SIDE
{
type groovyBC;
valueExpressions "P@SIDE=oldTime(P@SIDE)";
value uniform 0;
}

}
I get the following error:

FOAM FATAL ERROR:
gradientInternalCoeffs cannot be called for a genericFvPatchField (actual type groovyBC)
on patch UB of field P in file "/home/lg88/FAM_FVMtutorials/0/P"
You are probably trying to solve for a field with a generic boundary condition.

From function genericFvPatchField<Type>::gradientInternalCoeffs( ) const
in file fields/fvPatchFields/basic/generic/genericFvPatchField.C at line 782.

Do you know what it means?
Basically that you didn't load the groovyBC-lib with the libs-entry in the controlDict and the solver therefor doesn't know about groovyBC. Read the docu. It is explained there

Concerning your boundary condition:
- oldTime is in my opinion unnecessary
- your value-expression won't work. You're mixing the valueExpression and variables here
- the notation of the remote variables is "old school". The one in swak is different

Quote:
Originally Posted by lg88 View Post
waiting for you reply!
Your time is better spent by reading the docu (there isn't much anyway) and looking at the examples
gschaider is offline   Reply With Quote

Old   June 6, 2012, 00:50
Default
  #8
Member
 
jack
Join Date: Jul 2011
Posts: 52
Rep Power: 6
lg88 is on a distinguished road
Hello
I have loaded and compiled the groovyBC-lib successfully.Then add
libs ( "libgroovyBC.so" ) ;
to the system/controlDict of my case.And it run fluently without errors I mentioned above.But I didn't get my expected result.So I think I haven't set the right boundary condition.
What I really want to do is using the old time step value of P at SIDE as a "new" P boundary value at the same patch for the new time step to solve P.Can you tell me what kind of boundary condition should I use ?And if groovyBC is right for me ,could you tell me how to write it?I have spend time reading the examples in groovyBC,but I can't come up with any ideas.


Thank you in advance!

lg88
lg88 is offline   Reply With Quote

Old   June 6, 2012, 14:58
Default
  #9
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 lg88 View Post
Hello
I have loaded and compiled the groovyBC-lib successfully.Then add
libs ( "libgroovyBC.so" ) ;
to the system/controlDict of my case.And it run fluently without errors I mentioned above.But I didn't get my expected result.So I think I haven't set the right boundary condition.
What I really want to do is using the old time step value of P at SIDE as a "new" P boundary value at the same patch for the new time step to solve P.Can you tell me what kind of boundary condition should I use ?And if groovyBC is right for me ,could you tell me how to write it?I have spend time reading the examples in groovyBC,but I can't come up with any ideas.
What is the physical reason for such a boundary condition? "value at the last timestep" depends on your time-step and is therefore an artefact of the simulation. Your boundary condition would therefor only make sense in some strange universe where the time-step of your simulation is a physical constant of some kind

IF the solver stores the old time values then oldTime(p) gives you the previous value of p. If p hasn't been solved for yet during that time-step then p and oldTime(p) are the same. So if your valueExpression says "p" it should have the same meaning.
Anyway. Only application for oldTime(p) I see is if you want to get some kind of (under)relaxation.
gschaider is offline   Reply With Quote

Old   February 3, 2013, 05:28
Default chtMultiRegionFoam
  #10
Senior Member
 
Ahmed Khattab's Avatar
 
ahmed
Join Date: Feb 2010
Posts: 161
Blog Entries: 1
Rep Power: 7
Ahmed Khattab is on a distinguished road
Quote:
Originally Posted by gschaider View Post
The UserGuide is right and I'm right. Sorry. "derived from other fields" means "result of a calculation (for instance) of fields". Which is what I explained above

If you don't believe me have a look at the source of the calculated-BC. THere is hardly any calculation going on. "calculated" stands for "has been calculated" not "will be calculated"



Boundary conditions timeVaryingUniform, coded or groovyBC (you'll find information on them either in the UserGuide, this Forum or the Wiki). Depends on how complicated your time-dependence is.
Hi,

i have a question about this calculated boundary condition. in chtMultiRegionFoam case p_rgh is specified as buoyant pressure and p as calculated. i want to know how p_rgh is calculated by user, and how p is calculated by processor, if p_rgh is dynamic pressure why it is specified although velocity is input.

thanks in advance,
Ahmed
Ahmed Khattab is offline   Reply With Quote

Reply

Tags
calculated

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
Boundary Conditions Thomas P. Abraham Main CFD Forum 20 July 7, 2013 05:05
inlet velocity boundary condition murali CFX 5 August 3, 2012 08:56
asking for Boundary condition in FLUENT Destry FLUENT 0 July 27, 2010 00:55
problem with boundary condition??? smn CFX 5 November 24, 2009 07:37
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 05:05


All times are GMT -4. The time now is 03:18.