CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Pre-Processing

funkySetFields - how to set two "zones"?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 9, 2010, 03:30
Default funkySetFields - how to set two "zones"?
  #1
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 9
gwierink is on a distinguished road
Dear all,

I use funkySetFields to create a spherical zone (a drop or a bubble) and that works great. Now, does anyone have any idea how to set the field to two bubbles or e.g. two water blobs in the damBreak case? Can I for example just plug two expressions in funkySetFields (one for each bubble/drop)? Many thanks in advance!
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   April 9, 2010, 06:37
Default
  #2
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 11
sega is on a distinguished road
Quote:
Originally Posted by gwierink View Post
Dear all,

I use funkySetFields to create a spherical zone (a drop or a bubble) and that works great. Now, does anyone have any idea how to set the field to two bubbles or e.g. two water blobs in the damBreak case? Can I for example just plug two expressions in funkySetFields (one for each bubble/drop)? Many thanks in advance!
I think you can't use two expression in funkySetFields.
But you can run it twice with the appropriate expression.
funkySetFields will not overwrite your previously set fields.
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   April 9, 2010, 06:42
Default
  #3
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 9
gwierink is on a distinguished road
Quote:
But you can run it twice
Hmm, that's an interesting idea I haven't thought of yet. Thank you, I will go and try it.
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   April 9, 2010, 07:20
Default
  #4
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by gwierink View Post
Hmm, that's an interesting idea I haven't thought of yet. Thank you, I will go and try it.
It works together with the -condition-flag (see section 3.1 on the Wiki page for an example)
gschaider is offline   Reply With Quote

Old   April 9, 2010, 08:13
Default
  #5
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 9
gwierink is on a distinguished road
@Sebastian:
Thank you, it works! Behold, two bubbles rising and colliding .




@Bernhard:
Hi Bernhard,
Quote:
It works together with the -condition-flag
I used the following expression (for two different positions for two different bubbles of course ):
Code:
funkySetFields -field alpha1 -expression 1 -time 0 -keepPatches -condition "pow(pos().x,2) + pow(pos().y+0.1,2) < pow(0.02,2)"
Do you mean you can set a condition to make two spheres? If so, what would be the syntax for that? Thanks in advance!

Have a good weekend!
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   April 12, 2010, 04:44
Default
  #6
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by gwierink View Post
Do you mean you can set a condition to make two spheres? If so, what would be the syntax for that? Thanks in advance!
I quote from http://openfoamwiki.net/index.php/Co...nd_line_usage:
Code:
An optional option is -condition: only cells for which this expression evaluates to true are overwritten with the expression. For all other cells the old value is kept.
Sometimes I wonder why I bother to write ANY documentation (not that I write too much)
gschaider is offline   Reply With Quote

Old   April 13, 2010, 15:08
Default
  #7
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 9
gwierink is on a distinguished road
Hi Bernhard,

Quote:
I quote from http://openfoamwiki.net/index.php/Co...nd_line_usage:
Code:
An optional option is -condition: only cells for which this expression evaluates to true are overwritten with the expression. For all other cells the old value is kept.
Yes, I have seen that. I understand, as it says in the Wiki, that cells for which the expression is true are overwritten. This is what I used to generate the image above. My question was/is whether it is possible to use several expressions in the -condition flag, in my case to generate two spheres.

Quote:
Sometimes I wonder why I bother to write ANY documentation (not that I write too much)
Well, I am sorry if my question is frustrating, I appreciate your contributions and documentation very much.
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   April 14, 2010, 12:14
Default
  #8
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,915
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by gwierink View Post
Hi Bernhard,

Yes, I have seen that. I understand, as it says in the Wiki, that cells for which the expression is true are overwritten. This is what I used to generate the image above. My question was/is whether it is possible to use several expressions in the -condition flag, in my case to generate two spheres.

Well, I am sorry if my question is frustrating, I appreciate your contributions and documentation very much.
Sorry for being rude. I was in a hurry and misread your expression. Didn't see that you already were using a condition

