CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   internal field (https://www.cfd-online.com/Forums/openfoam-pre-processing/100498-internal-field.html)

libia87 April 26, 2012 05:56

internal field
 
Hi!

I have a cylinder and I want to simulate the concentration.
my problem is: I have the cylinder split in 20 parts and I want to say that 10 volums are C=0.5 and the others 10 volums C=-0.5.

how can I put this in the /0?? becouse in internalField can only be one value ... and I want to specify the volums, not the surfaces

Thanks!

Phicau April 26, 2012 06:04

You can use setFields for that purpose. Check the damBreak tutorial for an example.

Regards

libia87 April 26, 2012 06:36

Quote:

Originally Posted by Phicau (Post 357151)
You can use setFields for that purpose. Check the damBreak tutorial for an example.

Regards

ok!!! thanks :)

i have another question, in the example of break damm

defaultFieldValues
(
volScalarFieldValue alpha1 0
);

regions
(
boxToCell
{
box (0 0 -1) (0.1461 0.292 1);
fieldValues
(
volScalarFieldValue alpha1 1
);
}
);

what is box (0 0 -1) (0.1461 0.292 1);?? I know that the second parentesis is the coordinates x,y,z , but (0 0 -1) i don't know what it is.

and in my case that i have a cylinder, how can I describe the coordinates if it's cylindrical??

thanks

ybapat April 26, 2012 07:49

Hello,

For cylinderical region you need to use cylinderToCell.

Phicau April 26, 2012 09:39

All the cells whose center is within a box with lower corner (minX minY minZ) = (0 0 -1) and upper corner (maxX maxY maxZ) = (0.1461 0.292 1) get the alpha1 = 1.

Depending on the geometry of the 20 parts you may need to use cylinderToCell as Yogesh says, or you can continue using boxToCell.

libia87 April 27, 2012 03:08

Quote:

Originally Posted by Phicau (Post 357199)
All the cells whose center is within a box with lower corner (minX minY minZ) = (0 0 -1) and upper corner (maxX maxY maxZ) = (0.1461 0.292 1) get the alpha1 = 1.

Depending on the geometry of the 20 parts you may need to use cylinderToCell as Yogesh says, or you can continue using boxToCell.

ok thanks! but in the cylinder the lower corner and de upper corner which numbers I have to put??

the cylinder is split in 20 similar parts, like 20 small cylinders

Phicau April 27, 2012 03:19

cylinderToCell has a different input, 2 points and a radius instead of a box:

p1 (0 -0.08 0);
p2 (0 0.06 0);
radius 0.12;

libia87 April 27, 2012 03:21

defaultFieldValues
(
volScalarFieldValue p 0
);

regions
(
cylinderToCell
{
cylinder (0 0 0) (0 0 2.5) 1.25;
fieldValues
(
volScalarFieldValue p 1
);
}
);


with this setFields give me an error, FOAM FATAL IO ERROR: keyword p1 is undefined in dictionary cylinderToCell

what does it mean?

Phicau April 27, 2012 03:24

It asks for word p1, as you have not specified the points:

defaultFieldValues
(
volScalarFieldValue p 0
);

regions
(
cylinderToCell
{
p1 (0 0 0);
p2 (0 0 2.5);
radius 1.25;
fieldValues
(
volScalarFieldValue p 1
);
}
);

libia87 April 27, 2012 03:27

Quote:

Originally Posted by phicau (Post 357401)
it asks for word p1, as you have not specified the points:

Defaultfieldvalues
(
volscalarfieldvalue p 0
);

regions
(
cylindertocell
{
p1 (0 0 0);
p2 (0 0 2.5);
radius 1.25;
fieldvalues
(
volscalarfieldvalue p 1
);
}
);

thanks!!!!! :)

AC87 May 18, 2012 10:18

Hi
i have this error with the tool cylinderToCell

--> FOAM FATAL IO ERROR:
keyword fieldValues is undefined in dictionary "::cylinderToCell"

Can you help me?

range_rover February 4, 2015 03:20

Quote:

Hi
i have this error with the tool cylinderToCell

--> FOAM FATAL IO ERROR:
keyword fieldValues is undefined in dictionary "::cylinderToCell"

