# how to use the 'calculated' boundary condition

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Display Modes
 June 3, 2012, 09:56 how to use the 'calculated' boundary condition #1 Member   jack Join Date: Jul 2011 Posts: 52 Rep Power: 5 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::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

June 3, 2012, 10:59
#2
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
Quote:
 Originally Posted by lg88 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::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)

 June 4, 2012, 03:21 #3 Member   jack Join Date: Jul 2011 Posts: 52 Rep Power: 5 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

June 4, 2012, 18:30
#4
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
Quote:
 Originally Posted by lg88 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 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.

 June 4, 2012, 22:42 #5 Member   jack Join Date: Jul 2011 Posts: 52 Rep Power: 5 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

 June 5, 2012, 03:00 #6 Member   jack Join Date: Jul 2011 Posts: 52 Rep Power: 5 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::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.

June 5, 2012, 17:16
#7
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
Quote:
 Originally Posted by lg88 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::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 waiting for you reply!
Your time is better spent by reading the docu (there isn't much anyway) and looking at the examples

 June 6, 2012, 00:50 #8 Member   jack Join Date: Jul 2011 Posts: 52 Rep Power: 5 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

June 6, 2012, 14:58
#9
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,912
Rep Power: 40
Quote:
 Originally Posted by lg88 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.

February 3, 2013, 05:28
chtMultiRegionFoam
#10
Senior Member

ahmed
Join Date: Feb 2010
Posts: 161
Blog Entries: 1
Rep Power: 7
Quote:
 Originally Posted by gschaider 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

 Tags calculated

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Thomas P. Abraham Main CFD Forum 20 July 7, 2013 05:05 murali CFX 5 August 3, 2012 08:56 Destry FLUENT 0 July 27, 2010 00:55 smn CFX 5 November 24, 2009 07:37 Pankaj CFX 9 November 23, 2009 05:05

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

 Contact Us - CFD Online - Top