
[Sponsors] 
June 3, 2012, 09:56 
how to use the 'calculated' boundary condition

#1 
Member
jack
Join Date: Jul 2011
Posts: 52
Rep Power: 8 
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 

June 3, 2012, 10:59 

#2  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,020
Rep Power: 43 
Quote:
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: 8 
Hi
But in the userguide, 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: 4,020
Rep Power: 43 
Quote:
If you don't believe me have a look at the source of the calculatedBC. THere is hardly any calculation going on. "calculated" stands for "has been calculated" not "will be calculated" Quote:


June 4, 2012, 22:42 

#5 
Member
jack
Join Date: Jul 2011
Posts: 52
Rep Power: 8 
Hi
Thank you for your quick reply!Now I know that 'calculated' is not my need.I saw a thread here:http://www.cfdonline.com/Forums/ope...stepones.html 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 OpenFOAM1.6ext contain the function? Thank you very much lg88 

June 5, 2012, 03:00 

#6 
Member
jack
Join Date: Jul 2011
Posts: 52
Rep Power: 8 
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. 

June 5, 2012, 17:16 

#7  
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,020
Rep Power: 43 
Quote:
Concerning your boundary condition:  oldTime is in my opinion unnecessary  your valueexpression 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 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: 8 
Hello
I have loaded and compiled the groovyBClib 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: 4,020
Rep Power: 43 
Quote:
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 timestep 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

Quote:
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 

February 26, 2017, 02:08 
plz help

#11 
New Member
nandhagopal suresh
Join Date: Feb 2017
Posts: 1
Rep Power: 0 
> FOAM FATAL ERROR:
gradientInternalCoeffs cannot be called for a calculatedFvPatchField on patch floor of field p in file "/home/nanduzz/OpenFOAM/nanduzz3.0.1/run/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/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 fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C at line 199. FOAM exiting dimensions [0 2 2 0 0 0 0]; internalField uniform 0; boundaryField { floor { type calculated; value $internalField; } ceiling { type calculated; value $internalField; } fixedWalls { type calculated; value $internalField; } } 

Tags 
calculated 
Thread Tools  
Display Modes  


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 