CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Community Contributions (https://www.cfd-online.com/Forums/openfoam-community-contributions/)
-   -   [swak4Foam] Boundary Conditions with GroovyBC, Normal Gradient (https://www.cfd-online.com/Forums/openfoam-community-contributions/102183-boundary-conditions-groovybc-normal-gradient.html)

Peter Benovsky December 14, 2012 05:55

Quote:

Originally Posted by gschaider (Post 397495)
You can only have one BC on a patch at a time. Have you made sure that groovyBC is actually evaluated on that patch (for instance by introducing a syntactic error into an expression - if it fails it's evaluated)

BTW: which version of OF?

2.1.1
What I meant is that I use groovyBC for the temperature. alphat uses standard alpatWallFunction, hence should not be groovyfied.

gschaider December 14, 2012 07:26

Quote:

Originally Posted by Peter Benovsky (Post 397507)
2.1.1
What I meant is that I use groovyBC for the temperature. alphat uses standard alpatWallFunction, hence should not be groovyfied.

OK. Please provide some context (like which fields you used which BC on). It is not as absurd as you might think: I have seen people specifying 'type' twice hoping both would work.

Anyway: if the value 0 is only there during the first timestep then it is the same bug

Peter Benovsky December 17, 2012 10:44

Quote:

Originally Posted by gschaider (Post 397528)
OK. Please provide some context (like which fields you used which BC on). It is not as absurd as you might think: I have seen people specifying 'type' twice hoping both would work.

Anyway: if the value 0 is only there during the first timestep then it is the same bug

It took longer than I thought but here it is (the context):
Code:

location "0";
object alphat;
 
heater
{
type alphatWallFunction;
value uniform 0.01;
}
 
object T;
 
heater
{
type groovyBC;
refValue uniform 300;
valueExpression "300";
gradientExpression "gradT*time()";
fractionExpression "0";
variables "heatFlux=100;gradT=heatFlux/(alphaEff);";
}

Without groovybc in the next time step I get for alphat:
Code:

location "0";
object alphat;
 
heater
{
type alphatWallFunction;
Prt                            0.85;
value nonuniform List<scalar>
.
.
.
}

With groovy bc it is just fixedValue with value=0
Cheers
Peter

gschaider December 17, 2012 13:30

Quote:

Originally Posted by Peter Benovsky (Post 397925)
It took longer than I thought but here it is (the context):
Code:

location "0";
object alphat;
 
heater
{
type alphatWallFunction;
value uniform 0.01;
}
 
object T;
 
heater
{
type groovyBC;
refValue uniform 300;
valueExpression "300";
gradientExpression "gradT*time()";
fractionExpression "0";
variables "heatFlux=100;gradT=heatFlux/(alphaEff);";
}

Without groovybc in the next time step I get for alphat:
Code:

location "0";
object alphat;
 
heater
{
type alphatWallFunction;
Prt                            0.85;
value nonuniform List<scalar>
.
.
.
}

With groovy bc it is just fixedValue with value=0
Cheers
Peter

Hmm. That is strange. It should work. Could you try some things:

- instead of alphaEff add a constant (although I don't think that is the problem)
- set valueFraction to "uniform 0" (just to be sure)
- reset the 300 in the refValue to x. This should fail (this is just to make sure that it is really read)

Which version of swak do you use (check the start of the output of funkySetFields)

xuan8908 February 21, 2014 17:25

Hi, Bernhard,

I am trying to look at your codes of the groovyBC implementation. I am
curious where you pass those strings, like "valueExpression_" and
"gradientExpression_"? In the source code, groovyBCCommon.C, you just
look up those keywords from the dictionary file and read them. How do
those strings come into play to update the boundary condition? I guess
one of those source codes may contain the implementation of this. Could
you please tell me which source code is the right one that I can read
and learn from? Thanks a lot in advance. I will appreciate your reply.

gschaider February 22, 2014 12:23

Quote:

Originally Posted by xuan8908 (Post 476101)
Hi, Bernhard,

I am trying to look at your codes of the groovyBC implementation. I am
curious where you pass those strings, like "valueExpression_" and
"gradientExpression_"? In the source code, groovyBCCommon.C, you just
look up those keywords from the dictionary file and read them. How do
those strings come into play to update the boundary condition? I guess
one of those source codes may contain the implementation of this. Could
you please tell me which source code is the right one that I can read
and learn from? Thanks a lot in advance. I will appreciate your reply.

grep is your friend if you want to find the location of variables in the source code (of course there are more sophisticated tool, but this is installed on every system)

That'd be updateCoeffs in groovyBCFvPatchField.C. But the real magic happens in Libraries/swak4FoamParsers (especially everything with PatchValue in the beginning)

xuan8908 February 22, 2014 12:54

Thank you, Bernhard. I will take a look at it.

Sliwa September 17, 2014 05:40

Hello,

I am not sure this is the right thread for my question, but I was wondering if it was possible to set a fixed gradient in the direction normal to the patch and a fixed value in the tangential direction with groovyBC?

gschaider September 17, 2014 18:29

Quote:

Originally Posted by Sliwa (Post 510625)
Hello,

I am not sure this is the right thread for my question, but I was wondering if it was possible to set a fixed gradient in the direction normal to the patch and a fixed value in the tangential direction with groovyBC?

There is a groovyBCDirection that wraps directionMixed (http://www.cfd-online.com/Forums/ope...-mixed-bc.html) but maybe this is not exactly what you need (no Dirichlet in tangential direction)

Sliwa September 18, 2014 11:56

Yes, I needed the Dirichlet in the tangential direction. Thanks anyway.

behzad-cfd November 15, 2017 15:57

Quote:

Originally Posted by gschaider (Post 510716)
There is a groovyBCDirection that wraps directionMixed (http://www.cfd-online.com/Forums/ope...-mixed-bc.html) but maybe this is not exactly what you need (no Dirichlet in tangential direction)

Hi Bernhard,

I want to solve \nabla^{2}\xi+\vec{n}\cdot\nabla\xi=0 equation and obtain B that is defined like \overrightarrow{B}=(\frac{\partial\xi}{\partial  y})\vec{e_{x}}-(\frac{\partial\xi}{\partial x})\vec{e_{y}}.
I've implemented the equation in my base solver. Now i want to test functionality of the new solver but i have some boundary condition problem before testing.
For example if i want to get \overrightarrow{B}=(0,1) in boundaries i need to set (\frac{\partial\xi}{\partial  y})=0 and -(\frac{\partial\xi}{\partial x})=1.

Can i use groovyBC for this?
How can i implement this BCs?

Thanks in advance,

gschaider November 16, 2017 21:16

Quote:

Originally Posted by behzad-cfd (Post 671698)
Hi Bernhard,

I want to solve \nabla^{2}\xi+\vec{n}\cdot\nabla\xi=0 equation and obtain B that is defined like \overrightarrow{B}=(\frac{\partial\xi}{\partial  y})\vec{e_{x}}-(\frac{\partial\xi}{\partial x})\vec{e_{y}}.
I've implemented the equation in my base solver. Now i want to test functionality of the new solver but i have some boundary condition problem before testing.
For example if i want to get \overrightarrow{B}=(0,1) in boundaries i need to set (\frac{\partial\xi}{\partial  y})=0 and -(\frac{\partial\xi}{\partial x})=1.

Can i use groovyBC for this?
How can i implement this BCs?

Thanks in advance,

I'm afraid not. Because if you have a boundary with constant x then (\frac{\partial\xi}{\partial  y})=0 is not a boundary condition but a differential equation for the value on the boundary

behzad-cfd November 17, 2017 04:44

Quote:

Originally Posted by gschaider (Post 671844)
I'm afraid not. Because if you have a boundary with constant x then (\frac{\partial\xi}{\partial  y})=0 is not a boundary condition but a differential equation for the value on the boundary

Thanks for reply,
I should tell you that actually we have \vec{A}=(0,0,\xi) and \vec{B}=\nabla \times A = (\frac{\partial \xi}{\partial y}, -\frac{\partial \xi}{\partial x})
So how can i set such a condition?!:confused:


All times are GMT -4. The time now is 08:07.