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] groovyBC results diferent from funkySetBoundaryField?! (https://www.cfd-online.com/Forums/openfoam-community-contributions/108385-groovybc-results-diferent-funkysetboundaryfield.html)

xisto October 22, 2012 09:52

groovyBC results diferent from funkySetBoundaryField?!
 
Hello,

I'm trying to run a case with groovyBC because my boudary condition will need to change with time and I notice that time() is available there.

However when I'm running the case (without using time, check bottom expression) the correct values are putted on the boundary but the internal field it's not changing.
Code:

    Inlet
    {
        type            groovyBC;
        value uniform (0 0 0);
        variables        "bx=2.669/sqrt(pos().x*pos().x+pos().y*pos().y)*sin(atan(pos().y/pos().x));by=-2.669/sqrt(pos().x*pos().x+pos().y*pos().y)*cos(atan(pos().y/pos().x));"; 
        valueExpression "vector(bx,by,0)";
    }

You may say that the problem could be with my equations, but when I using funkySetBoundaryField with the same expression to create my fixedValue nonuniform BC everything works..

Perhaps I'm doing something wrong with groovy?!:confused:

gschaider October 22, 2012 15:28

Quote:

Originally Posted by xisto (Post 387898)
Hello,

I'm trying to run a case with groovyBC because my boudary condition will need to change with time and I notice that time() is available there.

However when I'm running the case (without using time, check bottom expression) the correct values are putted on the boundary but the internal field it's not changing.
Code:

    Inlet
    {
        type            groovyBC;
        value uniform (0 0 0);
        variables        "bx=2.669/sqrt(pos().x*pos().x+pos().y*pos().y)*sin(atan(pos().y/pos().x));by=-2.669/sqrt(pos().x*pos().x+pos().y*pos().y)*cos(atan(pos().y/pos().x));"; 
        valueExpression "vector(bx,by,0)";
    }

You may say that the problem could be with my equations, but when I using funkySetBoundaryField with the same expression to create my fixedValue nonuniform BC everything works..

Perhaps I'm doing something wrong with groovy?!:confused:

Looks alright to me. In later timesteps the output of groovyBC should be more verbose. Is the value of the field refValue the same (just check superficially) the same you get as when you used funkySetBoundaryField? What is the value of valueFraction?

BTW: which version of swak are you using? Check if there is an output "swakVersion: x.y.z" just below the regular OF-Header when you run funkySetBoundaryField. Not that I think that this is your problem because I'm not aware of a bug like this in the past

xisto October 22, 2012 16:05

The value and refValue are the same and both of them are the same as funkySetBoudary.

valueFraction should be "1" Drichilet BC

The version is 0.2.0. But, one strange thing happen, when I'm use a similar expression for a scalar its works.

Maybe its somehow related to my code (or not). At least I have find a way of get around this.

Thanks for your help Bernhard,

Carlos

gschaider October 22, 2012 16:57

Quote:

Originally Posted by xisto (Post 387972)
The value and refValue are the same and both of them are the same as funkySetBoudary.

valueFraction should be "1" Drichilet BC

And is it? "1" I mean
Quote:

Originally Posted by xisto (Post 387972)
The version is 0.2.0. But, one strange thing happen, when I'm use a similar expression for a scalar its works.

Maybe its somehow related to my code (or not). At least I have find a way of get around this.

If value is correct then it has something to do with your code. Because the value of value is not set by groovyBC but its super-class (mixed that is).

What you could do is: set the type of the BC to mixed. Set the refValue with funkySetBoundaryField to the value you want and try this. If the problem persists then it is a problem with mixed

xisto October 22, 2012 17:50

Yes it is "1".

I'm sure now that the problem is with my code. I'm working on a solution now..

Thanks,

Carlos

xisto October 23, 2012 06:59

Another question..

Imagine that in my BC I need to know the field value in the cell next to the wall and I need to know the distance from the BC to that cell.

Something like this
Code:


B[wall]=B[wall+1]/deltaY;

It is possible? In one of your presentations you say:

One feature that was suggested by a user for old-school
groovyBC was to access the values on other boundaries
• This is done via external variables
• For technical reasons only a single value (min, max, average) is
stored
• This has been extended for other entities (fields, sets, . . . )

Thanks,

Carlos

gschaider October 23, 2012 08:23

Quote:

Originally Posted by xisto (Post 388101)
Another question..

Imagine that in my BC I need to know the field value in the cell next to the wall and I need to know the distance from the BC to that cell.

Something like this
Code:


B[wall]=B[wall+1]/deltaY;

It is possible? In one of your presentations you say:

Been there. Done that. Have a look at http://openfoamwiki.net/index.php/Co...g_to_need_are: (you'll want delta() and internalField(B) )

Quote:

Originally Posted by xisto (Post 388101)
One feature that was suggested by a user for old-school
groovyBC was to access the values on other boundaries
• This is done via external variables
• For technical reasons only a single value (min, max, average) is
stored
• This has been extended for other entities (fields, sets, . . . )

Well. This is only for "other" boundaries. On the same you'll get what you want with the mentioned functions

xisto October 23, 2012 09:37

Great!!

Your utilities are the best...

Thanks,

Carlos

gschaider October 23, 2012 10:15

Quote:

Originally Posted by xisto (Post 388122)
Your utilities are the best...

Well. They're standing on the shoulders of giants: the functionality is all OpenFOAM. They just put a wrapper around it


All times are GMT -4. The time now is 09:26.