OK. You're halfway there. For more than one sphere just use the operator for a "logical or" || to connect your conditions (basically "(sphere1cond) || (sphere2cond)" put brackets around the expressions to avoid problems)

Bernhard
gschaider is offline   Reply With Quote

Old   April 14, 2010, 14:36
Default
  #9
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 9
gwierink is on a distinguished road
Hi Bernhard,

No worries, we're all in a hurry sometimes .
Thank you for the tip, that was exactly what I was looking for!

Thanks again and take care
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   June 4, 2010, 02:24
Default
  #10
New Member
 
John Chang
Join Date: Jun 2010
Posts: 4
Rep Power: 7
johnchang is on a distinguished road
Hi Gijsbert,

I am a beginner in the OF. I have a geometry exported from the STL file which needs to be divided into 2 zones. So my question is can I do that through funkySetFields or have to go through the normal process like creating cellSet, faceSet, and setsToZones??

And how can I do that?because I am confused what numbers to put into the topoSetSources......

Your advice would be highly appreciated.

Cheers.
johnchang is offline   Reply With Quote

Old   June 4, 2010, 02:39
Default
  #11
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 9
gwierink is on a distinguished road
Hi John,

Do you mean you want to create two zones as in two separate e.g. fluid zones? I think you have to do that with a mesh generator. In my understanding funkySetFields sets a field to a certain value, e.g. a sphere filled with air. But perhaps Bernhard knows a trick?
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   June 4, 2010, 02:51
Default
  #12
New Member
 
John Chang
Join Date: Jun 2010
Posts: 4
Rep Power: 7
johnchang is on a distinguished road
Thank you for the prompt reply Gijsbert. 2 separate zones as in 2 layers of which the heat transfer mode is different for each. The logic goes like this, if you are in zone A use this equation if else use this. But zone B values are highly dependent on zone A value.

I'm leaning more towards the cellSet and faceSet methods, but have no idea how to divide the geometry into 2 respective zones.

Thank you for you time.
johnchang is offline   Reply With Quote

