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] FunkySetFields for OF 141 (https://www.cfd-online.com/Forums/openfoam-community-contributions/61981-funkysetfields-141-a.html)

gschaider July 1, 2008 05:41

Hi Carlo! If the fields rho
 
Hi Carlo!

If the fields rho and pd exist in the time-step you're working on it should be possible. But FSF has no way of reading the densities for the two phases that are represented by gamma

Bernhard

carlodean July 1, 2008 12:18

Hi, thanks for you answer. I
 
Hi, thanks for you answer.
I made something like this:

funkySetFields . Pout -time 0 -field pd -expression '1000*9.81*pos().z' - expression 'pos().z <=386'.


It seems to work fine but i don't know if it's the right way to do it.
Carlo

gschaider July 1, 2008 13:37

Hi Carlo! But instead of th
 
Hi Carlo!

But instead of the second -expression you surly used -condition, didn't you?

Bernhard

carlodean July 1, 2008 14:19

yes Sorry, I used -condition
 
yes Sorry,
I used -condition 'pos().z<=386'.
Is it correct??
Thank you

gschaider July 29, 2008 07:04

Hi! It has been asked at an
 
Hi!

It has been asked at another place on the board when FSF will work with 1.5. Well it looks like the 1.4.1-version compiles without modifications on 1.5 (which means: it worked all the time). Nevertheless: if you plan to pull the version from the svn I'd recommend to use the "new" URL as documented on http://openfoamwiki.net/index.php/Co...funkySetFields The "old" URL will be kept for 1.4.1 and will only receive bug-fixes

Bernhard

dkingsley July 30, 2008 23:11

I tried to access the latest F
 
I tried to access the latest FSF using the openfoamwiki's pointer to the svn version as the July 29th 2008 post suggests. The svn seems to be down or its configuration has changed.

Can anyone provide an updated link to the svn or a link to FSF source for OF1.5?

dennis

gschaider July 31, 2008 04:25

According to a Sourceforge-Bul
 
According to a Sourceforge-Bulletin the sourceforge-svn-server is currently down for maintainance (they are speaking of a 12 hour window, which should be over soon, so be patient)

Bernhard

dkingsley July 31, 2008 11:30

Thanks, I am leaving on vacati
 
Thanks, I am leaving on vacation in less than 24 hours and setFields failed to set gamma properly on a free surface problem I want to run while I was gone.

The information in this discussion topic and wiki entry was exactly what I needed.

dennis

sega August 23, 2008 04:49

Hallo Bernhard. I was wound
 
Hallo Bernhard.

I was woundering why your tool is always setting all boundary-condition to zeroGradient?

I stumbled over it, while initializing a gamma-field (for the usage with interFoam).
I had an existing gamma-file with given BC's and funkySetFields had overwritten all of them.

If there is a possibility to read some existing BC's and to put them into the "new" field, it would be a great impovement of the tool!

Greetings. S.

ngj August 23, 2008 10:14

Hi Sebastian Look at the ke
 
Hi Sebastian

Look at the keepPatches option. It does exactly what you are inquiring about.

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

- Niels

sega August 23, 2008 11:21

Well, I'm sorry. Thats obviou
 
Well, I'm sorry.
Thats obvious. Why didn't I see it beforehand?

sega March 12, 2009 07:56

Hello Guys. It's me again.
 
Hello Guys.

It's me again.
Is it possible to access the bessel functions j0 and j1 from inside funkySetFields?

Greetings.

gschaider March 12, 2009 08:17

Currently: no What do you n
 
Currently: no

What do you need THAT for?

Shouldn't be to hard to implement as it seems to be implemented as a function for fields: in the .yy and the .ll file duplicate everything that has a "sin" (for example) in it and replace sin with j0. Then recompile and it should be there

Bernhard

sega March 12, 2009 08:22

I think I'm not well enough in
 
I think I'm not well enough into this.
What .yy and .ll files?

I need the Bessel functions to set up an initial 'hat shape' like Fig. 2 in http://test.interface.free.fr/Case04.pdf

gschaider March 12, 2009 12:11

There are two files in the FSF
 
There are two files in the FSF-sources with those extensions. You don't have to understand what you're doing there. Just trust you instincts ;) (some of the stuff you have to duplicate goes over more than one line)

I don't have time to insert that stuff before next week. So if you need it quickly you'll have to do it yourself

Bernhard

sega March 16, 2009 06:03

I think due to the fact, that you are exactly knowing what to do I would prefer, that you make the changes - no matter when.
Meanwhile I will take a look at the code and try not to mess with it.

gschaider March 16, 2009 06:08

Actually the update is already on the SVN. I also added the other functions that are specified in for scalars in the Programmer's guide. I just prefixed the Bessel-functions with "bessel" because I figured that y1 is too likely to clash with a field of the same name (so it is called besselJ1)

Bernhard

BTW: Concerning the title of this thread: I only fixed it for the 1.5-version

sega March 16, 2009 06:48

2 Attachment(s)
Great! I will try it the next days! Thank you.

Meanwhile I'm stuck on another problem concerning funkySetFields.
Working with the Rayleigh-Taylor-Instabilty I had to initialize a sinus-like interface.

Running funkySetFields with a condition like "pos().y <= 0.05*cos(2*pi*pos().x) + 2" does not include cells which should be partially filled and the interface looks more like some steps.

Unfortunately the simulations is not running as planned with the initialization from funkySetFields.

I had to write an MATLAB script which is also filling partially filled cells, to get a "smooth" sinus-function, which is far too much effort for such an initialization (imho).

Have a look at the attached images to make this more clear.

I have read this thread and found some similar problems with interfaces, but I'm not quite sure how to transfer this to my problem.

gschaider March 16, 2009 07:09

Hi!

Partial filling of the cells is easy if the mesh is equally spaced with a spacing dy in y-direction (please replace dy with the actual spacing and fun with the function you're using "0.05*cos(2*pi*pos().x) + 2")

"(mag(pos().y-fun)<dy/2) ? (fun-pos().y+dy/2) : ( pos().y < fun ? 1 : 0)"

Maybe a sign or two is wrong with that expression, I didn't test it. But the concept should be clear

Bernhard

sega March 17, 2009 14:47

Well, Sorry to ask this, but I don't know what xxx ? xxy : xxz means?
I read this is a conditional operator, but I have no idea what that is, and how it should look like in C++ ...

sega March 17, 2009 15:32

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.

gschaider March 17, 2009 15:46

Quote:

Originally Posted by sega (Post 209808)
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"

braennstroem April 29, 2009 04:18

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

gschaider April 29, 2009 13:48

Quote:

Originally Posted by braennstroem (Post 214577)
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

braennstroem May 3, 2009 14:58

Hi Bernhard,

thanks for the explanation!

Regards!
Fabian

alfa_8C May 4, 2011 07:11

fpos() and surf() synthax error
 
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 May 4, 2011 07:13

1 Attachment(s)
this is my initial filed:Attachment 7554

gschaider May 4, 2011 11:45

Quote:

Originally Posted by alfa_8C (Post 306214)
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

alfa_8C May 5, 2011 04:25

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

jianxiyao June 11, 2014 11:05

Quote:

Originally Posted by gschaider (Post 202678)
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

gschaider June 11, 2014 11:29

Quote:

Originally Posted by jianxiyao (Post 496588)
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

jianxiyao June 11, 2014 11:34

Quote:

Originally Posted by gschaider (Post 496597)
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.


All times are GMT -4. The time now is 13:47.