# [swak4Foam] funkySetFields

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 September 22, 2009, 19:34 funkySetFields #1 New Member   Chioma Frances Nnaji Join Date: Sep 2009 Posts: 2 Rep Power: 0 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

September 23, 2009, 09:02
#2
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,214
Rep Power: 49
Quote:
 Originally Posted by Chioma 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

 September 23, 2009, 14:52 #3 New Member   Chioma Frances Nnaji Join Date: Sep 2009 Posts: 2 Rep Power: 0 Thanks so much, I will look into it and hopefully I would get my expected results.

 July 25, 2011, 17:30 Using dictionary #4 Member   Join Date: Mar 2010 Posts: 31 Rep Power: 14 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

July 25, 2011, 18:33
#5
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,214
Rep Power: 49
Quote:
 Originally Posted by bunni 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 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"?

 December 6, 2011, 07:15 Initialize field alpha #6 Member   Stefan Join Date: Jan 2010 Location: Kiel, Germany Posts: 81 Rep Power: 14 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::New(const word&, const fvPatch&, const DimensionedField) 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

December 6, 2011, 13:56
#7
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,214
Rep Power: 49
Quote:
 Originally Posted by SD@TUB 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::New(const word&, const fvPatch&, const DimensionedField) 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

 December 7, 2011, 03:53 #8 Member   Stefan Join Date: Jan 2010 Location: Kiel, Germany Posts: 81 Rep Power: 14 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.

December 7, 2011, 04:56
#9
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,214
Rep Power: 49
Quote:
 Originally Posted by SD@TUB 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)

 December 7, 2011, 10:12 #10 Member   Stefan Join Date: Jan 2010 Location: Kiel, Germany Posts: 81 Rep Power: 14 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.

December 7, 2011, 14:28
#11
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,214
Rep Power: 49
Quote:
 Originally Posted by SD@TUB 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 The error only occur, if I use 'faceAverage' expression.
The problem is one of the intermediate surfaceScalarFields (when that gets created)

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 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 OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post bryant_k OpenFOAM Community Contributions 15 October 15, 2021 02:50 gschaider OpenFOAM Community Contributions 166 April 21, 2020 05:50 [swak4Foam] funkySetFields and funkySetBoundaryFields zxj160 OpenFOAM Community Contributions 19 February 14, 2018 19:07 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 12:56.

 Contact Us - CFD Online - Privacy Statement - Top