CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] funkySetFields

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 22, 2009, 19:34
Default funkySetFields
  #1
New Member
 
Chioma Frances Nnaji
Join Date: Sep 2009
Posts: 2
Rep Power: 0
Chioma is on a distinguished road
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
Chioma is offline   Reply With Quote

Old   September 23, 2009, 09:02
Default
  #2
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by Chioma View Post
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
gschaider is offline   Reply With Quote

Old   September 23, 2009, 14:52
Default
  #3
New Member
 
Chioma Frances Nnaji
Join Date: Sep 2009
Posts: 2
Rep Power: 0
Chioma is on a distinguished road
Thanks so much, I will look into it and hopefully I would get my expected results.
Chioma is offline   Reply With Quote

Old   July 25, 2011, 17:30
Default Using dictionary
  #4
Member
 
Join Date: Mar 2010
Posts: 31
Rep Power: 16
bunni is on a distinguished road
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
bunni is offline   Reply With Quote

Old   July 25, 2011, 18:33
Default
  #5
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by bunni View Post
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 View Post
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"?
gschaider is offline   Reply With Quote

Old   December 6, 2011, 07:15
Default Initialize field alpha
  #6
Member
 
Stefan
Join Date: Jan 2010
Location: Kiel, Germany
Posts: 81
Rep Power: 16
SD@TUB is on a distinguished road
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
SD@TUB is offline   Reply With Quote

Old   December 6, 2011, 13:56
Default
  #7
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by SD@TUB View Post
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
gschaider is offline   Reply With Quote

Old   December 7, 2011, 03:53
Default
  #8
Member
 
Stefan
Join Date: Jan 2010
Location: Kiel, Germany
Posts: 81
Rep Power: 16
SD@TUB is on a distinguished road
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.
SD@TUB is offline   Reply With Quote

Old   December 7, 2011, 04:56
Default
  #9
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by SD@TUB View Post
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)
gschaider is offline   Reply With Quote

Old   December 7, 2011, 10:12
Default
  #10
Member
 
Stefan
Join Date: Jan 2010
Location: Kiel, Germany
Posts: 81
Rep Power: 16
SD@TUB is on a distinguished road
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.
SD@TUB is offline   Reply With Quote

Old   December 7, 2011, 14:28
Default
  #11
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by SD@TUB View Post
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 View Post
The error only occur, if I use 'faceAverage' expression.
The problem is one of the intermediate surfaceScalarFields (when that gets created)
gschaider is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] groovyBC and funkySetFields married and got a kid named swak4Foam gschaider OpenFOAM Community Contributions 169 August 10, 2023 09:01
[swak4Foam] how to use funkySetFields function in muliregion case bryant_k OpenFOAM Community Contributions 15 October 15, 2021 02:50
[swak4Foam] funkySetFields and funkySetBoundaryFields zxj160 OpenFOAM Community Contributions 19 February 14, 2018 19:07
[swak4Foam] funkySetFields: problem with processor boundary nmikhailov OpenFOAM Community Contributions 4 May 26, 2015 09:48
[swak4Foam] funkySetFields Chrisi1984 OpenFOAM Community Contributions 10 June 17, 2010 03:26


All times are GMT -4. The time now is 16:58.