|
[Sponsors] |
June 1, 2011, 14:44 |
groovyBC and Eqn.setReference()
|
#1 |
Senior Member
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19 |
Hi, I've been experimenting with groovyBC and I'm trying to duplicate the fixedGradient boundary condition except in my simple test case I also need to be able to set a reference value.
In my example, I'm solving a simple 1D equation: Code:
fvm:ddt(a, T) - fvm::laplacian(k, T) - Q My boundary conditions on the left and right walls (this is just 1D) are both fixedGradient which means that I need to set a reference value, which I would normally do by: Code:
TEqn.setReference(0, someReferenceValue) When using groovyBC, the TEqn.setReference(0, refValue) seems to get ignored. I've noticed that groovyBC has it's own refValue and a refGradient. But when I specify the refValue in my groovyBC code, the fractionExpression automatically gets changed to "1" whereas I need it to be "0". This is probably the intended behavior, but is there a way to set a referenceValue and use a gradient based boundary condition (ie. fractionExpression "0") at the same time with groovyBC? |
|
June 1, 2011, 15:28 |
|
#2 | ||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
http://openfoamwiki.net/index.php/Co...s_in_the_patch Why don't you set the fraction expression to "0"? Quote:
Only solution I can think of is to use TEqn.setValues to fix tjhe value in a cell (but that would do it no matter what the BCs are) or to write a BC groovyGradientBC that is based on fixedGradient instead of mixed (see the groovyTotalPressure-BC in swak4Foam for an example). OR there is another solution if your gradient value is static but non-uniform: set the BC to fixedGradient. Then use groovySetBoundaryField to set the value of the gradient and calculate without groovyBC |
|||
June 1, 2011, 15:30 |
|
#3 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Sorry. As I always say: "I only write that stuff. This doesn't mean that I know how to use it correctly" the name of the utility is funkySetBoundaryField
|
|
June 2, 2011, 09:49 |
|
#4 |
Senior Member
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19 |
Ok, thanks for the info. I'll look into your suggestions.
|
|
|
|