Can you help me?
check out the spelling of of fieldvalues then

xoitx March 11, 2016 12:12

HI
I get this message after pasting your code to setfeildsdict

Setting field default values
--> FOAM Warning :
From function void setCellFieldType(const fvMesh& mesh, const labelList& selectedCells,Istream& fieldValueStream)
in file setFields.C at line 124
Field p not found

Setting field region values
Adding cells with centre within cylinder, with p1 = (0 0 -0.003), p2 = (0 0 0.003) and radius = 0.003
--> FOAM Warning :
From function void setCellFieldType(const fvMesh& mesh, const labelList& selectedCells,Istream& fieldValueStream)
in file setFields.C at line 124
Field p not found (I'm guessing this has to do with p file.. but I have p_rgh??? :O)

End

Can you help please?

martel March 31, 2016 10:57

Quote:

Originally Posted by xoitx (Post 589227)
HI
I get this message after pasting your code to setfeildsdict

Setting field default values
--> FOAM Warning :
From function void setCellFieldType(const fvMesh& mesh, const labelList& selectedCells,Istream& fieldValueStream)
in file setFields.C at line 124
Field p not found

Setting field region values
Adding cells with centre within cylinder, with p1 = (0 0 -0.003), p2 = (0 0 0.003) and radius = 0.003
--> FOAM Warning :
From function void setCellFieldType(const fvMesh& mesh, const labelList& selectedCells,Istream& fieldValueStream)
in file setFields.C at line 124
Field p not found (I'm guessing this has to do with p file.. but I have p_rgh??? :O)

End

Can you help please?

Hi Xoitx,

I have the same problem!, Did you find a solution?

Regards,

--Carlos

xoitx March 31, 2016 11:49

Hi Carlos
I solved it using this
Quote:

// Cells underneath plane such that volume is reached. E.g. for use
// // in setFields to set the level given a wanted volume.
// source targetVolumeToCell;
// sourceInfo
// {
// volume 2e-05;
// normal (0 1 0); // usually in direction of gravity//This is the vector (normal) of the plane
// }
you can find all of the commands and usage here:
openfoam30/applications/utilities/mesh/manipulation/topoSet/
There is a file called topoSetDict
Check it out :D

Regards
Xoitx

martel March 31, 2016 11:53

Quote:

Originally Posted by xoitx (Post 592694)
Hi Carlos
I solved it using this


you can find all of the commands and usage here:
openfoam30/applications/utilities/mesh/manipulation/topoSet/
There is a file called topoSetDict
Check it out :D

Regards
Xoitx

Thanks!
--Carlos

ebtedaei November 11, 2016 04:44

Quote:

Originally Posted by Phicau (Post 357401)
It asks for word p1, as you have not specified the points:

defaultFieldValues
(
volScalarFieldValue p 0
);

regions
(
cylinderToCell
{
p1 (0 0 0);
p2 (0 0 2.5);
radius 1.25;
fieldValues
(
volScalarFieldValue p 1
);
}
);

Hi, I also same error! :
" keyword p1 is undefined in dictionary cylinderToCell "

I introduced keyword p1 !!!
defaultFieldValues
(
volScalarFieldValue alpha.water 1
);

regions
(
cylinderToCell
{
cylinder
p1 (-0.83261 0.11118 0);
p2 (0.82468 -0.11012 0);
radius 0.03;
fieldValues
(
volScalarFieldValue alpha.water 0
);
}
);

Please help me.
Ali

ebtedaei November 11, 2016 04:46

Quote:

Originally Posted by libia87 (Post 357402)
thanks!!!!! :)

Hi, I also have same error! :
" keyword p1 is undefined in dictionary cylinderToCell "

I introduced keyword p1 :

defaultFieldValues
(
volScalarFieldValue alpha.water 1
);

regions
(
cylinderToCell
{
cylinder
p1 (-0.83261 0.11118 0);
p2 (0.82468 -0.11012 0);
radius 0.03;
fieldValues
(
volScalarFieldValue alpha.water 0
);
}
);

Please help me.
Ali


All times are GMT -4. The time now is 07:39.