CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   funkySetFields (http://www.cfd-online.com/Forums/openfoam-solving/68513-funkysetfields.html)

Chioma September 22, 2009 19:34

funkySetFields
 
Hello everyone,

Please can someone help me out. My geometry is a simple cylinder with boundaries as base, wall and top. The boundary condition for velocity field at the base is (0.5y,0.5x,0). I realized that I have to use funkySetFields in order to introduce such conditions. This I did using the dictionary option, a sample of my dictionary is

expression
(
base
field U;
expression "vector (0.5*pos().y, 0.5*pos().x, 0)";
)
it worked but unfortunately, it computed for the whole cylinder which has a total of 154000 cells.
I am presently trying to use "conditions" so that the expression is only applied at the base. I used
conditions "pos().z=0", but I keep getting an error of invalid character.

I decided to give this condition since there is no z component at the base.

Please, I need a command which applies this condition only to the base and not the whole geometry.

Thanks

gschaider September 23, 2009 09:02

Quote:

Originally Posted by Chioma (Post 230199)
Hello everyone,

Please can someone help me out. My geometry is a simple cylinder with boundaries as base, wall and top. The boundary condition for velocity field at the base is (0.5y,0.5x,0). I realized that I have to use funkySetFields in order to introduce such conditions. This I did using the dictionary option, a sample of my dictionary is

expression
(
base
field U;
expression "vector (0.5*pos().y, 0.5*pos().x, 0)";
)
it worked but unfortunately, it computed for the whole cylinder which has a total of 154000 cells.
I am presently trying to use "conditions" so that the expression is only applied at the base. I used
conditions "pos().z=0", but I keep getting an error of invalid character.

I decided to give this condition since there is no z component at the base.

Please, I need a command which applies this condition only to the base and not the whole geometry.

Thanks

You need the -keepPatches-option. Have a look at
http://openfoamwiki.net/index.php/Co...t-Room_Example
where the usage is demonstrated.

An alternative would be the groovyBC, but as your boundary condition is stationary this would be like going after mice with an atom-bomb

Chioma September 23, 2009 14:52

Thanks so much, I will look into it and hopefully I would get my expected results.

bunni July 25, 2011 17:30

Using dictionary
 
Hi,

I installed funkySetFields last week, and have been having some fun playing around with it, on OF 1.6

I've successfully set up the dictionary version for specifying two different fluids:
simple example to make waves.

FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object funkySetFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //



expressions
(
Alpha1
{
field alpha1;
expression "1";
condition "pos().y>= 0.5";

}
);


-----------

My question is this: how would I used the dictionary to specify velocity?

I did manage to set velocity with a command line approach:

funkySetFields -field U -expression 'vector(0,10*pos().y,0)' -condition "pos().y > 0.5" -time 0

but I'd like to know how to do it via a dictionary. Whatever I tried didn't work!

TIA

gschaider July 25, 2011 18:33

Quote:

Originally Posted by bunni (Post 317459)
Hi,

I installed funkySetFields last week, and have been having some fun playing around with it, on OF 1.6

I've successfully set up the dictionary version for specifying two different fluids:
simple example to make waves.

FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object funkySetFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //



expressions
(
Alpha1
{
field alpha1;
expression "1";
condition "pos().y>= 0.5";

}
);


-----------

My question is this: how would I used the dictionary to specify velocity?

The same way you did for alpha1:

Code:

field U;
Quote:

Originally Posted by bunni (Post 317459)
I did manage to set velocity with a command line approach:

funkySetFields -field U -expression 'vector(0,10*pos().y,0)' -condition "pos().y > 0.5" -time 0

but I'd like to know how to do it via a dictionary. Whatever I tried didn't work!

Could you be bit more specific about "whatever"?

SD@TUB December 6, 2011 08:15

Initialize field alpha
 
Hello,

Before opening a new thread, I post my problem of initializing field alpha with expression from http://openfoamwiki.net/index.php/Co...on_Sloping_Bed right here.
When using funkySetFields, I get following error message:
Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM Extend Project: Open source CFD        |
|  \\    /  O peration    | Version:  1.6-ext                              |
|  \\  /    A nd          | Web:      www.extend-project.de                |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 1.6-ext-632b4ce56df2
Exec  : funkySetFields -time 0
Date  : Dec 06 2011
Time  : 12:50:06
Host  : pc1
PID    : 15447
Case  : /home/tmp/testCase
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Time = 0
 Using funkySetFieldsDict



Part: internalAlphaField
 Putting "faceAverage((fpos().z + surf(0.5) * fproj().z) <= (surf(0.0)) ? surf(1.0) : ((fpos().z - surf(0.5) * fproj().z) > surf(0.0) ? surf(0.0) : (surf(0.5) - fpos().z / (fproj().z + surf(0.00000001)))))" into field alpha1 at t = "0" if condition "true" is true
 Keeping patches unaltered



--> FOAM FATAL ERROR:
Unknown patch field type zeroGradient

Valid patchField types are :

12
(
processor
overlapGgi
wedge
fixedValue
empty
calculated
regionCoupling
cyclicGgi
ggi
symmetryPlane
sliced
cyclic
)


    From function fvsPatchField<Type>::New(const word&, const fvPatch&, const DimensionedField<Type, surfaceMesh>)
    in file lnInclude/newFvsPatchField.C at line 61.

FOAM exiting

Within alpha1 dict, I use zeroGradient BC for several patches. That should be OK, because setFields works as expected.
I am using swak4Foam with 1.6-ext, see header above for more details.

Maybe someone has any clue, what is wrong here?


Stefan

gschaider December 6, 2011 14:56

Quote:

Originally Posted by SD@TUB (Post 334848)
Hello,

Before opening a new thread, I post my problem of initializing field alpha with expression from http://openfoamwiki.net/index.php/Co...on_Sloping_Bed right here.
When using funkySetFields, I get following error message:
Code:

/*---------------------------------------------------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM Extend Project: Open source CFD        |
|  \\    /  O peration    | Version:  1.6-ext                              |
|  \\  /    A nd          | Web:      www.extend-project.de                |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
Build  : 1.6-ext-632b4ce56df2
Exec  : funkySetFields -time 0
Date  : Dec 06 2011
Time  : 12:50:06
Host  : pc1
PID    : 15447
Case  : /home/tmp/testCase
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Time = 0
 Using funkySetFieldsDict



Part: internalAlphaField
 Putting "faceAverage((fpos().z + surf(0.5) * fproj().z) <= (surf(0.0)) ? surf(1.0) : ((fpos().z - surf(0.5) * fproj().z) > surf(0.0) ? surf(0.0) : (surf(0.5) - fpos().z / (fproj().z + surf(0.00000001)))))" into field alpha1 at t = "0" if condition "true" is true
 Keeping patches unaltered



--> FOAM FATAL ERROR:
Unknown patch field type zeroGradient

Valid patchField types are :

12
(
processor
overlapGgi
wedge
fixedValue
empty
calculated
regionCoupling
cyclicGgi
ggi
symmetryPlane
sliced
cyclic
)


    From function fvsPatchField<Type>::New(const word&, const fvPatch&, const DimensionedField<Type, surfaceMesh>)
    in file lnInclude/newFvsPatchField.C at line 61.

FOAM exiting

Within alpha1 dict, I use zeroGradient BC for several patches. That should be OK, because setFields works as expected.
I am using swak4Foam with 1.6-ext, see header above for more details.

Maybe someone has any clue, what is wrong here?


Stefan

Hmm. Tried your expression and it works for me. I think I have an idea what happens here (an overzealous template that is convinced that surfaceFields have zeroGradient-patches) and I think I already fixed that .... just don't know when and whether it is in the latest release. Which version of swak4Foam are you using? The latest from the SVN?

Bernhard

SD@TUB December 7, 2011 04:53

Thank you Bernhard for quick reply, svn info of my swak4Foam states:
Code:

Pfad: swak4Foam
URL: https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.7/libraries/swak4Foam
Basis des Projektarchivs: https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend
UUID des Projektarchivs: e4e07f05-0c2f-0410-a05a-b8ba57e0c909
Revision: 1919
Knotentyp: Verzeichnis
Plan: normal
Letzter Autor: bgschaid
Letzte geänderte Rev: 1919
Letztes Änderungsdatum: 2011-10-03 22:40:31 +0200 (Mo, 03. Okt 2011)

I will update swak4Foam and see if it works.

gschaider December 7, 2011 05:56

Quote:

Originally Posted by SD@TUB (Post 334965)
Thank you Bernhard for quick reply, svn info of my swak4Foam states:
Code:

Pfad: swak4Foam
URL: https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend/trunk/Breeder_1.7/libraries/swak4Foam
Basis des Projektarchivs: https://openfoam-extend.svn.sourceforge.net/svnroot/openfoam-extend
UUID des Projektarchivs: e4e07f05-0c2f-0410-a05a-b8ba57e0c909
Revision: 1919
Knotentyp: Verzeichnis
Plan: normal
Letzter Autor: bgschaid
Letzte geänderte Rev: 1919
Letztes Änderungsdatum: 2011-10-03 22:40:31 +0200 (Mo, 03. Okt 2011)

I will update swak4Foam and see if it works.

That is the latest RELEASED version. Try the development version (the one downloaded with hg) which is substantially newer and might (not toally sure) fix your problem (but also might have other problems)

SD@TUB December 7, 2011 11:12

Could this error be related to the simpleFunctionObjects-library? I did not explicitly compile this library before compiling swak4Foam.
The error only occur, if I use 'faceAverage' expression.

gschaider December 7, 2011 15:28

Quote:

Originally Posted by SD@TUB (Post 335034)
Could this error be related to the simpleFunctionObjects-library? I did not explicitly compile this library before compiling swak4Foam.

No. The problem occurs in FieldValueExpressionDriver which is part of swak4FoamParsers which doesn't depend on any other libraries

Quote:

Originally Posted by SD@TUB (Post 335034)
The error only occur, if I use 'faceAverage' expression.

The problem is one of the intermediate surfaceScalarFields (when that gets created)


All times are GMT -4. The time now is 04:57.