CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   switch between existing BCs with groovyBC?! (http://www.cfd-online.com/Forums/openfoam-pre-processing/122906-switch-between-existing-bcs-groovybc.html)

michielm August 31, 2013 06:37

switch between existing BCs with groovyBC?!
 
Hi,
I have seen in the groovyBC documentation that you can switch between dirichlet and neumann BCs and I would like to use groovyBC for something similar but, I think, a bit more difficult.

If possible, I would like to use groovyBC to set up a BC which switches between 2 existing BCs depending on the value of alpha1 in the boundary cell. I would like to switch between 2 contact angle BCs (constantAlphaContactAngle and dynamicAlphaContactAngle). Is groovyBC capable of calling existing BCs? If so, how can I do that? If not, would it be possible to plug in the functions used in the two contact angle BCs in some way?

Or should I bypass groovyBC altogether and build my own BC from the mixedBC that is already present in OF?!

akidess September 2, 2013 06:54

GroovyBC is built on top of mixedFvPatchField, i.e. technically it is a mixed BC itself. From a coding perspective, mixed BC is not a combination of fixedGradient and fixedValue, but an implementation of the equation dT/dn = h(T-Tinf). Thus IMO neither groovyBC, nor mixedBC seem to be a good starting point for what you want to achieve.

gschaider September 2, 2013 18:01

Quote:

Originally Posted by michielm (Post 449017)
Hi,
I have seen in the groovyBC documentation that you can switch between dirichlet and neumann BCs and I would like to use groovyBC for something similar but, I think, a bit more difficult.

If possible, I would like to use groovyBC to set up a BC which switches between 2 existing BCs depending on the value of alpha1 in the boundary cell. I would like to switch between 2 contact angle BCs (constantAlphaContactAngle and dynamicAlphaContactAngle). Is groovyBC capable of calling existing BCs? If so, how can I do that? If not, would it be possible to plug in the functions used in the two contact angle BCs in some way?

Or should I bypass groovyBC altogether and build my own BC from the mixedBC that is already present in OF?!

Can't be done with groovyBC. I'm not even sure if such a switch between existing boundary conditions can be implemented in C++. If it can it will result in very ugly code.

Quote:

Originally Posted by akidess (Post 449337)
GroovyBC is built on top of mixedFvPatchField, i.e. technically it is a mixed BC itself. From a coding perspective, mixed BC is not a combination of fixedGradient and fixedValue, but an implementation of the equation dT/dn = h(T-Tinf). Thus IMO neither groovyBC, nor mixedBC seem to be a good starting point for what you want to achieve.

Right.

Easiest would probably be to base a new BC on dynamicContact. Isolate the lines were it differs from constantContact and put a "if" "else" around them. The "if" conditions could be the result of a groovy-swak evaluation but I don't think that you'd want to do that as you had to code something in C++ anyway

michielm September 4, 2013 08:01

Ok, thanks for the explanation guys. I will look into adapting an existing BC.


All times are GMT -4. The time now is 06:44.