Old   June 4, 2010, 03:10
Default
  #13
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 9
gwierink is on a distinguished road
I think you should define two separate zones on your mesh generator for that. You need to split a volume (so that they're still connected) and give them different names, like e.g. fluidZone1 and fluidZone2. Then, you can define different rules for each zone.
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   June 4, 2010, 03:37
Default
  #14
New Member
 
John Chang
Join Date: Jun 2010
Posts: 4
Rep Power: 7
johnchang is on a distinguished road
Thanks again for the reply. Yes, what you said is exactly what I want to do. However, I can't seem to define two separate zones in one geometry using my mesh generator. I thought I can do this from setting up the cellSet and faceSet but again I don't quite know how to use them.

If you don't mind giving me your email address, I will forward you to my case.

Cheers
johnchang is offline   Reply With Quote

Old   June 4, 2010, 03:51
Default
  #15
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 9
gwierink is on a distinguished road
Hi John,

Well, I must confess I never used cellSet, I always define the zones in Gambit and then convert the mesh with the -writeZones flag. But I suppose you could use cellSet for that purpose as well. Check out this thread for some details. From what I gather from that thread you need to define a cellSetDict in the system directory, in which you define a name, an action, and a method to select cells ("topoSetSources"). So, it would look something like this:


Quote:
Code:
name rotor; 
 
// One of clear/new/invert/add/delete|subset/list 
action new; 
 
// Actions to apply to cellSet. These are all the topoSetSource's ending 
// in ..ToCell (see the meshTools library). 
 
topoSetSources 
( 
    // Cells in cell zone 
    boxToCell 
    { 
        box   (-1.2 -0.6 -1.2) (1.2 2.3 1.2);      // name of cellZone 
    } 
 
);
The code above is just pasted from the thread I included above and it seems there are still some things wrong with it, so please read through the thread carefully.

Quote:
If you don't mind giving me your email address, I will forward you to my case.
Sure, no problem. I will send you a PM with my e-mail address.
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   July 5, 2010, 05:27
Default
  #16
Member
 
G B
Join Date: Mar 2010
Posts: 37
Rep Power: 7
Disco_Caine is on a distinguished road
Well, i hate to post the same thing twice (because of the clutter and such). But i really need some help with funkysetfields. I have a very simple mesh:

(0 0 0) //0
(1.05 -0.045844 0) //1
(1.25 -0.054576 0) //2
(12 -0.523931 0) //3
(12 0.523931 0) //4
(1.25 0.054576 0) //5
(1.05 0.045844 0) //6
(0 0 0) //7

It's a wedge of height 8.23 cm. So anyways, i want to set a field for the cells with cellcentre <= 0.0105 (yeah, i have it in meters). So i have this for FST:

expressions
(
temperature1
{
field T;
expression "52.96281*(pow(pos().z,0.262054))+273";
conditions "pos().x <= 0.0105";
keepPatches 1;
}

The thing is, that it is setting the field for the whole wedge, as if my condition wasnt there. Perhaps im using the condition wrong, or theres another way to write it. Any help would be much appreciated.

I have tried putting it in cm, putting a another expression temperature2 for the rest of the mesh (it just uses this for the whole mesh). Ive tried limiting the position in the y and z axis. Anyways, im having a problem using the condition.

Anyones help is welcome, thanks in advance!
GB
Disco_Caine is offline   Reply With Quote

Old   July 5, 2010, 07:12
Default
  #17
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 9
gwierink is on a distinguished road
Hi GB,

Quote:
(0 0 0) //0
(1.05 -0.045844 0) //1
(1.25 -0.054576 0) //2
(12 -0.523931 0) //3
(12 0.523931 0) //4
(1.25 0.054576 0) //5
(1.05 0.045844 0) //6
(0 0 0) //7
I don't think you need to declare the origin (points 0 and 7) twice, i.e. delete point 7.


Quote:
expression "52.96281*(pow(pos().z,0.262054))+273";
conditions "pos().x <= 0.0105";
Should the expression maybe be something like (or change the condition, in any case, that there is either z in both or x in both ...)
Code:
expression "52.96281*(pow(pos().x,0.262054))+273";
         conditions "pos().x <= 0.0105";
Since all your points are at z=0, they're all below 0.0105, so everything will be set to 1.

Hope this helps
__________________
Regards, Gijs

Last edited by gwierink; July 5, 2010 at 07:14. Reason: typo
gwierink is offline   Reply With Quote

Old   July 5, 2010, 08:31
Default
  #18
Member
 
G B
Join Date: Mar 2010
Posts: 37
Rep Power: 7
Disco_Caine is on a distinguished road
Hi Gijs, thanks for your reply. However, my mesh does have height (i just didnt put the other vertex). The thing is that the profile should change with height, and only for those x values. If you want, i can post the full blockmesh.

Thank you1
Disco_Caine is offline   Reply With Quote

Old   July 5, 2010, 08:36
Default
  #19
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 9
gwierink is on a distinguished road
Hi GB,

Quote:
However, my mesh does have height
That's exactly the point. Your expression contains z, while your condition defines x. But if your case does not have height (which I see from the vertices) why use an expression in z? Shouldn't the expression also be in x?
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   July 5, 2010, 08:39
Default
  #20
Member
 
G B
Join Date: Mar 2010
Posts: 37
Rep Power: 7
Disco_Caine is on a distinguished road
Ah well, its because im trying to put a temperature profile that varies with height (which is represented by the z coordinate in my mesh). So i want the field for the whole height, but not for the whole mesh. I want one part of the mesh (limited by x < 0.0105) to have the profile, and for the other i would like, in worse case, a fixed temperature (not the same profile).
Disco_Caine is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OF 1.6 | Ubuntu 9.10 (64bit) | GLIBCXX_3.4.11 not found piprus OpenFOAM Installation 22 February 25, 2010 14:43
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08
Help with GNUPlot Renato. Main CFD Forum 6 June 6, 2007 19:51
Env variable not set gruber2 OpenFOAM Installation 5 December 30, 2005 05:27
How to set environment variables kanishka OpenFOAM Installation 1 September 4, 2005 10:15


All times are GMT -4. The time now is 20:45.