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

[swak4Foam] FunkySetFields for OF 141

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 17, 2009, 16:32
Default
  #61
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Sorry to bother again.
But the solution with the bessel function did not turn out to be working.
Actually the new function in funkySetFields is working, but the result is not as planned. The function named in the paper mentioned above turns out to produce a different interface than I desired.

At this point I need an advice, which function the correct interface is representing.

Please refer to the two attached images from a previous post.
I want to set up this cosine-function in 3D on a square domain, meaning that the interface should be elevated at the walls and be lowered in the center of the domain forming this cosine-like 'tub'.

I'm not quite shure which function (in 3D) would represent such an interface, nor where to look at (or start investigating).

Please don't smack me for posting in the funkySetFields thread, as this this not directly linked to the tool but is rather basic.
But as this should lead to a condition statement for funkySetFields I thought it would be good place to ask for.

Many thanks for your ideas.
S.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   March 17, 2009, 16:46
Default
  #62
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 sega View Post
Well, Sorry to ask this, but I don't know what xxx ? xxy : xxz means?
It means "if the logical expression xxx is true for a cell use the value xxy, else use xxz"
gschaider is offline   Reply With Quote

Old   April 29, 2009, 05:18
Default
  #63
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 19
braennstroem is on a distinguished road
Hi,

I am just trying to figure out, how this expression

'(grad(dist())^vector(0,0,-1))*mag(pos()-vector(0.05,0.05,0))/0.05'

creates a fild in a circle. I got trouble to understand it...
I would like to achieve something like:
u=2*y*(1-x^2), v=-2*x*(1-y^2)

It is probably similar!?
Thanks!
Fabian
braennstroem is offline   Reply With Quote

Old   April 29, 2009, 14:48
Default
  #64
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 braennstroem View Post
Hi,

I am just trying to figure out, how this expression

'(grad(dist())^vector(0,0,-1))*mag(pos()-vector(0.05,0.05,0))/0.05'

creates a field in a circle. I got trouble to understand it...
I would like to achieve something like:
u=2*y*(1-x^2), v=-2*x*(1-y^2)

It is probably similar!?
Not really. The first expression depends on the boundary of the mesh (dist() is the distance to the nearest wall). The grad gives you the direction away from the wall. The vector in the cross-product assumes that you are in the xy-plane and the cross product therefor gives you a vector almost parallel to the nearest boundary. The mag Assumes that the center of the mesh is 0.05/0.05 (basically it only works good for the driven cavity)

General circular field around a point in the xy-plane might be
'(pos()-vector(1,2,0))^vector(0,0,1)'

Bernhard
gschaider is offline   Reply With Quote

Old   May 3, 2009, 15:58
Default
  #65
Senior Member
 
Fabian Braennstroem
Join Date: Mar 2009
Posts: 407
Rep Power: 19
braennstroem is on a distinguished road
Hi Bernhard,

thanks for the explanation!

Regards!
Fabian
braennstroem is offline   Reply With Quote

Old   May 4, 2011, 08:11
Default fpos() and surf() synthax error
  #66
Member
 
Antonio Liggieri
Join Date: Aug 2010
Posts: 76
Rep Power: 15
alfa_8C is an unknown quantity at this point
Hy funkyFOAMers,

I've generated an initial Field for an interFoam simulation by using funkySetFileds and it worked quite well.

Now I'm trying to smoothen the free surface by using the commands shown on this page:

http://openfoamwiki.net/index.php/Co...funkySetFields

But I can't get it working. I always receive the following error:

Parser Error at "1.9-12" :"syntax error, unexpected TOKEN_fposition"
"average(fpos().z <= surf(0.) ? surf(1.0) : surf(0.))"
" ^^^^ "


Being in the case directory the executed command is the following:

funkySetFields -case ./ -time 0 -field alpha1 -keepPatches -expression "average (fpos().z <= surf(0.) ? surf(1.0) : surf(0.))"

Has anybody an idea, how to modify the command in order to do what desired?

Thanks in advance, Toni
alfa_8C is offline   Reply With Quote

Old   May 4, 2011, 08:13
Default
  #67
Member
 
Antonio Liggieri
Join Date: Aug 2010
Posts: 76
Rep Power: 15
alfa_8C is an unknown quantity at this point
this is my initial filed:pic.jpg
alfa_8C is offline   Reply With Quote

Old   May 4, 2011, 12:45
Default
  #68
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 alfa_8C View Post
Hy funkyFOAMers,

