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

Defining different "zones" in the same mesh

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 30, 2010, 10:28
Default Defining different "zones" in the same mesh
  #1
Member
 
G B
Join Date: Mar 2010
Posts: 37
Rep Power: 16
Disco_Caine is on a distinguished road
Hello, I have a very simple wedge in which i would like to define 3 different conductivities. I could modify my case solver, but i dont know the command for it to check the x positions, i have something like this:

forAll(mesh.cells(),cellI)
{ if (x>0.0105) {k[cellI]=1;}
if (x>0.0125) {k[cellI]=0;}
}

mind you, that is what i want to do. For that position in the x axis, change k (heat conductivity) for all the cells. IF it helps, or doesnt help, i have the regions clearly defined in the mesh (the boundary conditions are different for every zone).

Maybe with funkysetfields its easier?

Many thanks!
GB

--------UPDATE---------

i tried doing this:

forAll(mesh.cells(),cellI)
{ if (pos().x>0.0105 & pos().x<=0.0125) {k[cellI]=0.2;}
if (pos().x>0.0125) {k[cellI]=0.17;}
}

and im getting make error 1 when i try to compile the solver. Obviously, something is wrong with those lines. What could it be? I know i will keep hunting.

Last edited by Disco_Caine; June 30, 2010 at 10:54. Reason: update
Disco_Caine is offline   Reply With Quote

Old   June 30, 2010, 10:46
Default
  #2
Member
 
Robertas N.
Join Date: Mar 2009
Location: Kaunas, Lithuania
Posts: 53
Rep Power: 17
r08n is on a distinguished road
Quote:
Originally Posted by Disco_Caine View Post
forAll(mesh.cells(),cellI)
{ if (x>0.0105) {k[cellI]=1;}
if (x>0.0125) {k[cellI]=0;}
}
I guess this should be like this (untested):
Code:
forAll (mesh.cellCentres(), cellI)
{
    if (mesh.cellCentres()[cellI].x() > 0.0105) k[cellI] = 1;
    // etc.
}
Quote:
IF it helps, or doesnt help, i have the regions clearly defined in the mesh (the boundary conditions are different for every zone).
If k is defined as a field for which there are initial values, then it's clearly easier to use "setFields" (funky or not) and such.
r08n is offline   Reply With Quote

Old   June 30, 2010, 11:15
Default
  #3
Member
 
G B
Join Date: Mar 2010
Posts: 37
Rep Power: 16
Disco_Caine is on a distinguished road
Well, with your code sintax it compiled. I will see if it did the trick and update the results briefly.
Disco_Caine is offline   Reply With Quote

Old   July 2, 2010, 10:59
Default
  #4
Member
 
G B
Join Date: Mar 2010
Posts: 37
Rep Power: 16
Disco_Caine is on a distinguished road
I've managed to get a simulation running, however, i am now having a bit of trouble with the preprocessing part. I suppose i can keep this thread going rather than make a new one.

A small introduction:

As i said before, my mesh (an axisymmetric wedge) has 3 blocks. Now for 2 blocks i wanted to set different properties. And for the other block, i want to set different initial boundary conditions, and for that i am using funkySetFields (which is awesome by the way).

Ok, so my mesh is bi dimensional ( x and z) and this is what i wanna set up:

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

It looks correct enough, the dimensions all match, the cell points make sense, etc. But its setting the field to the whole mesh, its clearly not following my condition (because, most likely, its written incorrectly). So i tried setting that field for that box, and then another field for the rest of the mesh, and it would just put this second field everywhere.

What am i doing wrong? Im really stuck on that.

Thanks!
Disco_Caine is offline   Reply With Quote

Old   July 2, 2010, 13:56
Default
  #5
Member
 
G B
Join Date: Mar 2010
Posts: 37
Rep Power: 16
Disco_Caine is on a distinguished road
Ok, i am having serious problems defining anything for a given part of my mesh. And i believe its those pos().x conditions that are confusing me. Anyways, the situation right now is, in my solver i have this cell operation, but i wanna restrict to a particular set of cells. so i tried this (ill show the before and after):

before:
forAll(mesh.cells(),cellI)
{
bla bla bla

after:
forAll(mesh.cells(),cellI)
{
if (mesh.cellCentres()[cellI].x() < 0.0105)
{
bla bla bla;}
}

But now, its like my solver isnt doing anything. In paraFoam i can clearly see that x goes from 0 to 0.12, why doesnt it work? Any hints? Sintax issues?

Thanks!
Disco_Caine is offline   Reply With Quote

Old   July 2, 2010, 14:26
Default
  #6
Member
 
G B
Join Date: Mar 2010
Posts: 37
Rep Power: 16
Disco_Caine is on a distinguished road
Update: the solver condition works! It was just a panic attack. Still no luck with funkySetFields, ill try setting the field in the solver.

Im sorry for the annoying number of posts, at least its only in this thread.
Disco_Caine is offline   Reply With Quote

Old   September 24, 2010, 06:27
Default convertToMeters set?
  #7
Senior Member
 
Bernhard Linseisen
Join Date: May 2010
Location: Heilbronn
Posts: 183
Blog Entries: 1
Rep Power: 16
Linse is on a distinguished road
I do not know if that is the case here (and especially for funkySetFields), but:

If the different value goes everywhere within your domain, you should check if there is some measuring unit thingy in it.
E.g. I used blockMesh which usually uses meters as measuring unit. But it is also possible to use ¨convertToMeters¨, defining a conversion factor.

Point is: The conversion factor is used with blockMesh. But it is not used within setFields. So perhaps it is already the problem of one missing 0 (like 0.0105 instead of 0.00105) that could cause setFields being off-limits...

As I said: That was my experience with setFields, but perhaps it is the same for funkySetFields.
Linse 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
3D Hybrid Mesh Errors DarrenC ANSYS Meshing & Geometry 11 August 5, 2013 07:42
[Salome] unv mesh corrupted after createPatch maddalena OpenFOAM Meshing & Mesh Conversion 1 February 18, 2010 08:43
dynamic mesh without defining deforming zone erkan gunaydinoglu FLUENT 0 November 30, 2008 10:03
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55
basic of mesh refinement arya CFX 4 June 19, 2007 13:21


All times are GMT -4. The time now is 21:50.