I've generated an initial Field for an interFoam simulation by using funkySetFileds and it worked quite well.

Now I'm trying to smoothen the free surface by using the commands shown on this page:

http://openfoamwiki.net/index.php/Co...funkySetFields

But I can't get it working. I always receive the following error:

Parser Error at "1.9-12" :"syntax error, unexpected TOKEN_fposition"
"average(fpos().z <= surf(0.) ? surf(1.0) : surf(0.))"
" ^^^^ "


Being in the case directory the executed command is the following:

funkySetFields -case ./ -time 0 -field alpha1 -keepPatches -expression "average (fpos().z <= surf(0.) ? surf(1.0) : surf(0.))"

Has anybody an idea, how to modify the command in order to do what desired?

Thanks in advance, Toni
You're not REALLY using the 1.4.1 version, are you? If yes: that version of FSF is quite old and I can't help you on that. If no: why are you posting in a thread that implies that? (see also http://openfoamwiki.net/index.php/Ho..._Message_Board points 3 and 5)

Maybe the problem is that in newer versions of FSF what used to be called average was renamed to faceAverage (averaging over the faces of a cell. average is now the average of a whole field)

Bernhard
gschaider is offline   Reply With Quote

Old   May 5, 2011, 05:25
Default
  #69
Member
 
Antonio Liggieri
Join Date: Aug 2010
Posts: 76
Rep Power: 15
alfa_8C is an unknown quantity at this point
It seems that I didn't read the thread carefully - sorry for the inconvenience...

With the following link I switch now to a newer one, that implies a newer version of FSF.


http://www.cfd-online.com/Forums/ope...eld-patch.html
alfa_8C is offline   Reply With Quote

Old   June 11, 2014, 12:05
Default
  #70
New Member
 
Jianxi Yao
Join Date: Apr 2011
Posts: 17
Rep Power: 15
jianxiyao is on a distinguished road
Quote:
Originally Posted by gschaider View Post
Now it works (new version just went to the SVN. Get it from there)

The expression would be:
"average(fpos().y < surf(0.) ? surf(1.) : surf(0.))"

The surf-functions generates surface-fields.
Hi Gschaider,

I use the above expression to initial alpha.water in OF 2.3.0. error occurs such as :

Modifying field alpha.water of type volScalarField

Putting "average(fpos().z < surf(0.) ? surf(1.0) : surf(0.))" into field alpha.water at t = "0" if condition "true" is true
Keeping patches unaltered



--> FOAM FATAL ERROR:
inconsistent types: alpha.water is volScalarField while the expression evaluates to a surfaceScalarField

From function doAnExpression()
in file funkySetFields.C at line 361.

FOAM exiting
jianxiyao is offline   Reply With Quote

Old   June 11, 2014, 12:29
Default
  #71
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 jianxiyao View Post
Hi Gschaider,

I use the above expression to initial alpha.water in OF 2.3.0. error occurs such as :

Modifying field alpha.water of type volScalarField

Putting "average(fpos().z < surf(0.) ? surf(1.0) : surf(0.))" into field alpha.water at t = "0" if condition "true" is true
Keeping patches unaltered



--> FOAM FATAL ERROR:
inconsistent types: alpha.water is volScalarField while the expression evaluates to a surfaceScalarField

From function doAnExpression()
in file funkySetFields.C at line 361.

FOAM exiting
See http://www.cfd-online.com/Forums/ope...tml#post306250 above: you probably want to use faceAverage
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request
gschaider is offline   Reply With Quote

Old   June 11, 2014, 12:34
Default
  #72
New Member
 
Jianxi Yao
Join Date: Apr 2011
Posts: 17
Rep Power: 15
jianxiyao is on a distinguished road
Quote:
Originally Posted by gschaider View Post
See http://www.cfd-online.com/Forums/ope...tml#post306250 above: you probably want to use faceAverage
Thank you for your quick reply.

that is the reason. it works now.
jianxiyao is offline   Reply With Quote

Reply


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 10:01
[swak4Foam] how to use funkySetFields function in muliregion case bryant_k OpenFOAM Community Contributions 15 October 15, 2021 03:50
[swak4Foam] funkySetFields and funkySetBoundaryFields zxj160 OpenFOAM Community Contributions 19 February 14, 2018 20:07
[swak4Foam] funkySetFields: problem with processor boundary nmikhailov OpenFOAM Community Contributions 4 May 26, 2015 10:48
[swak4Foam] numerical beach with funkySetFields?! maxonline OpenFOAM Community Contributions 6 June 17, 2011 05:59


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